Skip to content

Commit

Permalink
vim-patch:86b4816766d9 (neovim#21314)
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
2 people authored and Nero-F committed Dec 16, 2022
1 parent 08e66a5 commit d76a420
Show file tree
Hide file tree
Showing 23 changed files with 1,096 additions and 57 deletions.
100 changes: 100 additions & 0 deletions runtime/autoload/zig/fmt.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
" Adapted from fatih/vim-go: autoload/go/fmt.vim
"
" Copyright 2011 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" Upstream: https://github.com/ziglang/zig.vim

function! zig#fmt#Format() abort
" Save cursor position and many other things.
let view = winsaveview()

if !executable('zig')
echohl Error | echomsg "no zig binary found in PATH" | echohl None
return
endif

let cmdline = 'zig fmt --stdin --ast-check'
let current_buf = bufnr('')

" The formatted code is output on stdout, the errors go on stderr.
if exists('*systemlist')
silent let out = systemlist(cmdline, current_buf)
else
silent let out = split(system(cmdline, current_buf))
endif
if len(out) == 1
if out[0] == "error: unrecognized parameter: '--ast-check'"
let cmdline = 'zig fmt --stdin'
if exists('*systemlist')
silent let out = systemlist(cmdline, current_buf)
else
silent let out = split(system(cmdline, current_buf))
endif
endif
endif
let err = v:shell_error


if err == 0
" remove undo point caused via BufWritePre.
try | silent undojoin | catch | endtry

" Replace the file content with the formatted version.
if exists('*deletebufline')
call deletebufline(current_buf, len(out), line('$'))
else
silent execute ':' . len(out) . ',' . line('$') . ' delete _'
endif
call setline(1, out)

" No errors detected, close the loclist.
call setloclist(0, [], 'r')
lclose
elseif get(g:, 'zig_fmt_parse_errors', 1)
let errors = s:parse_errors(expand('%'), out)

call setloclist(0, [], 'r', {
\ 'title': 'Errors',
\ 'items': errors,
\ })

let max_win_height = get(g:, 'zig_fmt_max_window_height', 5)
" Prevent the loclist from becoming too long.
let win_height = min([max_win_height, len(errors)])
" Open the loclist, but only if there's at least one error to show.
execute 'silent! lwindow ' . win_height
endif

call winrestview(view)

if err != 0
echohl Error | echomsg "zig fmt returned error" | echohl None
return
endif

" Run the syntax highlighter on the updated content and recompute the folds if
" needed.
syntax sync fromstart
endfunction

" parse_errors parses the given errors and returns a list of parsed errors
function! s:parse_errors(filename, lines) abort
" list of errors to be put into location list
let errors = []
for line in a:lines
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
if !empty(tokens)
call add(errors,{
\"filename": a:filename,
\"lnum": tokens[2],
\"col": tokens[3],
\"text": tokens[4],
\ })
endif
endfor

return errors
endfunction
" vim: sw=2 ts=2 et
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

0 comments on commit d76a420

Please sign in to comment.