October 2012
346 pages
7h 40m
English
| Tip 99 | Collect TODO Items in a Register |
Combining the :global and :yank commands allows us to collect all lines that match a {pattern} in a register.
This excerpt of code contains a couple of comments that lead with “TODO”:
| global/markdown.js | |
| | Markdown.dialects.Gruber = { |
| | lists: function() { |
| | // TODO: Cache this regexp for certain depths. |
| | function regex_for_depth(depth) { /* implementation */ } |
| | }, |
| | "`": function inlineCode( text ) { |
| | var m = text.match( /(`+)(([\s\S]*?)\1)/ ); |
| | if ( m && m[2] ) |
| | return [ m[1].length + m[2].length ]; |
| | else { |
| | // TODO: No matching end code found - warn! |
| | return [ 1, "`" ]; |
| | } |
| | } |
| | } |
Suppose that we wanted to collect all of the TODO items in one place. We could view them ...
Read now
Unlock full access