mirror of
https://github.com/sharkdp/bat.git
synced 2025-02-20 11:58:45 +00:00
Add syntax highlighting tests for VimL
Adds a syntax highlighting test for VimL with source file based on parts of my own configuration changed to cover as much of syntax as possible. **NOTES:** Last line of source (`syntax enable`) does not get highlighted, since `syntax` keyword is not part of highlighting rules. Related to #1213
This commit is contained in:
parent
47bb4a9c0f
commit
cc6109a751
79
tests/syntax-tests/highlighted/VimL/source.vim
Normal file
79
tests/syntax-tests/highlighted/VimL/source.vim
Normal file
@ -0,0 +1,79 @@
|
||||
[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255m&compatible[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mset[0m[38;2;248;248;242m nocompatible[0m
|
||||
[38;2;249;38;114mendif[0m
|
||||
|
||||
[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;102;217;239mhas[0m[38;2;248;248;242m([0m[38;2;230;219;116m'win32'[0m[38;2;248;248;242m) [0m[38;2;249;38;114m||[0m[38;2;248;248;242m has ([0m[38;2;230;219;116m'win64'[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mlet[0m[38;2;248;248;242m $VIMHOME = $HOME [0m[38;2;249;38;114m.[0m[38;2;248;248;242m [0m[38;2;230;219;116m"/vimfiles"[0m
|
||||
[38;2;249;38;114melseif[0m[38;2;248;248;242m [0m[38;2;255;255;255mv:false[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;255;255;255mv:true[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Can't get here"[0m
|
||||
[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mlet[0m[38;2;248;248;242m $VIMHOME = $HOME [0m[38;2;249;38;114m.[0m[38;2;248;248;242m [0m[38;2;230;219;116m"/.vim"[0m
|
||||
[38;2;249;38;114mendif[0m
|
||||
|
||||
[38;2;117;113;94m" show existing tab with 2 spaces width[0m
|
||||
[38;2;102;217;239mset[0m[38;2;248;248;242m tabstop=[0m[38;2;190;132;255m2[0m
|
||||
[38;2;117;113;94m" when indenting with '>', use 2 spaces width[0m
|
||||
[38;2;102;217;239mset[0m[38;2;248;248;242m shiftwidth=[0m[38;2;190;132;255m2[0m
|
||||
[38;2;117;113;94m" always set autoindenting on[0m
|
||||
[38;2;102;217;239mset[0m[38;2;248;248;242m autoindent[0m
|
||||
|
||||
[38;2;102;217;239mautocmd[0m[38;2;248;248;242m VimEnter [0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello Vim"[0m
|
||||
|
||||
[38;2;117;113;94m" Allow :W and :Wq to save too[0m
|
||||
[38;2;102;217;239mcommand[0m[38;2;248;248;242m! Wq :wq[0m
|
||||
[38;2;102;217;239mcommand[0m[38;2;248;248;242m! W :w[0m
|
||||
|
||||
[38;2;249;38;114maugroup[0m[38;2;248;248;242m vimrc[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mautocmd[0m[38;2;248;248;242m![0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mautocmd[0m[38;2;248;248;242m [0m[38;2;248;248;242mFileType[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"New filetype"[0m
|
||||
[38;2;249;38;114maugroup[0m[38;2;248;248;242m END[0m
|
||||
|
||||
[38;2;249;38;114mfunction[0m[38;2;248;248;242m! [0m[38;2;166;226;46ms:echo[0m[38;2;248;248;242m([0m[38;2;248;248;242mwhat)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;102;217;239ma[0m[38;2;249;38;114m:[0m[38;2;248;248;242mwhat[0m
|
||||
[38;2;249;38;114mendfunction[0m
|
||||
|
||||
[38;2;249;38;114mfunction[0m[38;2;248;248;242m! [0m[38;2;166;226;46mHelloWorld[0m[38;2;248;248;242m([0m[38;2;248;248;242mname)[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255ml:function_local[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"function_local_var"[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255ml:parts[0m[38;2;248;248;242m = [0m[38;2;102;217;239msplit[0m[38;2;248;248;242m([0m[38;2;255;255;255ml:function_local[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"_"[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255ml:greeting[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"Hello "[0m[38;2;248;248;242m [0m[38;2;249;38;114m.[0m[38;2;248;248;242m [0m[38;2;102;217;239ma[0m[38;2;249;38;114m:[0m[38;2;248;248;242mname[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;102;217;239ms:echo[0m[38;2;248;248;242m([0m[38;2;255;255;255ml:greeting[0m[38;2;248;248;242m)[0m
|
||||
[38;2;249;38;114mendfunction[0m
|
||||
|
||||
[38;2;249;38;114mfunction[0m[38;2;248;248;242m! [0m[38;2;166;226;46msource#Hello[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello from namespace"[0m
|
||||
[38;2;249;38;114mendfunction[0m
|
||||
|
||||
[38;2;249;38;114mfunction[0m[38;2;248;248;242m! [0m[38;2;166;226;46mEchoFunc[0m[38;2;248;248;242m([0m[38;2;249;38;114m.[0m[38;2;249;38;114m.[0m[38;2;249;38;114m.[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m s [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[38;2;102;217;239ma[0m[38;2;249;38;114m:[0m[38;2;190;132;255m000[0m
|
||||
[38;2;248;248;242m echon [0m[38;2;230;219;116m' '[0m[38;2;248;248;242m [0m[38;2;249;38;114m.[0m[38;2;248;248;242m s[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendfor[0m
|
||||
[38;2;249;38;114mendfunction[0m
|
||||
|
||||
[38;2;102;217;239mimap[0m[38;2;248;248;242m [0m[3;38;2;166;226;46m<C-h>[0m[38;2;248;248;242m [0m[3;38;2;166;226;46m<C-r>[0m[38;2;248;248;242m=[0m[38;2;102;217;239mHelloWorld[0m[38;2;248;248;242m([0m[38;2;230;219;116m"World"[0m[38;2;248;248;242m)[0m[3;38;2;166;226;46m<CR>[0m
|
||||
|
||||
[38;2;102;217;239mcommand[0m[38;2;248;248;242m! [0m[3;38;2;166;226;46m-nargs=[0m[38;2;248;248;242m? Echo :call [0m[38;2;102;217;239mEchoFunc[0m[38;2;248;248;242m([0m[3;38;2;166;226;46m<args>[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:global[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"global var"[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255ms:script_var[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"script var"[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mw:window_var[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"window war"[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mb:buffer_var[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"buffer war"[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m t[0m[38;2;249;38;114m:[0m[38;2;248;248;242mtab_var = [0m[38;2;230;219;116m"tab war"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;255;255;255mv:false[0m
|
||||
|
||||
[38;2;190;132;255m3[0m[38;2;248;248;242m + [0m[38;2;190;132;255m5[0m
|
||||
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m==#[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m==?[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m is [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114misnot[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m=~[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m!~[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:dict[0m[38;2;248;248;242m = {}[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:dict[0m[38;2;249;38;114m.[0m[38;2;248;248;242mitem = [[0m[38;2;230;219;116m'l1'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'l2'[0m[38;2;248;248;242m][0m
|
||||
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:dict2[0m[38;2;248;248;242m = {[0m[38;2;230;219;116m'dict_item'[0m[38;2;248;248;242m: [[0m[38;2;230;219;116m'l1'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'l2'[0m[38;2;248;248;242m], [0m[38;2;230;219;116m'di2'[0m[38;2;248;248;242m: [0m[38;2;230;219;116m'x'[0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;102;217;239mfiletype[0m[38;2;248;248;242m plugin indent on[0m
|
||||
[38;2;248;248;242msyntax enable[0m
|
79
tests/syntax-tests/source/VimL/source.vim
Normal file
79
tests/syntax-tests/source/VimL/source.vim
Normal file
@ -0,0 +1,79 @@
|
||||
if &compatible
|
||||
set nocompatible
|
||||
endif
|
||||
|
||||
if has('win32') || has ('win64')
|
||||
let $VIMHOME = $HOME . "/vimfiles"
|
||||
elseif v:false && v:true
|
||||
echo "Can't get here"
|
||||
else
|
||||
let $VIMHOME = $HOME . "/.vim"
|
||||
endif
|
||||
|
||||
" show existing tab with 2 spaces width
|
||||
set tabstop=2
|
||||
" when indenting with '>', use 2 spaces width
|
||||
set shiftwidth=2
|
||||
" always set autoindenting on
|
||||
set autoindent
|
||||
|
||||
autocmd VimEnter * echo "Hello Vim"
|
||||
|
||||
" Allow :W and :Wq to save too
|
||||
command! Wq :wq
|
||||
command! W :w
|
||||
|
||||
augroup vimrc
|
||||
autocmd!
|
||||
autocmd FileType * echo "New filetype"
|
||||
augroup END
|
||||
|
||||
function! s:echo(what)
|
||||
return a:what
|
||||
endfunction
|
||||
|
||||
function! HelloWorld(name)
|
||||
let l:function_local = "function_local_var"
|
||||
let l:parts = split(l:function_local, "_")
|
||||
let l:greeting = "Hello " . a:name
|
||||
return s:echo(l:greeting)
|
||||
endfunction
|
||||
|
||||
function! source#Hello()
|
||||
return "Hello from namespace"
|
||||
endfunction
|
||||
|
||||
function! EchoFunc(...)
|
||||
for s in a:000
|
||||
echon ' ' . s
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
imap <C-h> <C-r>=HelloWorld("World")<CR>
|
||||
|
||||
command! -nargs=? Echo :call EchoFunc(<args>)
|
||||
|
||||
let g:global = "global var"
|
||||
let s:script_var = "script var"
|
||||
let w:window_var = "window war"
|
||||
let b:buffer_var = "buffer war"
|
||||
let t:tab_var = "tab war"
|
||||
echo v:false
|
||||
|
||||
3 + 5
|
||||
|
||||
echo "Hello" ==# "Hello2"
|
||||
echo "Hello" ==? "Hello2"
|
||||
echo "Hello" == "Hello2"
|
||||
echo "Hello" is "Hello2"
|
||||
echo "Hello" isnot "Hello2"
|
||||
echo "Hello" =~ "Hello2"
|
||||
echo "Hello" !~ "Hello2"
|
||||
|
||||
let g:dict = {}
|
||||
let g:dict.item = ['l1', 'l2']
|
||||
|
||||
let g:dict2 = {'dict_item': ['l1', 'l2'], 'di2': 'x'}
|
||||
|
||||
filetype plugin indent on
|
||||
syntax enable
|
Loading…
x
Reference in New Issue
Block a user