目錄[-]
如果不熟悉vim的,請在使用vim插件之前,請先閱讀Vim學習指南, 建議通過前3個層次。以及有一個有趣的vim練習游戲http://vim-adventures.com/。
插件管理利器vim的插件原始安裝容易混亂,而且管理起來,不方便。那么就渴望一個插件管理工具:pathogen
簡單安裝:
?123 | mkdir -p ~/.vim /autoload ~/.vim /bundle ; / curl -Sso ~/.vim /autoload/pathogen .vim /
https: //raw .github.com /tpope/vim-pathogen/master/autoload/pathogen .vim |
詳細請查看:https://github.com/tpope/vim-pathogen
配置:
在vimrc文件的filetype plugin之前·「沒有的就在最前面」添加:
?12 | call pathogen #infect() filetype plugin indent on |
The NERD tree allows you to explore your filesystem and to open files and directories. It PResents the filesystem to you in the form of a tree which you manipulate with the keyboard and/or mouse. It also allows you to perform simple filesystem Operations.
你可以使用Git這樣安裝:
?12 | cd $HOME/.vim /bundle git clone https: //github .com /scrooloose/nerdtree .git |
這個可以有。想快速寫或者減少重復寫代碼,那么code snippets就是必須的,而對于vim來說,snipMate,你值得擁有。[ps:你可以在其snippets目錄下找到對應語言的snippets,可以修改相應的snippets]。請到vim官網下載http://www.vim.org/scripts/script.php?script_id=2540。
tagbar如果你使用過eclipse,那么它右邊有個叫做Outline函數列表,對,tagbar就是這個效果。
你可以使用Git這樣安裝:
?12 | cd $HOME/.vim /bundle git clone https: //github .com /majutsushi/tagbar .git |
vim-multiple-cursors
這個插件具有Sublime Text的多光標編輯功能喲。你可以使用Git這樣安裝:
?12 | cd $HOME/.vim /bundle git clone https: //github .com /terryma/vim-multiple-cursors .git |
如果使用python的,有了它,爽歪歪。它擁有強大的提示能力。
你可以使用Git這樣安裝:
?12 | cd $HOME/.vim /bundle git clone https: //github .com /davidhalter/jedi-vim .git |
eclim 就是 eclipse 和 vim的有機結合。它充分利用了eclipse強大的提示功能,快捷鍵<c-x><c-u>
按照官網安裝之后,它會在.vim目錄下生成eclim和plugin目錄,請在bundle目錄新建一個目錄eclim,然后將這兩個目錄剪切到bundle/eclim目錄中.這時它沒有啟動,還需要執行ECLIPSE目錄中的eclimd。這個并沒有列舉出來。
其實還可以加一個supertab插件,但是我習慣使用tab來代替空格,實際上一個tab是4個空格。所以并沒有列舉出來。
你可以使用git這樣安裝:
?12 | cd $HOME/.vim /bundle git clone https: //github .com /ervandew/supertab .git |
請到這里去下載,這個不解釋,很強大,官網有很詳細的解釋和幫助文檔,對于c/c++來說不可缺少。
vim-colorschemes保護視力,請從一個好的主題開始。那么vim-colorschemes中集成了很多的主題,個人比較愛好cobalt,不過有些主題只能在gvim中才能顯示效果,而在vim中沒有背景顏色等等問題。github去下載
?12 | cd $HOME/.vim /bundle git clone https: //github .com /upsuper/vim-colorschemes .git |
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 | " Uncomment the next line to make Vim more Vi-compatible " NOTE: debian.vim sets 'nocompatible' . Setting 'compatible' changes numerous " options, so any other options should be set AFTER setting 'compatible' . " set compatible set nocompatible " Vim5 and later versions support syntax highlighting. Uncommenting the next " line enables syntax highlighting by default. if has( "syntax" )
syntax on endif " If using a dark background within the editing area and syntax highlighting " turn on this option as well " set background=dark " Uncomment the following to have Vim jump to the last position when " reopening a file "if has(" autocmd") " au BufReadPost * if line(" '/"") > 1 && line("' /"") <= line( "$" ) | exe "normal! g'/"" | endif "endif " Uncomment the following to have Vim load indentation rules and plugins " according to the detected filetype. "if has(" autocmd") " filetype plugin indent on "endif call pathogen #infect() filetype plugin indent on " The following are commented out as they cause vim to behave a lot " differently from regular Vi. They are highly recommended though. set showcmd " Show (partial) command in status line. "set showmatch " Show matching brackets. "set ignorecase " Do case insensitive matching set smartcase " Do smart case matching "set incsearch " Incremental search "set autowrite " Automatically save before commands like :next and : make "set hidden " Hide buffers when they are abandoned set mouse=a " Enable mouse usage (all modes) set nu set tabstop=4 set softtabstop=4 " set shiftwidth=4 set expandtab " use whitespace instead of tab set autoindent set smartindent set cindent shiftwidth=4 " set autoindent shiftwidth=4 set foldmethod=indent set backspace=indent,eol,start set colorcolumn=80 " === tagbar setting ======= nmap <F4> :TagbarToggle<CR> " shortcut let g:tagbar_width = 20 " tagbar's width, default 20 autocmd VimEnter * nested :call tagbar #autoopen(1) "automate to open tagbar let g:tagbar_left = 1 " on the left side "let g:tagbar_right = 1 " on the right side let NERDTreeIgnore=[ '/.pyc' , '/.pyo' , '/.swp' , '/~' ] " ignore *.py[co], *.swp and *~ " =======end================== " switch window nnoremap <c-h> <c-w>h nnoremap <c-j> <c-w>j nnoremap <c-k> <c-w>k nnoremap <c-l> <c-w>l " ===== brace autocompletion ========= inoremap ( ()<Esc>i inoremap [ []<Esc>i inoremap { {<CR>}<Esc>O autocmd Syntax html,vim inoremap < <lt>><Esc>i| inoremap > <c-r>=ClosePair( '>' )<CR> inoremap ) <c-r>=ClosePair( ')' )<CR> inoremap ] <c-r>=ClosePair( ']' )<CR> inoremap } <c-r>=CloseBracket()<CR> inoremap " <c-r>=QuoteDelim('" ')<CR> inoremap ' <c-r>=QuoteDelim("' ")<CR> function ClosePair(char)
if getline( '.' )[col( '.' ) - 1] == a:char
return "/<Right>"
else
return a:char
endif endf function CloseBracket()
if match(getline(line( '.' ) + 1), '/s*}' ) < 0
return "/<CR>}"
else
return "/<Esc>j0f}a"
endif endf function QuoteDelim(char)
let line = getline( '.' )
let col = col( '.' )
if line[col - 2] == "http://"
"Inserting a quoted quotation mark into the string
return a:char
elseif line[col - 1] == a:char
"Escaping out of the string
return "/<Right>"
else
"Starting a string
return a:char.a:char. "/<Esc>i"
endif endf " Source a global configuration file if available if filereadable( "/etc/vim/vimrc.local" )
source /etc/vim/vimrc . local endif |
1234567891011121314 | <span>< /span >
<div>
< /div > |
這是我在寫python nose插件nose-colorxunit時截圖:
http://my.oschina.net/swuly302/blog/156784
新聞熱點
疑難解答