dscanner --ctags: local variables, functions, ... are now shown in vim/neovim Tagbar

David scherd3113 at gmail.com
Sun Dec 16 09:59:12 UTC 2018


I am wondering how I could display (nested) local variables and 
functions in vim's tagbar (majutsushi/tagbar) using dscanner? So 
far I only see gloable variables, functions, ...

=========== script.d ==========
import std.stdio;

enum globalEnum1  { A = 1, B = 2 }
enum globalEnum2  { C, D }
void globalFun(){ writeln("global"); }
double globalDouble = 2.3;
string globalString = "hi";

void main(){
   enum localEnum  { A = 1, B = 2 }
   void localFun(){ writeln("local"); }
   double localDouble = 2.3;
}
===========

=========== Tagbar shows: ===========
◢ functions
     globalFun()
     main()

◢ globalEnum1 : enum
     [enumerators]
     A
     B

◢ globalEnum2 : enum
     [enumerators]
     C
     D

◢ variables
     globalDouble
     globalString
===========

" tagbar:
let g:tagbar_type_d = {
   \ 'ctagstype' : 'd',
   \ 'kinds'     : [
   \ 'c:classes:1:1',
   \ 'f:functions:1:1',
   \ 'T:template:1:1',
   \ 'g:enums:1:1',
   \ 'e:enumerators:0:0',
   \ 'u:unions:1:1',
   \ 's:structs:1:1',
   \ 'v:variables:1:0',
   \ 'i:interfaces:1:1',
   \ 'm:members',
   \ 'a:alias'
   \ ],
   \'sro': '.',
   \ 'kind2scope' : {
   \ 'c' : 'class',
   \ 'g' : 'enum',
   \ 's' : 'struct',
   \ 'u' : 'union',
   \ 'T' : 'template',
   \},
   \ 'scope2kind' : {
   \ 'enum'      : 'g',
   \ 'class'     : 'c',
   \ 'struct'    : 's',
   \ 'union'     : 'u',
   \ 'template'  : 'T',
   \ },
   \ 'ctagsbin' : 'dscanner',
   \ 'ctagsargs' : ['--ctags']
\ }




More information about the Digitalmars-d-learn mailing list