This is to hadd markdown support for Vim Tagbar plugin. It generates ctags file for markdown document.
Tagbar is a vim plugin that helps navigating within file using ctags. Currently, Tagbar support markdown file through ctags language definition. And it doesn't support nesting headers.
~/.ctags
--langdef=markdown
--langmap=markdown:.mkd
--regex-markdown=/^#[ \t]+(.*)/\1/h,Heading_L1/
--regex-markdown=/^##[ \t]+(.*)/\1/i,Heading_L2/
--regex-markdown=/^###[ \t]+(.*)/\1/k,Heading_L3/
~/.vimrc
let g:tagbar_type_markdown = {
\ 'ctagstype' : 'markdown',
\ 'kinds' : [
\ 'h:Heading_L1',
\ 'i:Heading_L2',
\ 'k:Heading_L3'
\ ]
\ }
See Support for additional types
Since Tagbar can be conigured to use different program to generate tag files, I made this script to generate tag file Tabgar is happy with.
Install the gems.
$ gem install marktag
Add following in your ~/.vimrc
if executable('marktag')
let g:tagbar_type_markdown = {
\ 'ctagstype' : 'markdown',
\ 'ctagsbin' : 'marktag',
\ 'kinds' : [
\ 'h:header'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 'h' : 'header'
\ },
\ 'scope2kind' : {
\ 'header' : 'h'
\ }
\ }
end
TODO: Write usage instructions here
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
