[vim] Improved compatibility with sidebar plugins (e.g. NERDtree)
This commit is contained in:
parent
f22b83db6c
commit
8406cedf2d
@ -227,16 +227,19 @@ endfunction
|
|||||||
|
|
||||||
function! s:split(dict)
|
function! s:split(dict)
|
||||||
let directions = {
|
let directions = {
|
||||||
\ 'up': ['topleft', &lines],
|
\ 'up': ['topleft', 'resize', &lines],
|
||||||
\ 'down': ['botright', &lines],
|
\ 'down': ['botright', 'resize', &lines],
|
||||||
\ 'left': ['vertical topleft', &columns],
|
\ 'left': ['vertical topleft', 'vertical resize', &columns],
|
||||||
\ 'right': ['vertical botright', &columns] }
|
\ 'right': ['vertical botright', 'vertical resize', &columns] }
|
||||||
|
let s:ptab = tabpagenr()
|
||||||
try
|
try
|
||||||
for [dir, pair] in items(directions)
|
for [dir, triple] in items(directions)
|
||||||
let val = get(a:dict, dir, '')
|
let val = get(a:dict, dir, '')
|
||||||
if !empty(val)
|
if !empty(val)
|
||||||
let [cmd, max] = pair
|
let [cmd, resz, max] = triple
|
||||||
execute cmd s:calc_size(max, val).'new'
|
let sz = s:calc_size(max, val)
|
||||||
|
execute cmd sz.'new'
|
||||||
|
execute resz sz
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -256,7 +259,11 @@ function! s:execute_term(dict, command, temps)
|
|||||||
|
|
||||||
let fzf = { 'buf': bufnr('%'), 'dict': a:dict, 'temps': a:temps }
|
let fzf = { 'buf': bufnr('%'), 'dict': a:dict, 'temps': a:temps }
|
||||||
function! fzf.on_exit(id, code)
|
function! fzf.on_exit(id, code)
|
||||||
|
let tab = tabpagenr()
|
||||||
execute 'bd!' self.buf
|
execute 'bd!' self.buf
|
||||||
|
if s:ptab == tab
|
||||||
|
wincmd p
|
||||||
|
endif
|
||||||
call s:pushd(self.dict)
|
call s:pushd(self.dict)
|
||||||
try
|
try
|
||||||
call s:callback(self.dict, self.temps)
|
call s:callback(self.dict, self.temps)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user