天天看点

通用vim配置文件

配置文件

1.创建/home/user/.vimrc文件。

2.配置vim常用特性,及插件等。

3."在配置文件中表示注释。

.vimrc文件内容:

syntax on

set nocompatible

filetype on

set ts=4

set expandtab

set autoindent

set cindent

set smartindent

set tabstop=4

set shiftwidth =4

set fileencodings=utf-8-bom,ucs-bom,utf-8,cp936,gb18030,ucs,big5

set number

"设置Vundle的运行路径并初始化

set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

" Vundle安装位置与插件路径不同时,需要Vundle插件的路径

"call vundle#begin('~/some/path/here')

"------------------要安装的插件不能写在此行前!------------------

"Vundle对自己的调用,不可删去

Plugin 'VundleVim/Vundle.vim'

"以下是所支持的各种不同格式的示例

"需要安装的插件应写在调用的vundle#begin和vundle#end之间

"如果插件托管在Github上,写在下方,只写作者名/项目名就行了

"Plugin 'Valloric/YouCompleteMe'

"Plugin 'file://~/.vim/bundle/YouCompleteMe'

Plugin 'majutsushi/tagbar'

Plugin 'vim-syntastic/syntastic'

Plugin 'vim-airline/vim-airline-themes'

Plugin 'vim-airline/vim-airline'

"如果插件来自vim-scripts(官方),写插件名就行了

Plugin 'L9'

Plugin 'a.vim'

Plugin 'jiangmiao/auto-pairs'

Plugin 'scrooloose/nerdtree'

Plugin 'Valloric/ListToggle'

Plugin 'Lokaltog/vim-powerline'

Plugin 'Yggdroot/indentLine'

Plugin 'davidhalter/jedi'

Plugin 'grep.vim'

Plugin 'OmniCppComplete'

Plugin 'AutoComplPop'

"如果Git仓库不在Github上,需要提供完整的链接

" Plugin 'git://git.wincent.com/command-t.git'

"本地的插件需要提供文件路径

" Plugin 'file:///home/gmarik/path/to/plugin'

"一定要确保插件就在提供路径的文件夹中(没有子文件夹,直接在这层目录下)

"运行时目录的路径

"Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}

"避免插件间的命名冲突

"Plugin 'ascenator/L9', {'name': 'newL9'}

"------------------要安装的插件不能写在此行后!------------------

call vundle#end()            " required

filetype plugin indent on    " required

"要忽略插件缩进更改,请改用:

"filetype plugin on

"

" 安装插件的相关指令

":PluginList            - 列出已安装插件

":PluginInstall         - 安装新添加的插件;添加`!`或使用`:PluginUpdate`来更新已安装插件

":PluginSearch xxx      - 寻找名字带有xxx的插件;添加`!`刷新本地缓存

":PluginClean           - 删除已经从列表移除的插件;添加`!`静默卸载

":h                     - 帮助和说明文档

"Vundle的设置到此为止了

map <C-n> :NERDTreeToggle<CR>

set tags+=/home/xsw/wlot_xsw/tagswlot

set tags+=/home/xsw/wlot_new/tagswlot

"let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'

"nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>

"let g:ycm_python_binary_path = '/usr/bin/python3'

"nmap<C-a> :YcmCompleter FixIt<CR>

"ctags -af /home/xsw/wlot_new/tagswlot -R --c++-kinds=+p --fields=+iaS --extra=+q /home/xsw/wlot_new/

"ctags -R --c++-kinds=+p --fields=+iaS --extra=+q

怎样为某个工程生成相应的tags?

假如工程文件夹为wlot_new,那么为这个工程生成一个tags名为“tagswlot",生成命令如下:

ctags -af /home/xsw/wlot_new/tagswlot -R --c++-kinds=+p --fields=+iaS --extra=+q /home/xsw/wlot_new/

相关插件安装:

1.Set up ​​Vundle​​

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

2.Install Plugins: