File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -706,6 +706,11 @@ let s:FUF_BUF_NAME = '[fuf]'
706706
707707"
708708function s: activateFufBuffer ()
709+ " Save the last window number so we can switch back to it later (otherwise,
710+ " at least with more recent versions of Vim, we end up with the top left
711+ " window focused)
712+ let s: fuf_buffer_last_winnr = winnr ()
713+
709714 " lcd . : To avoid the strange behavior that unnamed buffer changes its cwd
710715 " if 'autochdir' was set on.
711716 lcd .
@@ -733,6 +738,7 @@ function s:deactivateFufBuffer()
733738 AutoComplPopUnlock
734739 endif
735740 call l9#tempbuffer#close (s: FUF_BUF_NAME )
741+ exec s: fuf_buffer_last_winnr . " wincmd w"
736742endfunction
737743
738744" }}}1
Original file line number Diff line number Diff line change 1+ diff --git a/autoload/fuf.vim b/autoload/fuf.vim
2+ index fe9e6eb..78be490 100644
3+ --- a/autoload/fuf.vim
4+ +++ b/autoload/fuf.vim
5+ @@ -706,6 +706,11 @@ let s:FUF_BUF_NAME = '[fuf]'
6+
7+ "
8+ function s:activateFufBuffer()
9+ + " Save the last window number so we can switch back to it later (otherwise,
10+ + " at least with more recent versions of Vim, we end up with the top left
11+ + " window focused)
12+ + let s:fuf_buffer_last_winnr = winnr()
13+ +
14+ " lcd . : To avoid the strange behavior that unnamed buffer changes its cwd
15+ " if 'autochdir' was set on.
16+ lcd .
17+ @@ -733,6 +738,7 @@ function s:deactivateFufBuffer()
18+ AutoComplPopUnlock
19+ endif
20+ call l9#tempbuffer#close(s:FUF_BUF_NAME)
21+ + exec s:fuf_buffer_last_winnr . "wincmd w"
22+ endfunction
23+
24+ " }}}1
You can’t perform that action at this time.
0 commit comments