VIM 配置随手记

刚开始使用VIM, 主要想用它来写python. 目标是颜色比较舒适, 并且能够自动换行自动补全.

.vimrc 设置

这是类似 .bashrc 的配置文件, vim 的各种配置都可以在里面实现. 一个很好的说明: A good vimrc

在实践中有一些trick. 比如colortheme配置, 首先要把对应的文件 (如badwolf.vim) 放置在 ~/.vim/colors/文件夹下. 在Ubuntu下, 还需要让gnome-term支持256色:

 " Colors
 " this is important for full color support
 " http://askubuntu.com/questions/67/how-do-i-enable-full-color-support-in-vim
 if $COLORTERM == 'gnome-terminal'
     set t_Co=256
 endif


自动缩进的话, 可以用下面script (shiftwidth是自动缩进的空格数)

set tabstop=4       " The width of a TAB is set to 4.
                    " Still it is a \t. It is just that
                    " Vim will interpret it to be having
                    " a width of 4.

set shiftwidth=4    " Indents will have a width of 4

set softtabstop=4   " Sets the number of columns for a TAB

set expandtab       " Expand TABs to spaces

Python autocompletion 代码提示与自动补全

使用的插件是 jedi-vim, 按照说明安装在 ~/.vim/bundle/ 后并没有自动补全! 后来参考这篇日志 (整个jedi的安装配置可以都参考这篇日志)才知道需要先安装 pathogen.

posted @ 2016-07-13 16:44  普兒  阅读(282)  评论(0编辑  收藏  举报