From 5370a743f29111e7a4e4a90d4e8bbba29c439a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98ystein=20Walle?= Date: Wed, 4 Dec 2013 12:48:14 +0100 Subject: [PATCH] New option: show relative paths Closes #72. --- autoload/startify.vim | 7 +++++-- doc/startify.txt | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/autoload/startify.vim b/autoload/startify.vim index 4669a2b..19217b5 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -15,6 +15,7 @@ let s:numfiles = get(g:, 'startify_files_number', 10) let s:show_special = get(g:, 'startify_enable_special', 1) let s:restore_position = get(g:, 'startify_restore_position') let s:delete_buffers = get(g:, 'startify_session_delete_buffers') +let s:relative_path = get(g:, 'startify_relative_path') let s:session_dir = resolve(expand(get(g:, 'startify_session_dir', \ has('win32') ? '$HOME\vimfiles\session' : '~/.vim/session'))) @@ -291,8 +292,9 @@ function! s:show_dir(cnt) abort let entries[fullpath] = 1 let index = s:get_index_as_string(cnt) + let display_fname = s:relative_path ? fnamemodify(fname, ':.') : fname - call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fname) + call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . display_fname) execute 'nnoremap ' index ':edit' fnameescape(fname) ' call check_user_options()' let cnt += 1 @@ -336,8 +338,9 @@ function! s:show_files(cnt) abort let entries[fullpath] = 1 let index = s:get_index_as_string(cnt) + let display_fname = s:relative_path ? fnamemodify(fname, ':.') : fname - call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fname) + call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . display_fname) execute 'nnoremap ' index ':edit' fnameescape(fname) ' call check_user_options()' let cnt += 1 diff --git a/doc/startify.txt b/doc/startify.txt index 236dc3b..4ca9c3a 100644 --- a/doc/startify.txt +++ b/doc/startify.txt @@ -105,6 +105,7 @@ default values. |g:startify_session_savevars| |g:startify_session_savecmds| |g:startify_disable_at_vimenter| + |g:startify_relative_path| ------------------------------------------------------------------------------ *g:startify_session_dir* @@ -405,6 +406,14 @@ Same as the custom header, but shown at the bottom of the startify buffer. Don't run Startify at Vim startup. You can still call it anytime via :Startify. +----------------------------------------------------------------------------- + *g:startify_relative_path* +> + let g:startify_relative_path = 0 +< +Show filenames relative to the current working directory instead of as +absolute paths. + ============================================================================== COMMANDS *startify-commands* >