Add :SDelete!
This commit is contained in:
parent
ec24c42b5c
commit
7994cae378
|
@ -309,7 +309,7 @@ function! startify#session_write(spath)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: #session_delete {{{1
|
" Function: #session_delete {{{1
|
||||||
function! startify#session_delete(...) abort
|
function! startify#session_delete(bang, ...) abort
|
||||||
if !isdirectory(s:session_dir)
|
if !isdirectory(s:session_dir)
|
||||||
echo 'The session directory does not exist: '. s:session_dir
|
echo 'The session directory does not exist: '. s:session_dir
|
||||||
return
|
return
|
||||||
|
@ -326,7 +326,7 @@ function! startify#session_delete(...) abort
|
||||||
call inputrestore()
|
call inputrestore()
|
||||||
|
|
||||||
echo 'Really delete '. spath .'? [y/n]' | redraw
|
echo 'Really delete '. spath .'? [y/n]' | redraw
|
||||||
if (nr2char(getchar()) == 'y')
|
if a:bang || nr2char(getchar()) == 'y'
|
||||||
if delete(spath) == 0
|
if delete(spath) == 0
|
||||||
echo 'Deleted session '. spath .'!'
|
echo 'Deleted session '. spath .'!'
|
||||||
else
|
else
|
||||||
|
@ -338,14 +338,20 @@ function! startify#session_delete(...) abort
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: #session_delete_buffers {{{1
|
" Function: #session_delete_buffers {{{1
|
||||||
function! startify#session_delete_buffers() abort
|
function! startify#session_delete_buffers()
|
||||||
if !s:delete_buffers
|
if !s:delete_buffers
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let n = 1
|
let n = 1
|
||||||
while n <= bufnr('$')
|
while n <= bufnr('$')
|
||||||
if buflisted(n)
|
if buflisted(n)
|
||||||
silent execute 'bdelete' n
|
try
|
||||||
|
silent execute 'bdelete' n
|
||||||
|
catch
|
||||||
|
echohl ErrorMsg
|
||||||
|
echomsg v:exception
|
||||||
|
echohl NONE
|
||||||
|
endtry
|
||||||
endif
|
endif
|
||||||
let n += 1
|
let n += 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
|
@ -76,10 +76,12 @@ Startify basically provides two things:
|
||||||
2) It eases handling of loading and saving sessions by only working with a
|
2) It eases handling of loading and saving sessions by only working with a
|
||||||
certain directory. These commands are used for convenience:
|
certain directory. These commands are used for convenience:
|
||||||
|
|
||||||
:SLoad load a session
|
:SLoad load a session
|
||||||
:SSave save a session
|
:SSave save a session
|
||||||
:SDelete delete a session
|
:SDelete[!] delete a session
|
||||||
:SClose close a session
|
:SClose close a session
|
||||||
|
|
||||||
|
If ! is given, you won't get prompted.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
OPTIONS *startify-options*
|
OPTIONS *startify-options*
|
||||||
|
|
|
@ -55,7 +55,7 @@ endfunction
|
||||||
|
|
||||||
command! -nargs=? -bar -complete=customlist,startify#session_list SSave call startify#session_save(<f-args>)
|
command! -nargs=? -bar -complete=customlist,startify#session_list SSave call startify#session_save(<f-args>)
|
||||||
command! -nargs=? -bar -complete=customlist,startify#session_list SLoad call startify#session_load(<f-args>)
|
command! -nargs=? -bar -complete=customlist,startify#session_list SLoad call startify#session_load(<f-args>)
|
||||||
command! -nargs=? -bar -complete=customlist,startify#session_list SDelete call startify#session_delete(<f-args>)
|
command! -nargs=? -bar -bang -complete=customlist,startify#session_list SDelete call startify#session_delete(<bang>0, <f-args>)
|
||||||
command! -nargs=0 -bar SClose call startify#session_close()
|
command! -nargs=0 -bar SClose call startify#session_close()
|
||||||
command! -nargs=0 -bar Startify enew | call startify#insane_in_the_membrane()
|
command! -nargs=0 -bar Startify enew | call startify#insane_in_the_membrane()
|
||||||
command! -nargs=0 -bar StartifyDebug call startify#debug()
|
command! -nargs=0 -bar StartifyDebug call startify#debug()
|
||||||
|
|
|
@ -12,7 +12,7 @@ Expect:
|
||||||
This is just a simple test file.
|
This is just a simple test file.
|
||||||
Foo, bar, quux.
|
Foo, bar, quux.
|
||||||
|
|
||||||
Execute (Session: :SDelete foo):
|
Execute (Session: :SDelete! foo):
|
||||||
Assert 1 == filereadable(g:startify_session_dir.'/foo')
|
Assert 1 == filereadable(g:startify_session_dir.'/foo')
|
||||||
SDelete foo
|
SDelete! foo
|
||||||
Assert 0 == filereadable(g:startify_session_dir.'/foo')
|
Assert 0 == filereadable(g:startify_session_dir.'/foo')
|
||||||
|
|
Loading…
Reference in a new issue