mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:00:04 +08:00
Add todo syntax (#2361)
* Add todo syntax * Remove error hi * Add debug info * Add todo manager
This commit is contained in:
parent
99faefc2cf
commit
4d8176fbe2
@ -28,23 +28,25 @@ function! s:open_win() abort
|
||||
nnoremap <buffer><silent> <Enter> :call <SID>open_todo()<cr>
|
||||
endfunction
|
||||
|
||||
" @todo Improve todo manager
|
||||
function! s:update_todo_content() abort
|
||||
let s:todos = []
|
||||
let argv = ['rg', '--hidden', '--no-heading', '--color=never', '--with-filename', '--line-number', '--column',
|
||||
\ '-g', '!.git','@t'. 'odo ']
|
||||
let argv = ['findstr', '/RSN', '/I', '@t'. 'odo ', '*.*']
|
||||
call s:JOB.start(argv, {
|
||||
\ 'on_stdout' : function('s:stdout'),
|
||||
\ 'on_stderr' : function('s:stderr'),
|
||||
\ 'on_exit' : function('s:exit'),
|
||||
\ })
|
||||
endfunction
|
||||
|
||||
function! s:stdout(id, data, event) abort
|
||||
call SpaceVim#logger#info('todomanager stdout: ' . string(a:data))
|
||||
for data in a:data
|
||||
if !empty(data)
|
||||
let file = fnameescape(split(data, ':\d\+:')[0])
|
||||
let line = matchstr(data, ':\d\+:')[1:-2]
|
||||
let column = matchstr(data, '\(:\d\+\)\@<=:\d\+:')[1:-2]
|
||||
let title = split(data, '@todo')[1]
|
||||
let title = split(data, '@to' . 'do')[1]
|
||||
call add(s:todos,
|
||||
\ {
|
||||
\ 'file' : file,
|
||||
@ -57,9 +59,16 @@ function! s:stdout(id, data, event) abort
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:stderr(id, data, event) abort
|
||||
call SpaceVim#logger#info('todomanager stderr: ' . string(a:data))
|
||||
endfunction
|
||||
|
||||
function! s:exit(id, data, event ) abort
|
||||
call SpaceVim#logger#info('todomanager exit: ' . string(a:data))
|
||||
let g:lines = map(deepcopy(s:todos), "v:val.file . ' ' . v:val.title")
|
||||
call setbufvar(s:bufnr, '&modifiable', 1)
|
||||
call setline(1, g:lines)
|
||||
call setbufvar(s:bufnr, '&modifiable', 0)
|
||||
endfunction
|
||||
|
||||
|
||||
|
@ -5,4 +5,11 @@ let b:current_syntax = 'SpaceVimTodoManager'
|
||||
syntax case ignore
|
||||
|
||||
syn match FileName /^[^ ]*/
|
||||
syn match TODOTAG /^\s*@[a-zA-Z]*/
|
||||
" syn match TODOCHECKBOX /[\d\+/\d\+\]/
|
||||
syn match TODOINDEX /^\s\+\d\+\.\s/
|
||||
syn match TODOCHECKBOXPANDING /\s\+√\s\+/
|
||||
syn match TODOCHECKBOXDONE /\s\+□\s\+/
|
||||
syn match TODOCHECKBOXNOTE /\s\+·\s\+/
|
||||
syn match TODODUETIME /\d\+[d]$\|\d\+[d]\s\*$/
|
||||
hi def link FileName Comment
|
||||
|
@ -248,6 +248,10 @@ else
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! s:self.set_buf_line() abort
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#api#vim#compatible#get() abort
|
||||
return deepcopy(s:self)
|
||||
endfunction
|
||||
|
Loading…
Reference in New Issue
Block a user