简单的 .vimrc 配置
文章目录
如果是在 Linux 中使用 Vim,那么这里就有一个现成的配置:/usr/share/vim/vim74/vimrc_example.vim,其中 74 是版本号,你的可能会有所不同。
把它拷到自己的主目录下,重命名为.vimrc:
- $ cp /usr/share/vim/vim74/vimrc_example.vim ~/.vimrc
这样,语法高亮、代码缩进这些喜闻乐见的特性,立刻就自动生效了。
另外,在文件末尾再添加一些个人的习惯配置:
1. set nobackup
2. set noundofile
3.
4. set expandtab
5. setlocal shiftwidth=4
6. setlocal softtabstop=4
7. inoremap ( ()《Left》
8. inoremap { {}《Left》
9. inoremap \[ \[\]《Left》
10. inoremap " ""《Left》
11. inoremap ' ''《Left》
12.
13. let loaded\_matchparen=1
14. set matchpairs+=<:>
补充上自动补齐、括号匹配、tab 键扩展。这样,写代码的基本需求就满足了,最起码比直接用记事本,要舒服太多了。
另外,别忘了将鼠标禁用,不然右键粘贴会不管用。
将文件中有关 mouse 的这段注掉,改成下面这样:
1. " In many terminal emulators the mouse works just fine, thus enable it.
2. " if has('mouse')
3. " set mouse=a
4. " endif
就可以了。
PS: 附上博主常用的.vimrc配置
1. set nobackup
2. set noundofile
3. set cindent
4. set nu
5.
6. inoremap ( ()《Left》
7. inoremap \[ \[\]《Left》
8. inoremap { {}《Left》《CR》《ESC》O
9. inoremap ' ''《Left》
10. inoremap " ""《Left》
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论