1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:40:03 +08:00

fix(history): fix history pos

This commit is contained in:
Eric Wong 2024-05-03 21:17:51 +08:00
parent c28fda48b1
commit bee24ee792

View File

@ -13,14 +13,22 @@ let s:history_cache_path = s:FILE.unify_path(g:spacevim_data_dir, ':p') . 'Space
let s:filepos = {}
function! SpaceVim#plugins#history#readcache() abort
call s:LOG.debug('read cache')
call s:read_cache()
endfunction
function! SpaceVim#plugins#history#writecache() abort
call s:LOG.debug('write cache')
call s:write_cache()
endfunction
function! SpaceVim#plugins#history#jumppos() abort
" nvim filename
" BufReadPost event before VimEnter
if empty(s:filepos)
call s:read_cache()
endif
let [l, c] = get(s:filepos, expand('%:p'), [0, 0])
call s:LOG.debug(printf('jump to pos: [%s, %s]', l, c))
if l != 0 && c != 0
call cursor(l, c)
endif