vim環境配置

ctags

ctags對瀏覽代碼很是的方便,能夠在函數、變量之間跳來跳去等等.php

下載

下載路徑:http://ctags.sourceforge.net/html

我已經下載過了,路徑:/home1/fujun/software/ctags-5.8.tar.gzlinux

編譯&安裝

$ tar -xzvf ctags-5.8.tar.gz
$ cd ctags-5.8
$ ./configure
# make
# make install

配置

在.vimrc中須要加入如下配置:git

set tags=/home1/fujun/opt/bin/ctags #本地編譯的ctags,將該文件放在了個人home目錄的指定目錄,僅對本用戶有效
set tags=tags;
set autochdir

使用

而後去你的工程目錄,若是你的工程是多層的目錄,就去最上層的目錄,在該目錄下運行命令: ctags -Rgithub

那麼在當前目錄及其子目錄下就會生成tags文件。正則表達式

Ctrl + ] 跳到函數func()的定義處;shell

Ctrl + T 跳回func()的調用處;vim

變量, 結構, 宏, 等等, 均可以的函數

更多用法, 在vim命令模式輸入 :help usr_29 查看便可.ui

taglist

高效地瀏覽源碼,其功能就像vc中的workpace,那裏面列出了當前文件中的全部宏,全局變量,函數名等。

下載

下載地址:http://www.vim.org/scripts/script.php?script_id=273

安裝

下載taglist壓縮包,而後把解壓的兩個文件taglist.vim 和 taglist.txt 分別放到

/usr/share/vim/vim74/doc/

/usr/share/vim/vim74/plugin/

使用

進入vim後用下面的命令打開taglist窗口.

:Tlist

mark.vim

多個單詞高亮

下載

路徑:http://www.vim.org/scripts/script.php?script_id=1238

安裝

將mark.vim文件添加到相應路徑下,個人是/usr/share/vim/vim74plugin下

使用

\m 用來使得光標處的單詞着色

\n 使得原先着色的單詞取消着色

\r 輸入\r後再輸入正則表達式,能夠高亮匹配的相關單詞

輸入\r 而後再輸入S->.*

有時候 \m 不起做用時,須要在.vimrc中加入

img

Vundle

下載&安裝

若是目錄.vim/bundle不存在請先建立,

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vundle
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'


" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

打開vim,運行 :PluginInstall 命令來自動安裝插件。

YouCompleteMe

YouCompleteMe是vim中一個強大的自動補全、提示引擎。

下載

在~/.vimrc中的Vundle插件列表區域中添加YouCompleteMe的源位置,

Plugin 'Valloric/YouCompleteMe'

保存後退出,再打開vim,運行:PluginInstall命令下載。

安裝

參考:https://github.com/Valloric/YouCompleteMe#linux-64-bit

問題

安裝完成後,終端輸入vim使用底部會報這樣的錯:

The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). YCM core library not detected; you need to compile YCM before using it. Follow the instructions in the documentation.

解決辦法:

cd .vim/bundle/YouCompleteMe
./install.py

Doxygen

安裝&下載

在~/.vimrc中的Vundle插件列表區域中添加DoxygenToolkit的源位置

Plugin 'vim-scripts/DoxygenToolkit.vim'

保存後退出,再打開vim,運行:PluginInstall命令安裝。

使用

安裝好Doxygen後,打開代碼文件,便可經過:DoxLic,:DoxAuthor,:Dox添加license說明、做者版本說明和函數說明。

默認的配置在~/.vim/bundle/DoxygenToolkit.vim/plugin/DoxygenToolkit.vim文件。

vim建立文件自動生成頭部註釋

參考個人博客:http://www.javashuo.com/article/p-zlbjbpjz-hu.html

相關文章
相關標籤/搜索