How to make NERDTree always open on the right side?

VimNerdtree

Vim Problem Overview


NERDTreeToggle always makes it show up on the left side. I'd like to make it show up on the right. Is it possible to do that?

Vim Solutions


Solution 1 - Vim

Add this line to your .vimrc:

let g:NERDTreeWinPos = "right"

Solution 2 - Vim

You can change the window position in your NERD_Tree.vim file too. I usually like looking through .vim files, if only to help keep my .vimrc file clear.

Here is the code to change:

call s:initVariable("g:NERDTreeWinPos", "left") "default
call s:initVariable("g:NERDTreeWinPos", "right")

The code should be at line number 90, if not then I have included the default so that you can search for it.

Also, here is a link for some info on the NERD_Tree.vim file.

Solution 3 - Vim

I Open NERDTree at right window with this.

$ vim ~/.vimrc
...

let NERDTreeWinPos=1

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRunning TurtleView Question on Stackoverflow
Solution 1 - VimhtanataView Answer on Stackoverflow
Solution 2 - Vimjosh-fuggleView Answer on Stackoverflow
Solution 3 - VimChu-Siang LaiView Answer on Stackoverflow