-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nvim] add the universal TODO comment system
- Loading branch information
Showing
28 changed files
with
156 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('awkTodo') | ||
syn clear awkTodo | ||
execute 'syn match awkTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('cTodo') | ||
syn clear cTodo | ||
execute 'syn match cTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('csTodo') | ||
syn clear csTodo | ||
execute 'syn match csTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
if !hlexists('cssTodo') && hlexists('cssComment') | ||
execute 'syn match cssTodo contained containedin=cssComment' dotfiles#todo_comments#get_pattern() | ||
hi def link cssTodo Todo | ||
elseif hlexists('cssTodo') | ||
syn clear cssTodo | ||
execute 'syn match cssTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('goTodo') | ||
syn clear goTodo | ||
execute 'syn match goTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('haskellTodo') | ||
syn clear haskellTodo | ||
execute 'syn match haskellTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
if !hlexists('htmlTodo') && hlexists('htmlComment') | ||
execute 'syn match htmlTodo contained containedin=htmlComment' dotfiles#todo_comments#get_pattern() | ||
hi def link htmlTodo Todo | ||
elseif hlexists('htmlTodo') | ||
syn clear htmlTodo | ||
execute 'syn match htmlTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('javaTodo') | ||
syn clear javaTodo | ||
execute 'syn match javaTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
syntax sync minlines=500 | ||
|
||
if hlexists('javaScriptCommentTodo') | ||
syn clear javaScriptCommentTodo | ||
execute 'syn match javaScriptCommentTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif | ||
|
||
if hlexists('jsCommentTodo') | ||
syn clear jsCommentTodo | ||
execute 'syn match jsCommentTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
syntax match Comment +\/\/.\+$+ | ||
|
||
if hlexists('jsonCommentTodo') | ||
syn clear jsonCommentTodo | ||
execute 'syn match jsonCommentTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('jsonCommentTodo') | ||
syn clear jsonCommentTodo | ||
execute 'syn match jsonCommentTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('ktTodo') | ||
syn clear ktTodo | ||
execute 'syn match ktTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
if hlexists('luaTodo') | ||
syn clear luaTodo | ||
execute 'syn match luaTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif | ||
if hlexists('luaCommentTodo') | ||
syn clear luaCommentTodo | ||
execute 'syn match luaCommentTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('rubyTodo') | ||
syn clear rubyTodo | ||
execute 'syn match rubyTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
syn keyword rustOperatorKeyword as | ||
hi def link rustOperatorKeyword Keyword | ||
|
||
if hlexists('rustTodo') | ||
syn clear rustTodo | ||
execute 'syn match rustTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('sassTodo') | ||
syn clear sassTodo | ||
execute 'syn match sassTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
" The VIMRUNTIME syntax file sources the syntax files for SASS (from | ||
" runtimepath, so it will load my todo-comment patch with it) and makes a few | ||
" minor modifications to the rules to accomodate for SCSS, vim-polyglot defines | ||
" an entirely separate file for SCSS with its own hlgroups, so this branch will | ||
" only execute for vim-polyglot's syntax file. | ||
if hlexists('scssTodo') | ||
syn clear scssTodo | ||
execute 'syn match scssTodo contained containedin=@comment' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('shTodo') | ||
syn clear shTodo | ||
execute 'syn match shTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('sqlTodo') | ||
syn clear sqlTodo | ||
execute 'syn match sqlTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('tomlTodo') | ||
syn clear tomlTodo | ||
execute 'syn match tomlTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
source <sfile>:h/javascript.vim | ||
|
||
if hlexists('typescriptCommentTodo') | ||
syn clear typescriptCommentTodo | ||
execute 'syn match typescriptCommentTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('vimTodo') | ||
syn clear vimTodo | ||
execute 'syn match vimTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('xmlTodo') | ||
syn clear xmlTodo | ||
execute 'syn match xmlTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('yamlTodo') | ||
syn clear yamlTodo | ||
execute 'syn match yamlTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if hlexists('zshTodo') | ||
syn clear zshTodo | ||
execute 'syn match zshTodo contained' dotfiles#todo_comments#get_pattern() | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
" Helper file for the universal TODO comments system. It is used by files in | ||
" `after/syntax/` to extend the built-in hlgroups to have somewhat unified | ||
" lists of keywords. | ||
|
||
" This rejected PEP has a semi-formal list of these markers: <https://www.python.org/dev/peps/pep-0350/#mnemonics>. | ||
" "SAFETY" originates from Rust. | ||
let g:dotfiles#todo_comments#keywords = ['TODO', 'NOTE', 'HACK', 'FIXME', 'XXX', 'BUG', 'SAFETY'] | ||
|
||
" The pattern idea was taken from <https://github.com/dmitmel/neovim/blob/e65b724451ba5f65dfcaf8f8c16afdd508db7359/runtime/syntax/sh.vim#L396-L400> | ||
" and <https://github.com/wbthomason/dotfiles/blob/9134e87b00102cda07f875805f900775244067fe/neovim/.config/nvim/init.lua#L88>. | ||
function! dotfiles#todo_comments#get_pattern() abort | ||
let pat = '\V\C\<\%(' . join(map(g:dotfiles#todo_comments#keywords, { _, s -> escape(s, '\') }), '\|') . '\)\ze:\=\>' | ||
let wrap_char = '/' | ||
return wrap_char . escape(pat, wrap_char) . wrap_char | ||
endfunction |