add wpy support
This commit is contained in:
parent
dc2b801f9e
commit
c456335450
18 changed files with 747 additions and 1 deletions
|
@ -1 +0,0 @@
|
||||||
Subproject commit 17298d55e40cc92224f84b99f6756ed12b889032
|
|
1
sources_non_forked/vim-vue/.gitignore
vendored
Normal file
1
sources_non_forked/vim-vue/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/pack
|
22
sources_non_forked/vim-vue/LICENSE
Normal file
22
sources_non_forked/vim-vue/LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Evan Sheehan, Eduardo San Martin Morote
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
10
sources_non_forked/vim-vue/circle.yml
Normal file
10
sources_non_forked/vim-vue/circle.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
dependencies:
|
||||||
|
override:
|
||||||
|
- sudo add-apt-repository ppa:jonathonf/vim -y
|
||||||
|
- sudo apt-get update
|
||||||
|
- sudo apt-get install vim
|
||||||
|
- bash test/install.sh
|
||||||
|
|
||||||
|
test:
|
||||||
|
override:
|
||||||
|
- vim -u test/vimrc -c 'Vader! test/*.vader'
|
1
sources_non_forked/vim-vue/ftdetect/vue.vim
Normal file
1
sources_non_forked/vim-vue/ftdetect/vue.vim
Normal file
|
@ -0,0 +1 @@
|
||||||
|
au BufNewFile,BufRead *.vue setf vue
|
19
sources_non_forked/vim-vue/ftplugin/vue.vim
Normal file
19
sources_non_forked/vim-vue/ftplugin/vue.vim
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
" Vim filetype plugin
|
||||||
|
" Language: Vue.js
|
||||||
|
" Maintainer: Eduardo San Martin Morote
|
||||||
|
" Author: Adriaan Zonnenberg
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! ftplugin/html.vim
|
||||||
|
|
||||||
|
setlocal suffixesadd+=.vue
|
||||||
|
|
||||||
|
if exists('g:loaded_ale')
|
||||||
|
let g:ale_linters = get(g:, 'ale_linters', {})
|
||||||
|
let g:ale_linters.vue = get(g:ale_linters, 'vue', ['eslint'])
|
||||||
|
let g:ale_linter_aliases = get(g:, 'ale_linter_aliases', {})
|
||||||
|
let g:ale_linter_aliases.vue = get(g:ale_linter_aliases, 'vue', 'javascript')
|
||||||
|
endif
|
64
sources_non_forked/vim-vue/indent/vue.vim
Normal file
64
sources_non_forked/vim-vue/indent/vue.vim
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
" Vim indent file
|
||||||
|
" Language: Vue.js
|
||||||
|
" Maintainer: Eduardo San Martin Morote
|
||||||
|
" Author: Adriaan Zonnenberg
|
||||||
|
|
||||||
|
if exists('b:did_indent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:get_indentexpr(language)
|
||||||
|
unlet! b:did_indent
|
||||||
|
execute 'runtime! indent/' . a:language . '.vim'
|
||||||
|
return &indentexpr
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" The order is important here, tags without attributes go last.
|
||||||
|
" HTML is left out, it will be used when there is no match.
|
||||||
|
let s:languages = [
|
||||||
|
\ { 'name': 'pug', 'pairs': ['<template lang="pug"', '</template>'] },
|
||||||
|
\ { 'name': 'stylus', 'pairs': ['<style lang="stylus"', '</style>'] },
|
||||||
|
\ { 'name': 'css', 'pairs': ['<style', '</style>'] },
|
||||||
|
\ { 'name': 'coffee', 'pairs': ['<script lang="coffee"', '</script>'] },
|
||||||
|
\ { 'name': 'javascript', 'pairs': ['<script', '</script>'] },
|
||||||
|
\ ]
|
||||||
|
|
||||||
|
for s:language in s:languages
|
||||||
|
" Set 'indentexpr' if the user has an indent file installed for the language
|
||||||
|
if strlen(globpath(&rtp, 'indent/'. s:language.name .'.vim'))
|
||||||
|
let s:language.indentexpr = s:get_indentexpr(s:language.name)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
let s:html_indent = s:get_indentexpr('html')
|
||||||
|
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal indentexpr=GetVueIndent()
|
||||||
|
|
||||||
|
if exists('*GetVueIndent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! GetVueIndent()
|
||||||
|
for language in s:languages
|
||||||
|
let opening_tag_line = searchpair(language.pairs[0], '', language.pairs[1], 'bWr')
|
||||||
|
|
||||||
|
if opening_tag_line
|
||||||
|
execute 'let indent = ' . get(language, 'indentexpr', -1)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if exists('l:indent')
|
||||||
|
if (opening_tag_line == prevnonblank(v:lnum - 1) || opening_tag_line == v:lnum)
|
||||||
|
\ || getline(v:lnum) =~ '\v^\s*\</(script|style|template)'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" Couldn't find language, fall back to html
|
||||||
|
execute 'let indent = ' . s:html_indent
|
||||||
|
endif
|
||||||
|
|
||||||
|
return indent
|
||||||
|
endfunction
|
131
sources_non_forked/vim-vue/readme.md
Normal file
131
sources_non_forked/vim-vue/readme.md
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
# vim-vue [![CircleCI](https://img.shields.io/circleci/project/github/posva/vim-vue.svg)](https://circleci.com/gh/posva/vim-vue)
|
||||||
|
|
||||||
|
Vim syntax highlighting for [Vue
|
||||||
|
components](https://vuejs.org/v2/guide/single-file-components.html).
|
||||||
|
|
||||||
|
This was initially forked from
|
||||||
|
[darthmall/vim-vue](https://github.com/darthmall/vim-vue). I already have an
|
||||||
|
implementation for this but found his code much cleaner. That's why I created a
|
||||||
|
new version instead of a PR.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Install with [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||||||
|
|
||||||
|
```viml
|
||||||
|
Plugin 'posva/vim-vue'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install with [Pathogen](https://github.com/tpope/vim-pathogen)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/.vim/bundle && \
|
||||||
|
git clone https://github.com/posva/vim-vue.git
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install without a plugin manager (Vim 8)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/posva/vim-vue.git ~/.vim/pack/plugins/start/vim-vue
|
||||||
|
```
|
||||||
|
|
||||||
|
### Integration with [Syntastic](https://github.com/scrooloose/syntastic) or [ALE](https://github.com/w0rp/ale)
|
||||||
|
|
||||||
|
Currently only `eslint` is available. Please make sure
|
||||||
|
[eslint](http://eslint.org/) and
|
||||||
|
[eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) are installed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm i -g eslint eslint-plugin-vue
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
If your language is not getting highlighted open an issue or a PR with the fix.
|
||||||
|
You only need to add a line to the `syntax/vue.vim` file.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### Where is Jade?
|
||||||
|
|
||||||
|
[Jade has been renamed to pug](https://github.com/pugjs/jade/issues/2184).
|
||||||
|
Therefore you have to replace all your `jade` occurrences with `pug`. The new
|
||||||
|
plugin for `pug` can be found on [the same repository](https://github.com/digitaltoad/vim-pug)
|
||||||
|
(the name has already been updated).
|
||||||
|
|
||||||
|
### Typescript support
|
||||||
|
|
||||||
|
You can use typescript by adding one of the following attributes/values to
|
||||||
|
your component's script tag:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script ts></script>
|
||||||
|
<script lang="ts"></script>
|
||||||
|
<script lang="typescript"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
Choose one that works with your module bundler
|
||||||
|
|
||||||
|
### My syntax highlighting stops working randomly
|
||||||
|
|
||||||
|
This is because Vim tries to highlight text in an efficient way. Especially in
|
||||||
|
files that include multiple languages, it can get confused. To work around
|
||||||
|
this, you can run `:syntax sync fromstart` when it happens.
|
||||||
|
|
||||||
|
You can also setup an autocmd for this:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
autocmd FileType vue syntax sync fromstart
|
||||||
|
```
|
||||||
|
|
||||||
|
See `:h :syn-sync-first` and [this article](http://vim.wikia.com/wiki/Fix_syntax_highlighting)
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
### How can I use existing configuration/plugins in Vue files?
|
||||||
|
|
||||||
|
If you already have some configuration for filetypes like html, css and
|
||||||
|
javascript (e.g. linters, completion), you can use them in .vue files by
|
||||||
|
setting compound filetypes like this:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css
|
||||||
|
```
|
||||||
|
|
||||||
|
:warning: This may cause problems, because some plugins will then treat the
|
||||||
|
whole buffer as html/javascript/css instead of only the part inside the tags.
|
||||||
|
|
||||||
|
### How can I use NERDCommenter in Vue files?
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
To use NERDCommenter with Vue files, you can use its "hooks" feature to
|
||||||
|
temporarily change the filetype. Click for an example.
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
```vim
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### _Vim gets slows down when using this plugin_ How can I fix that?
|
||||||
|
|
||||||
|
Add `let g:vue_disable_pre_processors=1` in your .vimrc to disable checking for prepocessors. When checking for prepocessor languages, multiple syntax highlighting checks are done, which can slow down vim. This variable prevents vim-vue from supporting **every** prepocessor language highlighting.
|
61
sources_non_forked/vim-vue/syntax/vue.vim
Normal file
61
sources_non_forked/vim-vue/syntax/vue.vim
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: Vue.js
|
||||||
|
" Maintainer: Eduardo San Martin Morote
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! syntax/html.vim
|
||||||
|
unlet! b:current_syntax
|
||||||
|
|
||||||
|
""
|
||||||
|
" Get the pattern for a HTML {name} attribute with {value}.
|
||||||
|
function! s:attr(name, value)
|
||||||
|
return a:name . '=\("\|''\)[^\1]*' . a:value . '[^\1]*\1'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Check whether a syntax file for a given {language} exists.
|
||||||
|
function! s:syntax_available(language)
|
||||||
|
return !empty(globpath(&runtimepath, 'syntax/' . a:language . '.vim'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Register {language} for a given {tag}. If [attr_override] is given and not
|
||||||
|
" empty, it will be used for the attribute pattern.
|
||||||
|
function! s:register_language(language, tag, ...)
|
||||||
|
let attr_override = a:0 ? a:1 : ''
|
||||||
|
let attr = !empty(attr_override) ? attr_override : s:attr('lang', a:language)
|
||||||
|
|
||||||
|
if s:syntax_available(a:language)
|
||||||
|
execute 'syntax include @' . a:language . ' syntax/' . a:language . '.vim'
|
||||||
|
unlet! b:current_syntax
|
||||||
|
execute 'syntax region vue_' . a:language
|
||||||
|
\ 'keepend'
|
||||||
|
\ 'start=/<' . a:tag . ' \_[^>]*' . attr . '\_[^>]*>/'
|
||||||
|
\ 'end="</' . a:tag . '>"me=s-1'
|
||||||
|
\ 'contains=@' . a:language . ',vueSurroundingTag'
|
||||||
|
\ 'fold'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if !exists("g:vue_disable_pre_processors") || !g:vue_disable_pre_processors
|
||||||
|
call s:register_language('pug', 'template', s:attr('lang', '\%(pug\|jade\)'))
|
||||||
|
call s:register_language('slm', 'template')
|
||||||
|
call s:register_language('handlebars', 'template')
|
||||||
|
call s:register_language('haml', 'template')
|
||||||
|
call s:register_language('typescript', 'script', '\%(lang=\("\|''\)[^\1]*\(ts\|typescript\)[^\1]*\1\|ts\)')
|
||||||
|
call s:register_language('coffee', 'script')
|
||||||
|
call s:register_language('stylus', 'style')
|
||||||
|
call s:register_language('sass', 'style')
|
||||||
|
call s:register_language('scss', 'style')
|
||||||
|
call s:register_language('less', 'style')
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn region vueSurroundingTag contained start=+<\(script\|style\|template\)+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
|
||||||
|
syn keyword htmlSpecialTagName contained template
|
||||||
|
syn keyword htmlArg contained scoped ts
|
||||||
|
syn match htmlArg "[@v:][-:.0-9_a-z]*\>" contained
|
||||||
|
|
||||||
|
let b:current_syntax = "vue"
|
13
sources_non_forked/vim-vue/syntax_checkers/vue/eslint.vim
Normal file
13
sources_non_forked/vim-vue/syntax_checkers/vue/eslint.vim
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
" Vue cofiguration for Syntastic
|
||||||
|
|
||||||
|
if exists('g:loaded_syntastic_vue_eslint_checker')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:loaded_syntastic_vue_eslint_checker = 1
|
||||||
|
|
||||||
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||||
|
\ 'filetype': 'vue',
|
||||||
|
\ 'name': 'eslint',
|
||||||
|
\ 'redirect': 'javascript/eslint'
|
||||||
|
\ })
|
31
sources_non_forked/vim-vue/test/install.sh
Executable file
31
sources_non_forked/vim-vue/test/install.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
repos=(
|
||||||
|
'junegunn/vader.vim'
|
||||||
|
|
||||||
|
# languages
|
||||||
|
'cakebaker/scss-syntax.vim'
|
||||||
|
'digitaltoad/vim-pug'
|
||||||
|
'groenewege/vim-less'
|
||||||
|
'kchmck/vim-coffee-script'
|
||||||
|
'leafgarland/typescript-vim'
|
||||||
|
'slm-lang/vim-slm'
|
||||||
|
'wavded/vim-stylus'
|
||||||
|
|
||||||
|
# utility
|
||||||
|
'scrooloose/nerdcommenter'
|
||||||
|
)
|
||||||
|
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
mkdir -p pack/testing/start
|
||||||
|
cd pack/testing/start
|
||||||
|
|
||||||
|
# Add our plugin to the pack.
|
||||||
|
ln -s ../../.. vim-vue
|
||||||
|
|
||||||
|
for repo in ${repos[@]}
|
||||||
|
do
|
||||||
|
git clone https://github.com/$repo.git
|
||||||
|
done
|
32
sources_non_forked/vim-vue/test/readme.md
Normal file
32
sources_non_forked/vim-vue/test/readme.md
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
# Vader Tests
|
||||||
|
|
||||||
|
> Requires Vim 8 or Neovim, due to the way dependencies are installed.
|
||||||
|
|
||||||
|
To run the tests, you need to install the dependencies first. Use the
|
||||||
|
[installation script](install.sh):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
test/install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running the tests from the command line
|
||||||
|
|
||||||
|
You can run the tests with the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
vim -u test/vimrc -c 'Vader! test/*.vader'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running the tests from within Vim
|
||||||
|
|
||||||
|
Open vim with:
|
||||||
|
|
||||||
|
```
|
||||||
|
vim -u test/vimrc
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, you can run the tests with the following command:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
:Vader test/*.vader
|
||||||
|
```
|
135
sources_non_forked/vim-vue/test/test_indent.vader
Normal file
135
sources_non_forked/vim-vue/test/test_indent.vader
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
#
|
||||||
|
# HTML
|
||||||
|
#
|
||||||
|
Given vue (An unindented html template):
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
Hello
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
Do (Indent the whole buffer):
|
||||||
|
gg=G
|
||||||
|
|
||||||
|
Expect (The html template got indented):
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
Hello
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
Given vue (Template tag inside a template):
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<template v-if="loading">
|
||||||
|
Loading...
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
Do (Indent the whole buffer):
|
||||||
|
gg=G
|
||||||
|
|
||||||
|
Expect (It didn't get unindented):
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<template v-if="loading">
|
||||||
|
Loading...
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
#
|
||||||
|
# JavaScript
|
||||||
|
#
|
||||||
|
Given vue (An unindented JavaScript region):
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
foo() {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
Do (Indent the whole buffer):
|
||||||
|
gg=G
|
||||||
|
|
||||||
|
Expect vue (The JavaScript region got indented):
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
foo() {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
#
|
||||||
|
# CSS
|
||||||
|
#
|
||||||
|
Given vue (An unindented css region):
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: tomato;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
Do (Indent the whole buffer):
|
||||||
|
gg=G
|
||||||
|
|
||||||
|
Expect vue (The css region got indented):
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: tomato;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pug
|
||||||
|
#
|
||||||
|
Given vue (Empty Pug region):
|
||||||
|
<template lang="pug">
|
||||||
|
</template>
|
||||||
|
|
||||||
|
Do (Insert list items):
|
||||||
|
o
|
||||||
|
ul\<CR>
|
||||||
|
li Item A\<CR>
|
||||||
|
li Item B
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
<template lang="pug">
|
||||||
|
ul
|
||||||
|
li Item A
|
||||||
|
li Item B
|
||||||
|
</template>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Stylus
|
||||||
|
#
|
||||||
|
Given vue (Empty Stylus region):
|
||||||
|
<style lang="stylus">
|
||||||
|
</style>
|
||||||
|
|
||||||
|
Do (Insert some styles):
|
||||||
|
o
|
||||||
|
body\<CR>
|
||||||
|
font-size: 14px\<CR>
|
||||||
|
\<CR>\<C-d>
|
||||||
|
h1\<CR>
|
||||||
|
font-size: 30px\<CR>
|
||||||
|
display: block
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
<style lang="stylus">
|
||||||
|
body
|
||||||
|
font-size: 14px
|
||||||
|
|
||||||
|
h1
|
||||||
|
font-size: 30px
|
||||||
|
display: block
|
||||||
|
</style>
|
40
sources_non_forked/vim-vue/test/test_nerdcommenter.vader
Normal file
40
sources_non_forked/vim-vue/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>
|
166
sources_non_forked/vim-vue/test/test_syntax.vader
Normal file
166
sources_non_forked/vim-vue/test/test_syntax.vader
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
#
|
||||||
|
# HTML
|
||||||
|
#
|
||||||
|
Given vue (HTML template without lang attribute):
|
||||||
|
<template>
|
||||||
|
<div></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'htmlTag', SyntaxAt(2, 3)
|
||||||
|
AssertEqual 'htmlTag', SyntaxAt(1, 1)
|
||||||
|
AssertEqual 'htmlSpecialTagName', SyntaxAt(1, 2)
|
||||||
|
|
||||||
|
|
||||||
|
Given vue (Template tag inside a template):
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<template v-if="loading">
|
||||||
|
Loading...
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
Execute (Syntax doesn't stop at the first closing template tag):
|
||||||
|
AssertEqual 'htmlEndTag', SyntaxAt(6, 3)
|
||||||
|
|
||||||
|
#
|
||||||
|
# JavaScript
|
||||||
|
#
|
||||||
|
Given vue:
|
||||||
|
<script>
|
||||||
|
//
|
||||||
|
</script>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'javaScriptLineComment', SyntaxAt(2, 1)
|
||||||
|
AssertEqual 'htmlScriptTag', SyntaxAt(1, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vue (Script tag with misc. attributes and newline):
|
||||||
|
<script type="text/babel"
|
||||||
|
lang="babel"
|
||||||
|
>
|
||||||
|
//
|
||||||
|
</script>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'javaScriptLineComment', SyntaxAt(4, 1)
|
||||||
|
AssertEqual 'htmlArg', SyntaxAt(2, 9)
|
||||||
|
AssertEqual 'htmlScriptTag', SyntaxAt(1, 1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# CSS
|
||||||
|
#
|
||||||
|
Given vue (CSS region without lang attribute):
|
||||||
|
<style>
|
||||||
|
/**/
|
||||||
|
</style>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'cssComment', SyntaxAt(2, 1)
|
||||||
|
AssertEqual 'htmlTag', SyntaxAt(1, 1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pug
|
||||||
|
#
|
||||||
|
Given vue (Pug template):
|
||||||
|
<template lang="pug">
|
||||||
|
p #{name}'s Pug source code!
|
||||||
|
</template>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'htmlTagName', SyntaxAt(2, 1)
|
||||||
|
AssertEqual 'pugInterpolationDelimiter', SyntaxAt(2, 3)
|
||||||
|
AssertEqual 'vueSurroundingTag', SyntaxAt(1, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vue (Pug template using their former name):
|
||||||
|
<template lang="jade">
|
||||||
|
p #{name}'s Pug source code!
|
||||||
|
</template>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'htmlTagName', SyntaxAt(2, 1)
|
||||||
|
AssertEqual 'pugInterpolationDelimiter', SyntaxAt(2, 3)
|
||||||
|
|
||||||
|
#
|
||||||
|
# SCSS
|
||||||
|
#
|
||||||
|
Given vue (SCSS region):
|
||||||
|
<style lang="scss">
|
||||||
|
$green: #42b983;
|
||||||
|
</style>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'scssVariable', SyntaxAt(2, 1)
|
||||||
|
AssertEqual 'vueSurroundingTag', SyntaxAt(1, 1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Sass
|
||||||
|
#
|
||||||
|
Given vue (Sass region):
|
||||||
|
<style lang="sass">
|
||||||
|
$green: #42b983
|
||||||
|
</style>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'sassVariable', SyntaxAt(2, 1)
|
||||||
|
AssertEqual 'vueSurroundingTag', SyntaxAt(1, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vue (Sass region with modifier):
|
||||||
|
<style lang="sass?indentedSyntax">
|
||||||
|
$green: #42b983
|
||||||
|
</style>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'sassVariable', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Stylus
|
||||||
|
#
|
||||||
|
Given vue (Sass region):
|
||||||
|
<style lang="stylus">
|
||||||
|
@import 'variables'
|
||||||
|
|
||||||
|
body
|
||||||
|
font: 12px Helvetica, Arial, sans-serif
|
||||||
|
</style>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'stylusImport', SyntaxAt(2, 1)
|
||||||
|
AssertEqual 'cssTagName', SyntaxAt(4, 1)
|
||||||
|
AssertEqual 'vueSurroundingTag', SyntaxAt(1, 1)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# TypeScript
|
||||||
|
#
|
||||||
|
Given vue (Typescript region using "ts" as name):
|
||||||
|
<script lang="ts">
|
||||||
|
@Component({})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'typescriptDecorators', SyntaxAt(2, 1)
|
||||||
|
AssertEqual 'vueSurroundingTag', SyntaxAt(1, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vue (Typescript region using "typescript" as name):
|
||||||
|
<script lang="typescript">
|
||||||
|
@Component({})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'typescriptDecorators', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vue (Typescript region using "ts" attribute):
|
||||||
|
<script ts>
|
||||||
|
@Component({})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
AssertEqual 'typescriptDecorators', SyntaxAt(2, 1)
|
||||||
|
AssertEqual 'htmlArg', SyntaxAt(1, 9)
|
13
sources_non_forked/vim-vue/test/vimrc
Normal file
13
sources_non_forked/vim-vue/test/vimrc
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
set nocompatible
|
||||||
|
|
||||||
|
let &packpath = expand('<sfile>:p:h:h')
|
||||||
|
|
||||||
|
" Remove first and last entry from runtimepath, to prevent loading plugins from ~/.vim
|
||||||
|
let &runtimepath = substitute(&runtimepath, '\v^.{-},(.*),.*$', '\1', '')
|
||||||
|
|
||||||
|
filetype plugin indent on
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
set expandtab
|
||||||
|
set shiftwidth=2
|
||||||
|
set softtabstop=2
|
|
@ -396,3 +396,4 @@ function! VisualSelection(direction, extra_filter) range
|
||||||
let @/ = l:pattern
|
let @/ = l:pattern
|
||||||
let @" = l:saved_reg
|
let @" = l:saved_reg
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,13 @@ au FileType python set cindent
|
||||||
au FileType python set cinkeys-=0#
|
au FileType python set cinkeys-=0#
|
||||||
au FileType python set indentkeys-=0#
|
au FileType python set indentkeys-=0#
|
||||||
|
|
||||||
|
au BufRead,BufNewFile *.wpy set ft=vue
|
||||||
|
au BufRead,BufNewFile *.wpy set syntax=vue
|
||||||
|
autocmd FileType vue,html,javascript,css set ai
|
||||||
|
autocmd FileType vue,html,javascript,css set sw=2
|
||||||
|
autocmd FileType vue,html,javascript,css set ts=2
|
||||||
|
autocmd FileType vue,html,javascript,css set sts=2
|
||||||
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""
|
||||||
" => JavaScript section
|
" => JavaScript section
|
||||||
|
|
Loading…
Reference in a new issue