-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suppress events for intermediate window/tab/buffer changes #1026
Conversation
The value doesn't matter, but 1 is a good choice. Its presence is an indicator that tells NERDTree to tell Vim to ignore all events. I'm not yet sure if there needs to be an else section to that if block. It may be OK to allow all events to fire in the right situations.
Finding all the right function calls is the key here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested this, but the approach looks sound.
lib/nerdtree/nerdtree.vim
Outdated
else | ||
call nerdtree#exec(bufwinnr(l:activeBufOrWin) . " wincmd w") | ||
call nerdtree#exec(bufwinnr(l:activeBufOrWin) . " wincmd w",0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you need a space after the ,
here and two lines above.
lib/nerdtree/opener.vim
Outdated
exec("silent ". splitMode ." resize ". size) | ||
call nerdtree#exec('wincmd p') | ||
call nerdtree#exec('wincmd p',0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after ,
.
lib/nerdtree/opener.vim
Outdated
|
||
let l:currentWindowNumber = winnr() | ||
|
||
" Restore the NERDTree to its original width. | ||
call g:NERDTree.CursorToTreeWin() | ||
execute 'silent vertical resize ' . l:winwidth | ||
|
||
call nerdtree#exec(l:currentWindowNumber . 'wincmd w') | ||
call nerdtree#exec(l:currentWindowNumber . 'wincmd w',0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
lib/nerdtree/opener.vim
Outdated
@@ -321,7 +321,7 @@ function! s:Opener._reuseWindow() | |||
"check the current tab for the window | |||
let winnr = bufwinnr('^' . self._path.str() . '$') | |||
if winnr != -1 | |||
call nerdtree#exec(winnr . "wincmd w") | |||
call nerdtree#exec(winnr . "wincmd w",0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
lib/nerdtree/opener.vim
Outdated
let winnr = bufwinnr('^' . self._path.str() . '$') | ||
call nerdtree#exec(winnr . "wincmd w") | ||
call nerdtree#exec(winnr . "wincmd w",0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
lib/nerdtree/ui.vim
Outdated
let b:NERDTreeZoomed = 0 | ||
else | ||
exec "vertical resize ". get(g:, 'NERDTreeWinSizeMax', '') | ||
call nerdtree#exec("vertical resize ". get(g:, 'NERDTreeWinSizeMax', ''),1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And on these two.
nerdtree_plugin/fs_menu.vim
Outdated
exec "tabnext " . s:originalTabNumber | ||
exec s:originalWindowNumber . "wincmd w" | ||
call nerdtree#exec("tabnext " . s:originalTabNumber,1) | ||
call nerdtree#exec(s:originalWindowNumber . "wincmd w",1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More missing spaces.
nerdtree_plugin/fs_menu.vim
Outdated
@@ -141,17 +141,17 @@ function! s:renameBuffer(bufNum, newNodeName, isDirectory) | |||
let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'}) | |||
endif | |||
" 1. ensure that a new buffer is loaded | |||
exec "badd " . quotedFileName | |||
call nerdtree#exec("badd " . quotedFileName,1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
Description of Changes
Closes #588
Got rid of the line that always ignores the
BufEnter
,BufLeave
, andVimEnter
events. So now, no events are ignored, and this allowsBufEnter
to be fired when opening an already open file, fixing #588.But not so fast.....
Closes #684
The change above causes events to be fired way more often than necessary because of NERDTree's need to switch windows at various times. To solve this, a new parameter was added to
nerdtree#exec()
that can cause all events to be ignored. This is set to 1 for all the intermediate window switches, and then to 0 for the final window switch to the selected file. This change, which comprises many lines of code throughout NERDTree, fixes the ping-ponging that was mentioned in #684 but has, until now, been left unaddressed.New Version Info
MAJOR
version when you make incompatible API changesMINOR
version when you add functionality in a backwards-compatible mannerPATCH
version when you make backwards-compatible bug fixes