Nerdtree: How to disable a NERDTree mapping that conflicts with a custom mapping?

Created on 26 Jul 2016  Â·  2Comments  Â·  Source: preservim/nerdtree

I currently have this mapping in my .vimrc to make navigating between windows easier.

nnoremap <c-j> <c-w>j

I noticed that after installing NERDTree and opening it in the current buffer with e ., I couldn't use c-j anymore to move down to below window. I took a look at the NERDTree docs and found this mapping

<C-J>...Jump down to the next sibling of the current directory...|NERDTree-C-J|

I don't really see myself using this mapping, so how could I disable it and go back to <c-j> doing <c-w>j?

Most helpful comment

@wwselleck, use NERDTree's customizability to your advantage. Put these lines in your vimrc to effectively disable the functionality:

let g:NERDTreeMapJumpNextSibling="☻"
let g:NERDTreeMapJumpPrevSibling="☺"

You can use any string or keystroke that you're unlikely to type in the NERDTree window. I picked the smiley faces because I know of no way to type them in Normal mode. I'd experimented with an empty string, and it worked, but I was concerned there would be unintended consequences. Long strings of random characters would also work, but they look ugly.

All 2 comments

@wwselleck, use NERDTree's customizability to your advantage. Put these lines in your vimrc to effectively disable the functionality:

let g:NERDTreeMapJumpNextSibling="☻"
let g:NERDTreeMapJumpPrevSibling="☺"

You can use any string or keystroke that you're unlikely to type in the NERDTree window. I picked the smiley faces because I know of no way to type them in Normal mode. I'd experimented with an empty string, and it worked, but I was concerned there would be unintended consequences. Long strings of random characters would also work, but they look ugly.

Thanks @PhilRunninger
An effective dirty hack :)

Was this page helpful?
0 / 5 - 0 ratings