The Etherparty ICO briefly fell prey a cyber attack, causing some contributors to misdirect their funds to the attacker’s address. Blockchain startup Etherparty launched the initial coin offering…
Essentially, ctags
will scan all files you ask it to and look for what it understands to be symbol definitions. These are classes, functions, variable names, and so on. ctags
has a large list of known languages, but the JavaScript support hasn’t yet been the greatest.
To start, make sure you have exuberant-ctags
installed, as opposed to regular ctags. You can brew install ctags
on a macOS machine, for example, which will install the latest version of exuberant-ctags
.
Generating ctags
I use ctags
to jump to the definition of a symbol in a given project. There are generally two ways I achieve this: from a cursor over the top of a symbol and using normal-mode commands to search the list of defined tags.
Jumping to a definition under the cursor
While reading code and the cursor is on top of a known symbol, pressing Ctrl+]
will jump to that definition.
Searching the available tags
If you know the tag you want but are nowhere near it, you can :tag <tagname>
to jump to it’s definition. The :tag
command supports tab completion; I often use :tag
searches to jump to class or constant definitions.
Navigating through multiple matches
Either of these ways of jumping to definition may result in multiple tag matches. You can navigate the tag stack with :tnext
(briefly, as :tn
) or :tprevious
(:tp
). If you’d like to see a list of definitions found for any given tag, you can :tselect
(:tsel
).
Including other packages in your generated tags file
After a bit of pruning and studying, this is the JavaScript-specific portion of my ~/.ctags
file looks like this:
Finally, and following Mr. Grasso’s example, let’s get rid of some over-greedy matching and wrap it up into a nice alias:
alias jtags=”ctags -R app config lib && sed -i ‘’ -E ‘/^(if|switch|function|module\.exports|it|describe).+language:js$/d’ tags”
Happy vimming!
The story of concrete is so ancient that we don’t even know when and where it begins. It is a story of discovery, experimentation, and mystery. Emperors and kings became legends for erecting great…
As the social media hype dies down, and issues facing our communities are no longer at the forefront of our news channels our drive and determination for change mustn’t dwindle. In our last blog…
Every story you write starts in your head first. This one I am writing now, been in-writing for the last 12 years. I lost my baby brother 12 years ago, today. November the 14th. We put him down in…