Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Task tags in Vim

Tags:

vim

Two questions regarding task tags:

What other task tags like TODO, is available in Vim? Is there any way to make custom task tags like in Eclipse IDE?

like image 204
freonix Avatar asked Jul 05 '11 02:07

freonix


People also ask

How do I use tags in Vim?

Jumping to a tag You can use the 'tag' ex command. For example, the command ':tag <tagname>' will jump to the tag named <tagname>. You can position the cursor over a tag name and then press Ctrl-]. You can visually select a text and then press Ctrl-] to jump to the tag matching the selected text.

How do I load a tag in Vim?

Just add the following line to your ~/. vimrc : set tags=./tags;,tags; It means "look for a tags file in the directory of the current file, then upward until / and in the working directory, then upward until / ".


3 Answers

For custom tags I use the following in my .vimrc, you should be able to adjust it to your needs.

if has("autocmd")
  " Highlight TODO, FIXME, NOTE, etc.
  if v:version > 701
    autocmd Syntax * call matchadd('Todo',  '\W\zs\(TODO\|FIXME\|CHANGED\|XXX\|BUG\|HACK\)')
    autocmd Syntax * call matchadd('Debug', '\W\zs\(NOTE\|INFO\|IDEA\)')
  endif
endif

This enables highlighting of these keywords in all files. \W\zs ensures that there is a word break in front of the match, mainly to prevent DEBUG and others from being highlighted partially.

like image 140
nobody Avatar answered Oct 13 '22 21:10

nobody


Like all syntax highlighting, TODO, FIXME, XXX, et cetera depend on which type of file you are editing. These keywords are defined in the syntax files for your chosen language.

The examples I quoted are from c.vim

Vim is open source: feel free to browse the repository!

like image 22
Johnsyweb Avatar answered Oct 13 '22 20:10

Johnsyweb


In addition to what others have mentioned, there's also TBD.

like image 1
blueCicada Avatar answered Oct 13 '22 21:10

blueCicada