WIP
This commit is contained in:
parent
464532e034
commit
dca9a3d990
1 changed files with 17 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ endfunction
|
||||||
|
|
||||||
let s:window = -1
|
let s:window = -1
|
||||||
let s:goto_table = {}
|
let s:goto_table = {}
|
||||||
|
let s:current_buffer = -1
|
||||||
let s:buffermap = {}
|
let s:buffermap = {}
|
||||||
let s:groups = {}
|
let s:groups = {}
|
||||||
let s:group_order = ["Types", "Routines", "Constants", "Globals", "Imports"]
|
let s:group_order = ["Types", "Routines", "Constants", "Globals", "Imports"]
|
||||||
|
|
@ -76,7 +77,7 @@ function! s:FindClosest()
|
||||||
let bline = line(".")
|
let bline = line(".")
|
||||||
let closest = 1
|
let closest = 1
|
||||||
for l in sort(map(keys(s:buffermap), 'str2nr(v:val)'), "n")
|
for l in sort(map(keys(s:buffermap), 'str2nr(v:val)'), "n")
|
||||||
if l < bline
|
if l <= bline
|
||||||
let closest = l
|
let closest = l
|
||||||
else
|
else
|
||||||
return closest
|
return closest
|
||||||
|
|
@ -120,6 +121,8 @@ function! features#outline#JumpToSymbol(stay)
|
||||||
normal! zt
|
normal! zt
|
||||||
wincmd p
|
wincmd p
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call features#outline#run(0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:UpdateOutline(groups)
|
function! s:UpdateOutline(groups)
|
||||||
|
|
@ -163,7 +166,7 @@ function! s:RenderOutline()
|
||||||
if g:nvim_nim_outline_track_symbol
|
if g:nvim_nim_outline_track_symbol
|
||||||
let s:buffermap[symbol.line] = len(rlines) + 1
|
let s:buffermap[symbol.line] = len(rlines) + 1
|
||||||
endif
|
endif
|
||||||
call add(rlines, s:CreateSymbolRow(symbol, closest == symbol.line))
|
call add(rlines, s:CreateSymbolRow(symbol, !wasFocused && closest == symbol.line))
|
||||||
endfor
|
endfor
|
||||||
call add(rlines, "")
|
call add(rlines, "")
|
||||||
endfor
|
endfor
|
||||||
|
|
@ -216,6 +219,7 @@ endfunction
|
||||||
|
|
||||||
let s:OutlineImpl = {}
|
let s:OutlineImpl = {}
|
||||||
function! s:OutlineImpl.run(data)
|
function! s:OutlineImpl.run(data)
|
||||||
|
let s:OutlineImpl.cache = a:data
|
||||||
let s:groups = {
|
let s:groups = {
|
||||||
\ "Types": [],
|
\ "Types": [],
|
||||||
\ "Routines": [],
|
\ "Routines": [],
|
||||||
|
|
@ -236,9 +240,20 @@ function! s:OutlineImpl.run(data)
|
||||||
call s:UpdateOutline(s:groups)
|
call s:UpdateOutline(s:groups)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:BufferModified()
|
||||||
|
return buffer_number(".") != s:current_buffer || getbufvar(buffer_number("."), "&mod")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! features#outline#run(isUpdating)
|
function! features#outline#run(isUpdating)
|
||||||
if !a:isUpdating || s:IsOpen()
|
if !a:isUpdating || s:IsOpen()
|
||||||
|
" if s:BufferModified()
|
||||||
|
let s:current_buffer = winnr()
|
||||||
call suggest#New("outline", 0, 1, s:OutlineImpl)
|
call suggest#New("outline", 0, 1, s:OutlineImpl)
|
||||||
|
" else
|
||||||
|
" call s:OutlineImpl.run(s:OutlineImpl.cache)
|
||||||
|
" endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue