Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerun committed Sep 15, 2020
1 parent 4314841 commit d43d269
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 16 deletions.
10 changes: 10 additions & 0 deletions ftplugin/zig.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion indent/erlang.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
" Ricardo Catalinas Jiménez <[email protected]>
" Last Update: 2017-Feb-28
" Last Update: 2020-Jun-11
" License: Vim license
" URL: https://github.com/vim-erlang/vim-erlang-runtime

Expand Down
25 changes: 14 additions & 11 deletions indent/graphql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand All @@ -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

Expand Down
3 changes: 3 additions & 0 deletions scripts/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "jasherai-oniguruma"
2 changes: 1 addition & 1 deletion syntax/dune.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion syntax/erlang.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'erlang') == -1
" Language: Erlang (http://www.erlang.org)
" Maintainer: Csaba Hoch <[email protected]>
" Contributor: Adam Rutkowski <[email protected]>
" Last Update: 2019-Jun-18
" Last Update: 2020-May-26
" License: Vim license
" URL: https://github.com/vim-erlang/vim-erlang-runtime

Expand Down
4 changes: 3 additions & 1 deletion syntax/odin.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion syntax/zig.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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\?\\\\/
Expand Down

0 comments on commit d43d269

Please sign in to comment.