aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-06-03 07:59:30 -0400
committerTeddy Wing2016-06-03 07:59:30 -0400
commit490125815b9e5f34b8d69bbad06f9e26cc923be2 (patch)
tree086bad3f140d471059aa4097c06504cf17e260dc
parent911fa3afff73b50c12dd9908a4b00458fb6ed965 (diff)
downloadvim-twodo-490125815b9e5f34b8d69bbad06f9e26cc923be2.tar.bz2
autoload/todo.vim: Descalate function
A function that descalates the priority of the TODO on the current line.
-rw-r--r--autoload/todo.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/autoload/todo.vim b/autoload/todo.vim
new file mode 100644
index 0000000..926f1e7
--- /dev/null
+++ b/autoload/todo.vim
@@ -0,0 +1,20 @@
+function! todo#Escalate()
+endfunction
+
+
+function! todo#Descalate()
+ let todo = getline('.')
+
+ " First non-whitespace character
+ let col = match(todo, '\S')
+
+ let priority = todo[col]
+
+ if priority ==# '!'
+ let todo = substitute(todo, '!', '-', '')
+ elseif priority ==# '-'
+ let todo = substitute(todo, '-', '_', '')
+ endif
+
+ call setline(line('.'), todo)
+endfunction