diff --git a/init.vim b/init.vim index c60ed21..bafcfae 100644 --- a/init.vim +++ b/init.vim @@ -798,6 +798,18 @@ EOF " Configure Vim-Commentary 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= + elseif join(syntaxGroups, ',') =~ 'javascript' + setlocal commentstring=\/\/\ %s + endif + endif + endfunction + autocmd! autocmd FileType matlab setlocal commentstring=%\ %s autocmd FileType julia setlocal commentstring=#\ %s @@ -808,6 +820,9 @@ augroup CustomCommentDefinitions autocmd FileType nix setlocal commentstring=#\ %s autocmd FileType dot setlocal commentstring=\/\/\ %s autocmd FileType markdown setlocal commentstring= + autocmd FileType html.epl setlocal commentstring=%#\ %s + autocmd FileType vue execute 'autocmd CustomCommentDefinitions CursorMoved :call SetCommentString()' + " autocmd CursorMoved * :call SetCommentString() augroup END " NCM2