diff --git a/ftplugin/zig.vim b/ftplugin/zig.vim index 1675d20c9..675a3bcfc 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(|||^\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 ad06ef5d3..2cc1cb23d 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 " Pawel 'kTT' Salata " Ricardo Catalinas Jiménez -" 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 7b6019572..3a9109286 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) =~# '\%(#.*\)\@ " Contributor: Adam Rutkowski -" 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 a8ad7482c..c9bae6390 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 9ab64571a..f9f889c54 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\?\\\\/