Syntastic and split view handling in Vim

元气小坏坏 提交于 2019-12-08 15:45:02

问题


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.

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.


回答1:


NerdTree often gets in the way of a a good split/window workflow. So have you thought about not using NerdTree?

A few problems with NerdTree:

  • 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.

The Vim Way

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:

  • 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)

Personally, I would find a good fuzzy file finder start fading NerdTree out of your workflow.

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.



来源:https://stackoverflow.com/questions/32394947/syntastic-and-split-view-handling-in-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!