vim 配置记录

"显示行号      
"set number "或者set  nu  
"map <F5> <Esc>:set nu<CR>   "映射F5显示行号,参考"vim 按键映射"(http://www.pythonclub.org/vim/map-basic)  
"map <C-F5> <Esc>:set nonu<CR>   "映射Ctrl+F5为不显示行号  
nmap <F2> <c-w><c-w>
nmap <S-TAB> :tabnext<CR>
"nmap <TAB> :tabnext<CR>
nmap <C-n>  :tabe.<CR>


set syntax=c 
"检测文件的类型      
syntax on
filetype on
filetype plugin on  
"记录历史的行数      
set history=1000  
  
"自动对齐      
"set autoindent  
"set cindent  
  
"智能选择对齐方式      
"set smartindent  
  
"tab为4个空格      
set tabstop=4  
  
"当前行之间交错时使用4个空格      
"set shiftwidth=4  
  
"设置匹配模式,输入做括号会出现右括号      
set showmatch  
  
"编辑时显示光标状态      
set ruler  
  
"高亮查找    
set hlsearch  
  
"粘贴插入  
set paste  
  
"快速匹配      
set incsearch  
  
"修改文件自动备份      
if has("vms")  
    set nobackup  
else  
    set nobackup  
endif  


"显示行号
"set nu 


colorscheme  desert


"""""""""""""设置开启ctags"""""""""""""     
map <F5> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>  
  
"第一个命令里的分号是必不可少的。这个命令让vim首先在当前目录里寻找tags文件,如果没有找到  
"tags文件,或者没有找到对应的目标,就到父目录 中查找,一直向上递归。因为tags文件中记录的>路径总是相对于tags文件所在的路径,所以要使用第二个设置项来改变vim的当前目录。   
set tags=tags;  
set autochdir  
"绝对路径  
  
  
"""""""""""""""""Taglist设置"""""""""""""""""           
map <F2> : Tlist<CR>  ""按下F3就可以呼出了  
"let Tlist_Auto_Open = 1  "在启动VIM后,自动打开taglist窗口  
let Tlist_Ctags_Cmd = '/usr/bin/ctags'  "设定ctags的位置  
let Tlist_Use_Right_Window=0 " 1为让窗口显示在右边,0为显示在左边  
let Tlist_Show_One_File=0 "让taglist可以同时展示多个文件的函数列表,设置为1时不同时显示>多个文件的tag,只显示当前文件的  
let Tlist_File_Fold_Auto_Close=1 "同时显示多个文件中的tag时,taglist只显示当前文件tag,>其他文件的函数列表折叠隐藏  
let Tlist_Exit_OnlyWindow=1 "当taglist是最后一个分割窗口时,自动退出vim  
"let Tlist_Use_SingleClick= 1    " 缺省情况下,在双击一个tag时,才会跳到该tag定义的位置  
"let Tlist_Process_File_Always=0  "是否一直处理tags.1:处理;0:不处理  
  
  
  
"""""""""""""""""""""""cscope设置""""""""""""""""""      
set cscopequickfix=s-,c-,d-,i-,t-,e-    


if has("cscope")  
    set csprg=/usr/bin/cscope  
    set csto=0  
    set cst  
    set csverb  
    set cspc=3  
    "add any database in current dir  
    "if filereadable("cscope.out")  
    "cs add cscope.out  
    "else search cscope.out elsewhere  
    "else  
    let cscope_file=findfile("cscope.out", ".;")  
echo cscope_file
    let cscope_pre=matchstr(cscope_file, ".*/")  
    if !empty(cscope_file) && filereadable(cscope_file)  
        exe "cs add" cscope_file cscope_pre  
    endif        
    "endif  
endif  
  
nmap <C-@>s :cs find s <C-R>=expand("<cword>")<CR><CR>  
nmap <C-@>g :cs find g <C-R>=expand("<cword>")<CR><CR>  
nmap <C-@>c :cs find c <C-R>=expand("<cword>")<CR><CR>  
nmap <C-@>t :cs find t <C-R>=expand("<cword>")<CR><CR>  
nmap <C-@>e :cs find e <C-R>=expand("<cword>")<CR><CR>  
nmap <C-@>f :cs find f <C-R>=expand("<cfile>")<CR><CR>  
nmap <C-@>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>  
nmap <C-@>d :cs find d <C-R>=expand("<cword>")<CR><CR>  




"highlight Functions
syn match cFunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>[^()]*)("me=e-2
syn match cFunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>\s*("me=e-1
hi cFunctions guifg=#7fd02e cterm=bold ctermfg=yellow
syn match cClass "\<[a-zA-Z_][a-zA-Z_0-9]*\>::"me=e-2
hi cClass guifg=#7fd02e cterm=bold ctermfg=yellow


"nerdtree config
map <F1> :NERDTreeToggle<CR>
map <C-F1> :NERDTreeFind<CR>
let NERDTreeChDirMode=2 "选中root即设置为当前目录
let NERDTreeQuitOnOpen=1 "打开文件时关闭树
let NERDTreeShowBookmarks=1 "显示书签
let NERDTreeMinimalUI=1 "不显示帮助面板
let NERDTreeDirArrows=0 "目录箭头 1 显示箭头 0传统+-|号
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值