summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorJoshua Rubin <jrubin@zvelo.com>2016-08-25 01:08:27 -0600
committerJunegunn Choi <junegunn.c@gmail.com>2016-08-28 19:17:24 +0900
commitf025602841384fb10cc80d37492ec44c2b872860 (patch)
treebca5b6a96a1472a57c68cdd320ddb2d74e0fc8e5 /plugin
parentf958c9daf59439240c36d74f42187333c23bd8a4 (diff)
[vim] Reset window sizes on close
Fix #520 Fix junegunn/fzf.vim#42
Diffstat (limited to 'plugin')
-rw-r--r--plugin/fzf.vim8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index abaa420c..4b554e92 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -431,9 +431,11 @@ function! s:split(dict)
endfunction
function! s:execute_term(dict, command, temps) abort
+ let winrest = winrestcmd()
let [ppos, winopts] = s:split(a:dict)
let fzf = { 'buf': bufnr('%'), 'ppos': ppos, 'dict': a:dict, 'temps': a:temps,
- \ 'winopts': winopts, 'command': a:command }
+ \ 'winopts': winopts, 'winrest': winrest, 'lines': &lines,
+ \ 'columns': &columns, 'command': a:command }
function! fzf.switch_back(inplace)
if a:inplace && bufnr('') == self.buf
" FIXME: Can't re-enter normal mode from terminal mode
@@ -465,6 +467,10 @@ function! s:execute_term(dict, command, temps) abort
execute 'bd!' self.buf
endif
+ if &lines <= self.lines && &columns <= self.columns && s:getpos() == self.ppos
+ execute self.winrest
+ endif
+
if !s:exit_handler(a:code, self.command, 1)
return
endif