mirror of
https://github.com/posva/vim-vue.git
synced 2025-12-09 02:44:45 +08:00
Add note to FAQ about nerdcommenter, and add tests for it
This commit is contained in:
40
test/test_nerdcommenter.vader
Normal file
40
test/test_nerdcommenter.vader
Normal file
@@ -0,0 +1,40 @@
|
||||
Execute (Configure NERDCommenter to support Vue files):
|
||||
let g:ft = ''
|
||||
function! NERDCommenter_before()
|
||||
if &ft == 'vue'
|
||||
let g:ft = 'vue'
|
||||
let stack = synstack(line('.'), col('.'))
|
||||
if len(stack) > 0
|
||||
let syn = synIDattr((stack)[0], 'name')
|
||||
if len(syn) > 0
|
||||
exe 'setf ' . substitute(tolower(syn), '^vue_', '', '')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
function! NERDCommenter_after()
|
||||
if g:ft == 'vue'
|
||||
setf vue
|
||||
let g:ft = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
Given vue:
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
<style>
|
||||
.glitters { color: gold }
|
||||
<style>
|
||||
|
||||
Do:
|
||||
j\cc
|
||||
3j\cc
|
||||
|
||||
Expect:
|
||||
<template>
|
||||
<!--<div></div>-->
|
||||
</template>
|
||||
<style>
|
||||
/*.glitters { color: gold }*/
|
||||
<style>
|
||||
Reference in New Issue
Block a user