]> git.rmz.io Git - dotfiles.git/commitdiff
vim: add fix and todo snippets
authorSamir Benmendil <sb@cad-scan.co.uk>
Mon, 27 Jul 2015 09:08:16 +0000 (10:08 +0100)
committerSamir Benmendil <sb@cad-scan.co.uk>
Mon, 27 Jul 2015 09:08:16 +0000 (10:08 +0100)
vim/ultisnips/all.snippets

index 7b779f62015e1c0f9b3e395153eec147af7d055f..f5a9f46925e40fc2fe49a45d5688a0e84ed57f8d 100644 (file)
@@ -12,7 +12,7 @@ def _parse_comments(s):
                        flags, text = next(i).split(':', 1)
 
                        if len(flags) == 0:
-                               rv.append((text, text, text, ""))
+                               rv.append((text, text, text, text, ""))
                        # parse 3-part comment, but ignore those with O flag
                        elif 's' in flags and 'O' not in flags:
                                ctriple = []
@@ -31,10 +31,14 @@ def _parse_comments(s):
                                ctriple.append(text)
                                ctriple.append(indent)
 
+                               flags,text = next(i).split(':', 1)
+                               assert(len(flags) == 0)
+                               ctriple.append(text)
+
                                rv.append(ctriple)
                        elif 'b' in flags and 'f' not in flags:
                                if len(text) == 1:
-                                       rv.insert(0, (text,text,text, ""))
+                                       rv.insert(0, (text,text,text, text, ""))
        except StopIteration:
                return rv
 
@@ -43,7 +47,8 @@ def _get_comment_format():
        the current file. """
        return _parse_comments(vim.eval("&comments"))[0]
 
-b, m, e, i = _get_comment_format()
+b, m, e, c, i = _get_comment_format()
+
 def _git_user_name():
        try:
                snip.rv = subprocess.check_output(["git", "config", "user.name"]).strip()
@@ -58,6 +63,14 @@ def _git_user_email():
 endglobal
 
 
+snippet fix "FIXME" w
+`!p snip.rv = c`FIXME~~sb ${VISUAL}${0}  (`!v strftime("%Y-%m-%d")`)
+endsnippet
+
+snippet todo "TODO" w
+`!p snip.rv = c`TODO~~sb ${VISUAL}${0}  (`!v strftime("%Y-%m-%d")`)
+endsnippet
+
 snippet GPL2 "GPL2 License" b
 `!p snip.rv = b`
 `!p snip.rv = i + m` ${1:One line to give the program's name and a brief description.}