2
0
mirror of https://github.com/webgefrickel/dotfiles synced 2024-11-15 12:12:58 +00:00
steffen-dotfiles/nvim/gotofile.vim
2019-12-01 11:38:56 +01:00

16 lines
417 B
VimL

set path=.,src
set suffixesadd=.js,.jsx,.scss
function! LoadMainNodeModule(fname)
let nodeModules = "./node_modules/"
let packageJsonPath = nodeModules . a:fname . "/package.json"
if filereadable(packageJsonPath)
return nodeModules . a:fname . "/" . json_decode(join(readfile(packageJsonPath))).main
else
return nodeModules . a:fname
endif
endfunction
set includeexpr=LoadMainNodeModule(v:fname)