parent
ab3513c8ea
commit
3a0cc7df67
|
@ -35,7 +35,7 @@ let s:sep = startify#get_separator()
|
||||||
|
|
||||||
" Function: #get_lastline {{{1
|
" Function: #get_lastline {{{1
|
||||||
function! startify#get_lastline() abort
|
function! startify#get_lastline() abort
|
||||||
return s:lastline + 1
|
return b:startify.lastline + 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: #insane_in_the_membrane {{{1
|
" Function: #insane_in_the_membrane {{{1
|
||||||
|
@ -82,8 +82,7 @@ function! startify#insane_in_the_membrane() abort
|
||||||
endif
|
endif
|
||||||
call append('$', g:startify_header)
|
call append('$', g:startify_header)
|
||||||
|
|
||||||
let s:tick = 0
|
let b:startify = { 'tick': 0, 'entries': {} }
|
||||||
let s:entries = {}
|
|
||||||
|
|
||||||
if s:show_special
|
if s:show_special
|
||||||
call append('$', [' [e] <empty buffer>', ''])
|
call append('$', [' [e] <empty buffer>', ''])
|
||||||
|
@ -106,7 +105,7 @@ function! startify#insane_in_the_membrane() abort
|
||||||
echohl NONE
|
echohl NONE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let b:startify_section_header_lines = []
|
let b:startify.section_header_lines = []
|
||||||
let s:lists = get(g:, 'startify_list_order', [
|
let s:lists = get(g:, 'startify_list_order', [
|
||||||
\ [' MRU'], 'files',
|
\ [' MRU'], 'files',
|
||||||
\ [' MRU '. getcwd()], 'dir',
|
\ [' MRU '. getcwd()], 'dir',
|
||||||
|
@ -135,14 +134,14 @@ function! startify#insane_in_the_membrane() abort
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" compute first line offset
|
" compute first line offset
|
||||||
let s:firstline = 2
|
let b:startify.firstline = 2
|
||||||
let s:firstline += len(g:startify_header)
|
let b:startify.firstline += len(g:startify_header)
|
||||||
" no special, no local Session.vim, but a section header
|
" no special, no local Session.vim, but a section header
|
||||||
if !s:show_special && !exists('l:show_session') && type(s:lists[0]) == type([])
|
if !s:show_special && !exists('l:show_session') && type(s:lists[0]) == type([])
|
||||||
let s:firstline += len(s:lists[0]) + 1
|
let b:startify.firstline += len(s:lists[0]) + 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:lastline = line('$')
|
let b:startify.lastline = line('$')
|
||||||
|
|
||||||
if exists('g:startify_custom_footer')
|
if exists('g:startify_custom_footer')
|
||||||
call append('$', g:startify_custom_footer)
|
call append('$', g:startify_custom_footer)
|
||||||
|
@ -151,7 +150,7 @@ function! startify#insane_in_the_membrane() abort
|
||||||
setlocal nomodifiable nomodified
|
setlocal nomodifiable nomodified
|
||||||
|
|
||||||
call s:set_mappings()
|
call s:set_mappings()
|
||||||
call cursor(s:firstline, 5)
|
call cursor(b:startify.firstline, 5)
|
||||||
autocmd startify CursorMoved <buffer> call s:set_cursor()
|
autocmd startify CursorMoved <buffer> call s:set_cursor()
|
||||||
|
|
||||||
silent! file Startify
|
silent! file Startify
|
||||||
|
@ -394,9 +393,9 @@ endfunction
|
||||||
|
|
||||||
" Function: #debug {{{1
|
" Function: #debug {{{1
|
||||||
function! startify#debug()
|
function! startify#debug()
|
||||||
if exists('s:entries')
|
if exists('b:startify.entries')
|
||||||
for k in sort(keys(s:entries))
|
for k in sort(keys(b:startify.entries))
|
||||||
echomsg '['. k .'] = '. string(s:entries[k])
|
echomsg '['. k .'] = '. string(b:startify.entries[k])
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -404,13 +403,13 @@ endfunction
|
||||||
" Function: #open_buffers {{{1
|
" Function: #open_buffers {{{1
|
||||||
function! startify#open_buffers(...) abort
|
function! startify#open_buffers(...) abort
|
||||||
if exists('a:1') " used in mappings
|
if exists('a:1') " used in mappings
|
||||||
call s:open_buffer(s:entries[a:1])
|
call s:open_buffer(b:startify.entries[a:1])
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let marked = filter(copy(s:entries), 'v:val.marked')
|
let marked = filter(copy(b:startify.entries), 'v:val.marked')
|
||||||
if empty(marked) " open current entry
|
if empty(marked) " open current entry
|
||||||
call s:open_buffer(s:entries[line('.')])
|
call s:open_buffer(b:startify.entries[line('.')])
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -695,7 +694,7 @@ function! s:set_cursor() abort
|
||||||
let movement = 2 * (s:newline > s:oldline) - 1
|
let movement = 2 * (s:newline > s:oldline) - 1
|
||||||
|
|
||||||
" skip section headers lines until an entry is found
|
" skip section headers lines until an entry is found
|
||||||
while index(b:startify_section_header_lines, s:newline) != -1
|
while index(b:startify.section_header_lines, s:newline) != -1
|
||||||
let s:newline += movement
|
let s:newline += movement
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
|
@ -705,7 +704,7 @@ function! s:set_cursor() abort
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" don't go beyond first or last entry
|
" don't go beyond first or last entry
|
||||||
let s:newline = max([s:firstline, min([s:lastline, s:newline])])
|
let s:newline = max([b:startify.firstline, min([b:startify.lastline, s:newline])])
|
||||||
|
|
||||||
call cursor(s:newline, 5)
|
call cursor(s:newline, 5)
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -726,8 +725,8 @@ function! s:set_mappings() abort
|
||||||
nnoremap <buffer><expr> n ' j'[v:searchforward].'n'
|
nnoremap <buffer><expr> n ' j'[v:searchforward].'n'
|
||||||
nnoremap <buffer><expr> N 'j '[v:searchforward].'N'
|
nnoremap <buffer><expr> N 'j '[v:searchforward].'N'
|
||||||
|
|
||||||
for k in keys(s:entries)
|
for k in keys(b:startify.entries)
|
||||||
execute 'nnoremap <buffer><silent>'. s:entries[k].nowait s:entries[k].index
|
execute 'nnoremap <buffer><silent>'. b:startify.entries[k].nowait b:startify.entries[k].index
|
||||||
\ ':call startify#open_buffers('. string(k) .')<cr>'
|
\ ':call startify#open_buffers('. string(k) .')<cr>'
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -745,7 +744,7 @@ endfunction
|
||||||
function! s:set_mark(type, ...) abort
|
function! s:set_mark(type, ...) abort
|
||||||
let index = expand('<cword>')
|
let index = expand('<cword>')
|
||||||
let line = exists('a:1') ? a:1 : line('.')
|
let line = exists('a:1') ? a:1 : line('.')
|
||||||
let entry = s:entries[line]
|
let entry = b:startify.entries[line]
|
||||||
|
|
||||||
if entry.type != 'file'
|
if entry.type != 'file'
|
||||||
return
|
return
|
||||||
|
@ -767,8 +766,8 @@ function! s:set_mark(type, ...) abort
|
||||||
else
|
else
|
||||||
let entry.cmd = default_cmds[a:type]
|
let entry.cmd = default_cmds[a:type]
|
||||||
let entry.marked = 1
|
let entry.marked = 1
|
||||||
let entry.tick = s:tick
|
let entry.tick = b:startify.tick
|
||||||
let s:tick += 1
|
let b:startify.tick += 1
|
||||||
execute 'normal! ci]'. repeat(a:type, len(index))
|
execute 'normal! ci]'. repeat(a:type, len(index))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -837,7 +836,7 @@ function! s:print_section_header() abort
|
||||||
let curline = line('.')
|
let curline = line('.')
|
||||||
|
|
||||||
for lnum in range(curline, curline + len(s:last_message) + 1)
|
for lnum in range(curline, curline + len(s:last_message) + 1)
|
||||||
call add(b:startify_section_header_lines, lnum)
|
call add(b:startify.section_header_lines, lnum)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
call append('$', s:last_message + [''])
|
call append('$', s:last_message + [''])
|
||||||
|
@ -846,7 +845,7 @@ endfunction
|
||||||
|
|
||||||
" Function: s:register {{{1
|
" Function: s:register {{{1
|
||||||
function! s:register(line, index, type, cmd, path, wait)
|
function! s:register(line, index, type, cmd, path, wait)
|
||||||
let s:entries[a:line] = {
|
let b:startify.entries[a:line] = {
|
||||||
\ 'index': a:index,
|
\ 'index': a:index,
|
||||||
\ 'type': a:type,
|
\ 'type': a:type,
|
||||||
\ 'cmd': a:cmd,
|
\ 'cmd': a:cmd,
|
||||||
|
|
|
@ -34,7 +34,7 @@ if exists('g:startify_custom_footer')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists('b:startify_section_header_lines')
|
if exists('b:startify_section_header_lines')
|
||||||
for line in b:startify_section_header_lines
|
for line in b:startify.section_header_lines
|
||||||
execute 'syntax region StartifySection start=/\%'. line .'l/ end=/$/'
|
execute 'syntax region StartifySection start=/\%'. line .'l/ end=/$/'
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue