This plugin improves Vim's gf
command when navigating JavaScript imports.
Support:
- ES Module (package.json:module)
- CommonJS (node_modules, package.json:main, /index.<supported suffixes>)
- Browserify module (package.json:browser)
- Vue.js (*.vue)
- JSON (*.json)
- React (*.jsx)
- TypeScript (*.ts, *.tsx)
Plug 'hotoo/jsgf.vim'
Vundle:
Plugin 'hotoo/jsgf.vim'
gf
in normal mode: goto file in current buffer.<C-w>gf
in normal mode: open file in new tab.
:help gf
Maybe you need autochdir
option in .vimrc
set autochdir
Open file method, default is 'edit', you can use 'new', 'tabnew', or 'vnew'.
let g:jsgf_option_open = 'vnew'
vim ./test/jsgf.test.js
and gf
, <Ctrl-o>
to test.