0

If I have many buffers opened and, if the cursor (focus) is within NERDTree, when I change the buffer with :bn or :bp, the content of buffer loads within NERDTree.

There's a way to, before buffer enter, check if cursor is focus on NerdTree and type <c-w><c-w> to prevent buffer loads within NERDTree?

  • Something along the lines of autocmd BufUnload nerdtree <your commands here>, maybe. There are a lot of posts that deal with nerdtree specific buffers...maybe not this question exactly but similar enough to reveal some useful information. – B Layer Feb 13 at 12:01
  • 1
    Tks @BLayer! I will try solutions and post here if I found something. – Diego Somar Feb 13 at 12:10
  • Sounds good. There will probably be some degree of scripting required, even if it's just the rest of an autocmd line like I mentioned so if you're not experienced with that just try to get a rough idea, come back and update your question with any relevant new details and we'll go from there. (If you are experienced you might figure it all out for yourself.) – B Layer Feb 13 at 12:51
  • If you want an easy workaround start using Normal mode mappings to cycle through buffers and use a mapping like this for :bnext ... :nnoremap <silent> <leader>n :if &filetype != 'nerdtree' <bar> :bnext <bar> endif<cr> and similar for :bprev. (I use such mappings for bnext/bprev even without having a requirement like yours...it's quicker!) – B Layer Feb 21 at 2:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.