From 23349d1a9847ec4ddb4ca41472f7e2ca8a5e919f Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Mon, 15 Jul 2013 23:19:56 +0200 Subject: [PATCH] New option: g:startify_change_to_dir --- autoload/startify.vim | 6 ++++-- doc/startify.txt | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/autoload/startify.vim b/autoload/startify.vim index eb9a894..06f1d3d 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -11,6 +11,8 @@ let g:autoloaded_startify = 1 let s:session_dir = resolve(expand(get(g:, 'startify_session_dir', \ has('win32') ? '$HOME\vimfiles\session' : '~/.vim/session'))) +let s:cmd = (get(g:, 'startify_change_to_dir', 1) ? ' lcd %:h' : '') . '' + " Function: startify#insane_in_the_membrane {{{1 function! startify#insane_in_the_membrane() abort if !empty(v:servername) && exists('g:startify_skiplist_server') @@ -59,7 +61,7 @@ function! startify#insane_in_the_membrane() abort let entries[expfname] = 1 let index = s:get_index_as_string(cnt) call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fname) - execute 'nnoremap '. index .' :edit '. fnameescape(fname) .' lcd %:h' + execute 'nnoremap '. index .' :edit '. fnameescape(fname) . s:cmd let cnt += 1 if (cnt == numfiles) break @@ -86,7 +88,7 @@ function! startify#insane_in_the_membrane() abort let cnt += 1 let index = s:get_index_as_string(cnt) call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fname) - execute 'nnoremap '. index .' :edit '. fnameescape(fname) .' lcd %:h' + execute 'nnoremap '. index .' :edit '. fnameescape(fname) . s:cmd endfor endif diff --git a/doc/startify.txt b/doc/startify.txt index 545709b..f775fff 100644 --- a/doc/startify.txt +++ b/doc/startify.txt @@ -211,6 +211,13 @@ Example: \ ] +============- + + let g:startify_change_to_dir = 1 + +When opening a file or bookmark, change to its directory. + + ============================================================================== 4. Commands *startify-commands*