Run scripts/build with changes

This commit is contained in:
Nick White
2024-07-24 14:11:07 -07:00
parent be4b94a788
commit ccddddd81e
206 changed files with 3989 additions and 2763 deletions

View File

@@ -23,57 +23,80 @@ if exists("*GetCucumberIndent")
finish
endif
function! s:syn(lnum)
return synIDattr(synID(a:lnum,1+indent(a:lnum),1),'name')
let s:headings = {
\ 'Feature': 'feature',
\ 'Rule': 'rule',
\ 'Background': 'bg_or_scenario',
\ 'Scenario': 'bg_or_scenario',
\ 'ScenarioOutline': 'bg_or_scenario',
\ 'Examples': 'examples',
\ 'Scenarios': 'examples'}
function! s:Line(lnum) abort
if getline(a:lnum) =~# ':'
let group = matchstr(synIDattr(synID(a:lnum,1+indent(a:lnum), 1), 'name'), '^cucumber\zs.*')
if !has_key(s:headings, group)
let group = substitute(matchstr(getline(a:lnum), '^\s*\zs\%([^:]\+\)\ze:\S\@!'), '\s\+', '', 'g')
endif
else
let group = ''
endif
let char = matchstr(getline(a:lnum), '^\s*\zs[[:punct:]]')
return {
\ 'lnum': a:lnum,
\ 'indent': indent(a:lnum),
\ 'heading': get(s:headings, group, ''),
\ 'tag': char ==# '@',
\ 'table': char ==# '|',
\ 'comment': char ==# '#',
\ }
endfunction
function! GetCucumberIndent()
let line = getline(prevnonblank(v:lnum-1))
let cline = getline(v:lnum)
let nline = getline(nextnonblank(v:lnum+1))
let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth()
let syn = s:syn(prevnonblank(v:lnum-1))
let csyn = s:syn(v:lnum)
let nsyn = s:syn(nextnonblank(v:lnum+1))
if csyn ==# 'cucumberFeature' || cline =~# '^\s*Feature:'
function! GetCucumberIndent(...) abort
let lnum = a:0 ? a:1 : v:lnum
let sw = shiftwidth()
let prev = s:Line(prevnonblank(lnum-1))
let curr = s:Line(lnum)
let next = s:Line(nextnonblank(lnum+1))
if curr.heading ==# 'feature'
" feature heading
return 0
elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):'
elseif curr.heading ==# 'examples'
" examples heading
return 2 * sw
elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
elseif curr.heading ==# 'bg_or_scenario'
" background, scenario or outline heading
return sw
elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:'
elseif prev.heading ==# 'feature'
" line after feature heading
return sw
elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):'
elseif prev.heading ==# 'examples'
" line after examples heading
return 3 * sw
elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
elseif prev.heading ==# 'bg_or_scenario'
" line after background, scenario or outline heading
return 2 * sw
elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0)
elseif (curr.tag || curr.comment) && (next.heading ==# 'feature' || prev.indent <= 0)
" tag or comment before a feature heading
return 0
elseif cline =~# '^\s*@'
elseif curr.tag
" other tags
return sw
elseif cline =~# '^\s*[#|]' && line =~# '^\s*|'
elseif (curr.table || curr.comment) && prev.table
" mid-table
" preserve indent
return indent(prevnonblank(v:lnum-1))
elseif cline =~# '^\s*|' && line =~# '^\s*[^|]'
return prev.indent
elseif curr.table && !prev.table
" first line of a table, relative indent
return indent(prevnonblank(v:lnum-1)) + sw
elseif cline =~# '^\s*[^|]' && line =~# '^\s*|'
return prev.indent + sw
elseif !curr.table && prev.table
" line after a table, relative unindent
return indent(prevnonblank(v:lnum-1)) - sw
elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):')
return prev.indent - sw
elseif curr.comment && getline(v:lnum-1) =~# '^\s*$' && next.heading ==# 'bg_or_scenario'
" comments on scenarios
return sw
endif
return indent(prevnonblank(v:lnum-1))
return prev.indent < 0 ? 0 : prev.indent
endfunction
" vim:set sts=2 sw=2:

View File

@@ -6,7 +6,6 @@ endif
" Language: eRuby
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
if exists("b:did_indent")
finish

View File

@@ -189,6 +189,13 @@ function! GetFsharpIndent()
endif
" Don't change indent after lines begins with '//':
if lline =~ '^\s*//'
let i = indent(v:lnum)
return i == 0 ? ind : i
endif
" Add a 'shiftwidth' after lines ending with:
if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$'
let ind = ind + &sw

View File

@@ -2,7 +2,7 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'indent/graphql.vim
finish
endif
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
" Copyright (c) Jon Parise <jon@indelible.org>
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
@@ -64,11 +64,11 @@ function GetGraphQLIndent()
return 0
endif
" If the previous line isn't GraphQL, don't change this line's indentation.
" Assume we've been manually indented as part of a template string.
" If the previous line isn't GraphQL, assume we're part of a template
" string and indent this new line within it.
let l:stack = map(synstack(l:prevlnum, 1), "synIDattr(v:val, 'name')")
if get(l:stack, -1) !~# '^graphql'
return -1
return indent(l:prevlnum) + shiftwidth()
endif
let l:line = getline(v:lnum)

View File

@@ -18,7 +18,7 @@ setlocal indentkeys-=0{
setlocal indentkeys-=0}
setlocal nosmartindent
let b:undo_indent = "setl ai< inde< indk< si<"
let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys< smartindent<"
" Only define the function once.
if exists("*GetJuliaIndent")
@@ -294,7 +294,7 @@ function IsInContinuationImportLine(lnum)
if len(stack) == 0
return 0
endif
return JuliaMatch(a:lnum, getline(a:lnum), '\<\%(import\|using\|export\)\>', indent(a:lnum)) == -1
return JuliaMatch(a:lnum, getline(a:lnum), '\<\%(import\|using\|export\|public\)\>', indent(a:lnum)) == -1
endfunction
function IsFunctionArgPar(lnum, c)
@@ -444,10 +444,10 @@ function GetJuliaIndent()
" Decrease indentation for each closed block in the current line
let ind -= shiftwidth() * num_closed_blocks
" Additional special case: multiline import/using/export statements
" Additional special case: multiline import/using/export/public statements
let prevline = getline(lnum)
" Are we in a multiline import/using/export statement, right below the
" Are we in a multiline import/using/export/public statement, right below the
" opening line?
if IsInContinuationImportLine(v:lnum) && !IsInContinuationImportLine(lnum)
if get(g:, 'julia_indent_align_import', 1)
@@ -461,9 +461,9 @@ function GetJuliaIndent()
return cind + 2
endif
else
" if the opening line is not a naked import/using/export statement, use
" if the opening line is not a naked import/using/export/public statement, use
" it as reference
let iind = JuliaMatch(lnum, prevline, '\<import\|using\|export\>', indent(lnum), lim)
let iind = JuliaMatch(lnum, prevline, '\<import\|using\|export\|public\>', indent(lnum), lim)
if iind >= 0
" assuming whitespace after using... so no `using(XYZ)` please!
let nonwhiteind = JuliaMatch(lnum, prevline, '\S', iind+6, -1, 'basic')
@@ -475,7 +475,7 @@ function GetJuliaIndent()
endif
let ind += shiftwidth()
" Or did we just close a multiline import/using/export statement?
" Or did we just close a multiline import/using/export/public statement?
elseif !IsInContinuationImportLine(v:lnum) && IsInContinuationImportLine(lnum)
" find the starting line of the statement
let ilnum = 0

55
indent/just.vim Normal file
View File

@@ -0,0 +1,55 @@
if polyglot#init#is_disabled(expand('<sfile>:p'), 'just', 'indent/just.vim')
finish
endif
" Vim indent file
" Language: Justfile
" Maintainer: Noah Bogart <noah.bogart@hey.com>
" URL: https://github.com/NoahTheDuke/vim-just.git
" Last Change: 2024 Jan 25
" Only load this indent file when no other was loaded yet.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetJustfileIndent()
setlocal indentkeys=0},0),!^F,o,O,0=''',0=\"\"\"
let b:undo_indent = "setlocal indentexpr< indentkeys<"
if exists("*GetJustfileIndent")
finish
endif
function GetJustfileIndent()
if v:lnum < 2
return 0
endif
let prev_line = getline(v:lnum - 1)
let last_indent = indent(v:lnum - 1)
if getline(v:lnum) =~ "\\v^\\s+%([})]|'''$|\"\"\"$)"
return last_indent - shiftwidth()
elseif prev_line =~ '\V#'
return last_indent
elseif prev_line =~ "\\v%([:{(]|^.*\\S.*%([^']'''|[^\"]\"\"\"))\\s*$"
return last_indent + shiftwidth()
elseif prev_line =~ '\\$'
if v:lnum == 2 || getline(v:lnum - 2) !~ '\\$'
if prev_line =~ '\v:\=@!'
return last_indent + shiftwidth() + shiftwidth()
else
return last_indent + shiftwidth()
endif
endif
elseif v:lnum > 2 && getline(v:lnum - 2) =~ '\\$'
return last_indent - shiftwidth()
elseif prev_line =~ '\v:\s*%(\h|\()' && prev_line !~ '\V:='
return last_indent + shiftwidth()
endif
return last_indent
endfunction

View File

@@ -31,7 +31,7 @@ function GetLedgerIndent(...)
if line =~# '^\s\+\S'
" Lines that already are indented (→postings, sub-directives) keep their indentation.
return &shiftwidth
return shiftwidth()
elseif line =~# '^\s*$'
" Current line is empty, try to guess its type based on the previous line.
if prev =~# '^\([[:digit:]~=]\|\s\+\S\)'
@@ -40,7 +40,7 @@ function GetLedgerIndent(...)
" indented you will have to indent the first line following a
" pre-declaration manually. This makes it easier to type long lists of
" 'account' pre-declarations without sub-directives, for example.
return &shiftwidth
return shiftwidth()
else
return 0
endif

View File

@@ -35,6 +35,8 @@ let b:did_indent = 1
setlocal indentexpr=GetLilyPondIndent()
setlocal indentkeys=o,O,},>>,!^F
let b:undo_indent = "setlocal indentexpr< indentkeys<"
" Only define the function once.
if exists("*GetLilyPondIndent")
finish

View File

@@ -2,16 +2,76 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'nginx', 'indent/nginx.vim')
finish
endif
if exists("b:did_indent")
finish
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
setlocal indentexpr=
setlocal indentexpr=GetNginxIndent()
" cindent actually works for nginx' simple file structure
setlocal cindent
" Just make sure that the comments are not reset as defs would be.
setlocal cinkeys-=0#
setlocal indentkeys=0{,0},0#,!^F,o,O
let b:undo_indent = "setl cin< cink< inde<"
let b:undo_indent = 'setl inde< indk<'
" Only define the function once.
if exists('*GetNginxIndent')
finish
endif
function GetNginxIndent() abort
let plnum = s:PrevNotAsBlank(v:lnum - 1)
" Hit the start of the file, use zero indent.
if plnum == 0
return 0
endif
let ind = indent(plnum)
" Add a 'shiftwidth' after '{'
if s:AsEndWith(getline(plnum), '{')
let ind = ind + shiftwidth()
end
" Subtract a 'shiftwidth' on '}'
" This is the part that requires 'indentkeys'.
if getline(v:lnum) =~ '^\s*}'
let ind = ind - shiftwidth()
endif
let pplnum = s:PrevNotAsBlank(plnum - 1)
if s:IsLineContinuation(plnum)
if !s:IsLineContinuation(pplnum)
let ind = ind + shiftwidth()
end
else
if s:IsLineContinuation(pplnum)
let ind = ind - shiftwidth()
end
endif
return ind
endfunction
" Find the first line at or above {lnum} that is non-blank and not a comment.
function s:PrevNotAsBlank(lnum) abort
let lnum = prevnonblank(a:lnum)
while lnum > 0
if getline(lnum) !~ '^\s*#'
break
endif
let lnum = prevnonblank(lnum - 1)
endwhile
return lnum
endfunction
" Check whether {line} ends with {pat}, ignoring trailing comments.
function s:AsEndWith(line, pat) abort
return a:line =~ a:pat . '\m\s*\%(#.*\)\?$'
endfunction
function s:IsLineContinuation(lnum) abort
return a:lnum > 0 && !s:AsEndWith(getline(a:lnum), '[;{}]')
endfunction

View File

@@ -1,41 +0,0 @@
if polyglot#init#is_disabled(expand('<sfile>:p'), 'pony', 'indent/pony.vim')
finish
endif
" Vim indent file
" Language: Pony
" Maintainer: Jak Wings
if exists('b:did_indent')
finish
endif
let s:cpo_save = &cpo
set cpo&vim
setlocal nolisp
setlocal nocindent
setlocal nosmartindent
setlocal autoindent
setlocal indentexpr=pony#Indent()
setlocal indentkeys=!^F,o,O,0\|,0(,0),0[,0],0{,0},0==>,0=\"\"\",0=end,0=then,0=else,0=in,0=do,0=until,0=actor,0=class,0=struct,0=primitive,0=trait,0=interface,0=new,0=be,0=fun,0=type,0=use
setlocal cinkeys=!^F,o,O,0\|,0(,0),0[,0],0{,0},0==>,0=\"\"\",0=end,0=then,0=else,0=in,0=do,0=until,0=actor,0=class,0=struct,0=primitive,0=trait,0=interface,0=new,0=be,0=fun,0=type,0=use
setlocal cinwords=ifdef,if,match,while,for,repeat,try,with,recover,object,lambda,then,elseif,else,until,do,actor,class,struct,primitive,trait,interface,new,be,fun,iftype,elseiftype
augroup pony
autocmd! * <buffer>
autocmd CursorHold <buffer> call pony#ClearTrailingSpace(1, 1)
"autocmd InsertEnter <buffer> call pony#ClearTrailingSpace(0, 0)
autocmd InsertLeave <buffer> call pony#ClearTrailingSpace(0, 1)
autocmd BufWritePre <buffer> call pony#ClearTrailingSpace(1, 0, 1)
augroup END
let b:undo_indent = 'set lisp< cindent< autoindent< smartindent< indentexpr< indentkeys< cinkeys< cinwords<'
\ . ' | execute("autocmd! pony * <buffer>")'
let &cpo = s:cpo_save
unlet s:cpo_save
let b:did_indent = 1

View File

@@ -7,7 +7,6 @@ endif
" Maintainer: Andrew Radev <andrey.radev@gmail.com>
" Previous Maintainer: Nikolai Weibull <now at bitwi.se>
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" 0. Initialization {{{1
" =================

View File

@@ -119,7 +119,14 @@ function! GetSvelteIndent()
let cursyns = s:SynsSOL(v:lnum)
let cursyn = get(cursyns, 0, '')
if s:SynHTML(cursyn) && !s:IsMultipleLineSvelteExpression(curline, cursyns)
if s:IsMultipleLineTemplateString(curline, cursyns)
call s:Log('current line is multiline template string expression')
if !s:IsMultipleLineTemplateString(prevline, prevsyns)
let ind = indent(v:lnum - 1) + &sw
else
let ind = indent(v:lnum - 1)
endif
elseif s:SynHTML(cursyn) && !s:IsMultipleLineSvelteExpression(curline, cursyns)
call s:Log('syntax: html')
let ind = XmlIndentGet(v:lnum, 0)
if prevline =~? s:empty_tag
@@ -247,6 +254,20 @@ function! s:IsMultipleLineSvelteExpression(curline, syns)
return 0
endfunction
function! s:IsMultipleLineTemplateString(curline, syns)
if a:curline =~ '^\s*{.*}\s*$'
return 0
endif
for syn in a:syns
if syn ==? 'javaScriptTemplateString'
return 1
endif
endfor
return 0
endfunction
function! s:SynBlockBody(syn)
return a:syn ==? 'svelteBlockBody'
endfunction