如何仅使用VIM管理大型项目(数百个文件)?
我个人开始在任何大型项目中遇到问题.
我知道所有的VIM基础知识,所以我没有问题使用它来编写脚本或快速编辑一些源代码.但是当我必须在文件之间导航时,它变得非常混乱.
sys*_*USE 32
VIM对标签提供了出色的支持.为项目创建标记文件后,您可以跳转到方法,类等的定义或声明,包括跳过文件,所有这些都在同一个编辑会话中.
尝试
:help tags
Run Code Online (Sandbox Code Playgroud)
要为C/C++生成标记文件,请转到shell提示符(我假设您的系统是*nix/Cygwin)并键入
info ctags
Run Code Online (Sandbox Code Playgroud)
要么
ctags --help
Run Code Online (Sandbox Code Playgroud)
avo*_*ade 26
我喜欢简单的解决方案,我最喜欢的导航方式是:
添加 ~/.vimrc.local
set path=$PWD/**
Run Code Online (Sandbox Code Playgroud)
然后在编辑器中键入它以在当前工作目录(pwd)中的任何位置查找该文件
:find user_spec.rb
Run Code Online (Sandbox Code Playgroud)
您可以在文件名上使用制表符完成来查找多个选项,使此TextMate转换非常满意.
don*_*nut 13
我使用NERDTree(目录侧边栏),FuzzyFinder Textmate(像TextMate的CMD + T这样的文件)和Sessions(:h sessions)的组合来帮助我处理大型项目.
我建议使用一些会话助手插件.我会提到我使用的东西,但我还不满意.只是谷歌"vim会议".
让FuzzyFinder Textmate工作时需要注意的一点是它依赖于旧版本的FuzzyFinder插件,特别是v2.16.任何更高的东西,你会得到错误.但这绝对是值得的.虽然它没有名称完成,但它的搜索很聪明,所以如果我搜索fro/time/actionsphp它会拉起文件apps/(fro)ntend/modules/(time)_tracking/actions/(actions).class.(php)(括号表示它匹配的内容).它可以很容易地选择仅由其文件夹名称唯一的文件.
以及无价的ctags和各种相关命令.如果没有项目插件,我也无法生存,它允许您在单独的窗格中将与项目相关的感兴趣文件.我不记得我的设置有多少是自定义的,但如果我想打开一个名为Debug.c的源文件,我点击:
<F12> " Opens the project pane
/De " Searches for "De", which is likely to be enough to find Debug.c or possibly Debug.h
<ENTER> " Opens the selected file and closes the project pane
Run Code Online (Sandbox Code Playgroud)
我经常这样做:
:vsp " Vertically split the window
<F12> " Reopen project pane
# " Search back to find previous entry with the same name (to find
Debug.h if I was on Debug.c: my headers are in Headers/ and
my source is in Source/, so the headers come earlier in the list
than the source). I use * to go the other way, obviously.
<ENTER> " Open the header file in the other window and close the project window.
Run Code Online (Sandbox Code Playgroud)
使用这个相对较短的序列,我可以在垂直分割中打开任何文件和它的标题.由于项目插件窗口只是一个文本文件,因此使用Vim的搜索功能可以完成.
| 归档时间: |
|
| 查看次数: |
29926 次 |
| 最近记录: |