parent
b3127cb0d4
commit
9e4a159637
|
@ -483,6 +483,19 @@ function! s:filter_oldfiles(path_prefix, path_format) abort
|
||||||
let oldfiles += [[fnameescape(absolute_path), entry_path]]
|
let oldfiles += [[fnameescape(absolute_path), entry_path]]
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
if get(g:, 'startify_use_env')
|
||||||
|
call s:init_env()
|
||||||
|
for i in range(len(oldfiles))
|
||||||
|
for [k,v] in s:env_by_len
|
||||||
|
let p = oldfiles[i][1]
|
||||||
|
if !stridx(p, v)
|
||||||
|
let oldfiles[i][1] = printf('$%s%s', k, p[len(v):])
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
|
||||||
return oldfiles
|
return oldfiles
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
|
@ -779,3 +792,27 @@ function! s:create_last_session_link(spath)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:init_env {{{1
|
||||||
|
function! s:init_env()
|
||||||
|
let env = []
|
||||||
|
let ignore = { 'PWD': 1, 'OLDPWD': 1 }
|
||||||
|
|
||||||
|
function! s:get_env()
|
||||||
|
silent execute "normal! :return $\<c-a>')\<c-b>\<c-right>\<right>\<del>split('\<cr>"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:compare(foo, bar)
|
||||||
|
return len(a:bar[1]) - len(a:foo[1])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
for k in s:get_env()
|
||||||
|
let v = eval('$'.k)
|
||||||
|
if v[0] != '/' || has_key(ignore, k) || len(k) > len(v)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
call insert(env, [k,v], 0)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
let s:env_by_len = sort(env, 's:compare')
|
||||||
|
endfunction
|
||||||
|
|
|
@ -107,6 +107,7 @@ default values.
|
||||||
|g:startify_files_number|
|
|g:startify_files_number|
|
||||||
|g:startify_mapping_nowait|
|
|g:startify_mapping_nowait|
|
||||||
|g:startify_skiplist_server|
|
|g:startify_skiplist_server|
|
||||||
|
|g:startify_use_env|
|
||||||
|
|
||||||
Sessions:~
|
Sessions:~
|
||||||
|g:startify_session_autoload|
|
|g:startify_session_autoload|
|
||||||
|
@ -471,6 +472,15 @@ Show filenames relative to the current working directory instead of as
|
||||||
absolute paths. This only applies to the "files" list, since the "dir" list is
|
absolute paths. This only applies to the "files" list, since the "dir" list is
|
||||||
relative by nature.
|
relative by nature.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*g:startify_use_env*
|
||||||
|
>
|
||||||
|
let g:startify_use_env = 0
|
||||||
|
<
|
||||||
|
Show environment variables in path, if their name is shorter than their value.
|
||||||
|
|
||||||
|
$PWD and $OLDPWD are ignored.
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*g:startify_mapping_nowait*
|
*g:startify_mapping_nowait*
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in a new issue