怎么用Vim玩转工程!!!! 求高手指教~
系统: ubuntu
虽然经常用SI, 但是一直比较向往那种纯键盘操作的快感, 而且直接在linux写代码 不用为了smb出点问题就纠结而痛苦~ 最近看了贴子:
http://blog.csdn.net/wooin/article/details/1858917
也下了一些插件, vim编辑文本的速度是提高了些, 但是在工程方面 却感觉还是不如SI啊。。。
按照贴子上的装那个Grep插件,并修改~/.vimrc, 设置了查找快捷键
nnoremap <silent> <F3> :Grep<CR>
但是按F3的查找的时候老是找不到呢
还有cscope find 按贴子上弄的快捷键, 用了没反应。。。 得按四个键... 我是没试出来的, 不知道是没设置对还是没按好,暂时只能 “cs find c my_func”的原始命令 很费劲!
VIM 能不能像SI那样 在下方显示某个函数的定义 而不用跳到定义处去看了?
有没有经常用VIM写工程的 来讲解讲解 怎么用得更方便一点~ 有什么vim方面好的建议都可以说哈
下面是我添加的vimrc的配置:
- C/C++ code
//taglistlet Tlist_Show_One_File=1let Tlist_Exit_OnlyWindow=1//WinManagerlet g:winManagerWindowLayout='FileExplorer|TagList'nmap wm :WMToggle<cr>//Bufferlet g:miniBufExplMapCTabSwitchBufs=1let g:miniBufExplMapWindowNavVim=1// Cscope set cscopequickfix=s-,c-,d-,i-,t-,e-cs add /opt/29XXNR/nr288/user/cscope.out /opt/29XXNR/nr288/usernmap <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>// A.vimnnoremap <silent> <F12> :A<CR>//Grepnnoremap <silent> <F3> :Grep<CR>// tagset completeopt=longest,menuset tags= /dir/tags// add line numberset nu
[解决办法]
我觉得有这些插件已经很好用了……
gD, [i, 再加上:cs find, 已经非常好用了,基本上编程需要的都能找到了……
另外,再加上自动补齐功能,把标准库和系统库的include加进去,自动补齐的时候,连函数声明都有提示,这还不够用的嘛?
反正对我来说够用了……
下面是我的vimrc,给你参考一下……
- C/C++ code
" 显示行号set number" 设置缩进set tabstop=4set shiftwidth=4set autoindentset cindent" 设置高亮syntax enablesyntax onset hlsearchnmap <f2> :noh<cr>" 设置ctags、cscope和TagListset tags=tags;set autochdirset cscopequickfix=s-,c-,d-,i-,t-,e-let Tlist_Ctags_Cmd = '/usr/bin/ctags'let Tlist_Show_One_File=1let Tlist_Exit_OnlyWindow=1" 设置WinManagerlet g:winManagerWindowLayout='FileExplorer|TagList'nmap mw :WMToggle<cr>" 设置自动补齐filetype plugin indent on"set completeopt=longest,menu" 设置OmniCppComplete" ctags 索引文件 (根据已经生成的索引文件添加即可, 这里我额外添加了 hge 和 curl的索引文件)set tags+=~/.vim/clibset tags+=~/.vim/cpplibset tags+=~/.vim/linuxlib" OmniCppCompletelet OmniCpp_NamespaceSearch = 1let OmniCpp_GlobalScopeSearch = 1let OmniCpp_ShowAccess = 1let OmniCpp_ShowPrototypeInAbbr = 1 " 显示函数参数列表let OmniCpp_MayCompleteDot = 1 " 输入 . 后自动补全let OmniCpp_MayCompleteArrow = 1 " 输入 -> 后自动补全let OmniCpp_MayCompleteScope = 1 " 输入 :: 后自动补全let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]" 自动关闭补全窗口au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endifset completeopt=menuone,menu,longest
[解决办法]
精辟
[解决办法]
[解决办法]