# Tag generation and navigation # Note: The Generate must be in Execute Execute (Setup): set sw=4 AssertEqual 4, &sw ###################################################################### Execute (Change delimiter {{{1): let g:vimwiki_tag_format = {'pre_mark': '<', 'post_mark': '>', 'sep': '|'} unlet g:vimwiki_syntaxlocal_vars call vimwiki#vars#init() edit $HOME/testmarkdown/Test-Tag.md AssertEqual $HOME . '/testmarkdown/Test-Tag.md', expand('%') AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax') AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr') Do (Create File Content with <>): :edit $HOME/testmarkdown/Test-Tag.md\ I \ \ # A header\ \ \ \ # Another header\ \ Words here. \ :write\ :VimwikiRebuildTags!\ gg Execute (Generate tags): edit $HOME/testmarkdown/Test-Tag.md AssertEqual 'VimwikiTag', SyntaxAt(1, 1) VimwikiGenerateTagLinks set tw=200 Expect (Correctly generated tags section {{{3): # A header # Another header Words here. # Generated Tags ## tag-bar-1 - [Test-Tag](Test-Tag) ## tag-bar-2 - [a-header](Test-Tag#a-header) ## tag-bar-3 - [a-header](Test-Tag#a-header) Do (Write a quick tag for a quick jump): :edit $HOME/testmarkdown/Test-Tag.md\ ggdG I [go1](Test-Tag#tag-bar-1)\ [go2](#tag-bar-1)\ bla\ \ ggl\A __HERE1__\ ggjl\A __HERE2__\ Expect (Good jump {{{3): [go1](Test-Tag#tag-bar-1) [go2](#tag-bar-1) bla __HERE1__ __HERE2__ Execute (Clean Test-Tag and .vimwiki_tags -2): let g:vimwiki_tag_format = {} unlet g:vimwiki_syntaxlocal_vars call vimwiki#vars#init() call system("rm $HOME/testmarkdown/Test.md") call system("rm $HOME/testmarkdown/.vimwiki_tags") call system("rm $HOME/testmarkdown/Test-Tag.md") call DeleteHiddenBuffers() ###################################################################### Execute (Default tag generation {{{1): edit $HOME/testmarkdown/Test-Tag.md AssertEqual $HOME . '/testmarkdown/Test-Tag.md', expand('%') AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax') AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr') set tw=200 Do (Single file Part1): :edit $HOME/testmarkdown/Test-Tag.md\ ggdGO :single-tag:\ :write\ :VimwikiRebuildTags!\ Execute (Generate tags): edit $HOME/testmarkdown/Test-Tag.md AssertEqual 'VimwikiTag', SyntaxAt(1, 1) VimwikiGenerateTagLinks write Expect (Single tags toc): :single-tag: # Generated Tags ## single-tag - [Test-Tag](Test-Tag) Do (Create File Content): :edit $HOME/testmarkdown/Test-Tag.md\ ggdGO :top-tag:\ \ # A header\ \ :test-tag:\ \ # Another header\ \ Words here.\ If tag isn't within 2 lines of header then it has a direct link instead of\ a link to the header.\ \ :second-tag: \ :write\ :VimwikiRebuildTags\ Execute (Edit tags file): edit $HOME/testmarkdown/.vimwiki_tags AssertEqual $HOME . '/testmarkdown/.vimwiki_tags', expand('%') AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax') AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr') # Note: tags file uses tabs Expect (Correctly formatted tags file): !_TAG_FILE_FORMAT 2 !_TAG_FILE_SORTED 1 !_TAG_OUTPUT_MODE vimwiki-tags !_TAG_PROGRAM_AUTHOR Vimwiki !_TAG_PROGRAM_NAME Vimwiki Tags !_TAG_PROGRAM_URL https://github.com/vimwiki/vimwiki !_TAG_PROGRAM_VERSION 2.5 second-tag Test-Tag.md 13;" vimwiki:Test-Tag\tTest-Tag#second-tag test-tag Test-Tag.md 5;" vimwiki:Test-Tag\tTest-Tag#a-header top-tag Test-Tag.md 1;" vimwiki:Test-Tag\tTest-Tag Execute (Generate tags): edit $HOME/testmarkdown/Test-Tag.md VimwikiGenerateTagLinks Expect (Correctly generated tags section): :top-tag: # A header :test-tag: # Another header Words here. If tag isn't within 2 lines of header then it has a direct link instead of a link to the header. :second-tag: # Generated Tags ## second-tag - [second-tag](Test-Tag#second-tag) ## test-tag - [a-header](Test-Tag#a-header) ## top-tag - [Test-Tag](Test-Tag) Execute (Clean Test-Tag and .vimwiki_tags -1 ): call system("rm $HOME/testmarkdown/Test.md") call system("rm $HOME/testmarkdown/.vimwiki_tags") call system("rm $HOME/testmarkdown/Test-Tag.md") call DeleteHiddenBuffers() # vim: sw=2:foldlevel=30:foldmethod=marker: