Tips of VIM

# 使用1号寄存器中的值
:%s/fred/\=@1/g <C-R>1

# 匹配任意字符包括换行符
\_.

# 非贪婪匹配
\{-}

# 替换Tab
:%s/^I/    /g

# 统计字数
:%s/pattern//n

# 除了/之外的分隔符
:%s!before!after!g

# 替换变成大写
:%s/PATTERN/\U\0/g # 其中\U是变成大写,\0表示所有匹配的文本

# change the path of .vim
:set runtimepath
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s