remove pad and padlen
This commit is contained in:
parent
edc6d625d4
commit
2fb9fa91c1
|
@ -10,7 +10,6 @@ let g:loaded_startify = 1
|
||||||
|
|
||||||
" Init {{{1
|
" Init {{{1
|
||||||
let g:startify_session_dir = resolve(expand(get(g:, 'startify_session_dir', '~/.vim/session')))
|
let g:startify_session_dir = resolve(expand(get(g:, 'startify_session_dir', '~/.vim/session')))
|
||||||
let s:padlen = 3
|
|
||||||
|
|
||||||
command! -nargs=0 -bar Lsave call startify#save_session()
|
command! -nargs=0 -bar Lsave call startify#save_session()
|
||||||
command! -nargs=0 -bar Lload call startify#load_session()
|
command! -nargs=0 -bar Lload call startify#load_session()
|
||||||
|
@ -20,7 +19,7 @@ augroup startify
|
||||||
autocmd VimEnter *
|
autocmd VimEnter *
|
||||||
\ if !argc() && (line2byte('$') == -1) |
|
\ if !argc() && (line2byte('$') == -1) |
|
||||||
\ call s:start() |
|
\ call s:start() |
|
||||||
\ call cursor(6, s:padlen+2) |
|
\ call cursor(6, 5) |
|
||||||
\endif
|
\endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
@ -31,10 +30,9 @@ function! s:start() abort
|
||||||
setlocal nonumber norelativenumber nobuflisted buftype=nofile
|
setlocal nonumber norelativenumber nobuflisted buftype=nofile
|
||||||
|
|
||||||
let numfiles = get(g:, 'startify_show_files_number', 10)
|
let numfiles = get(g:, 'startify_show_files_number', 10)
|
||||||
let pad = repeat(' ', s:padlen)
|
let cnt = 0
|
||||||
let cnt = 0
|
|
||||||
|
|
||||||
call append('$', [pad . 'startify>', '', pad . '[e] <empty buffer>'])
|
call append('$', [' startify>', '', ' [e] <empty buffer>'])
|
||||||
|
|
||||||
if get(g:, 'startify_show_files', 1) && !empty(v:oldfiles)
|
if get(g:, 'startify_show_files', 1) && !empty(v:oldfiles)
|
||||||
call append('$', '')
|
call append('$', '')
|
||||||
|
@ -42,7 +40,7 @@ function! s:start() abort
|
||||||
if !filereadable(expand(fname)) || (fname =~# $VIMRUNTIME .'/doc') || (fname =~# 'bundle/.*/doc')
|
if !filereadable(expand(fname)) || (fname =~# $VIMRUNTIME .'/doc') || (fname =~# 'bundle/.*/doc')
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
call append('$', pad .'['. cnt .']'. repeat(' ', s:padlen - strlen(string(cnt))) . fname)
|
call append('$', ' ['. cnt .']'. repeat(' ', 3 - strlen(string(cnt))) . fname)
|
||||||
execute 'nnoremap <buffer> '. cnt .' :edit '. fname .'<cr>'
|
execute 'nnoremap <buffer> '. cnt .' :edit '. fname .'<cr>'
|
||||||
let cnt += 1
|
let cnt += 1
|
||||||
if cnt == numfiles
|
if cnt == numfiles
|
||||||
|
@ -57,12 +55,12 @@ function! s:start() abort
|
||||||
call append('$', '')
|
call append('$', '')
|
||||||
for i in range(len(sfiles))
|
for i in range(len(sfiles))
|
||||||
let idx = i + cnt
|
let idx = i + cnt
|
||||||
call append('$', pad .'['. idx .']'. repeat(' ', s:padlen - 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 '. sfiles[i] .'<cr>'
|
execute 'nnoremap <buffer> '. idx .' :source '. sfiles[i] .'<cr>'
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call append('$', ['', pad .'[q] quit'])
|
call append('$', ['', ' [q] quit'])
|
||||||
|
|
||||||
setlocal nomodifiable
|
setlocal nomodifiable
|
||||||
|
|
||||||
|
@ -71,7 +69,7 @@ function! s:start() abort
|
||||||
nnoremap <buffer><silent> <cr> :execute 'normal '. <c-r><c-w><cr>
|
nnoremap <buffer><silent> <cr> :execute 'normal '. <c-r><c-w><cr>
|
||||||
|
|
||||||
autocmd! startify *
|
autocmd! startify *
|
||||||
autocmd startify CursorMoved <buffer> call cursor(line('.') < 4 ? 4 : 0, s:padlen+2)
|
autocmd startify CursorMoved <buffer> call cursor(line('.') < 4 ? 4 : 0, 5)
|
||||||
autocmd startify BufLeave <buffer> autocmd! startify *
|
autocmd startify BufLeave <buffer> autocmd! startify *
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue