VIM 配置随手记

刚开始使用VIM, 主要想用它来写python. 目标是颜色比较温馨, 而且可以自动换行自动补全.html

.vimrc 设置

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

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

" 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是自动缩进的空格数)github

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.ubuntu

相关文章
相关标签/搜索