Only check user options for regular files
We don't "switch to dir"/"switch to VCS dir"/"autoload sessions" when opening special entries ([e] and [q]) or sessions. References #165.
This commit is contained in:
parent
be611cd545
commit
2c7807566c
1 changed files with 20 additions and 20 deletions
|
@ -353,17 +353,13 @@ endfunction
|
||||||
" Function: #open_buffers {{{1
|
" Function: #open_buffers {{{1
|
||||||
function! startify#open_buffers(...) abort
|
function! startify#open_buffers(...) abort
|
||||||
if exists('a:1') " used in mappings
|
if exists('a:1') " used in mappings
|
||||||
let entry = s:entries[a:1]
|
call s:open_buffer(s:entries[a:1])
|
||||||
execute entry.cmd entry.path
|
|
||||||
call s:check_user_options()
|
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let marked = filter(copy(s:entries), 'v:val.marked')
|
let marked = filter(copy(s:entries), 'v:val.marked')
|
||||||
if empty(marked) " open current entry
|
if empty(marked) " open current entry
|
||||||
let entry = s:entries[line('.')]
|
call s:open_buffer(s:entries[line('.')])
|
||||||
execute entry.cmd entry.path
|
|
||||||
call s:check_user_options()
|
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -372,22 +368,26 @@ function! startify#open_buffers(...) abort
|
||||||
|
|
||||||
" Open all marked entries.
|
" Open all marked entries.
|
||||||
for entry in sort(values(marked), 's:sort_by_tick')
|
for entry in sort(values(marked), 's:sort_by_tick')
|
||||||
if entry.type == 'special'
|
call s:open_buffer(entry)
|
||||||
execute entry.cmd
|
|
||||||
elseif entry.type == 'session'
|
|
||||||
execute entry.cmd entry.path
|
|
||||||
elseif entry.type == 'file'
|
|
||||||
if line2byte('$') == -1
|
|
||||||
execute 'edit' entry.path
|
|
||||||
else
|
|
||||||
execute entry.cmd entry.path
|
|
||||||
endif
|
|
||||||
|
|
||||||
call s:check_user_options()
|
|
||||||
endif
|
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:open_buffer {{{1
|
||||||
|
function! s:open_buffer(entry)
|
||||||
|
if a:entry.type == 'special'
|
||||||
|
execute a:entry.cmd
|
||||||
|
elseif a:entry.type == 'session'
|
||||||
|
execute a:entry.cmd a:entry.path
|
||||||
|
elseif a:entry.type == 'file'
|
||||||
|
if line2byte('$') == -1
|
||||||
|
execute 'edit' a:entry.path
|
||||||
|
else
|
||||||
|
execute a:entry.cmd a:entry.path
|
||||||
|
endif
|
||||||
|
call s:check_user_options()
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Function: s:display_by_path {{{1
|
" Function: s:display_by_path {{{1
|
||||||
function! s:display_by_path(path_prefix, path_format) abort
|
function! s:display_by_path(path_prefix, path_format) abort
|
||||||
let oldfiles = call(get(g:, 'startify_enable_unsafe') ? 's:filter_oldfiles_unsafe' : 's:filter_oldfiles',
|
let oldfiles = call(get(g:, 'startify_enable_unsafe') ? 's:filter_oldfiles_unsafe' : 's:filter_oldfiles',
|
||||||
|
@ -656,7 +656,7 @@ function! s:check_user_options() abort
|
||||||
if isdirectory(path)
|
if isdirectory(path)
|
||||||
lcd %
|
lcd %
|
||||||
else
|
else
|
||||||
lcd %:h
|
lcd %:p:h
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue