Skip to content

Commit a990da9

Browse files
committed
Apply vim-scripts/FuzzyFinder PR vim-scripts#2
1 parent b9f1659 commit a990da9

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

autoload/fuf.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,11 @@ let s:FUF_BUF_NAME = '[fuf]'
706706

707707
"
708708
function 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"
736742
endfunction
737743

738744
" }}}1
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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

0 commit comments

Comments
 (0)