This commit is contained in:
Nachuan Tang
2023-03-16 13:33:34 -04:00
+30
View File
@@ -176,6 +176,35 @@ endfunction
let g:vista#renderer#enable_kind = 1
let g:vista#renderer#enable_icon = 1
let g:vista_last_row = v:null
function VistaCursorJump()
" let found = vista#util#BinarySearch(g:vista.raw, line('.'), 'line', '')
let found = g:vista_last_row
if empty(found)
return
endif
let vlnum = get(found, 'vlnum', v:null)
call cursor(vlnum, 3)
endfunction
function VistaH2()
if exists('*vista#util#BinarySearch')
let bufs = map(filter(copy(getbufinfo()), 'v:val.listed'), 'v:val.bufnr')
if index(bufs, bufnr('%')) < 0
return
endif
let found = vista#util#BinarySearch(g:vista.raw, line('.'), 'line', '')
if empty(found)
return
endif
let g:vista_last_row = found
endif
endfunction
autocmd BufLeave * call VistaH2()
" autocmd WinLeave call VistaH2()
autocmd FileType vista call VistaCursorJump()
function VistaHelper()
if winnr('$') == 1 && bufname() == "__vista__"
let bufs = map(filter(copy(getbufinfo()), 'v:val.listed'), 'v:val.bufnr')
@@ -186,6 +215,7 @@ endfunction
endif
endif
endfunction
" close vista when it is the last window
" autocmd BufEnter * if winnr('$') == 1 && bufname() == "__vista__" | execute "normal! :q!\<CR>" | endif
" autocmd BufEnter * call VistaHelper()