mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
fix a bug when opening files in a new tab
On bufleave we save the nerdtree window state. However, sometimes when bufleave is triggered the tree is no longer open in this tab - e.g. for secondary trees or mappings that open in another tab. Dont bother saving screen state in these cases as the code doing the saving assumes the tree is available in this tab.
This commit is contained in:
@@ -148,7 +148,7 @@ call nerdtree#ui_glue#setupCommands()
|
||||
"============================================================
|
||||
augroup NERDTree
|
||||
"Save the cursor position whenever we close the nerd tree
|
||||
exec "autocmd BufLeave ". g:NERDTreeCreator.BufNamePrefix() ."* call b:NERDTree.ui.saveScreenState()"
|
||||
exec "autocmd BufLeave ". g:NERDTreeCreator.BufNamePrefix() ."* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif"
|
||||
|
||||
"disallow insert mode in the NERDTree
|
||||
exec "autocmd BufEnter ". g:NERDTreeCreator.BufNamePrefix() ."* stopinsert"
|
||||
|
||||
Reference in New Issue
Block a user