aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2020-03-21 23:24:03 +0100
committerTeddy Wing2020-03-21 23:24:03 +0100
commit8d48a5c1beb6ec65cee1841967251a31a04fb12c (patch)
tree0db63e1d2c10db2dc6150a4aa617d48ba4051cb7
parent9a2d08847734353e703ac43eb82827582b3d2af9 (diff)
parentff379c41dab8749b3bf6b600cdf1d1513ca4d786 (diff)
downloadvim-twodo-8d48a5c1beb6ec65cee1841967251a31a04fb12c.tar.bz2
Merge branch 'don,t-save-substitutions-in-search-history'
-rw-r--r--TODO3
-rw-r--r--autoload/todo.vim36
-rw-r--r--ftplugin/todo.vim8
3 files changed, 42 insertions, 5 deletions
diff --git a/TODO b/TODO
index 805b61b..7f92bf3 100644
--- a/TODO
+++ b/TODO
@@ -16,6 +16,7 @@ Escalation and "descalation" should be an operator-pending mapping
2020.03.21:
- Add changelog
-- Don't save edits in search history
+v Don't save edits in search history
- Add repeat support
- Add license headers
+- Add no_plugin_maps support
diff --git a/autoload/todo.vim b/autoload/todo.vim
index 758d0d5..8cfa986 100644
--- a/autoload/todo.vim
+++ b/autoload/todo.vim
@@ -1,3 +1,39 @@
+function! todo#MarkComplete()
+ let view = winsaveview()
+
+ keeppatterns s/\v^(\s*)[-_!xS] /\1v /
+
+ call winrestview(view)
+endfunction
+
+
+function! todo#MarkDeleted()
+ let view = winsaveview()
+
+ keeppatterns s/\v^(\s*)[-_!vS] /\1x /
+
+ call winrestview(view)
+endfunction
+
+
+function! todo#MarkPartiallyCompleted()
+ let view = winsaveview()
+
+ keeppatterns s/\v^(\s*)[-_!xv] /\1S /
+
+ call winrestview(view)
+endfunction
+
+
+function! todo#RemoveOldTodos()
+ let view = winsaveview()
+
+ keeppatterns g/^\s*[vx] /d
+
+ call winrestview(view)
+endfunction
+
+
function! todo#Escalate()
let todo = getline('.')
diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim
index e7664d8..ff9be27 100644
--- a/ftplugin/todo.vim
+++ b/ftplugin/todo.vim
@@ -8,10 +8,10 @@ let b:did_ftplugin = 1
nnoremap <silent> <buffer> <Plug>TwodoNewTodoBelow o-
nnoremap <silent> <buffer> <Plug>TwodoNewTodoAbove O-
-nnoremap <silent> <buffer> <Plug>TwodoMarkComplete m`:<c-u>s/\v^(\s*)[-_!xS] /\1v / \| nohlsearch<cr>``
-nnoremap <silent> <buffer> <Plug>TwodoMarkDeleted m`:<c-u>s/\v^(\s*)[-_!vS] /\1x / \| nohlsearch<cr>``
-nnoremap <silent> <buffer> <Plug>TwodoMarkPartiallyCompleted m`:<c-u>s/\v^(\s*)[-_!xv] /\1S / \| nohlsearch<cr>``
-nnoremap <silent> <buffer> <Plug>TwodoRemoveOldTodos :<c-u>g/^\s*[vx] /d \| nohlsearch<cr>
+nnoremap <silent> <buffer> <Plug>TwodoMarkComplete :<c-u>call todo#MarkComplete()<cr>
+nnoremap <silent> <buffer> <Plug>TwodoMarkDeleted :<c-u>call todo#MarkDeleted()<cr>
+nnoremap <silent> <buffer> <Plug>TwodoMarkPartiallyCompleted :<c-u>call todo#MarkPartiallyCompleted()<cr>
+nnoremap <silent> <buffer> <Plug>TwodoRemoveOldTodos :<c-u>call todo#RemoveOldTodos()<cr>
nnoremap <silent> <buffer> <Plug>TwodoEscalate :<c-u>call todo#Escalate()<cr>
nnoremap <silent> <buffer> <Plug>TwodoDescalate :<c-u>call todo#Descalate()<cr>