vim进阶-自己设置vim编辑器
参考 : .vimrc 实用配置
个人使用,效果还不错,基本都有兼顾。
"===================" "1.基本设置" "===================" set wildmenu"按TAB键时命令行自动补齐" set ignorecase"忽略大小写" " set number "显示行号" " set ruler"显示当前光标位置" set autoread"文件在Vim之外修改过,自动重新读入" set nocp "使用vim而非vi" syn on "开启语法高亮功能" set cindent "c/c++自动缩进" set autoindent"参考上一行的缩进方式进行自动缩进" set softtabstop=4 "4 character as a tab" set shiftwidth=4 set smarttab set hlsearch "开启搜索结果的高亮显示" "========================" "11.txt文件按照wiki语法高亮" "========================" autocmd BufNewFile *.txt set ft=confluencewiki autocmd BufEnter *.txt set ft=confluencewiki "======================" "12.设置文件编码,解决中文乱码问题" "======================" if has("multi_byte") set fileencodings=utf-8,ucs-bom,cp936,cp1250,big5,euc-jp,euc-kr,latin1 else echoerr "Sorry, this version of (g)vim was not compiled with multi_byte" endif
我这是最基础的一些vim设置,参考文章http://blog.csdn.net/huiguixian/article/details/6394095
看大牛设置的vim,感觉很花里胡哨,以后慢慢接触:http://www.cnblogs.com/ma6174/archive/2011/12/10/2283393.html
系统vim设置:/etc/vim/vimrc
个人vim设置:~/.vimrc ,没有可以自己建一个
配置如下:
"syntax high light syntax on "show the line number set nu "let the tabstop equal 4 set tabstop=4 "set the autoindent on set autoindent "set the match time is one tenth second set matchtime=1 "high light the search set hlsearch "set the c language indent format set cindent "set the indent width set shiftwidth=4 "set show status on set ruler "set show mode on set showmode
统计vim中查找字符串的数量
比如我有一个log文件,我文件里符合规则的字符是yes,我想查找这个abc.log文件中的yes字符数量,怎么查找呢,如下:
:%s/yes//gn