use more idiomatic code style
This commit is contained in:
parent
7fc07a6cb6
commit
803b0adbbf
|
@ -24,9 +24,9 @@ function! startify#get_sep() abort
|
||||||
return !exists('+shellslash') || &shellslash ? '/' : '\'
|
return !exists('+shellslash') || &shellslash ? '/' : '\'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! startify#process_skiplist(arg) abort
|
function! startify#is_in_skiplist(arg) abort
|
||||||
for regexp in g:startify_skiplist
|
for regexp in g:startify_skiplist
|
||||||
if a:arg =~# regexp
|
if (a:arg =~# regexp)
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -36,7 +36,7 @@ function! startify#save_session(...) abort
|
||||||
if !isdirectory(g:startify_session_dir)
|
if !isdirectory(g:startify_session_dir)
|
||||||
if exists('*mkdir')
|
if exists('*mkdir')
|
||||||
echo 'The session directory does not exist: '. g:startify_session_dir .'. Create it? [y/n]' | redraw
|
echo 'The session directory does not exist: '. g:startify_session_dir .'. Create it? [y/n]' | redraw
|
||||||
if nr2char(getchar()) == 'y'
|
if (nr2char(getchar()) == 'y')
|
||||||
call mkdir(g:startify_session_dir, 'p')
|
call mkdir(g:startify_session_dir, 'p')
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -28,13 +28,13 @@ command! -nargs=0 -bar Startify enew | call s:insane_in_the_membrane()
|
||||||
function! s:insane_in_the_membrane() abort
|
function! s:insane_in_the_membrane() abort
|
||||||
if !empty(v:servername) && exists('g:startify_skiplist_server')
|
if !empty(v:servername) && exists('g:startify_skiplist_server')
|
||||||
for servname in g:startify_skiplist_server
|
for servname in g:startify_skiplist_server
|
||||||
if servname == v:servername
|
if (servname == v:servername)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
setlocal nonumber noswapfile bufhidden=wipe
|
setlocal nonumber noswapfile bufhidden=wipe
|
||||||
if v:version >= 703
|
if (v:version >= 703)
|
||||||
setlocal norelativenumber
|
setlocal norelativenumber
|
||||||
endif
|
endif
|
||||||
if get(g:, 'startify_unlisted_buffer', 1)
|
if get(g:, 'startify_unlisted_buffer', 1)
|
||||||
|
@ -57,13 +57,13 @@ function! s:insane_in_the_membrane() abort
|
||||||
endif
|
endif
|
||||||
for fname in v:oldfiles
|
for fname in v:oldfiles
|
||||||
let expfname = expand(fname)
|
let expfname = expand(fname)
|
||||||
if !filereadable(expfname) || (exists('g:startify_skiplist') && startify#process_skiplist(expfname))
|
if !filereadable(expfname) || (exists('g:startify_skiplist') && startify#is_in_skiplist(expfname))
|
||||||
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 '. startify#escape(fname) .' <bar> lcd %:h<cr>'
|
execute 'nnoremap <buffer> '. cnt .' :edit '. startify#escape(fname) .' <bar> lcd %:h<cr>'
|
||||||
let cnt += 1
|
let cnt += 1
|
||||||
if cnt == numfiles
|
if (cnt == numfiles)
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -103,7 +103,7 @@ function! s:insane_in_the_membrane() abort
|
||||||
nnoremap <buffer> <cr> :normal <c-r><c-w><cr>
|
nnoremap <buffer> <cr> :normal <c-r><c-w><cr>
|
||||||
nnoremap <buffer> <2-LeftMouse> :execute 'normal '. matchstr(getline('.'), '\w\+')<cr>
|
nnoremap <buffer> <2-LeftMouse> :execute 'normal '. matchstr(getline('.'), '\w\+')<cr>
|
||||||
nnoremap <buffer> q
|
nnoremap <buffer> q
|
||||||
\ :if len(filter(range(0, bufnr('$')), 'buflisted(v:val)')) > 1 <bar>
|
\ :if (len(filter(range(0, bufnr('$')), 'buflisted(v:val)')) > 1) <bar>
|
||||||
\ bd <bar>
|
\ bd <bar>
|
||||||
\ else <bar>
|
\ else <bar>
|
||||||
\ quit <bar>
|
\ quit <bar>
|
||||||
|
@ -125,7 +125,7 @@ function! s:set_cursor() abort
|
||||||
let s:line_old = exists('s:line_new') ? s:line_new : 5
|
let s:line_old = exists('s:line_new') ? s:line_new : 5
|
||||||
let s:line_new = line('.')
|
let s:line_new = line('.')
|
||||||
if empty(getline(s:line_new))
|
if empty(getline(s:line_new))
|
||||||
if s:line_new > s:line_old
|
if (s:line_new > s:line_old)
|
||||||
let s:line_new += 1
|
let s:line_new += 1
|
||||||
call cursor(s:line_new, 5) " going down
|
call cursor(s:line_new, 5) " going down
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue