-
-
Notifications
You must be signed in to change notification settings - Fork 445
Open
Description
From the source of 'https://github.com/posva/vim-vue#how-can-i-use-nerdcommenter-in-vue-files',I make the simplest configuration:
scriptencoding utf-8
let g:vimhome=fnamemodify(resolve(expand('<sfile>:p')), ':h')
let mapleader=','
let maplocalleader=';'
let &runtimepath=g:vimhome.'/runtime'.',$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,'.g:vimhome.'/runtime/after'
call plug#begin(g:vimhome.'/bundle') " 插件声明 {{{
Plug 'scrooloose/nerdcommenter'
Plug 'posva/vim-vue'
call plug#end() " }}}
function! NERDCommenter_before()
if &ft == 'vue'
setf javascript
echom "Changed to javascript"
endif
endfunctionFor the vue file, I input the <leader>cc command, but the commentary is not the javascript style.
From:
<script>
console.log("Hello")
</script>To:
<script>
<!-- console.log("Hello") -->
</script>On the other side, I can see the message "Changed to javascript", which means setf javascript actually executed.
Version info:
- nerdcommenter:
2c87cae7 - vim:
8.2 (2019 Dec 12) With Patch: 1-3204 - os:
openSUSE Tumbleweed 20210731
Metadata
Metadata
Assignees
Labels
No labels