0

I am new to Vim and installed tern for vim: https://github.com/ternjs/tern_for_vim

I would like to use the command TernDef to jump to the definition of a function.

I tried to put the cursor on a function name and enter :TernDef but that does not work:

E492: Kein Editorbefehl :TernDef

Does "command" mean something different than the ":"-commands?

Key shortcuts for tern_for_vim can be enabled with:

"enable keyboard shortcuts
let g:tern_map_keys=1

Source: http://www.dotnetsurfers.com/blog/2016/02/08/using-vim-as-a-javascript-ide/

The article above does not tell me which key shortcuts are mapped to the tern commands. How can I find out?

I use gVim 8.1 on Windows7 and cloned the tern_for_vim plugin to

C:\Users\eis\vimfiles\pack\mypackages\start\tern_for_vim

Furthermore, I set the windows system environment variable HOME to C:\users\eis

Related question: How to setup tern-vim in my project?

Eli
  • 55
  • 9
Stefan
  • 10,010
  • 7
  • 61
  • 117
  • https://github.com/ternjs/tern_for_vim/blob/3cffc28f280fc599d3f997b1c8c00ddc78d8fc21/doc/tern.txt#L127-L141 Here's the documentation for the key bindings. – melpomene Aug 10 '18 at 18:58
  • So it should be "\td" ? Does not work. (at least not with German keyboard) – Stefan Aug 10 '18 at 19:04
  • If the `:TernDef` command is not defined, then the tern plugin wasn't loaded. – melpomene Aug 10 '18 at 19:09
  • if I execute :scriptnames, the tern.vim file is included in the list. Therefore, I assumed that it would have been loaded. How can I check if it has been loaded correctly? – Stefan Aug 10 '18 at 19:13
  • Which tern.vim? I see two of them in the repository. – melpomene Aug 10 '18 at 19:43
  • The relevant file to enable everything seems to be https://github.com/ternjs/tern_for_vim/blob/master/after/ftplugin/javascript_tern.vim, which is a filetype plugin for javascript. – melpomene Aug 10 '18 at 19:44
  • The shown path is c:\users\eis\vimfiles\pack\mypackages\start\tern_for_vim\ftdetect\tern.vim Why should the file in "tern_for_vim/after" be used in your opinion? – Stefan Aug 11 '18 at 08:37
  • Look at [ftdetect/tern.vim](https://github.com/ternjs/tern_for_vim/blob/master/ftdetect/tern.vim). All it does is set the file type of tern config files to "JSON". javascript_tern.vim contains `tern#Enable()`, which is what bootstraps the whole thing. – melpomene Aug 11 '18 at 11:19

0 Answers0