Merge branch 'restore-cursor-position'

This commit is contained in:
Marco Hinz 2013-08-04 18:55:37 +02:00
commit 22edae78d1
2 changed files with 26 additions and 5 deletions

View file

@ -9,10 +9,11 @@ endif
let g:autoloaded_startify = 1
" Init: values {{{1
let s:cmd = (get(g:, 'startify_change_to_dir', 1) ? ' <bar> lcd %:h' : '') . '<cr>'
let s:numfiles = get(g:, 'startify_files_number', 10)
let s:show_special = get(g:, 'startify_enable_special', 1)
let s:session_dir = resolve(expand(get(g:, 'startify_session_dir',
let s:cmd = (get(g:, 'startify_change_to_dir', 1) ? ' <bar> lcd %:h' : '') . '<cr>'
let s:numfiles = get(g:, 'startify_files_number', 10)
let s:show_special = get(g:, 'startify_enable_special', 1)
let s:restore_position = get(g:, 'startify_restore_position')
let s:session_dir = resolve(expand(get(g:, 'startify_session_dir',
\ has('win32') ? '$HOME\vimfiles\session' : '~/.vim/session')))
" Function: #insane_in_the_membrane {{{1
@ -70,6 +71,9 @@ function! startify#insane_in_the_membrane() abort
endif
autocmd startify CursorMoved <buffer> call s:set_cursor()
if s:restore_position
autocmd startify BufReadPost * call s:restore_position()
endif
1
call cursor((s:show_special ? 4 : 2) + s:offset_header, 5)
@ -411,4 +415,12 @@ function! s:get_index_as_string(idx) abort
endif
endfunction
" Function: s:restore_position {{{1
function! s:restore_position() abort
autocmd! startify *
if line("'\"") > 0 && line("'\"") <= line('$')
call cursor(getpos("'\"")[1:])
endif
endfunction
" vim: et sw=2 sts=2