若是是在 Linux 中使用 Vim,那么这里就有一个现成的配置:/usr/share/vim/vim74/vimrc_example.vim,其中 74 是版本号,你的可能会有所不一样。
把它拷到本身的主目录下,重命名为 .vimrc:vim
$ cp /usr/share/vim/vim74/vimrc_example.vim ~/.vimrc
这样,语法高亮、代码缩进 这些喜闻乐见的特性,马上就自动生效了。
另外,在文件末尾再添加一些我的的习惯配置:code
set nobackup set noundofile set expandtab setlocal shiftwidth=4 setlocal softtabstop=4 inoremap ( ()<LEFT> inoremap { {}<LEFT> inoremap [ []<LEFT> inoremap " ""<LEFT> inoremap ' ''<LEFT> let loaded_matchparen=1 set matchpairs+=<:>
补充上 自动补齐、括号匹配、tab 键扩展。这样,写代码的基本需求就知足了,最起码比直接用记事本,要舒服太多了。
另外,别忘了将鼠标禁用,否则右键粘贴会无论用。
将文件中有关 mouse 的这段注掉,改为下面这样:rem
" In many terminal emulators the mouse works just fine, thus enable it. " if has('mouse') " set mouse=a " endif
就能够了。terminal