Chinaunix首页 | 论坛 | 博客
  • 博客访问: 713357
  • 博文数量: 235
  • 博客积分: 4309
  • 博客等级: 中校
  • 技术积分: 2325
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-17 11:25
个人简介

If you don\\\\\\\\\\\\\\\'t wanna do it, you find an EXCUSE; if you do, you\\\\\\\\\\\\\\\'ll find a WAY :-)

文章分类

全部博文(235)

文章存档

2014年(3)

2013年(2)

2012年(31)

2011年(199)

分类: Python/Ruby

2011-01-17 17:40:54

去除行首空格
:%s/^\s//g

去掉所有的行尾空格:   %s/\s\+$//

去掉所有的空白行:       %s/\(\s*\n\)\+/\r/

去掉所有的"//"注释:     %s!\s*//.*!!

去掉所有的"/*...*/"注释:     %s!\s*/ \*\_.\{-}\*/\s*! !g

删除DOS方式的回车^M :%s/r//g 
:%s= *$== 删除行尾空白:
:%s/^(.*)n1/1$/ 删除重复行:
:%s/^.{-}pdf/new.pdf/ 只是删除第一个pdf:
:%s/// 又是删除多行注释(咦?为什么要说「 」呢?)
:g/s*
 ^ $/d 删除所有空行 :这个好用有没有人用过还有其他的方法吗?
:g!/^dd/d 删除不含字符串'dd'的行 
:v/^dd/d 同上 (译释:v == g!,就是不匹配!) 
:g/str1/,/str2/d 删除所有第一个含str1到第一个含str2之间的行
:v/./.,/./-1join 压缩空行 
:g/^$/,/./-j 压缩空行


set autoindent
set hlsearch
set incsearch
set ignorecase
set backspace=2
set history=50
"set nowrap&
"set autowrite
"set sidescroll=10
set ruler
set showmode
"set showcmd
syntax on

"p = parentheses
map \p i(ea)

"c = curly brace
map \c i{ea)

"plugin
"$VIMRUNTIME/macros = global plugin
"$VIMRUNTIME/ftplugin = filetype plugin
filetype plugin on

"man plugin
runtime! ftplugin/man.vim


阅读(673) | 评论(0) | 转发(0) |
0

上一篇:LiveUSB Script

下一篇:IPTABLES.Tutorial

给主人留下些什么吧!~~