Vim 配置ctags、winmanager、NERDTree、Taglist若干问题

来源:互联网 发布:com域名和cn域名 编辑:程序博客网 时间:2024/05/17 23:15

Vim 配置遇到的一些问题


1. winmanager合并显示NERDTree和TagList 后自动开启 wm会出现空白窗口

" 修改plugin/winmanager.vim配置文件function! <SID>ToggleWindowsManager()if IsWinManagerVisible()call s:CloseWindowsManager()elsecall s:StartWindowsManager()exe 'q' "####添加此行endendfunction"####添加如下内容if g:AutoOpenWinManagerautocmd VimEnter * nested call s:ToggleWindowsManager()|3wincmd w endif

网上流传的其他方法测试无效

比如 

"添加 autocmd VimEnter * nested call s:StartWindowsManager()|1wincmd w|q"或者修改function! <SID>ToggleWindowsManager()if IsWinManagerVisible()call s:CloseWindowsManager()elsecall s:StartWindowsManager()exe '1wincmd w'"###添加此行exe 'q' "###添加此行endendfunction 
总结:问题的关键是将StartWindowsManager()函数换成ToggleWindowsManager()


2.关于ctag插件 总是 提示“E426:找不到 tag:xxxx”
添加如下配置即可

map <leader>cd  :cd %:p:h<cr>map <Leader>tag <leader>cd:!ctags -R<cr> "使用\tag命令在程序目录生成tags文件set tags=tags; 

附:

我的VIM配置文件

set nocompatiblesource $VIMRUNTIME/vimrc_example.vimsource $VIMRUNTIME/mswin.vimbehave mswinset diffexpr=MyDiff()function MyDiff()  let opt = '-a --binary '  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif  let arg1 = v:fname_in  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif  let arg2 = v:fname_new  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif  let arg3 = v:fname_out  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif  let eq = ''  if $VIMRUNTIME =~ ' '    if &sh =~ '\<cmd'      let cmd = '""' . $VIMRUNTIME . '\diff"'      let eq = '"'    else      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'    endif  else    let cmd = $VIMRUNTIME . '\diff'  endif  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eqendfunctionset expandtab   "设置tabset shiftwidth=4    "设置tab的间隔set tabstop=4   "四个空格代表一个tabset sts=4set showmatch   "在输入括号时光标会短暂地跳到与之相匹配的括号处set autoindent  "设置自动缩进" set smartindent"设置智能缩进set nowrap    "设置自动换行 colorscheme desert " 主题设置set number      " 显示行号set guifont=Courier_new:h13:b:cDEFAULT " 设置字体大小set helplang=cn " 帮助中文支持syntax enablesyntax on"ctags 配置set autochdirmap <leader>cd  :cd %:p:h<cr>map <Leader>tag <leader>cd:!ctags -R<cr>set tags=tags;" taglist 配置let Tlist_Show_One_File=1let Tlist_Exit_OnlyWindow=1let Tlist_Use_Right_Window=1            "让窗口显示在右边,0的话就是显示在左边map <F3> :TlistToggle<CR>" winmanager配置"let g:winManagerWindowLayout='TagList|FileExplorer'let g:winManagerWindowLayout='NERDTree|TagList'nmap <silent> <F8> :WMToggle<cr>let g:winManagerWidth = 30let g:AutoOpenWinManager =1map wm :WMToggle<cr>"NERDTree 配置let g:NERDTree_title="[NERDTree]"function! NERDTree_Start()    exec 'NERDTree'endfunctionfunction! NERDTree_IsValid()    return 1endfunction "编码相关set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1set fileencoding=utf-8set encoding=gbk"set termencoding=gbk"set gfn=Monaco:h10:cANSI"set gfw=NSimsun:h12set nocpfiletype plugin on



0 0
原创粉丝点击