2017-01-21 21:47:36 +08:00
|
|
|
function! SpaceVim#layers#lang#javascript#plugins() abort
|
2017-06-26 21:22:22 +08:00
|
|
|
let plugins = []
|
|
|
|
call add(plugins,['pangloss/vim-javascript', { 'on_ft' : ['javascript']}])
|
|
|
|
if has('nvim')
|
|
|
|
call add(plugins,['carlitux/deoplete-ternjs', { 'on_ft' : ['javascript']}])
|
|
|
|
endif
|
|
|
|
call add(plugins,['ternjs/tern_for_vim', { 'on_ft' : ['javascript'],
|
|
|
|
\ 'build' : 'npm install',
|
|
|
|
\ }])
|
|
|
|
call add(plugins,['othree/javascript-libraries-syntax.vim', { 'on_ft' : ['javascript','coffee','ls','typescript']}])
|
|
|
|
call add(plugins,['mmalecki/vim-node.js', { 'on_ft' : ['javascript']}])
|
|
|
|
call add(plugins,['othree/yajs.vim', { 'on_ft' : ['javascript']}])
|
|
|
|
call add(plugins,['othree/es.next.syntax.vim', { 'on_ft' : ['javascript']}])
|
|
|
|
call add(plugins,['maksimr/vim-jsbeautify', { 'on_ft' : ['javascript']}])
|
|
|
|
return plugins
|
2017-01-21 21:47:36 +08:00
|
|
|
endfunction
|
2017-06-26 21:22:22 +08:00
|
|
|
|
|
|
|
function! SpaceVim#layers#lang#javascript#config() abort
|
|
|
|
call SpaceVim#mapping#gd#add('javascript', function('s:gotodef'))
|
2017-09-17 09:56:42 +08:00
|
|
|
if !exists(g:spacevim_javascript_autofix)
|
|
|
|
let g:spacevim_javascript_autofix = 1
|
|
|
|
endif
|
|
|
|
if (g:spacevim_javascript_autofix)
|
|
|
|
" Only use eslint
|
|
|
|
let g:neomake_javascript_enabled_makers = ['eslint']
|
|
|
|
" Use the fix option of eslint
|
|
|
|
let g:neomake_javascript_eslint_args = ['-f', 'compact', '--fix']
|
|
|
|
au User NeomakeFinished checktime
|
|
|
|
au FocusGained * checktime
|
|
|
|
endif
|
2017-06-26 21:22:22 +08:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:gotodef() abort
|
|
|
|
if exists(':TernDef')
|
|
|
|
TernDef
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
" vim:set et sw=2 cc=80:
|