Support both html and javascript commentstrings in vue files
This commit is contained in:
parent
be59725d52
commit
bcbadda8d0
15
init.vim
15
init.vim
@ -798,6 +798,18 @@ EOF
|
|||||||
|
|
||||||
" Configure Vim-Commentary
|
" Configure Vim-Commentary
|
||||||
augroup CustomCommentDefinitions
|
augroup CustomCommentDefinitions
|
||||||
|
function! SetCommentString()
|
||||||
|
let syntaxGroups = map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")')
|
||||||
|
" echo syntaxGroups " enable when debugging
|
||||||
|
if &ft == 'vue'
|
||||||
|
if join(syntaxGroups, ',') =~ 'html'
|
||||||
|
setlocal commentstring=<!--\ %s\ -->
|
||||||
|
elseif join(syntaxGroups, ',') =~ 'javascript'
|
||||||
|
setlocal commentstring=\/\/\ %s
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType matlab setlocal commentstring=%\ %s
|
autocmd FileType matlab setlocal commentstring=%\ %s
|
||||||
autocmd FileType julia setlocal commentstring=#\ %s
|
autocmd FileType julia setlocal commentstring=#\ %s
|
||||||
@ -808,6 +820,9 @@ augroup CustomCommentDefinitions
|
|||||||
autocmd FileType nix setlocal commentstring=#\ %s
|
autocmd FileType nix setlocal commentstring=#\ %s
|
||||||
autocmd FileType dot setlocal commentstring=\/\/\ %s
|
autocmd FileType dot setlocal commentstring=\/\/\ %s
|
||||||
autocmd FileType markdown setlocal commentstring=<!---\ %s\ -->
|
autocmd FileType markdown setlocal commentstring=<!---\ %s\ -->
|
||||||
|
autocmd FileType html.epl setlocal commentstring=%#\ %s
|
||||||
|
autocmd FileType vue execute 'autocmd CustomCommentDefinitions CursorMoved <buffer> :call SetCommentString()'
|
||||||
|
" autocmd CursorMoved * :call SetCommentString()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" NCM2
|
" NCM2
|
||||||
|
Loading…
Reference in New Issue
Block a user