Vim 配置

记录下我的.vimrc

set nu
set hls
set incsearch
syntax enable
syntax on


let mapleader = ","       "Set mapleader
map <C-F7> ,be
map <C-F6> ,mbt
",be/,bt  Open Buffer explorer
",mbt Toggle mini Buf explorer


map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR> 
"map <C-A> :TlistToggle<CR>
let Tlist_Show_One_File=1  
let Tlist_Exit_OnlyWindow=1  
let Tlist_Use_Right_Window=1


"let g:winManagerWindowLayout='BufExplorer,FileExplorer|TagList'
let g:winManagerWindowLayout='FileExplorer'
nmap <C-F9> :WMToggle<cr>
nmap <C-F10> :TlistToggle<cr>


map <C-F11> :Rgrep<CR>
let g:miniBufExplMapWindowNavVim = 100


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" cscope setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("cscope")
  set csprg=/usr/bin/cscope
  set csto=1
  set cst
  set nocsverb
  " add any database in current directory
  if filereadable("cscope.out")
      cs add cscope.out
  endif
  set csverb
endif


set cscopequickfix=s-,c-,d-,i-,t-,e-
nmap <F8>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <F8>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <F8>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <F8>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <F8>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <F8>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <F8>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <F8>d :cs find d <C-R>=expand("<cword>")<CR><CR>


map <C-F8> :!cs_load.sh <CR> :cs add cscope.out <CR>
"-----------------------------------------------------------------------------
" lookupfile.vim 插件设置
"-----------------------------------------------------------------------------
let g:LookupFile_MinPatLength = 2               "最少输入2个字符才开始查找
let g:LookupFile_PreserveLastPattern = 0        "不保存上次查找的字符串
let g:LookupFile_PreservePatternHistory = 1     "保存查找历史
let g:LookupFile_AlwaysAcceptFirst = 1          "回车打开第一个匹配项目
let g:LookupFile_AllowNewFiles = 0              "不允许创建不存在的文件
let g:LookupFile_SortMethod = ""                "关闭对搜索结果的字母排序
if filereadable("./filenametags")                "设置tag文件的名字
let g:LookupFile_TagExpr ='"./filenametags"'
endif
map <C-F5> :!generate_lookupinfo.sh <CR>  :let g:LookupFile_TagExpr ='"./filenametags"' <CR>


"Define by louyong 
"Reversal line number setting
:function Rev_LineNum()
:  if &number == 1
:    set nonumber
:  else
:    set number
:  endif
:endfunction
map <silent><C-N> :call Rev_LineNum()<CR>


"Reversal mouse setting
:function Rev_Mouse()
:  if &mouse == ""
:    set mouse=a
:  else
:    set mouse=
:  endif
:endfunction
map <silent><C-M> :call Rev_Mouse()<CR>


"Only setting
map <silent>,o :only<CR>


"Setting cursor status
:function Rev_CursorLine()
:  if &cursorline == 0
:    set cursorline
:  else
:    set nocursorline 
:  endif
:endfunction
:function Rev_CursorColumn()
:  if &cursorcolumn == 0
:    set cursorcolumn 
:  else
:    set nocursorcolumn
:  endif
:endfunction
map <silent>,l :call Rev_CursorLine()<CR>
map <silent>,ll :call Rev_CursorColumn()<CR>
map <silent>,lll :call Rev_CursorColumn()<CR> :call Rev_CursorLine()<CR>


"android manifest jump
:function Search_OpenTypeFiles(suffix)
:  let filename=expand("<cword>")
:  let java_filename=filename . "." . a:suffix
:  let $REALPATH=findfile(java_filename, "**") 
:  if empty($REALPATH)
:    echo "Can not find " . java_filename 
:  else
:    find $REALPATH
:    call search(filename)
:  endif
:endfunction
map <silent>,fj :call Search_OpenTypeFiles("java")<CR>
map <silent>,fc :call Search_OpenTypeFiles("c")<CR>
map <silent>,fC :call Search_OpenTypeFiles("cpp")<CR>
map <silent>,fh :call Search_OpenTypeFiles("h")<CR>


"add for session write/read/clean
map <silent>,ms :mksession vim.session<CR>:wviminfo vim.info<CR>
map <silent>,rs :source vim.session<CR>:rviminfo vim.info<CR>
map <silent>,cs :!rm vim.session vim.info tags cscope.* filenametags<CR>



脚本:

 cat  /usr/bin/generate_lookupinfo.sh
#!/bin/sh 
# generate tag file for lookupfile plugin
echo -e "!_TAG_FILE_SORTED\t2\t/2=foldcase/" > filenametags
find . -not -regex '.*\.\(png\|gif\)' -type f -printf "%f\t%p\t1\n" | sort -f >> filenametags

cat  /usr/bin/cs_load.sh 
#!/bin/sh 
 
#!/bin/sh   
   
#find $(pwd) -type f > cscope.files   
#cscope -bkq -i cscope.files   
#ctags -R 


find . -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.java">cscope.files  
cscope -bkq -i cscope.files  
ctags -R 


我的插件:

grep.vim
minibufexpl.vim
SuperTab.vim
taglist.vim
visualmark.vim
winfileexplorer.vim
winmanager.vim
wintagexplorer.vim
lookupfile.vim
genutils.vim


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值