Make vim commands work in the initial window, for example, NERDTree, MiniBufExplorer and CtrlP

I have NERDTree and MiniBufExplorer that open when vim starts, so I have three windows. Whenever I use the above plugins, the files / buffers are displayed in the correct window, which is the original one. However, whenever I use a command such as :e ~/.vimrc, the command works in a window that contains a cursor. This means that I must always remember to move the cursor to the window used for editing. I was wondering if there is a way to make the commands work in this window, regardless of where the cursor is, or if file buffers automatically appear in this window?

I was looking for a way to move the cursor to the desired window when a button is pressed :(or some other key that I can use), but I could not understand how there is no way to identify the windows (or is there?).

0
source share
1 answer

Files, buffers and splits Oh My!

You ask Vim to change how each individual file and buffer command change to fit your choice and workflow. You go against vim here and it will interfere with your use of Vim partitions.

First of all, you need to understand that Vim does not have the concept of Project boxes, only split / windows. This means that NerdTree and other plugins go to great lengths to emulate the behavior of Project Drawer and ultimately fail.

NerdTree MiniBufExplorer, :

NerdTree:

  • . ? 10% ? ?
  • - , , <c-w>b. NerdTree . <c-w>t ? , ,
  • NerdTree . , <c-w>J <c-w>H. , .

MiniBufExplorer

  • - MiniBufExplorer . . , , MiniBufExplorer.
  • . , .
  • - , :bnext :bprev
  • - MiniBufExplorer ,
  • - , NerdTree
  • MiniBufExplorer Vim vim:

Vim Way

Vimcast, - , Vim - , , . NerdTree , . vim:

Vim:

  • :b :sb , , glob
  • :ls, , :b .
  • <c-6>
  • :bnext :bprev [b ]b Unimpaired.vim mappings
  • set hidden . , vim ,
  • , CtrlP Command-T .

. , , . , . :h opening-window. :h window, .

+6

All Articles