syntastic and split views

Asked by At

Recently, I started using syntastic, as it eases up development quite a bit.

The only thing that rly bothers me, is it deals with split views.

I use NERDtree as well, and whenever a open another file in a vsplit view, the following happens:

---------------------------------------------------------
|        |                   |                          |
|NERDTree|    file           |                          |
|        |                   |       file               |
|        |                   |                          |
|        |--------------------                          |
|        |   syntastic       |                          |
---------------------------------------------------------
|                                                       |
|                 syntastic                             |
|                                                       |
---------------------------------------------------------

Is there a way to ged rid of the small additional syntastic tile? If rather want two small tiles (one for each file), or only one tile displaying information for the currently active file tile.

1 Answers

5
Peter Rincker On

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.