How to collect tags in a vimwiki?
How to collect tags in a vimwiki?
In Vimwiki, a tag is words where each is separated by minus symbol (-) and delimited inside two colons (:). For example:
:my-important-tag:
:good:
:to-do:
Above are three tags. A tag can reside in a wikipage, anywhere as a standalone tag. But if it is located at most two lines below the main title of the wikipage, it becomes the tag of the whole file or document. The case also applies if it resides at most two lines below any level of subheadings.
A tag can function as an anchor where we can link from the same page, or from a different page in the wiki page.
Assume you already created some tags in your vimwiki pages, and you want to list your tags.
For now, I want to teach you how to collect tags in your vimwiki. Assumes you have composes a vimwiki containing many pages. You already gave some tags to some pages. You want to list all tags that you assigned. How to do this?
Just use this command:
:VimwikiSearchTags \(\h\|[-]\)\{2,8}
The code \(\h\|[-]\)\{2,8} is a regular expression that you can find elsewhere on the Internet. It means that
find me at least two and at most 8 words containing small or capital letter or underscore or minus symbol.
If your tag contains more than 8 characters, then you need to replace 8 with a higher number such as 15 or 20.
So your command becomes:
:VimwikiSearchTags \(\h\|[-]\)\{2,20}
In order to become fluent in using this command, you need to learn for example this vim regular expression tutorial. In this blog, I only give a simple example command. When you master regular expression, you can customize your command to suit your need.
After running the above command, you then can list the results with this command:
:lopen
then your vim will split, and the bottom window will become the list of your tags. Navigate back and forth between these two windows, and you will be able to easily find which page contains which tag.
Thank you.
In Vimwiki, a tag is words where each is separated by minus symbol (-) and delimited inside two colons (:). For example:
:my-important-tag:
:good:
:to-do:
Above are three tags. A tag can reside in a wikipage, anywhere as a standalone tag. But if it is located at most two lines below the main title of the wikipage, it becomes the tag of the whole file or document. The case also applies if it resides at most two lines below any level of subheadings.
A tag can function as an anchor where we can link from the same page, or from a different page in the wiki page.
Assume you already created some tags in your vimwiki pages, and you want to list your tags.
For now, I want to teach you how to collect tags in your vimwiki. Assumes you have composes a vimwiki containing many pages. You already gave some tags to some pages. You want to list all tags that you assigned. How to do this?
Just use this command:
:VimwikiSearchTags \(\h\|[-]\)\{2,8}
The code \(\h\|[-]\)\{2,8} is a regular expression that you can find elsewhere on the Internet. It means that
find me at least two and at most 8 words containing small or capital letter or underscore or minus symbol.
If your tag contains more than 8 characters, then you need to replace 8 with a higher number such as 15 or 20.
So your command becomes:
:VimwikiSearchTags \(\h\|[-]\)\{2,20}
In order to become fluent in using this command, you need to learn for example this vim regular expression tutorial. In this blog, I only give a simple example command. When you master regular expression, you can customize your command to suit your need.
After running the above command, you then can list the results with this command:
:lopen
then your vim will split, and the bottom window will become the list of your tags. Navigate back and forth between these two windows, and you will be able to easily find which page contains which tag.
Thank you.
Comments
Post a Comment