Reputation: 11986
I edit quite a few markdown files using Vim these days. One thing I'm missing is a map of the file like function list in C based on ctags. So I came up with the following .ctags file
--langdef=markdown
--langmap=markdown:.md
--regex-markdown=/^# ([a-zA-Z0-9]+)/\1/
It runs OK but generates no valid tags for my .md file. With verbose mode turned on I get the following:
Considering option file /home/wenliang/.ctags: reading...
Option: --langdef=markdown
Option: --langmap=markdown:.md
Setting markdown language map: .md
Option: --regex-markdown=/^# ([a-zA-Z0-9]+)/\1/
Considering option file ./.ctags: not found
What's wrong with what I did?
Upvotes: 5
Views: 3899
Reputation: 196781
Your definition looks OK.
What command did you use to generate your tags
file? $ ctags .
won't index anything but $ ctags -R .
will.
FWIW, here is a slightly modified version of your definition that provides meaningful tag names and kind informations:
--langdef=markdown
--langmap=markdown:.md
--regex-markdown=/^#[ \t](.*$)/\1/h,heading,headings/
As an alternative, you might be interested in these cheaper, built-in, solutions…
using the define
option and :dlist
:
:setlocal define=^#\\s*
:dli /<CR>
using :ilist
and no setup:
:il /#<CR>
which both produce the same list, ready for you to type :126<CR>
:
See :help :ilist
, :help :dlist
, :help 'define'
.
Upvotes: 8