Created
May 10, 2021 08:46
-
-
Save kwbr/2446e881b7990cc6cf33403767b625ea to your computer and use it in GitHub Desktop.
Set proper &path for Next.js and Nuxt.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autocmd BufNewFile,BufRead * call <SID>DetectFrontEndFramework() | |
function! s:DetectFrontEndFramework() | |
if v:version >= 801 && has('patch1803') | |
let package_json = findfile('package.json', '.;') | |
if len(package_json) | |
let dependencies = readfile(package_json) | |
\ ->join() | |
\ ->json_decode() | |
\ ->get('dependencies', {}) | |
\ ->keys() | |
if dependencies->count('next') | |
set path=.,,components/**,lib/**,pages/**,public/**,ssl/**,styles/** | |
endif | |
if dependencies->count('nuxt') | |
set path=.,,assets/**,components/**,layouts/**,middleware/**,pages/**,plugins/**,static/**,store/**,test/**,content/** | |
endif | |
endif | |
endif | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment