add input dialog completion
This commit is contained in:
parent
6cfbbbd6a1
commit
90bfd61296
|
@ -8,8 +8,19 @@ if exists('g:autoloaded_startify') || &cp
|
||||||
endif
|
endif
|
||||||
let g:autoloaded_startify = 1
|
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
|
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)
|
if !filereadable(spath)
|
||||||
execute 'mksession '. spath | echo 'Session saved under: '. spath
|
execute 'mksession '. spath | echo 'Session saved under: '. spath
|
||||||
return
|
return
|
||||||
|
@ -23,7 +34,10 @@ function! startify#save_session(...) abort
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! startify#load_session(...) abort
|
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)
|
if filereadable(spath)
|
||||||
execute 'source '. spath
|
execute 'source '. spath
|
||||||
else
|
else
|
||||||
|
|
|
@ -109,8 +109,8 @@ There are only two commands for handling sessions:
|
||||||
These take either 0 or 1 argument. If you don't specify the session name as an
|
These take either 0 or 1 argument. If you don't specify the session name as an
|
||||||
argument, they will just ask for it.
|
argument, they will just ask for it.
|
||||||
|
|
||||||
You can use <c-u> and <tab> for argument completion. Providing only a part of
|
Providing only a part of the session name works too, if you complete the
|
||||||
the session name works, too.
|
argument with either <c-u> or <tab> afterwards.
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
|
@ -20,13 +20,8 @@ augroup startify
|
||||||
\endif
|
\endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
command! -nargs=? -bar -complete=customlist,s:get_session_names SSave call startify#save_session(<f-args>)
|
command! -nargs=? -bar -complete=customlist,startify#get_session_names SSave call startify#save_session(<f-args>)
|
||||||
command! -nargs=? -bar -complete=customlist,s:get_session_names SLoad call startify#load_session(<f-args>)
|
command! -nargs=? -bar -complete=customlist,startify#get_session_names SLoad call startify#load_session(<f-args>)
|
||||||
|
|
||||||
" Function: s:get_session_names {{{1
|
|
||||||
function! s:get_session_names(lead, ...) abort
|
|
||||||
return map(split(globpath(g:startify_session_dir, '*'.a:lead.'*', '\n')), 'fnamemodify(v:val, ":t")')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Function: s:start {{{1
|
" Function: s:start {{{1
|
||||||
function! s:start() abort
|
function! s:start() abort
|
||||||
|
|
Loading…
Reference in a new issue