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:
Marco Hinz 2015-06-03 10:09:30 +02:00
parent be611cd545
commit 2c7807566c

View file

@ -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,20 +368,24 @@ 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 endfor
elseif entry.type == 'session' endfunction
execute entry.cmd entry.path
elseif entry.type == 'file'
if line2byte('$') == -1
execute 'edit' entry.path
else
execute entry.cmd entry.path
endif
" 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() call s:check_user_options()
endif endif
endfor
endfunction endfunction
" Function: s:display_by_path {{{1 " Function: s:display_by_path {{{1
@ -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