-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update runtime files vim/vim@86b4816 vim-patch:9.0.1029: autoload directory missing from distribution Problem: Autoload directory missing from distribution. Solution: Add the autoload/zig directory to the list of distributed files. vim/vim@84dbf85 Co-authored-by: Bram Moolenaar <Bram@vim.org>
- Loading branch information
Showing
22 changed files
with
996 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
" Vim compiler file | ||
" Compiler: dotnet build (.NET CLI) | ||
" Maintainer: Nick Jensen <nickspoon@gmail.com> | ||
" Last Change: 2022-12-06 | ||
" License: Vim (see :h license) | ||
" Repository: https://github.com/nickspoons/vim-cs | ||
|
||
if exists("current_compiler") | ||
finish | ||
endif | ||
let current_compiler = "dotnet" | ||
|
||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal | ||
command -nargs=* CompilerSet setlocal <args> | ||
endif | ||
|
||
let s:cpo_save = &cpo | ||
set cpo&vim | ||
|
||
if get(g:, "dotnet_errors_only", v:false) | ||
CompilerSet makeprg=dotnet\ build\ -nologo | ||
\\ -consoleloggerparameters:NoSummary | ||
\\ -consoleloggerparameters:ErrorsOnly | ||
else | ||
CompilerSet makeprg=dotnet\ build\ -nologo\ -consoleloggerparameters:NoSummary | ||
endif | ||
|
||
if get(g:, "dotnet_show_project_file", v:true) | ||
CompilerSet errorformat=%E%f(%l\\,%c):\ %trror\ %m, | ||
\%W%f(%l\\,%c):\ %tarning\ %m, | ||
\%-G%.%# | ||
else | ||
CompilerSet errorformat=%E%f(%l\\,%c):\ %trror\ %m\ [%.%#], | ||
\%W%f(%l\\,%c):\ %tarning\ %m\ [%.%#], | ||
\%-G%.%# | ||
endif | ||
|
||
let &cpo = s:cpo_save | ||
unlet s:cpo_save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
" Vim compiler file | ||
" Compiler: Zig Compiler | ||
" Upstream: https://github.com/ziglang/zig.vim | ||
|
||
if exists("current_compiler") | ||
finish | ||
endif | ||
let current_compiler = "zig" | ||
|
||
let s:save_cpo = &cpo | ||
set cpo&vim | ||
|
||
if exists(":CompilerSet") != 2 | ||
command -nargs=* CompilerSet setlocal <args> | ||
endif | ||
|
||
" a subcommand must be provided for the this compiler (test, build-exe, etc) | ||
if has('patch-7.4.191') | ||
CompilerSet makeprg=zig\ \$*\ \%:S | ||
else | ||
CompilerSet makeprg=zig\ \$*\ \"%\" | ||
endif | ||
|
||
" TODO: improve errorformat as needed. | ||
|
||
let &cpo = s:save_cpo | ||
unlet s:save_cpo | ||
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
" Vim compiler file | ||
" Compiler: Zig Compiler (zig build) | ||
" Upstream: https://github.com/ziglang/zig.vim | ||
|
||
if exists('current_compiler') | ||
finish | ||
endif | ||
runtime compiler/zig.vim | ||
let current_compiler = 'zig_build' | ||
|
||
let s:save_cpo = &cpo | ||
set cpo&vim | ||
|
||
|
||
if exists(':CompilerSet') != 2 | ||
command -nargs=* CompilerSet setlocal <args> | ||
endif | ||
|
||
if exists('g:zig_build_makeprg_params') | ||
execute 'CompilerSet makeprg=zig\ build\ '.escape(g:zig_build_makeprg_params, ' \|"').'\ $*' | ||
else | ||
CompilerSet makeprg=zig\ build\ $* | ||
endif | ||
|
||
" TODO: anything to add to errorformat for zig build specifically? | ||
|
||
let &cpo = s:save_cpo | ||
unlet s:save_cpo | ||
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
" Vim compiler file | ||
" Compiler: Zig Compiler (zig build-exe) | ||
" Upstream: https://github.com/ziglang/zig.vim | ||
|
||
if exists('current_compiler') | ||
finish | ||
endif | ||
runtime compiler/zig.vim | ||
let current_compiler = 'zig_build_exe' | ||
|
||
let s:save_cpo = &cpo | ||
set cpo&vim | ||
|
||
|
||
if exists(':CompilerSet') != 2 | ||
command -nargs=* CompilerSet setlocal <args> | ||
endif | ||
|
||
if has('patch-7.4.191') | ||
CompilerSet makeprg=zig\ build-exe\ \%:S\ \$* | ||
else | ||
CompilerSet makeprg=zig\ build-exe\ \"%\"\ \$* | ||
endif | ||
|
||
let &cpo = s:save_cpo | ||
unlet s:save_cpo | ||
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
" Vim compiler file | ||
" Compiler: Zig Compiler (zig test) | ||
" Upstream: https://github.com/ziglang/zig.vim | ||
|
||
if exists('current_compiler') | ||
finish | ||
endif | ||
runtime compiler/zig.vim | ||
let current_compiler = 'zig_test' | ||
|
||
let s:save_cpo = &cpo | ||
set cpo&vim | ||
|
||
|
||
if exists(':CompilerSet') != 2 | ||
command -nargs=* CompilerSet setlocal <args> | ||
endif | ||
|
||
if has('patch-7.4.191') | ||
CompilerSet makeprg=zig\ test\ \%:S\ \$* | ||
else | ||
CompilerSet makeprg=zig\ test\ \"%\"\ \$* | ||
endif | ||
|
||
let &cpo = s:save_cpo | ||
unlet s:save_cpo | ||
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
" Vim filetype plugin file | ||
" Language: Zig | ||
" Upstream: https://github.com/ziglang/zig.vim | ||
|
||
" Only do this when not done yet for this buffer | ||
if exists("b:did_ftplugin") | ||
finish | ||
endif | ||
|
||
let b:did_ftplugin = 1 | ||
|
||
let s:cpo_orig = &cpo | ||
set cpo&vim | ||
|
||
compiler zig_build | ||
|
||
" Match Zig builtin fns | ||
setlocal iskeyword+=@-@ | ||
|
||
" Recomended code style, no tabs and 4-space indentation | ||
setlocal expandtab | ||
setlocal tabstop=8 | ||
setlocal softtabstop=4 | ||
setlocal shiftwidth=4 | ||
|
||
setlocal formatoptions-=t formatoptions+=croql | ||
|
||
setlocal suffixesadd=.zig,.zir | ||
|
||
if has('comments') | ||
setlocal 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)' | ||
endif | ||
|
||
let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)' | ||
|
||
if !exists('g:zig_std_dir') && exists('*json_decode') && executable('zig') | ||
silent let s:env = system('zig env') | ||
if v:shell_error == 0 | ||
let g:zig_std_dir = json_decode(s:env)['std_dir'] | ||
endif | ||
unlet! s:env | ||
endif | ||
|
||
if exists('g:zig_std_dir') | ||
let &l:path = &l:path . ',' . g:zig_std_dir | ||
endif | ||
|
||
let b:undo_ftplugin = | ||
\ 'setl isk< et< ts< sts< sw< fo< sua< mp< com< cms< inex< inc< pa<' | ||
|
||
augroup vim-zig | ||
autocmd! * <buffer> | ||
autocmd BufWritePre <buffer> if get(g:, 'zig_fmt_autosave', 1) | call zig#fmt#Format() | endif | ||
augroup END | ||
|
||
let b:undo_ftplugin .= '|au! vim-zig * <buffer>' | ||
|
||
let &cpo = s:cpo_orig | ||
unlet s:cpo_orig | ||
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
" Vim filetype indent file | ||
" Language: Zig | ||
" Upstream: https://github.com/ziglang/zig.vim | ||
|
||
" Only load this indent file when no other was loaded. | ||
if exists("b:did_indent") | ||
finish | ||
endif | ||
let b:did_indent = 1 | ||
|
||
if (!has("cindent") || !has("eval")) | ||
finish | ||
endif | ||
|
||
setlocal cindent | ||
|
||
" L0 -> 0 indent for jump labels (i.e. case statement in c). | ||
" j1 -> indenting for "javascript object declarations" | ||
" J1 -> see j1 | ||
" w1 -> starting a new line with `(` at the same indent as `(` | ||
" m1 -> if `)` starts a line, match its indent with the first char of its | ||
" matching `(` line | ||
" (s -> use one indent, when starting a new line after a trailing `(` | ||
setlocal cinoptions=L0,m1,(s,j1,J1,l1 | ||
|
||
" cinkeys: controls what keys trigger indent formatting | ||
" 0{ -> { | ||
" 0} -> } | ||
" 0) -> ) | ||
" 0] -> ] | ||
" !^F -> make CTRL-F (^F) reindent the current line when typed | ||
" o -> when <CR> or `o` is used | ||
" O -> when the `O` command is used | ||
setlocal cinkeys=0{,0},0),0],!^F,o,O | ||
|
||
setlocal indentexpr=GetZigIndent(v:lnum) | ||
|
||
let b:undo_indent = "setlocal cindent< cinkeys< cinoptions< indentexpr<" | ||
|
||
function! GetZigIndent(lnum) | ||
let curretLineNum = a:lnum | ||
let currentLine = getline(a:lnum) | ||
|
||
" cindent doesn't handle multi-line strings properly, so force no indent | ||
if currentLine =~ '^\s*\\\\.*' | ||
return -1 | ||
endif | ||
|
||
let prevLineNum = prevnonblank(a:lnum-1) | ||
let prevLine = getline(prevLineNum) | ||
|
||
" for lines that look like | ||
" }, | ||
" }; | ||
" try treating them the same as a } | ||
if prevLine =~ '\v^\s*},$' | ||
if currentLine =~ '\v^\s*};$' || currentLine =~ '\v^\s*}$' | ||
return indent(prevLineNum) - 4 | ||
endif | ||
return indent(prevLineNum-1) - 4 | ||
endif | ||
if currentLine =~ '\v^\s*},$' | ||
return indent(prevLineNum) - 4 | ||
endif | ||
if currentLine =~ '\v^\s*};$' | ||
return indent(prevLineNum) - 4 | ||
endif | ||
|
||
|
||
" cindent doesn't handle this case correctly: | ||
" switch (1): { | ||
" 1 => true, | ||
" ~ | ||
" ^---- indents to here | ||
if prevLine =~ '.*=>.*,$' && currentLine !~ '.*}$' | ||
return indent(prevLineNum) | ||
endif | ||
|
||
return cindent(a:lnum) | ||
endfunction |
Oops, something went wrong.