0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

Update runtime files

This commit is contained in:
Bram Moolenaar
2022-08-08 15:42:38 +01:00
parent cf85d97baf
commit 48c3f4e0bf
19 changed files with 511 additions and 210 deletions

2
.github/CODEOWNERS vendored
View File

@@ -98,6 +98,7 @@ runtime/doc/pi_tar.txt @cecamp
runtime/doc/pi_vimball.txt @cecamp runtime/doc/pi_vimball.txt @cecamp
runtime/doc/pi_zip.txt @cecamp runtime/doc/pi_zip.txt @cecamp
runtime/doc/ps1.txt @heaths runtime/doc/ps1.txt @heaths
runtime/ftplugin/abaqus.vim @costerwi
runtime/ftplugin/awk.vim @dkearns runtime/ftplugin/awk.vim @dkearns
runtime/ftplugin/basic.vim @dkearns runtime/ftplugin/basic.vim @dkearns
runtime/ftplugin/bst.vim @tpope runtime/ftplugin/bst.vim @tpope
@@ -267,6 +268,7 @@ runtime/plugin/netrwPlugin.vim @cecamp
runtime/plugin/tarPlugin.vim @cecamp runtime/plugin/tarPlugin.vim @cecamp
runtime/plugin/vimballPlugin.vim @cecamp runtime/plugin/vimballPlugin.vim @cecamp
runtime/plugin/zipPlugin.vim @cecamp runtime/plugin/zipPlugin.vim @cecamp
runtime/syntax/abaqus.vim @costerwi
runtime/syntax/aidl.vim @dpelle runtime/syntax/aidl.vim @dpelle
runtime/syntax/amiga.vim @cecamp runtime/syntax/amiga.vim @cecamp
runtime/syntax/arduino.vim @johshoff runtime/syntax/arduino.vim @johshoff

View File

@@ -348,7 +348,7 @@ export def FTidl()
setf idl setf idl
enddef enddef
# Distinguish between "default" and Cproto prototype file. */ # Distinguish between "default", Prolog and Cproto prototype file.
export def ProtoCheck(default: string) export def ProtoCheck(default: string)
# Cproto files have a comment in the first line and a function prototype in # Cproto files have a comment in the first line and a function prototype in
# the second line, it always ends in ";". Indent files may also have # the second line, it always ends in ";". Indent files may also have
@@ -357,9 +357,16 @@ export def ProtoCheck(default: string)
# chacter before the ';'. # chacter before the ';'.
if getline(2) =~ '.;$' if getline(2) =~ '.;$'
setf cpp setf cpp
else
# recognize Prolog by specific text in the first non-empty line
# require a blank after the '%' because Perl uses "%list" and "%translate"
var l = getline(nextnonblank(1))
if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
setf prolog
else else
exe 'setf ' .. default exe 'setf ' .. default
endif endif
endif
enddef enddef
export def FTm() export def FTm()

View File

@@ -3,13 +3,28 @@
let s:keepcpo= &cpo let s:keepcpo= &cpo
set cpo&vim set cpo&vim
" searchpair() can be slow, limit the time to 150 msec or what is put in
" g:pyindent_searchpair_timeout
let s:searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150)
" Identing inside parentheses can be very slow, regardless of the searchpair()
" timeout, so let the user disable this feature if he doesn't need it
let s:disable_parentheses_indenting = get(g:, 'pyindent_disable_parentheses_indenting', v:false)
let s:maxoff = 50 " maximum number of lines to look backwards for ()
function s:SearchBracket(fromlnum, flags)
return searchpairpos('[[({]', '', '[])}]', a:flags,
\ {-> synID('.', col('.'), v:true)->synIDattr('name')
\ =~ '\%(Comment\|Todo\|String\)$'},
\ [0, a:fromlnum - s:maxoff]->max(), s:searchpair_timeout)
endfunction
" See if the specified line is already user-dedented from the expected value. " See if the specified line is already user-dedented from the expected value.
function s:Dedented(lnum, expected) function s:Dedented(lnum, expected)
return indent(a:lnum) <= a:expected - shiftwidth() return indent(a:lnum) <= a:expected - shiftwidth()
endfunction endfunction
let s:maxoff = 50 " maximum number of lines to look backwards for ()
" Some other filetypes which embed Python have slightly different indent " Some other filetypes which embed Python have slightly different indent
" rules (e.g. bitbake). Those filetypes can pass an extra funcref to this " rules (e.g. bitbake). Those filetypes can pass an extra funcref to this
" function which is evaluated below. " function which is evaluated below.
@@ -39,30 +54,30 @@ function python#GetIndent(lnum, ...)
return 0 return 0
endif endif
call cursor(plnum, 1) if s:disable_parentheses_indenting == 1
" Identing inside parentheses can be very slow, regardless of the searchpair()
" timeout, so let the user disable this feature if he doesn't need it
let disable_parentheses_indenting = get(g:, "pyindent_disable_parentheses_indenting", 0)
if disable_parentheses_indenting == 1
let plindent = indent(plnum) let plindent = indent(plnum)
let plnumstart = plnum let plnumstart = plnum
else else
" searchpair() can be slow sometimes, limit the time to 150 msec or what is " Indent inside parens.
" put in g:pyindent_searchpair_timeout " Align with the open paren unless it is at the end of the line.
let searchpair_stopline = 0 " E.g.
let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150) " open_paren_not_at_EOL(100,
" (200,
" 300),
" 400)
" open_paren_at_EOL(
" 100, 200, 300, 400)
call cursor(a:lnum, 1)
let [parlnum, parcol] = s:SearchBracket(a:lnum, 'nbW')
if parlnum > 0 && parcol != col([parlnum, '$']) - 1
return parcol
endif
call cursor(plnum, 1)
" If the previous line is inside parenthesis, use the indent of the starting " If the previous line is inside parenthesis, use the indent of the starting
" line. " line.
" Trick: use the non-existing "dummy" variable to break out of the loop when let [parlnum, _] = s:SearchBracket(plnum, 'nbW')
" going too far back.
let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW',
\ "line('.') < " . (plnum - s:maxoff) . " ? dummy :"
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
\ searchpair_stopline, searchpair_timeout)
if parlnum > 0 if parlnum > 0
if a:0 > 0 && ExtraFunc(parlnum) if a:0 > 0 && ExtraFunc(parlnum)
" We may have found the opening brace of a bitbake Python task, e.g. 'python do_task {' " We may have found the opening brace of a bitbake Python task, e.g. 'python do_task {'
@@ -85,11 +100,7 @@ function python#GetIndent(lnum, ...)
" + b " + b
" + c) " + c)
call cursor(a:lnum, 1) call cursor(a:lnum, 1)
let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', let [p, _] = s:SearchBracket(a:lnum, 'bW')
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
\ searchpair_stopline, searchpair_timeout)
if p > 0 if p > 0
if a:0 > 0 && ExtraFunc(p) if a:0 > 0 && ExtraFunc(p)
" Currently only used by bitbake " Currently only used by bitbake
@@ -109,11 +120,7 @@ function python#GetIndent(lnum, ...)
else else
if p == plnum if p == plnum
" When the start is inside parenthesis, only indent one 'shiftwidth'. " When the start is inside parenthesis, only indent one 'shiftwidth'.
let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', let [pp, _] = s:SearchBracket(a:lnum, 'bW')
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
\ searchpair_stopline, searchpair_timeout)
if pp > 0 if pp > 0
return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth())
endif endif
@@ -136,12 +143,12 @@ function python#GetIndent(lnum, ...)
" If the last character in the line is a comment, do a binary search for " If the last character in the line is a comment, do a binary search for
" the start of the comment. synID() is slow, a linear search would take " the start of the comment. synID() is slow, a linear search would take
" too long on a long line. " too long on a long line.
if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)$" if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)"
let min = 1 let min = 1
let max = pline_len let max = pline_len
while min < max while min < max
let col = (min + max) / 2 let col = (min + max) / 2
if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)$" if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)"
let max = col let max = col
else else
let min = col + 1 let min = col + 1

View File

@@ -26,6 +26,7 @@ Get specific help: It is possible to go directly to whatever you want help
Option ' :help 'textwidth' Option ' :help 'textwidth'
Regular expression / :help /[ Regular expression / :help /[
See |help-summary| for more contexts and an explanation. See |help-summary| for more contexts and an explanation.
See |notation| for an explanation of the help syntax.
Search for help: Type ":help word", then hit CTRL-D to see matching Search for help: Type ":help word", then hit CTRL-D to see matching
help entries for "word". help entries for "word".

View File

@@ -808,8 +808,33 @@ A jump table for the options with a short description can be found at |Q_op|.
When on, Vim will change the current working directory whenever you When on, Vim will change the current working directory whenever you
change the directory of the shell running in a terminal window. You change the directory of the shell running in a terminal window. You
need proper setting-up, so whenever the shell's pwd changes an OSC 7 need proper setting-up, so whenever the shell's pwd changes an OSC 7
escape sequence will be emitted. For example, on Linux, you can source escape sequence will be emitted. For example, on Linux, you can
/etc/profile.d/vte.sh in your shell profile if you use bash or zsh. source /etc/profile.d/vte.sh in your shell profile if you use bash or
zsh. For bash this should work (put it in a bash init file): >
if [[ -n "$VIM_TERMINAL" ]]; then
PROMPT_COMMAND='_vim_sync_PWD'
function _vim_sync_PWD() {
printf "\033]7;file://%s\033\\" "$PWD"
}
fi
<
Or, in a zsh init file: >
if [[ -n "$VIM_TERMINAL" ]]; then
autoload -Uz add-zsh-hook
add-zsh-hook -Uz chpwd _vim_sync_PWD
function _vim_sync_PWD() {
printf "\033]7;file://%s\033\\" "$PWD"
}
fi
<
In a fish init file: >
if test -n "$VIM_TERMINAL"
function _vim_sync_PWD --on-variable=PWD
printf "\033]7;file://%s\033\\" "$PWD"
end
end
<
You can find an alternative method at |terminal-autoshelldir|.
When the parsing of the OSC sequence fails you get *E1179* . When the parsing of the OSC sequence fails you get *E1179* .
*'arabic'* *'arab'* *'noarabic'* *'noarab'* *'arabic'* *'arab'* *'noarabic'* *'noarab'*
@@ -1767,7 +1792,8 @@ A jump table for the options with a short description can be found at |Q_op|.
page can have a different value. page can have a different value.
When 'cmdheight' is zero, there is no command-line unless it is being When 'cmdheight' is zero, there is no command-line unless it is being
used. Any messages will cause the |hit-enter| prompt. used. Some informative messages will not be displayed, any other
messages will cause the |hit-enter| prompt.
*'cmdwinheight'* *'cwh'* *'cmdwinheight'* *'cwh'*
'cmdwinheight' 'cwh' number (default 7) 'cmdwinheight' 'cwh' number (default 7)
@@ -5027,8 +5053,8 @@ A jump table for the options with a short description can be found at |Q_op|.
*'lispwords'* *'lw'* *'lispwords'* *'lw'*
'lispwords' 'lw' string (default is very long) 'lispwords' 'lw' string (default is very long)
global or local to buffer |global-local| global or local to buffer |global-local|
Comma-separated list of words that influence the Lisp indenting. Comma-separated list of words that influence the Lisp indenting when
|'lisp'| enabled with the |'lisp'| option.
*'list'* *'nolist'* *'list'* *'nolist'*
'list' boolean (default off) 'list' boolean (default off)
@@ -7327,6 +7353,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Name of the word list file where words are added for the |zg| and |zw| Name of the word list file where words are added for the |zg| and |zw|
commands. It must end in ".{encoding}.add". You need to include the commands. It must end in ".{encoding}.add". You need to include the
path, otherwise the file is placed in the current directory. path, otherwise the file is placed in the current directory.
The path may include characters from 'isfname', space, comma and '@'.
*E765* *E765*
It may also be a comma-separated list of names. A count before the It may also be a comma-separated list of names. A count before the
|zg| and |zw| commands can be used to access each. This allows using |zg| and |zw| commands can be used to access each. This allows using

View File

@@ -7900,6 +7900,7 @@ if_tcl.txt if_tcl.txt /*if_tcl.txt*
ignore-errors eval.txt /*ignore-errors* ignore-errors eval.txt /*ignore-errors*
ignore-timestamp editing.txt /*ignore-timestamp* ignore-timestamp editing.txt /*ignore-timestamp*
import-legacy vim9.txt /*import-legacy* import-legacy vim9.txt /*import-legacy*
import-map vim9.txt /*import-map*
improved-autocmds-5.4 version5.txt /*improved-autocmds-5.4* improved-autocmds-5.4 version5.txt /*improved-autocmds-5.4*
improved-quickfix version5.txt /*improved-quickfix* improved-quickfix version5.txt /*improved-quickfix*
improved-sessions version5.txt /*improved-sessions* improved-sessions version5.txt /*improved-sessions*
@@ -10086,6 +10087,7 @@ termdebug_use_prompt terminal.txt /*termdebug_use_prompt*
termdebug_wide terminal.txt /*termdebug_wide* termdebug_wide terminal.txt /*termdebug_wide*
terminal terminal.txt /*terminal* terminal terminal.txt /*terminal*
terminal-api terminal.txt /*terminal-api* terminal-api terminal.txt /*terminal-api*
terminal-autoshelldir terminal.txt /*terminal-autoshelldir*
terminal-client-server terminal.txt /*terminal-client-server* terminal-client-server terminal.txt /*terminal-client-server*
terminal-close terminal.txt /*terminal-close* terminal-close terminal.txt /*terminal-close*
terminal-colors os_unix.txt /*terminal-colors* terminal-colors os_unix.txt /*terminal-colors*

View File

@@ -1019,6 +1019,36 @@ A trick to have Vim send this escape sequence: >
Rationale: Why not allow for any command or expression? Because that might Rationale: Why not allow for any command or expression? Because that might
create a security problem. create a security problem.
*terminal-autoshelldir*
This can be used to pass the current directory from a shell to Vim.
Put this in your .vimrc: >
def g:Tapi_lcd(_, args: string)
execute 'silent lcd ' .. args
enddef
<
And, in a bash init file: >
if [[ -n "$VIM_TERMINAL" ]]; then
PROMPT_COMMAND='_vim_sync_PWD'
function _vim_sync_PWD() {
printf '\033]51;["call", "Tapi_lcd", "%q"]\007' "$PWD"
}
fi
<
Or, for zsh: >
if [[ -n "$VIM_TERMINAL" ]]; then
autoload -Uz add-zsh-hook
add-zsh-hook -Uz chpwd _vim_sync_PWD
function _vim_sync_PWD() {
printf '\033]51;["call", "Tapi_lcd", "%q"]\007' "$PWD"
}
fi
<
Or, for fish: >
if test -n "$VIM_TERMINAL"
function _vim_sync_PWD --on-variable=PWD
printf '\033]51;["call", "Tapi_lcd", "%s"]\007' "$PWD"
end
end
Using the client-server feature ~ Using the client-server feature ~

View File

@@ -38,20 +38,6 @@ browser use: https://github.com/vim/vim/issues/1234
*known-bugs* *known-bugs*
-------------------- Known bugs and current work ----------------------- -------------------- Known bugs and current work -----------------------
Support virtual text: #7553
- Wrong cursor position in Insert mode, wrong pos after typing char #10786
- implement "text_align" - right
when not truncated, may increase line height
- implement "text_align" - below
need to compute extra screen line
- implement "text_wrap" - truncate
- when Tab is in text handle it like a space
- Also consider an empty line, should fix #10786. Also check inserting text.
- win_lbr_chartabsize() TODO item: count screen cells
- check that when inserting/deleting text col == MAXCOL isn't changed
- wrong cursor position (Yegappan, July 27)
- many tests
Further Vim9 improvements, possibly after launch: Further Vim9 improvements, possibly after launch:
- Use Vim9 for more runtime files. - Use Vim9 for more runtime files.
- Check performance with callgrind and kcachegrind. - Check performance with callgrind and kcachegrind.
@@ -129,19 +115,6 @@ Popup windows:
Use ERROR_IF_POPUP_WINDOW for these. Use ERROR_IF_POPUP_WINDOW for these.
- Figure out the size and position better if wrapping inserts indent - Figure out the size and position better if wrapping inserts indent
Text properties:
- property is overruled by cursorline. (#8225).
Add better control over priority? Make list of all highlighting, specify
where property fits in.
Or Should we let the textprop highlight overrule other (e.g. diff) highlight
if the priority is above a certain value? (#7392)
Combining text property with 'cursorline' does not always work (Billie
Cleek, #5533)
- Add text property that shifts text to make room for annotation (e.g.
variable type). Like the opposite of conceal. Requires fixing the cursor
positioning and mouse clicks as with conceal mode.
- See remarks at top of src/textprop.c
'incsearch' with :s: 'incsearch' with :s:
- :s/foo using CTRL-G moves to another line, should not happen, or use the - :s/foo using CTRL-G moves to another line, should not happen, or use the
correct line (it uses the last but one line) (Lifepillar, Aug 18, #3345) correct line (it uses the last but one line) (Lifepillar, Aug 18, #3345)
@@ -248,6 +221,7 @@ consistenly (James McCoy, #10698)
To avoid flicker: add an option that when a screen clear is requested, instead To avoid flicker: add an option that when a screen clear is requested, instead
of clearing it draws everything and uses "clear to end of line" for every line. of clearing it draws everything and uses "clear to end of line" for every line.
Resetting 't_ut' already causes this?
When scheme can't be found by configure there is no clear "not found" message: When scheme can't be found by configure there is no clear "not found" message:
configure:5769: checking MzScheme install prefix configure:5769: checking MzScheme install prefix
@@ -2679,6 +2653,8 @@ Better 'rightleft' or BIDI support:
Spell checking: Spell checking:
- [s does not find missing capital at start of the line. #10838
Probably because the dot at the end of the previous line isn't seen.
- When 'cursorline' is set and the first word should have SpellCap - When 'cursorline' is set and the first word should have SpellCap
highlighting, redrawing the line removes it when moving the cursor away highlighting, redrawing the line removes it when moving the cursor away
from the line. (#7085) Would need to inspect the end of the previous line from the line. (#7085) Would need to inspect the end of the previous line
@@ -3784,6 +3760,7 @@ Printing:
Syntax highlighting: Syntax highlighting:
Long term goal: faster, better, etc. Options: Long term goal: faster, better, etc. Options:
- use treesitter, NeoVim uses it - Many people don't like it. - use treesitter, NeoVim uses it - Many people don't like it.
After changes requires rebuilding the library.
- use TextMate, vscode uses it. #9087 - Other people don't like it. - use TextMate, vscode uses it. #9087 - Other people don't like it.
Vscode is asked to switch to treesitter: Vscode is asked to switch to treesitter:
https://github.com/microsoft/vscode/issues/50140 https://github.com/microsoft/vscode/issues/50140

View File

@@ -268,14 +268,15 @@ when it doesn't, append !: >
You cannot `unlet` script-local variables in |Vim9| script, only in legacy You cannot `unlet` script-local variables in |Vim9| script, only in legacy
script. script.
When a script finishes, the local variables declared there will not be When a script has been processed to the end, the local variables declared
deleted. Functions defined in the script can use them. Example: there will not be deleted. Functions defined in the script can use them.
Example:
> >
vim9script vim9script
var counter = 0 var counter = 0
def g:GetCount(): number def g:GetCount(): number
s:counter += 1 counter += 1
return s:counter return counter
enddef enddef
Every time you call the function it will return the next count: > Every time you call the function it will return the next count: >

View File

@@ -1773,7 +1773,7 @@ line, there can be no line break: >
name # Error! name # Error!
echo that echo that
.name # Error! .name # Error!
< *import-map*
When you've imported a function from one script into a vim9 script you can When you've imported a function from one script into a vim9 script you can
refer to the imported function in a mapping by prefixing it with |<SID>|: > refer to the imported function in a mapping by prefixing it with |<SID>|: >
noremap <silent> ,a :call <SID>name.Function()<CR> noremap <silent> ,a :call <SID>name.Function()<CR>

View File

@@ -1,7 +1,7 @@
" Vim filetype plugin file " Vim filetype plugin file
" Language: Abaqus finite element input file (www.abaqus.com) " Language: Abaqus finite element input file (www.abaqus.com)
" Maintainer: Carl Osterwisch <osterwischc@asme.org> " Maintainer: Carl Osterwisch <costerwi@gmail.com>
" Last Change: 2022 May 09 " Last Change: 2022 Aug 03
" Only do this when not done yet for this buffer " Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif if exists("b:did_ftplugin") | finish | endif
@@ -46,7 +46,7 @@ if has("folding")
endif endif
" Set the file browse filter (currently only supported under Win32 gui) " Set the file browse filter (currently only supported under Win32 gui)
if has("gui_win32") && !exists("b:browsefilter") if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Abaqus Input Files (*.inp *.inc)\t*.inp;*.inc\n" . let b:browsefilter = "Abaqus Input Files (*.inp *.inc)\t*.inp;*.inc\n" .
\ "Abaqus Results (*.dat)\t*.dat\n" . \ "Abaqus Results (*.dat)\t*.dat\n" .
\ "Abaqus Messages (*.pre *.msg *.sta)\t*.pre;*.msg;*.sta\n" . \ "Abaqus Messages (*.pre *.msg *.sta)\t*.pre;*.msg;*.sta\n" .
@@ -65,14 +65,15 @@ if exists("loaded_matchit") && !exists("b:match_words")
let b:undo_ftplugin .= "|unlet! b:match_ignorecase b:match_words" let b:undo_ftplugin .= "|unlet! b:match_ignorecase b:match_words"
endif endif
" Define keys used to move [count] keywords backward or forward. if !exists("no_plugin_maps") && !exists("no_abaqus_maps")
noremap <silent><buffer> [[ ?^\*\a<CR>:nohlsearch<CR> " Define keys used to move [count] keywords backward or forward.
noremap <silent><buffer> ]] /^\*\a<CR>:nohlsearch<CR> noremap <silent><buffer> [[ ?^\*\a<CR>:nohlsearch<CR>
noremap <silent><buffer> ]] /^\*\a<CR>:nohlsearch<CR>
" Define key to toggle commenting of the current line or range " Define key to toggle commenting of the current line or range
noremap <silent><buffer> <LocalLeader><LocalLeader> noremap <silent><buffer> <LocalLeader><LocalLeader>
\ :call <SID>Abaqus_ToggleComment()<CR>j \ :call <SID>Abaqus_ToggleComment()<CR>j
function! <SID>Abaqus_ToggleComment() range function! <SID>Abaqus_ToggleComment() range
if strpart(getline(a:firstline), 0, 2) == "**" if strpart(getline(a:firstline), 0, 2) == "**"
" Un-comment all lines in range " Un-comment all lines in range
silent execute a:firstline . ',' . a:lastline . 's/^\*\*//' silent execute a:firstline . ',' . a:lastline . 's/^\*\*//'
@@ -80,10 +81,11 @@ function! <SID>Abaqus_ToggleComment() range
" Comment all lines in range " Comment all lines in range
silent execute a:firstline . ',' . a:lastline . 's/^/**/' silent execute a:firstline . ',' . a:lastline . 's/^/**/'
endif endif
endfunction endfunction
let b:undo_ftplugin .= "|unmap <buffer> [[|unmap <buffer> ]]" let b:undo_ftplugin .= "|unmap <buffer> [[|unmap <buffer> ]]"
\ . "|unmap <buffer> <LocalLeader><LocalLeader>" \ . "|unmap <buffer> <LocalLeader><LocalLeader>"
endif
" Undo must be done in nocompatible mode for <LocalLeader>. " Undo must be done in nocompatible mode for <LocalLeader>.
let b:undo_ftplugin = "let b:cpo_save = &cpoptions|" let b:undo_ftplugin = "let b:cpo_save = &cpoptions|"

View File

@@ -1,12 +1,12 @@
" Vim filetype plugin file " Vim filetype plugin file
" Language: php " Language: PHP
" " Maintainer: Doug Kearns <dougkearns@gmail.com>
" This runtime file is looking for a new maintainer. " Previous Maintainer: Dan Sharp
" " Last Changed: 2022 Jul 20
" Former maintainer: Dan Sharp
" Last Changed: 20 Jan 2009
if exists("b:did_ftplugin") | finish | endif if exists("b:did_ftplugin")
finish
endif
" Make sure the continuation lines below do not cause problems in " Make sure the continuation lines below do not cause problems in
" compatibility mode. " compatibility mode.
@@ -15,7 +15,7 @@ set cpo&vim
" Define some defaults in case the included ftplugins don't set them. " Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = "" let s:undo_ftplugin = ""
let s:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" . let s:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" ..
\ "All Files (*.*)\t*.*\n" \ "All Files (*.*)\t*.*\n"
let s:match_words = "" let s:match_words = ""
@@ -24,63 +24,130 @@ let b:did_ftplugin = 1
" Override our defaults if these were set by an included ftplugin. " Override our defaults if these were set by an included ftplugin.
if exists("b:undo_ftplugin") if exists("b:undo_ftplugin")
" let b:undo_ftplugin = "setlocal comments< commentstring< formatoptions< omnifunc<"
let s:undo_ftplugin = b:undo_ftplugin let s:undo_ftplugin = b:undo_ftplugin
endif endif
if exists("b:browsefilter") if exists("b:browsefilter")
" let b:undo_ftplugin ..= " | unlet! b:browsefilter b:html_set_browsefilter"
let s:browsefilter = b:browsefilter let s:browsefilter = b:browsefilter
endif endif
if exists("b:match_words") if exists("b:match_words")
" let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words b:html_set_match_words"
let s:match_words = b:match_words let s:match_words = b:match_words
endif endif
if exists("b:match_skip") if exists("b:match_skip")
unlet b:match_skip unlet b:match_skip
endif endif
" Change the :browse e filter to primarily show PHP-related files. setlocal comments=s1:/*,mb:*,ex:*/,://,:#
if has("gui_win32") setlocal commentstring=/*%s*/
let b:browsefilter="PHP Files (*.php)\t*.php\n" . s:browsefilter setlocal formatoptions+=l formatoptions-=t
if get(g:, "php_autocomment", 1)
setlocal formatoptions+=croq
" NOTE: set g:PHP_autoformatcomment = 0 to prevent the indent plugin from
" overriding this 'comments' value
setlocal comments-=:#
" space after # comments to exclude attributes
setlocal comments+=b:#
endif endif
if exists('&omnifunc')
setlocal omnifunc=phpcomplete#CompletePHP
endif
setlocal suffixesadd=.php
" ### " ###
" Provided by Mikolaj Machowski <mikmach at wp dot pl> " Provided by Mikolaj Machowski <mikmach at wp dot pl>
setlocal include=\\\(require\\\|include\\\)\\\(_once\\\)\\\? setlocal include=\\\(require\\\|include\\\)\\\(_once\\\)\\\?
" Disabled changing 'iskeyword', it breaks a command such as "*" " Disabled changing 'iskeyword', it breaks a command such as "*"
" setlocal iskeyword+=$ " setlocal iskeyword+=$
if exists("loaded_matchit") let b:undo_ftplugin = "setlocal include< suffixesadd<"
let b:match_words = '<?php:?>,\<switch\>:\<endswitch\>,' .
\ '\<if\>:\<elseif\>:\<else\>:\<endif\>,' . if exists("loaded_matchit") && exists("b:html_set_match_words")
\ '\<while\>:\<endwhile\>,' . let b:match_ignorecase = 1
\ '\<do\>:\<while\>,' . let b:match_words = 'PhpMatchWords()'
\ '\<for\>:\<endfor\>,' .
\ '\<foreach\>:\<endforeach\>,' . if !exists("*PhpMatchWords")
\ '(:),[:],{:},' . function! PhpMatchWords()
\ s:match_words " The PHP syntax file uses the Delimiter syntax group for the phpRegion
" matchgroups, without a "php" prefix, so use the stack to test for the
" outer phpRegion group. This also means the closing ?> tag which is
" outside of the matched region just uses the Delimiter group for the
" end match.
let stack = synstack(line('.'), col('.'))
let php_region = !empty(stack) && synIDattr(stack[0], "name") =~# '\<php'
if php_region || getline(".") =~ '.\=\%.c\&?>'
let b:match_skip = "PhpMatchSkip('html')"
return '<?php\|<?=\=:?>,' ..
\ '\<if\>:\<elseif\>:\<else\>:\<endif\>,' ..
\ '\<switch\>:\<case\>:\<break\>:\<continue\>:\<endswitch\>,' ..
\ '\<while\>.\{-})\s*\::\<break\>:\<continue\>:\<endwhile\>,' ..
\ '\<do\>:\<break\>:\<continue\>:\<while\>,' ..
\ '\<for\>:\<break\>:\<continue\>:\<endfor\>,' ..
\ '\<foreach\>:\<break\>:\<continue\>:\<endforeach\>,' ..
\ '\%(<<<\s*\)\@<=''\=\(\h\w*\)''\=:^\s*\1\>'
" TODO: these probably aren't worth adding and really need syntax support
" '<\_s*script\_s*language\_s*=\_s*[''"]\=\_s*php\_s*[''"]\=\_s*>:<\_s*\_s*/\_s*script\_s*>,' ..
" '<%:%>,' ..
else
let b:match_skip = "PhpMatchSkip('php')"
return s:match_words
endif
endfunction
endif
if !exists("*PhpMatchSkip")
function! PhpMatchSkip(skip)
let name = synIDattr(synID(line('.'), col('.'), 1), 'name')
if a:skip == "html"
" ?> in line comments will also be correctly matched as Delimiter
return name =~? 'comment\|string' || name !~? 'php\|delimiter'
else " php
return name =~? 'comment\|string\|php'
endif
endfunction
endif
let b:undo_ftplugin ..= " | unlet! b:match_skip"
endif endif
" ### " ###
if exists('&omnifunc') " Change the :browse e filter to primarily show PHP-related files.
setlocal omnifunc=phpcomplete#CompletePHP if (has("gui_win32") || has("gui_gtk")) && exists("b:html_set_browsefilter")
let b:browsefilter = "PHP Files (*.php)\t*.php\n" ..
\ "PHP Test Files (*.phpt)\t*.phpt\n" ..
\ s:browsefilter
endif endif
" Section jumping: [[ and ]] provided by Antony Scriven <adscriven at gmail dot com> if !exists("no_plugin_maps") && !exists("no_php_maps")
let s:function = '\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function' " Section jumping: [[ and ]] provided by Antony Scriven <adscriven at gmail dot com>
let s:class = '\(abstract\s\+\|final\s\+\)*class' let s:function = '\%(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function'
let s:interface = 'interface' let s:class = '\%(abstract\s\+\|final\s\+\)*class'
let s:section = '\(.*\%#\)\@!\_^\s*\zs\('.s:function.'\|'.s:class.'\|'.s:interface.'\)' let s:section = escape('^\s*\zs\%(' .. s:function .. '\|' .. s:class .. '\|interface\|trait\|enum\)\>', "|")
exe 'nno <buffer> <silent> [[ ?' . escape(s:section, '|') . '?<CR>:nohls<CR>'
exe 'nno <buffer> <silent> ]] /' . escape(s:section, '|') . '/<CR>:nohls<CR>'
exe 'ono <buffer> <silent> [[ ?' . escape(s:section, '|') . '?<CR>:nohls<CR>'
exe 'ono <buffer> <silent> ]] /' . escape(s:section, '|') . '/<CR>:nohls<CR>'
setlocal suffixesadd=.php function! s:Jump(pattern, count, flags)
setlocal commentstring=/*%s*/ normal! m'
for i in range(a:count)
if !search(a:pattern, a:flags)
break
endif
endfor
endfunction
" Undo the stuff we changed. for mode in ["n", "o", "x"]
let b:undo_ftplugin = "setlocal suffixesadd< commentstring< include< omnifunc<" . exe mode .. "noremap <buffer> <silent> ]] <Cmd>call <SID>Jump('" .. s:section .. "', v:count1, 'W')<CR>"
\ " | unlet! b:browsefilter b:match_words | " . exe mode .. "noremap <buffer> <silent> [[ <Cmd>call <SID>Jump('" .. s:section .. "', v:count1, 'bW')<CR>"
\ s:undo_ftplugin let b:undo_ftplugin ..= " | sil! exe '" .. mode .. "unmap <buffer> ]]'" ..
\ " | sil! exe '" .. mode .. "unmap <buffer> [['"
endfor
endif
let b:undo_ftplugin ..= " | " .. s:undo_ftplugin
" Restore the saved compatibility options. " Restore the saved compatibility options.
let &cpo = s:keepcpo let &cpo = s:keepcpo
unlet s:keepcpo unlet s:keepcpo
" vim: nowrap sw=2 sts=2 ts=8 noet:

View File

@@ -1,7 +1,7 @@
" Vim filetype plugin " Vim filetype plugin
" Language: Vim " Language: Vim
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2021 Apr 11 " Last Change: 2022 Aug 4
" Only do this when not done yet for this buffer " Only do this when not done yet for this buffer
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
@@ -110,7 +110,7 @@ if exists("loaded_matchit")
" - set spl=de,en " - set spl=de,en
" - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ … " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ …
let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name")
\ =~? "comment\\|string\\|vimSynReg\\|vimSet"' \ =~? "comment\\|string\\|vimLetHereDoc\\|vimSynReg\\|vimSet"'
endif endif
let &cpo = s:cpo_save let &cpo = s:cpo_save

View File

@@ -2,7 +2,7 @@
" Language: SystemVerilog " Language: SystemVerilog
" Maintainer: kocha <kocha.lsifrontend@gmail.com> " Maintainer: kocha <kocha.lsifrontend@gmail.com>
" Last Change: 05-Feb-2017 by Bilal Wasim " Last Change: 05-Feb-2017 by Bilal Wasim
" 2022 April: b:undo_indent added by Doug Kearns " 03-Aug-2022 Improved indent
" Only load this indent file when no other was loaded. " Only load this indent file when no other was loaded.
if exists("b:did_indent") if exists("b:did_indent")
@@ -15,7 +15,7 @@ setlocal indentkeys=!^F,o,O,0),0},=begin,=end,=join,=endcase,=join_any,=join_non
setlocal indentkeys+==endmodule,=endfunction,=endtask,=endspecify setlocal indentkeys+==endmodule,=endfunction,=endtask,=endspecify
setlocal indentkeys+==endclass,=endpackage,=endsequence,=endclocking setlocal indentkeys+==endclass,=endpackage,=endsequence,=endclocking
setlocal indentkeys+==endinterface,=endgroup,=endprogram,=endproperty,=endchecker setlocal indentkeys+==endinterface,=endgroup,=endprogram,=endproperty,=endchecker
setlocal indentkeys+==`else,=`endif setlocal indentkeys+==`else,=`elsif,=`endif
let b:undo_indent = "setl inde< indk<" let b:undo_indent = "setl inde< indk<"
@@ -27,6 +27,9 @@ endif
let s:cpo_save = &cpo let s:cpo_save = &cpo
set cpo&vim set cpo&vim
let s:multiple_comment = 0
let s:open_statement = 0
function SystemVerilogIndent() function SystemVerilogIndent()
if exists('b:systemverilog_indent_width') if exists('b:systemverilog_indent_width')
@@ -40,6 +43,12 @@ function SystemVerilogIndent()
let indent_modules = 0 let indent_modules = 0
endif endif
if exists('b:systemverilog_indent_ifdef_off')
let indent_ifdef = 0
else
let indent_ifdef = 1
endif
" Find a non-blank line above the current line. " Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1) let lnum = prevnonblank(v:lnum - 1)
@@ -54,48 +63,55 @@ function SystemVerilogIndent()
let last_line2 = getline(lnum2) let last_line2 = getline(lnum2)
let ind = indent(lnum) let ind = indent(lnum)
let ind2 = indent(lnum - 1) let ind2 = indent(lnum - 1)
let offset_comment1 = 1
" Define the condition of an open statement " Define the condition of an open statement
" Exclude the match of //, /* or */ " Exclude the match of //, /* or */
let sv_openstat = '\(\<or\>\|\([*/]\)\@<![*(,{><+-/%^&|!=?:]\([*/]\)\@!\)' let sv_openstat = '\(\<or\>\|\([*/]\)\@<![*(,{><+-/%^&|!=?:]\([*/]\)\@!\)'
" Define the condition when the statement ends with a one-line comment " Define the condition when the statement ends with a one-line comment
let sv_comment = '\(//.*\|/\*.*\*/\s*\)' let sv_comment = '\(//.*\|/\*.*\*/\s*\)'
if exists('b:verilog_indent_verbose') if exists('b:systemverilog_indent_verbose')
let vverb_str = 'INDENT VERBOSE:' let vverb_str = 'INDENT VERBOSE: '. v:lnum .":"
let vverb = 1 let vverb = 1
else else
let vverb = 0 let vverb = 0
endif endif
" Indent according to last line " Multiple-line comment count
" End of multiple-line comment if curr_line =~ '^\s*/\*' && curr_line !~ '/\*.\{-}\*/'
if last_line =~ '\*/\s*$' && last_line !~ '/\*.\{-}\*/' let s:multiple_comment += 1
let ind = ind - offset_comment1 if vverb | echom vverb_str "Start of multiple-line commnt" | endif
if vverb elseif curr_line =~ '\*/\s*$' && curr_line !~ '/\*.\{-}\*/'
echo vverb_str "De-indent after a multiple-line comment." let s:multiple_comment -= 1
if vverb | echom vverb_str "End of multiple-line commnt" | endif
return ind
endif
" Maintain indentation during commenting.
if s:multiple_comment > 0
return ind
endif endif
" Indent after if/else/for/case/always/initial/specify/fork blocks " Indent after if/else/for/case/always/initial/specify/fork blocks
elseif last_line =~ '`\@<!\<\(if\|else\)\>' || if last_line =~ '^\s*\(end\)\=\s*`\@<!\<\(if\|else\)\>' ||
\ last_line =~ '^\s*\<\(for\|case\%[[zx]]\|do\|foreach\|forever\|randcase\)\>' || \ last_line =~ '^\s*\<\(for\|while\|repeat\|case\%[[zx]]\|do\|foreach\|forever\|randcase\)\>' ||
\ last_line =~ '^\s*\<\(always\|always_comb\|always_ff\|always_latch\)\>' || \ last_line =~ '^\s*\<\(always\|always_comb\|always_ff\|always_latch\)\>' ||
\ last_line =~ '^\s*\<\(initial\|specify\|fork\|final\)\>' \ last_line =~ '^\s*\<\(initial\|specify\|fork\|final\)\>'
if last_line !~ '\(;\|\<end\>\)\s*' . sv_comment . '*$' || if last_line !~ '\(;\|\<end\>\|\*/\)\s*' . sv_comment . '*$' ||
\ last_line =~ '\(//\|/\*\).*\(;\|\<end\>\)\s*' . sv_comment . '*$' \ last_line =~ '\(//\|/\*\).*\(;\|\<end\>\)\s*' . sv_comment . '*$'
let ind = ind + offset let ind = ind + offset
if vverb | echo vverb_str "Indent after a block statement." | endif if vverb | echom vverb_str "Indent after a block statement." | endif
endif endif
" Indent after function/task/class/package/sequence/clocking/ " Indent after function/task/class/package/sequence/clocking/
" interface/covergroup/property/checkerprogram blocks " interface/covergroup/property/checkerprogram blocks
elseif last_line =~ '^\s*\<\(function\|task\|class\|package\)\>' || elseif last_line =~ '^\s*\<\(function\|task\|class\|package\)\>' ||
\ last_line =~ '^\s*\<\(sequence\|clocking\|interface\)\>' || \ last_line =~ '^\s*\<\(sequence\|clocking\|interface\)\>' ||
\ last_line =~ '^\s*\(\w\+\s*:\)\=\s*\<covergroup\>' || \ last_line =~ '^\s*\(\w\+\s*:\)\=\s*\<covergroup\>' ||
\ last_line =~ '^\s*\<\(property\|checker\|program\)\>' \ last_line =~ '^\s*\<\(property\|checker\|program\)\>' ||
\ ( last_line =~ '^\s*\<virtual\>' && last_line =~ '\<\(function\|task\|class\|interface\)\>' ) ||
\ ( last_line =~ '^\s*\<pure\>' && last_line =~ '\<virtual\>' && last_line =~ '\<\(function\|task\)\>' )
if last_line !~ '\<end\>\s*' . sv_comment . '*$' || if last_line !~ '\<end\>\s*' . sv_comment . '*$' ||
\ last_line =~ '\(//\|/\*\).*\(;\|\<end\>\)\s*' . sv_comment . '*$' \ last_line =~ '\(//\|/\*\).*\(;\|\<end\>\)\s*' . sv_comment . '*$'
let ind = ind + offset let ind = ind + offset
if vverb if vverb
echo vverb_str "Indent after function/task/class block statement." echom vverb_str "Indent after function/task/class block statement."
endif endif
endif endif
@@ -103,13 +119,13 @@ function SystemVerilogIndent()
elseif last_line =~ '^\s*\(\<extern\>\s*\)\=\<module\>' elseif last_line =~ '^\s*\(\<extern\>\s*\)\=\<module\>'
let ind = ind + indent_modules let ind = ind + indent_modules
if vverb && indent_modules if vverb && indent_modules
echo vverb_str "Indent after module statement." echom vverb_str "Indent after module statement."
endif endif
if last_line =~ '[(,]\s*' . sv_comment . '*$' && if last_line =~ '[(,]\s*' . sv_comment . '*$' &&
\ last_line !~ '\(//\|/\*\).*[(,]\s*' . sv_comment . '*$' \ last_line !~ '\(//\|/\*\).*[(,]\s*' . sv_comment . '*$'
let ind = ind + offset let ind = ind + offset
if vverb if vverb
echo vverb_str "Indent after a multiple-line module statement." echom vverb_str "Indent after a multiple-line module statement."
endif endif
endif endif
@@ -119,7 +135,7 @@ function SystemVerilogIndent()
\ ( last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' || \ ( last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' ||
\ last_line2 =~ '^\s*[^=!]\+\s*:\s*' . sv_comment . '*$' ) \ last_line2 =~ '^\s*[^=!]\+\s*:\s*' . sv_comment . '*$' )
let ind = ind + offset let ind = ind + offset
if vverb | echo vverb_str "Indent after begin statement." | endif if vverb | echom vverb_str "Indent after begin statement." | endif
" Indent after a '{' or a '(' " Indent after a '{' or a '('
elseif last_line =~ '[{(]' . sv_comment . '*$' && elseif last_line =~ '[{(]' . sv_comment . '*$' &&
@@ -127,7 +143,21 @@ function SystemVerilogIndent()
\ ( last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' || \ ( last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' ||
\ last_line2 =~ '^\s*[^=!]\+\s*:\s*' . sv_comment . '*$' ) \ last_line2 =~ '^\s*[^=!]\+\s*:\s*' . sv_comment . '*$' )
let ind = ind + offset let ind = ind + offset
if vverb | echo vverb_str "Indent after begin statement." | endif if vverb | echom vverb_str "Indent after begin statement." | endif
" Ignore de-indent for the end of one-line block
elseif ( last_line !~ '\<begin\>' ||
\ last_line =~ '\(//\|/\*\).*\<begin\>' ) &&
\ last_line2 =~ '\<\(`\@<!if\|`\@<!else\|for\|always\|initial\|do\|foreach\|forever\|final\)\>.*' .
\ sv_comment . '*$' &&
\ last_line2 !~ '\(//\|/\*\).*\<\(`\@<!if\|`\@<!else\|for\|always\|initial\|do\|foreach\|forever\|final\)\>' &&
\ last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' &&
\ ( last_line2 !~ '\<begin\>' ||
\ last_line2 =~ '\(//\|/\*\).*\<begin\>' ) &&
\ last_line2 =~ ')*\s*;\s*' . sv_comment . '*$'
if vverb
echom vverb_str "Ignore de-indent after the end of one-line statement."
endif
" De-indent for the end of one-line block " De-indent for the end of one-line block
elseif ( last_line !~ '\<begin\>' || elseif ( last_line !~ '\<begin\>' ||
@@ -136,11 +166,12 @@ function SystemVerilogIndent()
\ sv_comment . '*$' && \ sv_comment . '*$' &&
\ last_line2 !~ '\(//\|/\*\).*\<\(`\@<!if\|`\@<!else\|for\|always\|initial\|do\|foreach\|forever\|final\)\>' && \ last_line2 !~ '\(//\|/\*\).*\<\(`\@<!if\|`\@<!else\|for\|always\|initial\|do\|foreach\|forever\|final\)\>' &&
\ last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' && \ last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' &&
\ last_line2 !~ '\(;\|\<end\>\|\*/\)\s*' . sv_comment . '*$' &&
\ ( last_line2 !~ '\<begin\>' || \ ( last_line2 !~ '\<begin\>' ||
\ last_line2 =~ '\(//\|/\*\).*\<begin\>' ) \ last_line2 =~ '\(//\|/\*\).*\<begin\>' )
let ind = ind - offset let ind = ind - offset
if vverb if vverb
echo vverb_str "De-indent after the end of one-line statement." echom vverb_str "De-indent after the end of one-line statement."
endif endif
" Multiple-line statement (including case statement) " Multiple-line statement (including case statement)
@@ -150,25 +181,14 @@ function SystemVerilogIndent()
\ last_line !~ '\(//\|/\*\).*' . sv_openstat . '\s*$' && \ last_line !~ '\(//\|/\*\).*' . sv_openstat . '\s*$' &&
\ last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' \ last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$'
let ind = ind + offset let ind = ind + offset
if vverb | echo vverb_str "Indent after an open statement." | endif let s:open_statement = 1
if vverb | echom vverb_str "Indent after an open statement." | endif
" Close statement " `ifdef or `ifndef or `elsif or `else
" De-indent for an optional close parenthesis and a semicolon, and only elseif last_line =~ '^\s*`\<\(ifn\?def\|elsif\|else\)\>' && indent_ifdef
" if there exists precedent non-whitespace char
elseif last_line =~ ')*\s*;\s*' . sv_comment . '*$' &&
\ last_line !~ '^\s*)*\s*;\s*' . sv_comment . '*$' &&
\ last_line !~ '\(//\|/\*\).*\S)*\s*;\s*' . sv_comment . '*$' &&
\ ( last_line2 =~ sv_openstat . '\s*' . sv_comment . '*$' &&
\ last_line2 !~ ';\s*//.*$') &&
\ last_line2 !~ '^\s*' . sv_comment . '$'
let ind = ind - offset
if vverb | echo vverb_str "De-indent after a close statement." | endif
" `ifdef and `else
elseif last_line =~ '^\s*`\<\(ifdef\|else\)\>'
let ind = ind + offset let ind = ind + offset
if vverb if vverb
echo vverb_str "Indent after a `ifdef or `else statement." echom vverb_str "Indent after a `ifdef or `ifndef or `elsif or `else statement."
endif endif
endif endif
@@ -177,17 +197,21 @@ function SystemVerilogIndent()
" De-indent on the end of the block " De-indent on the end of the block
" join/end/endcase/endfunction/endtask/endspecify " join/end/endcase/endfunction/endtask/endspecify
if curr_line =~ '^\s*\<\(join\|join_any\|join_none\|\|end\|endcase\|while\)\>' || if curr_line =~ '^\s*\<\(join\|join_any\|join_none\|\|end\|endcase\)\>' ||
\ curr_line =~ '^\s*\<\(endfunction\|endtask\|endspecify\|endclass\)\>' || \ curr_line =~ '^\s*\<\(endfunction\|endtask\|endspecify\|endclass\)\>' ||
\ curr_line =~ '^\s*\<\(endpackage\|endsequence\|endclocking\|endinterface\)\>' || \ curr_line =~ '^\s*\<\(endpackage\|endsequence\|endclocking\|endinterface\)\>' ||
\ curr_line =~ '^\s*\<\(endgroup\|endproperty\|endchecker\|endprogram\)\>' || \ curr_line =~ '^\s*\<\(endgroup\|endproperty\|endchecker\|endprogram\)\>'
\ curr_line =~ '^\s*}'
let ind = ind - offset let ind = ind - offset
if vverb | echo vverb_str "De-indent the end of a block." | endif if vverb | echom vverb_str "De-indent the end of a block." | endif
if s:open_statement == 1
let ind = ind - offset
let s:open_statement = 0
if vverb | echom vverb_str "De-indent the close statement." | endif
endif
elseif curr_line =~ '^\s*\<endmodule\>' elseif curr_line =~ '^\s*\<endmodule\>'
let ind = ind - indent_modules let ind = ind - indent_modules
if vverb && indent_modules if vverb && indent_modules
echo vverb_str "De-indent the end of a module." echom vverb_str "De-indent the end of a module."
endif endif
" De-indent on a stand-alone 'begin' " De-indent on a stand-alone 'begin'
@@ -202,25 +226,46 @@ function SystemVerilogIndent()
\ last_line =~ sv_openstat . '\s*' . sv_comment . '*$' ) \ last_line =~ sv_openstat . '\s*' . sv_comment . '*$' )
let ind = ind - offset let ind = ind - offset
if vverb if vverb
echo vverb_str "De-indent a stand alone begin statement." echom vverb_str "De-indent a stand alone begin statement."
endif endif
endif if s:open_statement == 1
" De-indent after the end of multiple-line statement
elseif curr_line =~ '^\s*)' &&
\ ( last_line =~ sv_openstat . '\s*' . sv_comment . '*$' ||
\ last_line !~ sv_openstat . '\s*' . sv_comment . '*$' &&
\ last_line2 =~ sv_openstat . '\s*' . sv_comment . '*$' )
let ind = ind - offset let ind = ind - offset
if vverb let s:open_statement = 0
echo vverb_str "De-indent the end of a multiple statement." if vverb | echom vverb_str "De-indent the close statement." | endif
endif
endif endif
" De-indent `else and `endif " " Close statement
elseif curr_line =~ '^\s*`\<\(else\|endif\)\>' " " De-indent for an optional close parenthesis and a semicolon, and only
let ind = ind - offset " " if there exists precedent non-whitespace char
if vverb | echo vverb_str "De-indent `else and `endif statement." | endif " elseif last_line =~ ')*\s*;\s*' . sv_comment . '*$' &&
" \ last_line !~ '^\s*)*\s*;\s*' . sv_comment . '*$' &&
" \ last_line !~ '\(//\|/\*\).*\S)*\s*;\s*' . sv_comment . '*$' &&
" \ ( last_line2 =~ sv_openstat . '\s*' . sv_comment . '*$' &&
" \ last_line2 !~ ';\s*//.*$') &&
" \ last_line2 !~ '^\s*' . sv_comment . '$'
" let ind = ind - offset
" if vverb | echom vverb_str "De-indent after a close statement." | endif
" " De-indent after the end of multiple-line statement
" elseif curr_line =~ '^\s*)' &&
" \ ( last_line =~ sv_openstat . '\s*' . sv_comment . '*$' ||
" \ last_line !~ sv_openstat . '\s*' . sv_comment . '*$' &&
" \ last_line2 =~ sv_openstat . '\s*' . sv_comment . '*$' )
" let ind = ind - offset
" if vverb
" echom vverb_str "De-indent the end of a multiple statement."
" endif
" De-indent `elsif or `else or `endif
elseif curr_line =~ '^\s*`\<\(elsif\|else\|endif\)\>' && indent_ifdef
let ind = ind - offset
if vverb | echom vverb_str "De-indent `elsif or `else or `endif statement." | endif
if b:systemverilog_open_statement == 1
let ind = ind - offset
let b:systemverilog_open_statement = 0
if vverb | echom vverb_str "De-indent the open statement." | endif
endif
endif endif
" Return the indentation " Return the indentation
@@ -231,3 +276,4 @@ let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save
" vim:sw=2 " vim:sw=2

View File

@@ -0,0 +1,68 @@
" vim: set ft=python sw=4 et:
" START_INDENT
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
" END_INDENT

View File

@@ -0,0 +1,68 @@
" vim: set ft=python sw=4 et:
" START_INDENT
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
open_paren_not_at_EOL(100,
(200,
300),
400)
open_paren_at_EOL(
100, 200, 300, 400)
" END_INDENT

View File

@@ -244,9 +244,6 @@ Examples:
comment character) you can > comment character) you can >
:let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%' :let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%'
< <
See the $VIMRUNTIME/ftplugin/vim.vim for an example that uses both
syntax and a regular expression.
============================================================================== ==============================================================================
4. Supporting a New Language *matchit-newlang* 4. Supporting a New Language *matchit-newlang*
*b:match_words* *b:match_words*

View File

@@ -1,6 +1,6 @@
" Vim syntax file " Vim syntax file
" Language: Abaqus finite element input file (www.hks.com) " Language: Abaqus finite element input file (www.hks.com)
" Maintainer: Carl Osterwisch <osterwischc@asme.org> " Maintainer: Carl Osterwisch <costerwi@gmail.com>
" Last Change: 2002 Feb 24 " Last Change: 2002 Feb 24
" Remark: Huge improvement in folding performance--see filetype plugin " Remark: Huge improvement in folding performance--see filetype plugin
@@ -31,5 +31,4 @@ hi def link abaqusParameter Identifier
hi def link abaqusValue Constant hi def link abaqusValue Constant
hi def link abaqusBadLine Error hi def link abaqusBadLine Error
let b:current_syntax = "abaqus" let b:current_syntax = "abaqus"