问题描述
最近,我开始使用syntastic,因为它大大简化了开发过程.
Recently, I started using syntastic, as it eases up development quite a bit.
真正令我困扰的是它如何处理分割视图.
The only thing that realy bothers me is how it deals with split views.
我也使用NERDtree插件,每当我在vsplit视图中打开另一个文件时,就会发生以下情况:
I use the NERDtree plugin as well, and whenever I open another file in a vsplit view, the following happens:
---------------------------------------------------------
| | | |
|NERDTree| file | |
| | | file |
| | | |
| |-------------------- |
| | syntastic | |
---------------------------------------------------------
| |
| syntastic |
| |
---------------------------------------------------------
有没有一种方法可以消除额外的小合成砖?
Is there a way to get rid of the small additional syntastic tile?
我宁愿有两个小图块(每个文件一个),或者只有一个图块显示当前活动文件图块的信息.
I would rather have two small tiles (one for each file), or only one tile displaying information for the currently active file tile.
推荐答案
NerdTree通常会妨碍良好的拆分/窗口工作流程.那么您是否考虑过不使用NerdTree?
NerdTree often gets in the way of a a good split/window workflow. So have you thought about not using NerdTree?
NerdTree的一些问题:
A few problems with NerdTree:
- 浪费的空间.您需要多久查看一次文件结构? 10%的时间?少一点?
- Vim没有项目抽屉"的概念.意思是NerdTree竭尽全力模仿"Project Drawer"行为并最终失败.
- 拆分导航-使
<c-w>t
的使用率大大降低.与其他工作流程相比,通常会导致使用更多的窗口导航命令. - 重新排列拆分时,NerdTree的播放效果不佳.创建一些拆分,然后执行
<c-w>J
或<c-w>H
.看看它如何弄乱您的布局.这就是您使用合成法的情况.
- Wasted space. How often do you need look at your file structure? 10% of the time? Less?
- Vim has no concept of a "Project Drawer". Meaning NerdTree goes to great lengths to emulate "Project Drawer" behavior and ultimately fails.
- Splits navigation - Makes
<c-w>t
much less useful. Often causing more window navigation commands to be used compared to other workflows. - NerdTree doesn't play well when rearranging splits. Create some splits then do
<c-w>J
or<c-w>H
. See how it messed up your layout. This is the case you are having with syntastic.
如 Vimcasts 所述,油醋-分开窗户和项目抽屉,Vim宁愿打开一个当您 需要它时,然后在不需要 时将其关闭.您也可以以这种方式使用NerdTree,只是忘了始终使用文件资源管理器.还有其他在vim中打开文件的方法:
As laid out in the Vimcasts post, Oil and vinegar - split windows and the project drawer, Vim prefers to just open a file explorer when you need it then switch away from it when it isn't needed. You can user NerdTree in this fashion too, just forget the alway on file explorer bit. There are other ways of opening files in vim:
- 通过
<tab>
和:e
和:sp
之类的命令使用文件补全 - 使用
<c-d>
而不是<tab>
来获取完成列表 -
:e
和:sp
命令采用glob.例如:e *.c
和:e foo/**/bar.c
-
:find
并设置'path'
和'suffix'
选项 - 使用标签或cscope跳转到标签
-
gf
将转到光标下方的文件 - 查看模糊查找器,例如 CtrlP , Command-T 或团结
- 通过 Projectionist (铁路是一个很好的例子)
- Use file completion, via
<tab>
, with commands like:e
and:sp
- Use
<c-d>
instead of<tab>
to get a list of completions :e
and:sp
commands take globs. e.g.:e *.c
and:e foo/**/bar.c
:find
and setup'path'
and'suffix'
options- Ctags or cscope to jump to tags
gf
will go to a file under the cursor- Look into fuzzy finders like CtrlP, Command-T, or Unite
- Create project specific navigation via Projectionist (Rails is a good example of this)
我个人会发现一个不错的模糊文件查找器会开始使NerdTree淡出您的工作流程.
Personally, I would find a good fuzzy file finder start fading NerdTree out of your workflow.
Vim很高兴.确保您尽可能有效地使用拆分.有许多分割的命令,请参见:h opening-window
.最好还是阅读整个:h window
帮助文件,那里有很多宝藏.
Vim is split happy. Make sure you use splits as effectively as you can. There are many split commmands, see :h opening-window
. Better yet read the whole :h window
help file, there are many treasures in there.
这篇关于Vim中的同步和拆分视图处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!