vim摘要

The "." command is one of the most simple yet powerful commands in Vim.
It
repeats the last change. For instance, suppose you are editing an HTML
file
and want to delete all the <B> tags. You position the cursor on
the first <
and delete the <B> with the command "df>". You then
go to the < of the next
</B> and kill it using the "." command. The
"." command executes the last
change command (in this case, "df>"). To
delete another tag, position the
cursor on the < and use the "."
command.
f<
df>
f<
.
f<
.
find first
<
delete to >
find next <
repeat df>
find next
<
repeat df>
To <B>generate</B> a table of
<B>contents
~
???>
??>
?????????>
???>
?????????????>
??>
The
"." command works for all changes you make, except for the "u" (undo),
CTRL?R
(redo) and commands that start with a colon (:).
Another example: You want to
change the word "four" to "five". It appears
several times in your text. You
can do this quickly with this sequence
of
commands:
/four<Enter>
cwfive<Esc>
n
.
n
.
find
the first string "four"
change the word to "five"
find the next
"four"
repeat the change to "five‘
find the next "four"
repeat the
change
etc.
================================

vim摘要,布布扣,bubuko.com

时间: 2024-07-28 21:47:32

vim摘要的相关文章

a byte of vim -- 学习摘要

说在前面的话 -- a byte of vim 是我见过的最介绍vim 最好的书,想了解强大的vim的人,或者是已经在使用vim而打算进一步了解的人,我感觉都应该看看这个,内容精炼但涵盖很广,--"vim为什么这么强大",当看完这本书时,我想你就能完全的了解了--此外,本书是一英文版,但很简单,学语言的同时学习英语很不多-- 附上最新版的下载链接 http://download.csdn.net/detail/wuzhimang/8933257  ,当然上官网才是硬道理 以下是自己针对

[Practical.Vim(2012.9)].Drew.Neil.Tip14,15学习摘要

在vim输入命令zz可以重绘屏幕,让当前行在屏幕中间. 在insert模式下粘贴 yt,命令从当前字符复制到字符,处,然后j命令移动到下一行,A命令移动到行尾,进入insert模式,然后<C-r>0粘贴到行尾.0表示从寄存器0中粘贴数据,vim中复制数据,删除数据后默认放在0寄存器中.

[Practical.Vim(2012.9)].Drew.Neil.Tip10学习摘要

Use Counts to Do Simple Arithmetic 在vim中,执行<C-a>和<C-x>命令可以对文本中的数字直接进行加或减. 如果不提供数字而直接执行上面的命令的话,默认对光标所在的数字值进行加1或减1. 如果在命令前面加一个数字,就会对光标所在的数字加或减这个数. 如果光标所在位置不是数字,就会自动在当前行后面查找数字然后定位到该数字上. 如下面的测试文件 我们要复制最后一行然后把0px改为-180px. 除了直接对数字进行更改外可以使用命令<C-x&

[Practical.Vim(2012.9)].Drew.Neil.Tip51 学习摘要

Trace Your Selection with Precision Text Objects 对于括号,引号,以及例如html,xml中的标签<a> </a>等,都是成对出现,Vim能够理解这种结构方式,对它们限定的区域文本进行选择. 对于如下js代码 执行如下命令 最开始光标在url的r上,然后输入v命令,进入 visual模式,i}表示选择{}里面的内容但是不包含{},a"表示选择""内的内容且包含""..it表示包含标签内

[Practical.Vim(2012.9)].Drew.Neil.Tip49 学习摘要

Find by Character 在Vim中快速定位到某个字符的命令为f In this case, the fx command does nothing. Vim searches forward for an occurrence of the "x" character, but no matches are found, so the cursor doesn 't move. The fo command finds an occurrence of the "

[Practical.Vim(2012.9)].Drew.Neil.Tip50 学习摘要

Search to Navigate 在Vim中快速定位到某处的另外方法就是搜索word,使用方法就是符号/后跟要搜索的word,如下: 由上图可以看出执行命令后会显示多个匹配项,我们可以使用n或N命令将光标移动到前一个或后一个匹配项上. Operate with a Search Motion 类似f命令,我们可以结合操作命令和移动命令(在Vim中称搜索命令为移动命令,因为移动了光标,前面的f命令也是移动命令),来快速对某个区域文本进行操作,如删除或修改. 我们在normal模式下输入v进入v

[Practical.Vim(2012.9)].Drew.Neil.Tip16学习摘要

Do Back-of-the-Envelope Calculations in Place 在vim中我们可以利用表达式寄存器来直接进行数学运算然后把结果插入我们的文档. 表达式寄存器可以通过=来访问,在insert模式中我们可以输入<C-r>=来启动这个表达式寄存器,这时在屏幕底部出现一个终端,我们输入计算式,然后回车,计算结果就会插入到文档光标所在位置.如下:

[Practical.Vim(2012.9)].Drew.Neil.Tip12学习摘要

Operator+Motion=Action 在Vim中,d{motion}命令可以删除单个字符dl,也可以删除整个单词daw,整个段落dap. 同样的可以用c命令来改变单词caw或锻炼cap.y命令类似使用. g~, gu, gU命令是由两个语法组成.如果我们要让整个word变为大写就可可以gUaw, 让整个段落变为大写,用gUap. vim还有另外一个语法就是,当一个operaor 命令重复出现时,在当前行执行命令.例如dd删除当前行,yy复制当前行,gu命令是个特殊例子,我们可以用gUgU

[Practical.Vim(2012.9)].Drew.Neil.Tip100学习摘要

Alphabetize the Properties of Each Rule in a CSS File When combining an Ex command with :global, we can also specify a range for our chosen [cmd]. Vim allows us to set the range dynamically using the :g/{pattern} as a reference point. 当用:global结合Ex命令