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

相關文章
相關標籤/搜索