From 719bdd97650674177e036d80cb60fb4341cf6748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Sun, 27 Dec 2020 09:00:57 +0100 Subject: [PATCH] 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 --- .../syntax-tests/highlighted/VimL/source.vim | 81 +++++++++++++++++++ tests/syntax-tests/source/VimL/source.vim | 81 +++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 tests/syntax-tests/highlighted/VimL/source.vim create mode 100644 tests/syntax-tests/source/VimL/source.vim diff --git a/tests/syntax-tests/highlighted/VimL/source.vim b/tests/syntax-tests/highlighted/VimL/source.vim new file mode 100644 index 0000000000..73f3b994b2 --- /dev/null +++ b/tests/syntax-tests/highlighted/VimL/source.vim @@ -0,0 +1,81 @@ +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  =HelloWorld("World") + +command! -nargs=? Echo :call EchoFunc() + +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" + +" ALE Linters configuration +let g:dict = {} +let g:dict.item = ['l1', 'l2'] + +" ALE Fixers configuration +let g:dict2 = {'dict_item': ['l1', 'l2'], 'di2': 'x'} + +filetype plugin indent on +syntax enable diff --git a/tests/syntax-tests/source/VimL/source.vim b/tests/syntax-tests/source/VimL/source.vim new file mode 100644 index 0000000000..b3b14a435e --- /dev/null +++ b/tests/syntax-tests/source/VimL/source.vim @@ -0,0 +1,81 @@ +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 =HelloWorld("World") + +command! -nargs=? Echo :call EchoFunc() + +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" + +" ALE Linters configuration +let g:dict = {} +let g:dict.item = ['l1', 'l2'] + +" ALE Fixers configuration +let g:dict2 = {'dict_item': ['l1', 'l2'], 'di2': 'x'} + +filetype plugin indent on +syntax enable