Today I decided to create a simple document with a table of contents with a document in Vim. Text editors like Google Docs provide internal linking structures, but in Vim it's much, much simpler. Simply create a TOC with one item per line like the following:
>>SECTION_1<< >>SECTION_2<< >>SECTION_2_a<< >>SECTION_3<< >>SECTION_4<< >>SECTION_4_a<< >>SECTION_4_b<< >>SECTION_5<<
Once you create your TOC, it's really easy to navigate about your document. Simply move the cursor to the line in your TOC that you'd like to find in the main document, then hit the asterisk "*" key. Vim will find the closest word following the cursor's current location on the line and then search for the next value in the document that matches that word. You'll also notice I've used underscores in my section headings. The reason for this is that Vim will treat underscores as part of a word, rather than as a delimiting character like a space or hyphen. Does it get any simpler than this?
Cheers,
~Mike
No comments:
Post a Comment