Using TagBar and vim with .ini files

One application I work with uses a .ini file with over 30 sections.  I thought it would be handy to ‘outline’ that with tagbar.

In ctags.cnf, add:
–langdef=inifile
–langmap=inifile:.ini
–regex-inifile=/^\[([,&0-9A-Za-z ]+)\]/\1/s,section/
(I am still tuning the regex.  Please leave a comment if you have a better version…)

And in _vimrc:
let g:tagbar_type_dosini = {
\ ‘ctagstype’ : ‘inifile’,
\ ‘kinds’ : [
\ ‘s:section’
\ ]
\ }

In putting this together, I learned that in ‘tagbar_type_zzz‘, the ‘zzz’ is the vim string for a file type.  “:set ft” (in vim) reveals the file type for .ini files is ‘dosini’.

Tagbar lets you toggle between sorting the tags alphabetically and displaying them in the order they appear in the file.

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you human? * Time limit is exhausted. Please reload CAPTCHA.

Protected with IP Blacklist CloudIP Blacklist Cloud