Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I make vim's taglist plugin show useful information for javascript?
    primarykey
    data
    text
    <p>I've recently abandoned mouse-driven, platform-specific GUI editors and committed entirely to vim. The experience so far has been fantastic, but I'm stuck when it comes to Javascript.</p> <p>The ever-popular taglist utility (using Exuberant Ctags) has been great for everything but Javascript. With the language's overly-free form and structure, taglist could only pick up a handful of functions when I opened it up -- only those defined in the format:</p> <pre><code>function FUNCNAME (arg1, arg2) { </code></pre> <p>but no variables or function objects defined like: </p> <pre><code>var myFunc = function (arg1, arg2) { </code></pre> <p>So I googled a bit and found the following definition set for ctags, which I put in my ~/.ctags file:</p> <pre><code>--langdef=js --langmap=js:.js --regex-js=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\{/\1/,object/ --regex-js=/([A-Za-z0-9._$()]+)[ \t]*[:=][ \t]*function[ \t]*\(/\1/,function/ --regex-js=/function[ \t]+([A-Za-z0-9._$]+)[ \t]*([^])])/\1/,function/ --regex-js=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\[/\1/,array/ --regex-js=/([^= ]+)[ \t]*=[ \t]*[^""]'[^'']*/\1/,string/ --regex-js=/([^= ]+)[ \t]*=[ \t]*[^'']"[^""]*/\1/,string/ </code></pre> <p>After that, running ctags from the command line was fantastic. It found every function and object that I needed it to find.</p> <p>The problem is that the taglist.vim plugin isn't seeing those new results. When I open my javascript file in vim and hit :TlistToggle, I get the exact same meager handful of functions I got before. I hit 'u' to update the list, with no effect.</p> <p>Digging into taglist.vim, I found this:</p> <pre><code>" java language let s:tlist_def_java_settings = 'java;p:package;c:class;i:interface;' . \ 'f:field;m:method' " javascript language let s:tlist_def_javascript_settings = 'javascript;f:function' </code></pre> <p>...which implies we're only looking at one specific kind of output from the ctags utility for javascript. Unfortunately, I'm not savvy enough with taglist or vim in general (yet) to discover what change I can make to get all those wonderful ctags command-line results to show up in vim.</p> <p>Help appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload