Nvim: use stdpath() for all OS

This commit is contained in:
Marco Hinz 2019-01-30 11:42:40 +01:00
parent b98f7a5a93
commit 69e835d1f7
No known key found for this signature in database
GPG key ID: 1C980A1B657B4A4F
2 changed files with 23 additions and 5 deletions

View file

@ -1016,6 +1016,23 @@ function! s:warn(msg) abort
echohl NONE
endfunction
" Function: s:get_session_path {{{1
function! s:get_session_path() abort
if exists('g:startify_session_dir')
let path = g:startify_session_dir
elseif has('nvim')
let path = stdpath('data') . s:sep . 'session'
else
if has('win32')
let path = '$HOME\vimfiles\session'
else
let path = '~/.vim/session'
endif
endif
return resolve(expand(path))
endfunction
" Init: values {{{1
let s:sep = startify#get_separator()
@ -1023,9 +1040,7 @@ let s:numfiles = get(g:, 'startify_files_number', 10)
let s:show_special = get(g:, 'startify_enable_special', 1)
let s:relative_path = get(g:, 'startify_relative_path') ? ':~:.' : ':p:~'
let s:tf = exists('g:startify_transformations')
let s:session_dir = resolve(expand(get(g:, 'startify_session_dir',
\ has('win32') ? '$HOME\vimfiles\session' :
\ has('nvim') ? stdpath('data') . '/session' : '~/.vim/session')))
let s:session_dir = s:get_session_path()
let s:skiplist = get(g:, 'startify_skiplist', [
\ 'COMMIT_EDITMSG',

View file

@ -134,8 +134,11 @@ default values.
<
The directory to save/load sessions to/from.
The default for Windows systems is '$HOME\vimfiles\session'. The
default for Neovim is '$XDG_DATA_HOME/nvim/session'.
Defaults:~
Nvim: `$XDG_DATA_HOME/nvim/session` (`:echo stdpath('data')`)
Vim (Unix): `$HOME/.vim/session`
Vim (Windows): `$HOME/vimfiles/session`
------------------------------------------------------------------------------
*g:startify_list_order*