2011-08-12 7 views
3

J'essaie de créer des tags pour un wiki-fichier = vimwiki. Ceci est ma définition pour ctags, stockée sous forme ctags.cnfctags, vimwiki, vim et tagbar-plugin

--langdef=vimwiki 
--langmap=vimwiki:.wiki 
--regex-vimwiki=/^=[ \t]+(.*)/\1/h,heading1/ 
--regex-vimwiki=/^==[ \t]+(.*)/2-\1/h,heading2/ 
--regex-vimwiki=/^===[ \t]+(.*)/3-\1/h,heading3/ 
--regex-vimwiki=/^====[ \t]+(.*)/4-\1/h,heading4/ 

Appel ctags --verbose index.wiki résultats dans:

... 
Considering option file .\ctags.cnf: reading... 
    Option: --langdef=vimwiki 
    Option: --langmap=vimwiki:.wiki 
    Setting vimwiki language map: .wiki 
    Option: --regex-vimwiki=/^=[ \t]+(.*)/\1/h,heading1/ 
    Option: --regex-vimwiki=/^==[ \t]+(.*)/2-\1/h,heading2/ 
    Option: --regex-vimwiki=/^===[ \t]+(.*)/3-\1/h,heading3/ 
    Option: --regex-vimwiki=/^====[ \t]+(.*)/4-\1/h,heading4/ 
Reading initial options from command line 
Reading command line arguments 
OPENING index.wiki as vimwiki language file 
sorting tag file 

Le fichier généré tags montre ceci:

!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ 
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ 
!_TAG_PROGRAM_AUTHOR Darren Hiebert /[email protected]/ 
!_TAG_PROGRAM_NAME Exuberant Ctags // 
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ 
!_TAG_PROGRAM_VERSION 5.8 // 
2-!KnowledgeBase == index.wiki /^== !KnowledgeBase ==$/;" h 
2-Dokumentation == index.wiki /^== Dokumentation ==$/;" h 
2-Entwicklung == index.wiki /^== Entwicklung ==$/;" h 
2-Essential Tools == index.wiki /^== Essential Tools ==$/;" h 
2-TODO == index.wiki /^== TODO ==$/;" h 
2-Vim-Mode in shell/bash /zsh == index.wiki /^== Vim-Mode in shell \/ bash \/zsh ==$/;" h 
[email protected] === index.wiki /^=== @home ===$/;" h 
3-Clojure === index.wiki /^=== Clojure ===$/;" h 
3-HTML5 & CSS3 === index.wiki /^=== HTML5 & CSS3 ===$/;" h 
3-LaTeX === index.wiki /^=== LaTeX ===$/;" h 
3-Online-Tools === index.wiki /^=== Online-Tools ===$/;" h 
3-Open Source === index.wiki /^=== Open Source ===$/;" h 
3-Vim === index.wiki /^=== Vim ===$/;" h 
3-Wetware === index.wiki /^=== Wetware ===$/;" h 
4-git ==== index.wiki /^==== git ====$/;" h 
4-nosql ==== index.wiki /^==== nosql ====$/;" h 
Self Org = index.wiki /^= Self Org =$/;" h 

Dans mon _vimrc i ajouté

let g:tagbar_type_wiki = { 
\ 'ctagstype' : 'vimwiki', 
\ 'kinds'  : [ 
\ 'h:headings' 
\ ], 
\ 'sort' : 0, 
\ 'deffile' : expand('<sfile>:p:h:h') . 'c:\\d\\ctags.cnf' 
\ } 

L'ouverture d'index.wiki et :TagbarToggle ouvre uniquement une barre de tag vide.

Où est mon erreur?

+0

Quelle est votre paramètre 'filetype' réglé sur les fichiers Wiki? La configuration de Tagbar suppose qu'elle est définie sur 'wiki', mais est-ce vraiment ce que rapporte' set filetype? De plus, vous n'avez pas besoin du paramètre 'deffile' si votre ctags.cnf est à l'emplacement standard, seulement pour les fichiers supplémentaires. –

+0

filetype est la solution. Tyvm! – vbd

+0

Ceci est une question assez ancienne, mais arrive toujours tôt dans les recherches. FWIW une version "officielle" de l'intégration de vimwiki et tagbar est publiée [ici] (https://github.com/vimwiki/utils/blob/master/vwtags.py) par le dev vimwiki. – Sparhawk

Répondre

4
  • grâce à l'indice de Jan Larres avec :echo &ft J'ai trouvé la solution.
  • déplacer le ctags.cnf vers le chemin du profil utilisateur est également utile.

Ma mise à jour _vimrc

let g:tagbar_type_vimwiki = { 
\ 'ctagstype' : 'vimwiki', 
\ 'kinds'  : [ 
\ 'h:header', 
\ ], 
\ 'sort' : 0 
\ } 

et ma mise à jour ctags.cnf

--langdef=vimwiki 
--langmap=vimwiki:.wiki 
--regex-vimwiki=/^=[ \t]+(.+)[ \t]+=$/\1/h,header/ 
--regex-vimwiki=/^==[ \t]+(.+)[ \t]+==$/. \1/h,header/ 
--regex-vimwiki=/^===[ \t]+(.+)[ \t]+===$/. \1/h,header/ 
--regex-vimwiki=/^====[ \t]+(.+)[ \t]+====$/.  \1/h,header/ 
--regex-vimwiki=/^=====[ \t]+(.+)[ \t]+=====$/.  \1/h,header/ 
--regex-vimwiki=/^======[ \t]+(.+)[ \t]+======$/.   \1/h,header/ 
Questions connexes