1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 23:50:04 +08:00

refactor(comments): move comments autocmd to layer

This commit is contained in:
wsdjeg 2022-06-12 15:33:13 +08:00
parent b443539fb3
commit b215212db6
4 changed files with 19 additions and 17 deletions

View File

@ -43,7 +43,6 @@ function! SpaceVim#autocmds#init() abort
autocmd BufWinEnter * if(exists('b:_winview')) | call winrestview(b:_winview) | endif
autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
autocmd BufNewFile,BufRead *.avs set syntax=avs " for avs syntax file.
autocmd FileType c,cpp,java,javascript set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
autocmd FileType cs set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
autocmd Filetype qf setlocal nobuflisted
au StdinReadPost * call s:disable_welcome()

View File

@ -225,6 +225,7 @@ function! SpaceVim#layers#lang#c#config() abort
auto FileType c,cpp call s:highlight()
endif
au BufRead,BufNewFile *.m set filetype=objc
autocmd FileType c,cpp set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
augroup END
call add(g:spacevim_project_rooter_patterns, '.clang')
if has('nvim')

View File

@ -157,6 +157,7 @@ function! SpaceVim#layers#lang#java#config() abort
autocmd FileType java setlocal omnifunc=javacomplete#Complete
endif
autocmd FileType jsp call <SID>JspFileTypeInit()
autocmd FileType java set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
augroup END
let g:neoformat_enabled_java = get(g:, 'neoformat_enabled_java', ['googlefmt'])
let g:neoformat_java_googlefmt = {

View File

@ -66,16 +66,16 @@ let s:format_on_save = 0
function! SpaceVim#layers#lang#javascript#plugins() abort
let plugins = [
\ ['Galooshi/vim-import-js', {
\ 'on_ft': 'javascript', 'build' : 'npm install -g import-js' }],
\ ['heavenshell/vim-jsdoc', { 'on_cmd': 'JsDoc' }],
\ ['maksimr/vim-jsbeautify', { 'on_ft': 'javascript' }],
\ ['mmalecki/vim-node.js', { 'on_ft': 'javascript' }],
\ ['moll/vim-node', { 'on_ft': 'javascript' }],
\ ['neoclide/vim-jsx-improve', { 'on_ft': 'javascript' }],
\ ['othree/es.next.syntax.vim', { 'on_ft': 'javascript' }],
\ ['othree/javascript-libraries-syntax.vim', {
\ 'on_ft': ['javascript', 'coffee', 'ls', 'typescript'] }],
\ ]
\ 'on_ft': 'javascript', 'build' : 'npm install -g import-js' }],
\ ['heavenshell/vim-jsdoc', { 'on_cmd': 'JsDoc' }],
\ ['maksimr/vim-jsbeautify', { 'on_ft': 'javascript' }],
\ ['mmalecki/vim-node.js', { 'on_ft': 'javascript' }],
\ ['moll/vim-node', { 'on_ft': 'javascript' }],
\ ['neoclide/vim-jsx-improve', { 'on_ft': 'javascript' }],
\ ['othree/es.next.syntax.vim', { 'on_ft': 'javascript' }],
\ ['othree/javascript-libraries-syntax.vim', {
\ 'on_ft': ['javascript', 'coffee', 'ls', 'typescript'] }],
\ ]
if s:enable_flow_syntax
call add(plugins, ['flowtype/vim-flow', { 'on_ft': 'javascript' }])
@ -141,14 +141,15 @@ function! SpaceVim#layers#lang#javascript#config() abort
endif
" Only use eslint
if s:auto_fix
augroup SpaceVim_lang_javascript
autocmd!
augroup SpaceVim_lang_javascript
autocmd!
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType javascript set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
if s:auto_fix
autocmd User NeomakeFinished call <SID>checktime_if_javascript()
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FocusGained * call <SID>checktime_if_javascript()
augroup END
endif
endif
augroup END
" just add a note here, when using `node -`, the Buffered stdout will not
" be flushed by sender.
" Use node -i will show the output of repl command.