change shellslash handling
This commit is contained in:
parent
43feec0a89
commit
dad7c9cd08
|
@ -16,6 +16,14 @@ function! startify#get_session_names_as_string(lead, ...) abort
|
||||||
return join(map(split(globpath(g:startify_session_dir, '*'.a:lead.'*', '\n')), 'fnamemodify(v:val, ":t")'), "\n")
|
return join(map(split(globpath(g:startify_session_dir, '*'.a:lead.'*', '\n')), 'fnamemodify(v:val, ":t")'), "\n")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! startify#escape(path) abort
|
||||||
|
return !exists('+shellslash') || &shellslash ? a:path : escape(a:path, '\')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! startify#get_sep() abort
|
||||||
|
return !exists('+shellslash') || &shellslash ? '/' : '\'
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! startify#save_session(...) abort
|
function! startify#save_session(...) abort
|
||||||
if !isdirectory(g:startify_session_dir)
|
if !isdirectory(g:startify_session_dir)
|
||||||
echo 'The session directory does not exist: '. g:startify_session_dir
|
echo 'The session directory does not exist: '. g:startify_session_dir
|
||||||
|
|
|
@ -33,25 +33,22 @@ function! s:start() abort
|
||||||
if get(g:, 'startify_unlisted_buffer', 1)
|
if get(g:, 'startify_unlisted_buffer', 1)
|
||||||
setlocal nobuflisted
|
setlocal nobuflisted
|
||||||
endif
|
endif
|
||||||
if exists('+shellslash')
|
|
||||||
let old_ssl = &shellslash
|
|
||||||
set noshellslash
|
|
||||||
endif
|
|
||||||
|
|
||||||
call append('$', [' startify>', '', ' [e] <empty buffer>'])
|
call append('$', [' startify>', '', ' [e] <empty buffer>'])
|
||||||
let cnt = 0
|
let cnt = 0
|
||||||
|
let sep = startify#get_sep()
|
||||||
|
|
||||||
if get(g:, 'startify_show_files', 1) && !empty(v:oldfiles)
|
if get(g:, 'startify_show_files', 1) && !empty(v:oldfiles)
|
||||||
let numfiles = get(g:, 'startify_show_files_number', 10)
|
let numfiles = get(g:, 'startify_show_files_number', 10)
|
||||||
call append('$', '')
|
call append('$', '')
|
||||||
for fname in v:oldfiles
|
for fname in v:oldfiles
|
||||||
if !filereadable(expand(fname))
|
if !filereadable(expand(fname))
|
||||||
\ || (expand(fname) =~# $VIMRUNTIME .'/doc')
|
\ || (expand(fname) =~# $VIMRUNTIME . sep .'doc')
|
||||||
\ || (fname =~# 'bundle/.*/doc')
|
\ || (fname =~# 'bundle'. sep .'.*'. sep .'doc')
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
call append('$', ' ['. cnt .']'. repeat(' ', 3 - strlen(string(cnt))) . fname)
|
call append('$', ' ['. cnt .']'. repeat(' ', 3 - strlen(string(cnt))) . fname)
|
||||||
execute 'nnoremap <buffer> '. cnt .' :edit '. fnameescape(fname) .'<cr>'
|
execute 'nnoremap <buffer> '. cnt .' :edit '. startify#escape(fname) .'<cr>'
|
||||||
let cnt += 1
|
let cnt += 1
|
||||||
if cnt == numfiles
|
if cnt == numfiles
|
||||||
break
|
break
|
||||||
|
@ -66,7 +63,7 @@ function! s:start() abort
|
||||||
for i in range(len(sfiles))
|
for i in range(len(sfiles))
|
||||||
let idx = i + cnt
|
let idx = i + cnt
|
||||||
call append('$', ' ['. idx .']'. repeat(' ', 3 - strlen(string(idx))) . fnamemodify(sfiles[i], ':t:r'))
|
call append('$', ' ['. idx .']'. repeat(' ', 3 - strlen(string(idx))) . fnamemodify(sfiles[i], ':t:r'))
|
||||||
execute 'nnoremap <buffer> '. idx .' :source '. fnameescape(sfiles[i]) .'<cr>'
|
execute 'nnoremap <buffer> '. idx .' :source '. startify#escape(sfiles[i]) .'<cr>'
|
||||||
endfor
|
endfor
|
||||||
let cnt = idx
|
let cnt = idx
|
||||||
endif
|
endif
|
||||||
|
@ -79,7 +76,7 @@ function! s:start() abort
|
||||||
endif
|
endif
|
||||||
let cnt += 1
|
let cnt += 1
|
||||||
call append('$', ' ['. cnt .']'. repeat(' ', 3 - strlen(string(cnt))) . fname)
|
call append('$', ' ['. cnt .']'. repeat(' ', 3 - strlen(string(cnt))) . fname)
|
||||||
execute 'nnoremap <buffer> '. cnt .' :edit '. fnameescape(fname) .'<cr>'
|
execute 'nnoremap <buffer> '. cnt .' :edit '. startify#escape(fname) .'<cr>'
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -95,9 +92,6 @@ function! s:start() abort
|
||||||
autocmd startify CursorMoved <buffer> call cursor(line('.') < 4 ? 4 : 0, 5)
|
autocmd startify CursorMoved <buffer> call cursor(line('.') < 4 ? 4 : 0, 5)
|
||||||
autocmd startify BufLeave <buffer> autocmd! startify *
|
autocmd startify BufLeave <buffer> autocmd! startify *
|
||||||
|
|
||||||
if exists('old_ssl')
|
|
||||||
let &shellslash = old_ssl
|
|
||||||
endif
|
|
||||||
call cursor(6, 5)
|
call cursor(6, 5)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue