1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:50:06 +08:00

Improve todo plugins (#3276)

This commit is contained in:
Wang Shidong 2020-01-01 23:00:30 +08:00 committed by GitHub
parent 4a2edb3047
commit ef36d19f9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,15 +34,26 @@ function! s:open_win() abort
exe 'bd ' . s:bufnr
endif
botright split __todo_manager__
" @todo add win_getid api
let s:winid = win_getid(winnr('#'))
let lines = &lines * 30 / 100
exe 'resize ' . lines
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber winfixheight nomodifiable
set filetype=SpaceVimTodoManager
let s:bufnr = bufnr('%')
call s:update_todo_content()
augroup spacevim_plugin_todo
autocmd! * <buffer>
autocmd WinEnter <buffer> call s:WinEnter()
augroup END
nnoremap <buffer><silent> <Enter> :call <SID>open_todo()<cr>
endfunction
function! s:WinEnter() abort
" @todo add win_getid api
let s:winid = win_getid(winnr('#'))
endfunction
" @todo Improve todo manager
function! s:update_todo_content() abort
let s:todos = []
@ -128,6 +139,8 @@ function! s:open_todo() abort
close
catch
endtry
" @todo add win_gotoid api
call win_gotoid(s:winid)
exe 'e ' . todo.file
call cursor(todo.line, todo.column)
noautocmd normal! :