summaryrefslogtreecommitdiffhomepage
path: root/tools/todo.vim
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2021-11-20 03:10:50 +0000
committerMichael Smith <mikesmiffy128@gmail.com>2021-11-20 03:18:08 +0000
commitda6f343032cb01597dc7866e66f091adf3243a62 (patch)
tree870f8cb8e82bb42202ab92bea03fc6ab35ada7ca /tools/todo.vim
Initial public snapshot
With code from Bill. Thanks Bill!
Diffstat (limited to 'tools/todo.vim')
-rw-r--r--tools/todo.vim41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/todo.vim b/tools/todo.vim
new file mode 100644
index 0000000..04c704d
--- /dev/null
+++ b/tools/todo.vim
@@ -0,0 +1,41 @@
+" This file is dedicated to the public domain.
+
+function! Todo(...)
+ if exists("a:1") && a:1 != ""
+ copen
+ " cex "" | cadde to avoid insta-jumping
+ if &shell == "cmd.exe"
+ cex "" | cadde system("git grep -nF TODO(".shellescape(a:1).")")
+ else
+ cex "" | cadde system("git grep -nF \"TODO(\"".shellescape(a:1)."\\)")
+ endif
+ else
+ " just displaying like this for now...
+ if &shell == "cmd.exe"
+ " FIXME: write a Windows batch equivalent!? in the meantime, you
+ " need a Unix shell to track issues :^)
+ cex "" | cclose | !sh tools/todo
+ else
+ cex "" | cclose | !tools/todo
+ endif
+ endif
+endfunction
+
+function! TodoEdit(...)
+ if exists("a:1") && a:1 != ""
+ exec "tabe TODO/".a:1
+ if line('$') == 1 && getline(1) == ''
+ normal o====
+ 1
+ else
+ 3 " XXX should really search for ====, but this is fine for now
+ endif
+ else
+ echoerr "Specify an issue ID"
+ endif
+endfunction
+
+command! -nargs=? Todo call Todo("<args>")
+command! -nargs=? TodoEdit call TodoEdit("<args>")
+
+" vi: sw=4 ts=4 noet tw=80 cc=80