During the preparation of my slides I realised there are a few things about Tern for Vim that aren't entirely obvious, mainly to do with configuration options. For one thing, the Vim plugin has excellent keyboard shortcuts that aren't enabled by default. To enable them, add this to your
As far as I know the keyboard shortcuts are not documented, so here's a reference: tern_keyboard.pdf.
|<Leader> td||:TernDoc||Documentation under cursor|
|<Leader> tb||:TernDocBrowse||Browse documentation|
|<Leader> tt||:TernType||Type hints|
|<Leader> td||:TernDef||Jump to definition (yes, 'td' is duplicated)|
|<Leader> tpd||:TernDefPreview||Jump to definition inside preview|
|<Leader> tsd||:TernDefSplit||Definition in new split|
|<Leader> ttd||:TernDefTab||Definition in new tab|
|<Leader> tr||:TernRefs||All references under cursor|
|<Leader> tR||:TernRename||Rename variable|
Another useful configuration option is
let g:tern_show_argument_hints='on_hold', which will display argument type hints when the cursor is left over a function. It can do a certain amount of introspection to figure out types, and also parses JSDoc-style comments.