From 490125815b9e5f34b8d69bbad06f9e26cc923be2 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 3 Jun 2016 07:59:30 -0400 Subject: autoload/todo.vim: Descalate function A function that descalates the priority of the TODO on the current line. --- autoload/todo.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 autoload/todo.vim 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 -- cgit v1.2.3