parent
697d008f1b
commit
339cdae1af
|
@ -143,7 +143,7 @@ function! startify#insane_in_the_membrane() abort
|
||||||
nnoremap <buffer><silent> s :call <sid>set_mark('S')<cr>
|
nnoremap <buffer><silent> s :call <sid>set_mark('S')<cr>
|
||||||
nnoremap <buffer><silent> t :call <sid>set_mark('T')<cr>
|
nnoremap <buffer><silent> t :call <sid>set_mark('T')<cr>
|
||||||
nnoremap <buffer><silent> v :call <sid>set_mark('V')<cr>
|
nnoremap <buffer><silent> v :call <sid>set_mark('V')<cr>
|
||||||
nnoremap <buffer><silent> <cr> :call <sid>open_buffers(expand('<cword>'))<cr>
|
nnoremap <buffer><silent> <cr> :call startify#open_buffers()<cr>
|
||||||
nnoremap <buffer><silent> <2-LeftMouse> :execute 'normal' matchstr(getline('.'), '\w\+')<cr>
|
nnoremap <buffer><silent> <2-LeftMouse> :execute 'normal' matchstr(getline('.'), '\w\+')<cr>
|
||||||
nnoremap <buffer><silent> q :call <sid>close()<cr>
|
nnoremap <buffer><silent> q :call <sid>close()<cr>
|
||||||
|
|
||||||
|
@ -323,6 +323,52 @@ function! startify#session_list_as_string(lead, ...) abort
|
||||||
return join(map(split(globpath(s:session_dir, '*'.a:lead.'*'), '\n'), 'fnamemodify(v:val, ":t")'), "\n")
|
return join(map(split(globpath(s:session_dir, '*'.a:lead.'*'), '\n'), 'fnamemodify(v:val, ":t")'), "\n")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Function: #open_buffers {{{1
|
||||||
|
function! startify#open_buffers() abort
|
||||||
|
" markers found; open one or more buffers
|
||||||
|
if exists('s:marked') && !empty(s:marked)
|
||||||
|
enew
|
||||||
|
setlocal nobuflisted
|
||||||
|
|
||||||
|
for val in values(s:marked)
|
||||||
|
let [path, type] = val[1:2]
|
||||||
|
let path = fnameescape(path)
|
||||||
|
|
||||||
|
if line2byte('$') == -1
|
||||||
|
" open in current window
|
||||||
|
execute 'edit' path
|
||||||
|
elseif type == 'S'
|
||||||
|
" open in split
|
||||||
|
execute 'split' path
|
||||||
|
elseif type == 'V'
|
||||||
|
" open in vsplit
|
||||||
|
execute 'vsplit' path
|
||||||
|
elseif type == 'T'
|
||||||
|
" open in tab
|
||||||
|
execute 'tabnew' path
|
||||||
|
else
|
||||||
|
" open in current window
|
||||||
|
execute 'edit' path
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:check_user_options()
|
||||||
|
endfor
|
||||||
|
|
||||||
|
" remove markers for next instance of :Startify
|
||||||
|
if exists('s:marked')
|
||||||
|
unlet s:marked
|
||||||
|
endif
|
||||||
|
" no markers found; open a single buffer
|
||||||
|
else
|
||||||
|
try
|
||||||
|
execute 'normal' expand('<cword>')
|
||||||
|
catch /E832/ " don't ask for undo encryption key twice
|
||||||
|
edit
|
||||||
|
catch /E325/ " swap file found
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Function: s:show_dir {{{1
|
" Function: s:show_dir {{{1
|
||||||
function! s:show_dir(cnt) abort
|
function! s:show_dir(cnt) abort
|
||||||
if empty(v:oldfiles)
|
if empty(v:oldfiles)
|
||||||
|
@ -543,52 +589,6 @@ function! s:set_mark(type) abort
|
||||||
setlocal nomodifiable nomodified
|
setlocal nomodifiable nomodified
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:open_buffers {{{1
|
|
||||||
function! s:open_buffers(cword) abort
|
|
||||||
" markers found; open one or more buffers
|
|
||||||
if exists('s:marked') && !empty(s:marked)
|
|
||||||
enew
|
|
||||||
setlocal nobuflisted
|
|
||||||
|
|
||||||
for val in values(s:marked)
|
|
||||||
let [path, type] = val[1:2]
|
|
||||||
let path = fnameescape(path)
|
|
||||||
|
|
||||||
if line2byte('$') == -1
|
|
||||||
" open in current window
|
|
||||||
execute 'edit' path
|
|
||||||
elseif type == 'S'
|
|
||||||
" open in split
|
|
||||||
execute 'split' path
|
|
||||||
elseif type == 'V'
|
|
||||||
" open in vsplit
|
|
||||||
execute 'vsplit' path
|
|
||||||
elseif type == 'T'
|
|
||||||
" open in tab
|
|
||||||
execute 'tabnew' path
|
|
||||||
else
|
|
||||||
" open in current window
|
|
||||||
execute 'edit' path
|
|
||||||
endif
|
|
||||||
|
|
||||||
call s:check_user_options()
|
|
||||||
endfor
|
|
||||||
|
|
||||||
" remove markers for next instance of :Startify
|
|
||||||
if exists('s:marked')
|
|
||||||
unlet s:marked
|
|
||||||
endif
|
|
||||||
" no markers found; open a single buffer
|
|
||||||
else
|
|
||||||
try
|
|
||||||
execute 'normal' a:cword
|
|
||||||
catch /E832/ " don't ask for undo encryption key twice
|
|
||||||
edit
|
|
||||||
catch /E325/ " swap file found
|
|
||||||
endtry
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Function: s:check_user_options {{{1
|
" Function: s:check_user_options {{{1
|
||||||
function! s:check_user_options() abort
|
function! s:check_user_options() abort
|
||||||
let path = expand('%')
|
let path = expand('%')
|
||||||
|
|
|
@ -469,6 +469,10 @@ in a vertical split window or in a new tab.
|
||||||
Open all marked entries. If nothing was marked beforehand, just open the
|
Open all marked entries. If nothing was marked beforehand, just open the
|
||||||
current entry.
|
current entry.
|
||||||
|
|
||||||
|
If you want to use another key instead of <cr>, put this in your vimrc:
|
||||||
|
>
|
||||||
|
nmap o <plug>(startify-open-buffers)
|
||||||
|
<
|
||||||
==============================================================================
|
==============================================================================
|
||||||
COLORS *startify-colors*
|
COLORS *startify-colors*
|
||||||
|
|
||||||
|
|
|
@ -31,3 +31,5 @@ command! -nargs=? -bar -complete=customlist,startify#session_list SSave call s
|
||||||
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 -complete=customlist,startify#session_list SDelete call startify#session_delete(<f-args>)
|
||||||
command! -nargs=0 -bar Startify call startify#insane_in_the_membrane()
|
command! -nargs=0 -bar Startify call startify#insane_in_the_membrane()
|
||||||
|
|
||||||
|
nnoremap <silent><plug>(startify-open-buffers) :<c-u>call startify#open_buffers()<cr>
|
||||||
|
|
Loading…
Reference in a new issue