add input dialog completion
This commit is contained in:
parent
6cfbbbd6a1
commit
90bfd61296
3 changed files with 20 additions and 11 deletions
autoload
|
@ -8,8 +8,19 @@ if exists('g:autoloaded_startify') || &cp
|
|||
endif
|
||||
let g:autoloaded_startify = 1
|
||||
|
||||
function! startify#get_session_names(lead, ...) abort
|
||||
return map(split(globpath(g:startify_session_dir, '*'.a:lead.'*', '\n')), 'fnamemodify(v:val, ":t")')
|
||||
endfunction
|
||||
|
||||
function! startify#get_session_names_as_string(lead, ...) abort
|
||||
return join(map(split(globpath(g:startify_session_dir, '*'.a:lead.'*', '\n')), 'fnamemodify(v:val, ":t")'), "\n")
|
||||
endfunction
|
||||
|
||||
function! startify#save_session(...) abort
|
||||
let spath = g:startify_session_dir .'/'. (exists('a:1') ? a:1 : input('Save under this session name: ')) | redraw
|
||||
let spath = g:startify_session_dir .'/'. (exists('a:1')
|
||||
\ ? a:1
|
||||
\ : input('Save under this session name: ', '', 'custom,startify#get_session_names_as_string'))
|
||||
\ | redraw
|
||||
if !filereadable(spath)
|
||||
execute 'mksession '. spath | echo 'Session saved under: '. spath
|
||||
return
|
||||
|
@ -23,7 +34,10 @@ function! startify#save_session(...) abort
|
|||
endfunction
|
||||
|
||||
function! startify#load_session(...) abort
|
||||
let spath = g:startify_session_dir .'/'. (exists('a:1') ? a:1 : input('Load this session: ')) | redraw
|
||||
let spath = g:startify_session_dir .'/'. (exists('a:1')
|
||||
\ ? a:1
|
||||
\ : input('Load this session: ', '', 'custom,startify#get_session_names_as_string'))
|
||||
\ | redraw
|
||||
if filereadable(spath)
|
||||
execute 'source '. spath
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue