Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hack to enable neovim support #136

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 37 additions & 19 deletions autoload/taskwarrior/action.vim
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,30 @@ function! taskwarrior#action#delete()
let uuid = taskwarrior#data#get_uuid()
if uuid == ''
call taskwarrior#action#annotate('del')
call taskwarrior#refresh()
else
let ccol = taskwarrior#data#current_column()
if index(['project', 'tags', 'due', 'priority', 'start', 'depends'], ccol) != -1
call taskwarrior#system_call(uuid, 'modify', ccol.':', 'silent')
call taskwarrior#refresh()
else
execute '!task '.uuid.' delete'
if has('nvim')
execute 'new | terminal task '.uuid.' delete'
else
execute '!task '.uuid.' delete'
call taskwarrior#refresh()
endif
endif
endif
call taskwarrior#refresh()
endfunction

function! taskwarrior#action#remove()
execute '!task '.taskwarrior#data#get_uuid().' delete'
call taskwarrior#list()
if has('nvim')
execute 'new | terminal task '.taskwarrior#data#get_uuid().' delete'
else
execute '!task '.taskwarrior#data#get_uuid().' delete'
call taskwarrior#list()
endif
endfunction

function! taskwarrior#action#annotate(op)
Expand Down Expand Up @@ -297,21 +307,25 @@ function! taskwarrior#action#move_cursor(direction, mode)
endfunction

function! taskwarrior#action#undo()
if has("gui_running")
if exists('g:task_gui_term') && g:task_gui_term == 1
!task rc.color=off undo
elseif executable('xterm')
silent !xterm -e 'task undo'
elseif executable('urxvt')
silent !urxvt -e task undo
elseif executable('gnome-terminal')
silent !gnome-terminal -e 'task undo'
endif
if has('nvim')
execute 'new | terminal task undo'
else
sil !clear
!task undo
if has("gui_running")
if exists('g:task_gui_term') && g:task_gui_term == 1
!task rc.color=off undo
elseif executable('xterm')
silent !xterm -e 'task undo'
elseif executable('urxvt')
silent !urxvt -e task undo
elseif executable('gnome-terminal')
silent !gnome-terminal -e 'task undo'
endif
else
sil !clear
!task undo
endif
call taskwarrior#refresh()
endif
call taskwarrior#refresh()
endfunction

function! taskwarrior#action#clear_completed()
Expand All @@ -320,8 +334,12 @@ function! taskwarrior#action#clear_completed()
endfunction

function! taskwarrior#action#sync(action)
execute '!task '.a:action.' '
call taskwarrior#refresh()
if has('nvim')
execute 'new | terminal task '.a:action.' '
else
execute '!task '.a:action.' '
call taskwarrior#refresh()
endif
endfunction

function! taskwarrior#action#select()
Expand Down
7 changes: 7 additions & 0 deletions ftplugin/taskreport.vim
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,10 @@ endif
command! -buffer TWToggleReadonly :let g:task_readonly = (g:task_readonly ? 0 : 1) | call taskwarrior#refresh()
command! -buffer TWToggleHLField :let g:task_highlight_field = (g:task_highlight_field ? 0 : 1) | call taskwarrior#refresh()
command! -buffer -nargs=? -complete=customlist,taskwarrior#complete#sort TWReportSort :call taskwarrior#action#sort_by_arg(<q-args>)

if has('nvim')
augroup taskwarrior#neovim
autocmd!
autocmd BufEnter task*report call taskwarrior#refresh()
augroup end
endif