summaryrefslogtreecommitdiff
path: root/plugin/fzf.vim
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-04-11 23:42:01 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-04-11 23:42:01 +0900
commit8406cedf2d8755729636bf788037b916c52483f4 (patch)
tree90bb1002b9d41e5f90058a5b7c190220770b88c7 /plugin/fzf.vim
parentf22b83db6c8ab6b83373381fa97b3b4e1c89b640 (diff)
downloadfzf-8406cedf2d8755729636bf788037b916c52483f4.tar.gz
[vim] Improved compatibility with sidebar plugins (e.g. NERDtree)
Diffstat (limited to 'plugin/fzf.vim')
-rw-r--r--plugin/fzf.vim21
1 files changed, 14 insertions, 7 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index 3a30a37d..fc42bb0d 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -227,16 +227,19 @@ endfunction
function! s:split(dict)
let directions = {
- \ 'up': ['topleft', &lines],
- \ 'down': ['botright', &lines],
- \ 'left': ['vertical topleft', &columns],
- \ 'right': ['vertical botright', &columns] }
+ \ 'up': ['topleft', 'resize', &lines],
+ \ 'down': ['botright', 'resize', &lines],
+ \ 'left': ['vertical topleft', 'vertical resize', &columns],
+ \ 'right': ['vertical botright', 'vertical resize', &columns] }
+ let s:ptab = tabpagenr()
try
- for [dir, pair] in items(directions)
+ for [dir, triple] in items(directions)
let val = get(a:dict, dir, '')
if !empty(val)
- let [cmd, max] = pair
- execute cmd s:calc_size(max, val).'new'
+ let [cmd, resz, max] = triple
+ let sz = s:calc_size(max, val)
+ execute cmd sz.'new'
+ execute resz sz
return
endif
endfor
@@ -256,7 +259,11 @@ function! s:execute_term(dict, command, temps)
let fzf = { 'buf': bufnr('%'), 'dict': a:dict, 'temps': a:temps }
function! fzf.on_exit(id, code)
+ let tab = tabpagenr()
execute 'bd!' self.buf
+ if s:ptab == tab
+ wincmd p
+ endif
call s:pushd(self.dict)
try
call s:callback(self.dict, self.temps)