Skip to content

Commit

Permalink
vim-patch:86b4816766d9
Browse files Browse the repository at this point in the history
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
clason and brammool committed Dec 8, 2022
1 parent f8aa2a0 commit 82569a1
Show file tree
Hide file tree
Showing 22 changed files with 996 additions and 57 deletions.
39 changes: 39 additions & 0 deletions runtime/compiler/dotnet.vim
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
28 changes: 28 additions & 0 deletions runtime/compiler/zig.vim
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
29 changes: 29 additions & 0 deletions runtime/compiler/zig_build.vim
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
27 changes: 27 additions & 0 deletions runtime/compiler/zig_build_exe.vim
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
27 changes: 27 additions & 0 deletions runtime/compiler/zig_test.vim
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
5 changes: 5 additions & 0 deletions runtime/doc/fold.txt
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,11 @@ line is folded, it cannot be displayed there.
Many movement commands handle a sequence of folded lines like an empty line.
For example, the "w" command stops once in the first column.

When starting a search in a closed fold it will not find a match in the
current fold. It's like a forward search always starts from the end of the
closed fold, while a backwards search starts from the start of the closed
fold.

When in Insert mode, the cursor line is never folded. That allows you to see
what you type!

Expand Down
4 changes: 2 additions & 2 deletions runtime/doc/map.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ Possible attributes are:
number.
-count=N A count (default N) which is specified either in the line
number position, or as an initial argument (like |:Next|).
-count acts like -count=0
-count Acts like -count=0

Note that -range=N and -count=N are mutually exclusive - only one should be
specified.
Expand All @@ -1489,7 +1489,7 @@ Possible values are (second column is the short name used in listing):
-addr=windows win Range for windows
-addr=tabs tab Range for tab pages
-addr=quickfix qf Range for quickfix entries
-addr=other ? other kind of range; can use ".", "$" and "%"
-addr=other ? Other kind of range; can use ".", "$" and "%"
as with "lines" (this is the default for
-count)

Expand Down
8 changes: 8 additions & 0 deletions runtime/doc/syntax.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3571,6 +3571,14 @@ highlighting is to put the following line in your |vimrc|: >
<


WDL *wdl.vim* *wdl-syntax*

The Workflow Description Language is a way to specify data processing workflows
with a human-readable and writeable syntax. This is used a lot in
bioinformatics. More info on the spec can be found here:
https://github.com/openwdl/wdl


XF86CONFIG *xf86conf.vim* *ft-xf86conf-syntax*

The syntax of XF86Config file differs in XFree86 v3.x and v4.x. Both
Expand Down
2 changes: 2 additions & 0 deletions runtime/doc/windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ autocommand event can be used.
If you want to get notified of text in windows scrolling vertically or
horizontally, the |WinScrolled| autocommand event can be used. This will also
trigger in window size changes.
Exception: the events will not be triggered when the text scrolls for
'incsearch'.
*WinResized-event*
The |WinResized| event is triggered after updating the display, several
windows may have changed size then. A list of the IDs of windows that changed
Expand Down
5 changes: 3 additions & 2 deletions runtime/ftplugin/cs.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
" Language: C#
" Maintainer: Nick Jensen <nickspoon@gmail.com>
" Former Maintainer: Johannes Zellner <johannes@zellner.org>
" Last Change: 2021-12-07
" Last Change: 2022-11-16
" License: Vim (see :h license)
" Repository: https://github.com/nickspoons/vim-cs

Expand All @@ -25,8 +25,9 @@ let b:undo_ftplugin = 'setl com< fo<'

if exists('loaded_matchit') && !exists('b:match_words')
" #if/#endif support included by default
let b:match_ignorecase = 0
let b:match_words = '\%(^\s*\)\@<=#\s*region\>:\%(^\s*\)\@<=#\s*endregion\>,'
let b:undo_ftplugin .= ' | unlet! b:match_words'
let b:undo_ftplugin .= ' | unlet! b:match_ignorecase b:match_words'
endif

if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter')
Expand Down
4 changes: 2 additions & 2 deletions runtime/ftplugin/vim.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Vim
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2022 Sep 09
" Last Change: 2022 Nov 27

" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
Expand Down Expand Up @@ -98,7 +98,7 @@ if exists("loaded_matchit")
" func name
" require a parenthesis following, then there can be an "endfunc".
let b:match_words =
\ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+(:\%(\%(^\||\)\s*\)\@<=\<retu\%[rn]\>:\%(\%(^\||\)\s*\)\@<=\<\%(endf\%[unction]\|enddef\)\>,' .
\ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+\s*(:\%(\%(^\||\)\s*\)\@<=\<retu\%[rn]\>:\%(\%(^\||\)\s*\)\@<=\<\%(endf\%[unction]\|enddef\)\>,' .
\ '\<\(wh\%[ile]\|for\)\>:\%(\%(^\||\)\s*\)\@<=\<brea\%[k]\>:\%(\%(^\||\)\s*\)\@<=\<con\%[tinue]\>:\%(\%(^\||\)\s*\)\@<=\<end\(w\%[hile]\|fo\%[r]\)\>,' .
\ '\<if\>:\%(\%(^\||\)\s*\)\@<=\<el\%[seif]\>:\%(\%(^\||\)\s*\)\@<=\<en\%[dif]\>,' .
\ '{:},' .
Expand Down
66 changes: 66 additions & 0 deletions runtime/ftplugin/zig.vim
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
80 changes: 80 additions & 0 deletions runtime/indent/zig.vim
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

0 comments on commit 82569a1

Please sign in to comment.