diff options
-rw-r--r-- | ftplugin/zig.vim | 10 | ||||
-rw-r--r-- | indent/erlang.vim | 2 | ||||
-rw-r--r-- | indent/graphql.vim | 25 | ||||
-rw-r--r-- | scripts/Gemfile | 3 | ||||
-rw-r--r-- | syntax/dune.vim | 2 | ||||
-rw-r--r-- | syntax/erlang.vim | 2 | ||||
-rw-r--r-- | syntax/odin.vim | 4 | ||||
-rw-r--r-- | syntax/zig.vim | 2 |
8 files changed, 34 insertions, 16 deletions
diff --git a/ftplugin/zig.vim b/ftplugin/zig.vim index 1675d20c..675a3bcf 100644 --- a/ftplugin/zig.vim +++ b/ftplugin/zig.vim @@ -26,6 +26,16 @@ if has("comments") setlocal commentstring=//\ %s endif +if has('find_in_path') + let &l:includeexpr='substitute(v:fname, "^([^.])$", "\1.zig", "")' + let &l:include='\v(\@import>|\@cInclude>|^\s*\#\s*include)' + let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)' +endif + +if has('eval') + execute 'setlocal path+=' . json_decode(system('zig env'))['std_dir'] +endif + let b:undo_ftplugin = "setl et< ts< sts< sw< fo< sua< mp< com< cms<" let &cpo = s:cpo_orig diff --git a/indent/erlang.vim b/indent/erlang.vim index ad06ef5d..2cc1cb23 100644 --- a/indent/erlang.vim +++ b/indent/erlang.vim @@ -6,7 +6,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'erlang') == -1 " Contributors: Edwin Fine <efine145_nospam01 at usa dot net> " Pawel 'kTT' Salata <rockplayer.pl@gmail.com> " Ricardo Catalinas Jiménez <jimenezrick@gmail.com> -" Last Update: 2017-Feb-28 +" Last Update: 2020-Jun-11 " License: Vim license " URL: https://github.com/vim-erlang/vim-erlang-runtime diff --git a/indent/graphql.vim b/indent/graphql.vim index 7b601957..3a910928 100644 --- a/indent/graphql.vim +++ b/indent/graphql.vim @@ -45,6 +45,10 @@ endif let s:cpo_save = &cpoptions set cpoptions&vim +" searchpair() skip expression that matches in comments and strings. +let s:pair_skip_expr = + \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "comment\\|string"' + " Check if the character at lnum:col is inside a string. function s:InString(lnum, col) return synIDattr(synID(a:lnum, a:col, 1), 'name') ==# 'graphqlString' @@ -61,18 +65,18 @@ function GetGraphQLIndent() let l:line = getline(v:lnum) " If this line contains just a closing bracket, find its matching opening - " bracket and indent the closing backet to match. + " bracket and indent the closing bracket to match. let l:col = matchend(l:line, '^\s*[]})]') if l:col > 0 && !s:InString(v:lnum, l:col) - let l:bracket = l:line[l:col - 1] call cursor(v:lnum, l:col) - if l:bracket is# '}' - let l:matched = searchpair('{', '', '}', 'bW') - elseif l:bracket is# ']' - let l:matched = searchpair('\[', '', '\]', 'bW') - elseif l:bracket is# ')' - let l:matched = searchpair('(', '', ')', 'bW') + let l:bracket = l:line[l:col - 1] + if l:bracket ==# '}' + let l:matched = searchpair('{', '', '}', 'bW', s:pair_skip_expr) + elseif l:bracket ==# ']' + let l:matched = searchpair('\[', '', '\]', 'bW', s:pair_skip_expr) + elseif l:bracket ==# ')' + let l:matched = searchpair('(', '', ')', 'bW', s:pair_skip_expr) else let l:matched = -1 endif @@ -85,9 +89,8 @@ function GetGraphQLIndent() return indent(v:lnum) endif - " If the previous line contained an opening bracket, and we are still in it, - " add indent depending on the bracket type. - if getline(l:prevlnum) =~# '[[{(]\s*$' + " If the previous line ended with an opening bracket, indent this line. + if getline(l:prevlnum) =~# '\%(#.*\)\@<![[{(]\s*$' return indent(l:prevlnum) + shiftwidth() endif diff --git a/scripts/Gemfile b/scripts/Gemfile new file mode 100644 index 00000000..fc8e5745 --- /dev/null +++ b/scripts/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "jasherai-oniguruma" diff --git a/syntax/dune.vim b/syntax/dune.vim index b9160f78..31925088 100644 --- a/syntax/dune.vim +++ b/syntax/dune.vim @@ -20,7 +20,7 @@ syn keyword lispKey ppx_runtime_libraries virtual_deps js_of_ocaml link_flags syn keyword lispKey javascript_files flags ocamlc_flags ocamlopt_flags pps staged_pps syn keyword lispKey library_flags c_flags c_library_flags kind package action syn keyword lispKey deps targets locks fallback -syn keyword lispKey inline_tests tests names +syn keyword lispKey inline_tests tests test names syn keyword lispAtom true false diff --git a/syntax/erlang.vim b/syntax/erlang.vim index a60eaad9..65b8059c 100644 --- a/syntax/erlang.vim +++ b/syntax/erlang.vim @@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'erlang') == -1 " Language: Erlang (http://www.erlang.org) " Maintainer: Csaba Hoch <csaba.hoch@gmail.com> " Contributor: Adam Rutkowski <hq@mtod.org> -" Last Update: 2019-Jun-18 +" Last Update: 2020-May-26 " License: Vim license " URL: https://github.com/vim-erlang/vim-erlang-runtime diff --git a/syntax/odin.vim b/syntax/odin.vim index a8ad7482..c9bae639 100644 --- a/syntax/odin.vim +++ b/syntax/odin.vim @@ -16,6 +16,7 @@ syntax keyword odinBitField bit_field syntax keyword odinBitSet bit_set syntax keyword odinIf if +syntax keyword odinWhen when syntax keyword odinElse else syntax keyword odinDo do syntax keyword odinFor for @@ -36,7 +37,7 @@ syntax match odinFixMe "FIXME" syntax match odinNoCheckin "NOCHECKIN" syntax match odinHack "HACK" -syntax keyword odinDataType string bool b8 b16 b32 b64 rune any rawptr f32 f64 f32le f32be f64le f64be u8 u16 u32 u64 u128 u16le u32le u64le u128le u16be u32be u64be u128be uint i8 i16 i32 i64 i128 i16le i32le i64le i128le i16be i32be i64be i128be int +syntax keyword odinDataType string cstring bool b8 b16 b32 b64 rune any rawptr f32 f64 f32le f32be f64le f64be u8 u16 u32 u64 u128 u16le u32le u64le u128le u16be u32be u64be u128be uint i8 i16 i32 i64 i128 i16le i32le i64le i128le i16be i32be i64be i128be int syntax keyword odinBool true false syntax keyword odinNull nil syntax keyword odinDynamic dynamic @@ -138,6 +139,7 @@ highlight link odinDynamicFunction Function highlight link odinMacro Macro highlight link odinIf Conditional +highlight link odinWhen Conditional highlight link odinElse Conditional highlight link odinFor Repeat diff --git a/syntax/zig.vim b/syntax/zig.vim index 9ab64571..f9f889c5 100644 --- a/syntax/zig.vim +++ b/syntax/zig.vim @@ -60,7 +60,7 @@ syn match zigCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{6}\)\)'/ contain syn region zigBlock start="{" end="}" transparent fold syn region zigCommentLine start="//" end="$" contains=zigTodo,@Spell -syn region zigCommentLineDoc start="////\@!" end="$" contains=zigTodo,@Spell +syn region zigCommentLineDoc start="//[/!]/\@!" end="$" contains=zigTodo,@Spell " TODO: match only the first '\\' within the zigMultilineString as zigMultilineStringPrefix syn match zigMultilineStringPrefix display contained /c\?\\\\/ |