Skip to content

The vue hook doesn't work now #476

@run27017

Description

@run27017

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
endfunction

For 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions