Update runtime files

This commit is contained in:
Bram Moolenaar
2022-04-18 15:36:40 +01:00
parent a929c922b1
commit 75ab590f85
31 changed files with 4295 additions and 3219 deletions

View File

@ -3,7 +3,7 @@ vim9script
# Vim functions for file type detection
#
# Maintainer: Bram Moolenaar <Bram@vim.org>
# Last Change: 2022 Apr 06
# Last Change: 2022 Apr 13
# These functions are moved here from runtime/filetype.vim to make startup
# faster.

View File

@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 8.2. Last change: 2022 Apr 08
*autocmd.txt* For Vim version 8.2. Last change: 2022 Apr 17
VIM REFERENCE MANUAL by Bram Moolenaar
@ -95,6 +95,7 @@ Or use `:execute`: >
:augroup mine | exe "au! BufRead *" | augroup END
:augroup mine | exe "au BufRead * set tw=70" | augroup END
< *autocmd-expand*
Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
arguments are not expanded when the autocommand is defined. These will be
expanded when the Event is recognized, and the {cmd} is executed. The only
@ -473,13 +474,15 @@ BufRead or BufReadPost When starting to edit a new buffer, after
executing the modelines. See |BufWinEnter|
for when you need to do something after
processing the modelines.
This does NOT work for ":r file". Not used
when the file doesn't exist. Also used after
successfully recovering a file.
Also triggered for the filetypedetect group
when executing ":filetype detect" and when
writing an unnamed buffer in a way that the
buffer gets a name.
Also triggered:
- when writing an unnamed buffer in a way that
the buffer gets a name
- after successfully recovering a file
- for the filetypedetect group when executing
":filetype detect"
Not triggered:
- for the `:read file` command
- when the file doesn't exist
*BufReadCmd*
BufReadCmd Before starting to edit a new buffer. Should
read the file into the buffer. |Cmd-event|
@ -707,9 +710,38 @@ CursorMoved After the cursor was moved in Normal or Visual
CursorMovedI After the cursor was moved in Insert mode.
Not triggered when the popup menu is visible.
Otherwise the same as CursorMoved.
*DiffUpdated*
DiffUpdated After diffs have been updated. Depending on
what kind of diff is being used (internal or
external) this can be triggered on every
change or when doing |:diffupdate|.
*DirChangedPre*
DirChangedPre The working directory is going to be changed,
as with |DirChanged|. The pattern is like
with |DirChanged|. The new directory can be
found in v:event.directory.
*DirChanged*
DirChanged The working directory has changed in response
to the |:cd| or |:tcd| or |:lcd| commands, or
as a result of the 'autochdir' option.
The pattern can be:
"window" to trigger on `:lcd`
"tabpage" to trigger on `:tcd`
"global" to trigger on `:cd`
"auto" to trigger on 'autochdir'.
"drop" to trigger on editing a file
<afile> is set to the new directory name.
*EncodingChanged*
EncodingChanged Fires off after the 'encoding' option has been
changed. Useful to set up fonts, for example.
*ExitPre*
ExitPre When using `:quit`, `:wq` in a way it makes
Vim exit, or using `:qall`, just after
|QuitPre|. Can be used to close any
non-essential window. Exiting may still be
cancelled if there is a modified buffer that
isn't automatically saved, use |VimLeavePre|
for really exiting.
*FileAppendCmd*
FileAppendCmd Before appending to a file. Should do the
appending to the file. Use the '[ and ']
@ -737,35 +769,6 @@ FileChangedRO Before making the first change to a read-only
*E881*
If the number of lines changes saving for undo
may fail and the change will be aborted.
*DiffUpdated*
DiffUpdated After diffs have been updated. Depending on
what kind of diff is being used (internal or
external) this can be triggered on every
change or when doing |:diffupdate|.
*DirChangedPre*
DirChangedPre The working directory is going to be changed,
as with |DirChanged|. The pattern is like
with |DirChanged|. The new directory can be
found in v:event.directory.
*DirChanged*
DirChanged The working directory has changed in response
to the |:cd| or |:tcd| or |:lcd| commands, or
as a result of the 'autochdir' option.
The pattern can be:
"window" to trigger on `:lcd`
"tabpage" to trigger on `:tcd`
"global" to trigger on `:cd`
"auto" to trigger on 'autochdir'.
"drop" to trigger on editing a file
<afile> is set to the new directory name.
*ExitPre*
ExitPre When using `:quit`, `:wq` in a way it makes
Vim exit, or using `:qall`, just after
|QuitPre|. Can be used to close any
non-essential window. Exiting may still be
cancelled if there is a modified buffer that
isn't automatically saved, use |VimLeavePre|
for really exiting.
*FileChangedShell*
FileChangedShell When Vim notices that the modification time of
a file has changed since editing started.

View File

@ -1,4 +1,4 @@
*builtin.txt* For Vim version 8.2. Last change: 2022 Apr 06
*builtin.txt* For Vim version 8.2. Last change: 2022 Apr 16
VIM REFERENCE MANUAL by Bram Moolenaar
@ -2046,7 +2046,7 @@ execute({command} [, {silent}]) *execute()*
It is not possible to use `:redir` anywhere in {command}.
To get a list of lines use |split()| on the result: >
split(execute('args'), "\n")
execute('args')->split("\n")
< To execute a command in another window than the current one
use `win_execute()`.
@ -2237,6 +2237,8 @@ expand({string} [, {nosuf} [, {list}]]) *expand()*
a function
<SID> "<SNR>123_" where "123" is the
current script ID |<SID>|
<script> sourced script file, or script file
where the current function was defined
<stack> call stack
<cword> word under the cursor
<cWORD> WORD under the cursor

View File

@ -614,9 +614,10 @@ attack or other people reading your file). When Vim exits the directory and
all files in it are deleted. When Vim has the setuid bit set this may cause
problems, the temp file is owned by the setuid user but the filter command
probably runs as the original user.
On MS-Windows the first of these directories that works is used: $TMP,
$TEMP, c:\TMP, c:\TEMP.
For Unix the list of directories is: $TMPDIR, /tmp, current-dir, $HOME.
Directory for temporary files is created in the first of these directories
that works:
Unix: $TMPDIR, /tmp, current-dir, $HOME.
Windows: $TMP, $TEMP, c:\TMP, c:\TEMP
For MS-Windows the GetTempFileName() system function is used.
For other systems the tmpnam() library function is used.

View File

@ -1,4 +1,4 @@
*channel.txt* For Vim version 8.2. Last change: 2022 Apr 05
*channel.txt* For Vim version 8.2. Last change: 2022 Apr 16
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*cmdline.txt* For Vim version 8.2. Last change: 2022 Feb 04
*cmdline.txt* For Vim version 8.2. Last change: 2022 Apr 09
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*editing.txt* For Vim version 8.2. Last change: 2022 Apr 03
*editing.txt* For Vim version 8.2. Last change: 2022 Apr 16
VIM REFERENCE MANUAL by Bram Moolenaar
@ -445,7 +445,8 @@ does apply like to other wildcards.
Environment variables in the expression are expanded when evaluating the
expression, thus this works: >
:e `=$HOME .. '/.vimrc'`
This does not work, $HOME is inside a string and used literally: >
This uses $HOME inside a string and it will be used literally, most likely not
what you intended: >
:e `='$HOME' .. '/.vimrc'`
If the expression returns a string then names are to be separated with line
@ -1694,7 +1695,7 @@ session or with another command (e.g., a filter command). Then you will know
which version of the file you want to keep.
The accuracy of the time check depends on the filesystem. On Unix it is
usually sub-second. With old file sytems and on MS-Windows it is normally one
usually sub-second. With old file systems and on MS-Windows it is normally one
second. Use `has('nanotime')` to check if sub-second time stamp checks are
available.

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.2. Last change: 2022 Apr 06
*eval.txt* For Vim version 8.2. Last change: 2022 Apr 17
VIM REFERENCE MANUAL by Bram Moolenaar
@ -4723,7 +4723,7 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
:
:try
:
: " something with arithmetics and I/O
: " something with arithmetic and I/O
:
:catch /^EXCEPT:MATHERR:RANGE/
: let function = substitute(v:exception, '.*(\(\a\+\)).*', '\1', "")

View File

@ -1,4 +1,4 @@
*filetype.txt* For Vim version 8.2. Last change: 2022 Apr 07
*filetype.txt* For Vim version 8.2. Last change: 2022 Apr 09
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*map.txt* For Vim version 8.2. Last change: 2022 Apr 03
*map.txt* For Vim version 8.2. Last change: 2022 Apr 14
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1324,7 +1324,8 @@ underscore. Example: >
could define a mapping "<SNR>23_Add".
When defining a function in a script, "s:" can be prepended to the name to
make it local to the script. But when a mapping is executed from outside of
make it local to the script (in |Vim9| script functions without a prefix are
local to the script). But when a mapping is executed from outside of
the script, it doesn't know in which script the function was defined. To
avoid this problem, use "<SID>" instead of "s:". The same translation is done
as for mappings. This makes it possible to define a call to the function in

View File

@ -1,4 +1,4 @@
*motion.txt* For Vim version 8.2. Last change: 2021 Dec 27
*motion.txt* For Vim version 8.2. Last change: 2022 Apr 18
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1078,7 +1078,7 @@ in the current file (an indent is removed and a long line is truncated to fit
in the window).
The marker ">" indicates the current position in the jumplist. It may not be
shown when filtering the |:jump| command using |:filter|
shown when filtering the |:jumps| command using |:filter|
You are currently in line 1167. If you then use the CTRL-O command, the
cursor is put in line 1154. This results in:

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 8.2. Last change: 2022 Apr 07
*options.txt* For Vim version 8.2. Last change: 2022 Apr 13
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*starting.txt* For Vim version 8.2. Last change: 2022 Feb 01
*starting.txt* For Vim version 8.2. Last change: 2022 Apr 12
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -215,7 +215,7 @@ A syntax group name doesn't specify any color or attributes itself.
The name for a highlight or syntax group must consist of ASCII letters, digits
and the underscore. As a regexp: "[a-zA-Z0-9_]*". However, Vim does not give
an error when using other characters. The maxium length of a group name is
an error when using other characters. The maximum length of a group name is
about 200 bytes. *E1249*
To be able to allow each user to pick their favorite set of colors, there must

View File

@ -1457,6 +1457,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
--echo-wid starting.txt /*--echo-wid*
--help starting.txt /*--help*
--literal starting.txt /*--literal*
--log starting.txt /*--log*
--nofork starting.txt /*--nofork*
--noplugin starting.txt /*--noplugin*
--not-a-term starting.txt /*--not-a-term*
@ -2003,6 +2004,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:<cfile> cmdline.txt /*:<cfile>*
:<client> cmdline.txt /*:<client>*
:<cword> cmdline.txt /*:<cword>*
:<script> cmdline.txt /*:<script>*
:<sfile> cmdline.txt /*:<sfile>*
:<sflnum> cmdline.txt /*:<sflnum>*
:<slnum> cmdline.txt /*:<slnum>*
@ -2082,6 +2084,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:Termdebug terminal.txt /*:Termdebug*
:TermdebugCommand terminal.txt /*:TermdebugCommand*
:Texplore pi_netrw.txt /*:Texplore*
:Until terminal.txt /*:Until*
:UseVimball pi_vimball.txt /*:UseVimball*
:Vexplore pi_netrw.txt /*:Vexplore*
:VimballList pi_vimball.txt /*:VimballList*
@ -3722,6 +3725,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
<range> map.txt /*<range>*
<reg> map.txt /*<reg>*
<register> map.txt /*<register>*
<script> cmdline.txt /*<script>*
<sfile> cmdline.txt /*<sfile>*
<sflnum> cmdline.txt /*<sflnum>*
<slnum> cmdline.txt /*<slnum>*
@ -4057,7 +4061,6 @@ E1081 eval.txt /*E1081*
E1083 editing.txt /*E1083*
E1084 eval.txt /*E1084*
E1085 eval.txt /*E1085*
E1086 eval.txt /*E1086*
E1087 vim9.txt /*E1087*
E1089 eval.txt /*E1089*
E109 eval.txt /*E109*
@ -4222,7 +4225,6 @@ E1231 map.txt /*E1231*
E1232 builtin.txt /*E1232*
E1233 builtin.txt /*E1233*
E1234 vim9.txt /*E1234*
E1235 vim9.txt /*E1235*
E1236 vim9.txt /*E1236*
E1237 map.txt /*E1237*
E1238 vim9.txt /*E1238*
@ -4260,6 +4262,7 @@ E1266 if_pyth.txt /*E1266*
E127 eval.txt /*E127*
E1270 change.txt /*E1270*
E1271 vim9.txt /*E1271*
E1274 cmdline.txt /*E1274*
E128 eval.txt /*E128*
E129 eval.txt /*E129*
E13 message.txt /*E13*
@ -4780,9 +4783,6 @@ E610 editing.txt /*E610*
E611 eval.txt /*E611*
E612 sign.txt /*E612*
E613 print.txt /*E613*
E614 editing.txt /*E614*
E615 editing.txt /*E615*
E616 editing.txt /*E616*
E617 options.txt /*E617*
E618 print.txt /*E618*
E619 print.txt /*E619*
@ -5772,6 +5772,7 @@ autocmd-disable autocmd.txt /*autocmd-disable*
autocmd-events autocmd.txt /*autocmd-events*
autocmd-events-abc autocmd.txt /*autocmd-events-abc*
autocmd-execute autocmd.txt /*autocmd-execute*
autocmd-expand autocmd.txt /*autocmd-expand*
autocmd-groups autocmd.txt /*autocmd-groups*
autocmd-intro autocmd.txt /*autocmd-intro*
autocmd-list autocmd.txt /*autocmd-list*
@ -6082,6 +6083,7 @@ channel-functions-details channel.txt /*channel-functions-details*
channel-mode channel.txt /*channel-mode*
channel-more channel.txt /*channel-more*
channel-noblock channel.txt /*channel-noblock*
channel-onetime-callback channel.txt /*channel-onetime-callback*
channel-open channel.txt /*channel-open*
channel-open-options channel.txt /*channel-open-options*
channel-raw channel.txt /*channel-raw*
@ -7607,6 +7609,7 @@ hitest.vim syntax.txt /*hitest.vim*
hjkl usr_02.txt /*hjkl*
hl-ColorColumn syntax.txt /*hl-ColorColumn*
hl-Conceal syntax.txt /*hl-Conceal*
hl-CurSearch syntax.txt /*hl-CurSearch*
hl-Cursor syntax.txt /*hl-Cursor*
hl-CursorColumn syntax.txt /*hl-CursorColumn*
hl-CursorIM syntax.txt /*hl-CursorIM*

View File

@ -1285,6 +1285,8 @@ Put focus on the gdb window to type commands there. Some common ones are:
- next execute the current line and stop at the next line
- step execute the current line and stop at the next statement,
entering functions
- until execute until past the current cursor line or past a specified
position or the current stack frame returns
- finish execute until leaving the current function
- where show the stack
- frame N go to the Nth stack frame
@ -1303,6 +1305,7 @@ gdb:
*:Step* execute the gdb "step" command
*:Over* execute the gdb "next" command (`:Next` is a Vim command)
*:Until* execute the gdb "until" command
*:Finish* execute the gdb "finish" command
*:Continue* execute the gdb "continue" command
*:Stop* interrupt the program

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.2. Last change: 2022 Apr 06
*todo.txt* For Vim version 8.2. Last change: 2022 Apr 18
VIM REFERENCE MANUAL by Bram Moolenaar
@ -38,6 +38,8 @@ browser use: https://github.com/vim/vim/issues/1234
*known-bugs*
-------------------- Known bugs and current work -----------------------
Use "`=expr`" in heredoc also in :def function. #10216 Yegappan will do it.
Once Vim9 is stable:
- Use Vim9 for more runtime files.
- Check code coverage, add more tests if needed.
@ -151,7 +153,6 @@ Terminal debugger:
- Add option to not open the program window. It's not used when attaching to
an already running program. (M. Kelly)
- When only gdb window exists, on "quit" edit another buffer.
- Use a sign group
- Termdebug does not work when Vim was built with mzscheme: gdb hangs just
after "run". Everything else works, including communication channel. Not
initializing mzscheme avoid the problem, thus it's not some #ifdef.
@ -202,6 +203,11 @@ Terminal emulator window:
- When 'encoding' is not utf-8, or the job is using another encoding, setup
conversions.
CurSearch highlight is wrong when searching for a space, matches all spaces
instead of only the current one.
Can deref_func_name() and deref_function_name() be merged?
When using 'cryptmethod' xchaha20 the undo file is not encrypted.
Need to handle extra bytes.
@ -223,8 +229,6 @@ Fails in line 64 of Ch_communicate, no exception is thrown.
Patch for Template string: #4634
Have another look at the implementation.
Add expanding <script> which works like <sfile> everywhere. #9189
Rename getdigraphlist -> digraph_getlist() etc.
Can "CSI nr X" be used instead of outputting spaces? Is it faster? #8002
@ -255,6 +259,14 @@ Idea: when typing ":e /some/dir/" and "dir" does not exist, highlight in red.
initialization to figure out the default value from 'shell'. Add a test for
this.
With concealed text mouse click doesn't put the cursor in the right position.
(Herb Sitz) Fix by Christian Brabandt, 2011 Jun 16. Doesn't work properly,
need to make the change in where RET_WIN_BUF_CHARTABSIZE() is called.
IDEA: when drawing the text, store the text byte index in ScreenLinesIdx[].
When converting screen column to text position use this.
Store the line number and byte index for the start of the line, when
converting the screen line to text position use this, add the byte offset.
MS-Windows: did path modifier :p:8 stop working? #8600
Add support for "underdouble", "underdot" and "underdash". #9553
@ -1920,10 +1932,6 @@ On MS-Windows a temp dir with a & init causes system() to fail. (Ben Fritz,
Patch 7.3.116 was the wrong solution.
Christian Brabandt has another incomplete patch. (2011 Jul 13)
With concealed text mouse click doesn't put the cursor in the right position.
(Herb Sitz) Fix by Christian Brabandt, 2011 Jun 16. Doesn't work properly,
need to make the change in where RET_WIN_BUF_CHARTABSIZE() is called.
Syntax region with 'concealends' and a 'cchar' value, 'conceallevel' set to 2,
only one of the two ends gets the cchar displayed. (Brett Stahlman, 2010 Aug
21, Ben Fritz, 2010 Sep 14)

View File

@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2022 Mar 30
*vim9.txt* For Vim version 8.2. Last change: 2022 Apr 14
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2022 Apr 07
" Last Change: 2022 Apr 13
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")

View File

@ -31,7 +31,7 @@ Always use ":setlocal" to set 'indentexpr'. This avoids it being carried over
to other buffers.
To trigger the indenting after typing a word like "endif", add the word to the
'cinkeys' option with "+=".
'indentkeys' option with "+=".
You normally set 'indentexpr' to evaluate a function and then define that
function. That function only needs to be defined once for as long as Vim is

130
runtime/indent/krl.vim Normal file
View File

@ -0,0 +1,130 @@
" Vim indent file
" Language: Kuka Robot Language
" Maintainer: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
" Version: 3.0.0
" Last Change: 15. Apr 2022
" Credits: Based on indent/vim.vim
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal nolisp
setlocal nocindent
setlocal nosmartindent
setlocal autoindent
setlocal indentexpr=GetKrlIndent()
setlocal indentkeys=!^F,o,O,=~end,0=~else,0=~case,0=~default,0=~until,0=~continue,=~part
let b:undo_indent = "setlocal lisp< cindent< smartindent< autoindent< indentexpr< indentkeys<"
if get(g:,'krlSpaceIndent',1)
" Use spaces, not tabs, for indention, 2 is enough.
" More or even tabs would waste valuable space on the teach pendant.
setlocal softtabstop=2
setlocal shiftwidth=2
setlocal expandtab
setlocal shiftround
let b:undo_indent = b:undo_indent." softtabstop< shiftwidth< expandtab< shiftround<"
endif
" Only define the function once.
if exists("*GetKrlIndent")
finish
endif
let s:keepcpo = &cpo
set cpo&vim
function GetKrlIndent() abort
let currentLine = getline(v:lnum)
if currentLine =~? '\v^;(\s*(end)?fold>)@!' && !get(g:, 'krlCommentIndent', 0)
" If current line has a ; in column 1 and is no fold, keep zero indent.
" This may be usefull if code is commented out at the first column.
return 0
endif
" Find a non-blank line above the current line.
let preNoneBlankLineNum = s:KrlPreNoneBlank(v:lnum - 1)
if preNoneBlankLineNum == 0
" At the start of the file use zero indent.
return 0
endif
let preNoneBlankLine = getline(preNoneBlankLineNum)
let ind = indent(preNoneBlankLineNum)
" Define add 'shiftwidth' pattern
let addShiftwidthPattern = '\v^\s*('
if get(g:, 'krlIndentBetweenDef', 1)
let addShiftwidthPattern ..= '(global\s+)?def(fct|dat)?\s+\$?\w'
let addShiftwidthPattern ..= '|'
endif
let addShiftwidthPattern ..= 'if>|while>|for>|loop>'
let addShiftwidthPattern ..= '|else>'
let addShiftwidthPattern ..= '|case>|default>'
let addShiftwidthPattern ..= '|repeat>'
let addShiftwidthPattern ..= '|skip>|(ptp_)?spline>'
let addShiftwidthPattern ..= '|time_block\s+(start|part)>'
let addShiftwidthPattern ..= '|const_vel\s+start>'
let addShiftwidthPattern ..= ')'
" Define Subtract 'shiftwidth' pattern
let subtractShiftwidthPattern = '\v^\s*('
if get(g:, 'krlIndentBetweenDef', 1)
let subtractShiftwidthPattern ..= 'end(fct|dat)?>'
let subtractShiftwidthPattern ..= '|'
endif
let subtractShiftwidthPattern ..= 'end(if|while|for|loop)>'
let subtractShiftwidthPattern ..= '|else>'
let subtractShiftwidthPattern ..= '|case>|default>|endswitch>'
let subtractShiftwidthPattern ..= '|until>'
let subtractShiftwidthPattern ..= '|end(skip|spline)>'
let subtractShiftwidthPattern ..= '|time_block\s+(part|end)>'
let subtractShiftwidthPattern ..= '|const_vel\s+end>'
let subtractShiftwidthPattern ..= ')'
" Add shiftwidth
if preNoneBlankLine =~? addShiftwidthPattern
let ind += &sw
endif
" Subtract shiftwidth
if currentLine =~? subtractShiftwidthPattern
let ind = ind - &sw
endif
" First case after a switch gets the indent of the switch.
if currentLine =~? '\v^\s*case>'
\&& preNoneBlankLine =~? '\v^\s*switch>'
let ind = ind + &sw
endif
" align continue with the following instruction
if currentLine =~? '\v^\s*continue>'
\&& getline(v:lnum + 1) =~? subtractShiftwidthPattern
let ind = ind - &sw
endif
return ind
endfunction
" This function works almost like prevnonblank() but handles &-headers,
" comments and continue instructions like blank lines
function s:KrlPreNoneBlank(lnum) abort
let nPreNoneBlank = prevnonblank(a:lnum)
while nPreNoneBlank > 0 && getline(nPreNoneBlank) =~? '\v^\s*(\&\w\+|;|continue>)'
" Previouse none blank line irrelevant. Look further aback.
let nPreNoneBlank = prevnonblank(nPreNoneBlank - 1)
endwhile
return nPreNoneBlank
endfunction
let &cpo = s:keepcpo
unlet s:keepcpo
" vim:sw=2 sts=2 et

View File

@ -0,0 +1,148 @@
; vim: set ft=krl :
; START_INDENT
def One()
int i
If i==1 then
While i>=1
For i=1 to 5 step 2
Loop
i = i+1
EndLoop
EndFor
EndWhile
Else
Repeat
Switch i
Case 1
Skip 123
i = i+1
EndSkip 123
Spline with $acc=100, $vel.cp=3
slin {x 100}
scirc {x 110, y 110}, {x 120, y 90}
slin {x 200} c_dis
Time_Block Start
slin {x 300} c_dis
Time_Block Part = 22.2
slin {y 400} c_dis
Time_Block Part = 33.3
Time_Block End = 10
slin {y 200} c_dis
Const_Vel Start +100 OnStart
slin {y 300} c_dis
slin {x 100}
Const_Vel End -5.5
slin {y 200} c_dis
EndSpline
Case 2,3
PTP_Spline with $acc=100, $vel.ptp=100
sptp {a1 0} c_ptp
sptp {a1 90}
EndSpline c_spl
Default
i = i+1
EndSwitch
Continue
Until False
EndIf
end
DEF Two()
int i
END
global def Three()
int i
end
GLOBAL DEF Four()
int i
END
Global Def Five()
int i
End
deffct bool fOne()
int i
endfct
DEFFCT bool fTwo()
int i
ENDFCT
global deffct bool fThree()
int i
endfct
GLOBAL DEFFCT bool fFour()
int i
ENDFCT
Global DefFct bool fFive()
int i
EndFct
DefDat datfile()
global int i=1
; don't indent column 1 comments unless g:krlCommentIndent is set
; global int o=2
EndDat
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlSpaceIndent = 0
; INDENT_EXE set shiftwidth=4
def bla()
int i
end
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlCommentIndent = 1
def bla()
; indent this first column comment because of g:krlCommentIndent=1
end
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlIndentBetweenDef = 0
def bla()
int i ; don't indent this line because of g:krlIndentBetweenDef=0
end
; END_INDENT
; START_INDENT
; INDENT_AT this-line
def Some()
int f
if true then
f = 1 ; this-line
endif
end
; END_INDENT
; START_INDENT
; INDENT_NEXT next-line
def Some()
int i
; next-line
i = 1 ; should get indent of line 'int i' above
end
; END_INDENT
; START_INDENT
; INDENT_PREV prev-line
def Some()
int f
if true then
f = 1
; prev-line
endif
end
; END_INDENT

View File

@ -0,0 +1,148 @@
; vim: set ft=krl :
; START_INDENT
def One()
int i
If i==1 then
While i>=1
For i=1 to 5 step 2
Loop
i = i+1
EndLoop
EndFor
EndWhile
Else
Repeat
Switch i
Case 1
Skip 123
i = i+1
EndSkip 123
Spline with $acc=100, $vel.cp=3
slin {x 100}
scirc {x 110, y 110}, {x 120, y 90}
slin {x 200} c_dis
Time_Block Start
slin {x 300} c_dis
Time_Block Part = 22.2
slin {y 400} c_dis
Time_Block Part = 33.3
Time_Block End = 10
slin {y 200} c_dis
Const_Vel Start +100 OnStart
slin {y 300} c_dis
slin {x 100}
Const_Vel End -5.5
slin {y 200} c_dis
EndSpline
Case 2,3
PTP_Spline with $acc=100, $vel.ptp=100
sptp {a1 0} c_ptp
sptp {a1 90}
EndSpline c_spl
Default
i = i+1
EndSwitch
Continue
Until False
EndIf
end
DEF Two()
int i
END
global def Three()
int i
end
GLOBAL DEF Four()
int i
END
Global Def Five()
int i
End
deffct bool fOne()
int i
endfct
DEFFCT bool fTwo()
int i
ENDFCT
global deffct bool fThree()
int i
endfct
GLOBAL DEFFCT bool fFour()
int i
ENDFCT
Global DefFct bool fFive()
int i
EndFct
DefDat datfile()
global int i=1
; don't indent column 1 comments unless g:krlCommentIndent is set
; global int o=2
EndDat
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlSpaceIndent = 0
; INDENT_EXE set shiftwidth=4
def bla()
int i
end
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlCommentIndent = 1
def bla()
; indent this first column comment because of g:krlCommentIndent=1
end
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlIndentBetweenDef = 0
def bla()
int i ; don't indent this line because of g:krlIndentBetweenDef=0
end
; END_INDENT
; START_INDENT
; INDENT_AT this-line
def Some()
int f
if true then
f = 1 ; this-line
endif
end
; END_INDENT
; START_INDENT
; INDENT_NEXT next-line
def Some()
int i
; next-line
i = 1 ; should get indent of line 'int i' above
end
; END_INDENT
; START_INDENT
; INDENT_PREV prev-line
def Some()
int f
if true then
f = 1
; prev-line
endif
end
; END_INDENT

View File

@ -2,7 +2,7 @@
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
" Last Change: 2022 Jan 17
" Last Change: 2022 Apr 16
"
" WORK IN PROGRESS - The basics works stable, more to come
" Note: In general you need at least GDB 7.12 because this provides the
@ -445,7 +445,7 @@ endfunc
func s:StartDebugCommon(dict)
" Sign used to highlight the line where the program has stopped.
" There can be only one.
sign define debugPC linehl=debugPC
call sign_define('debugPC', #{linehl: 'debugPC'})
" Install debugger commands in the text window.
call win_gotoid(s:sourcewin)
@ -668,7 +668,9 @@ func s:EndDebugCommon()
endif
endif
endfor
exe was_buf .. "buf"
if bufexists(was_buf)
exe was_buf .. "buf"
endif
call s:DeleteCommands()
@ -740,8 +742,8 @@ func s:HandleDisasmMsg(msg)
let lnum = search('^' . s:asm_addr)
if lnum != 0
exe 'sign unplace ' . s:asm_id
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
call sign_unplace('TermDebug', #{id: s:asm_id})
call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
call win_gotoid(curwinid)
@ -830,6 +832,7 @@ func s:InstallCommands()
command Clear call s:ClearBreakpoint()
command Step call s:SendResumingCommand('-exec-step')
command Over call s:SendResumingCommand('-exec-next')
command -nargs=? Until call s:Until(<q-args>)
command Finish call s:SendResumingCommand('-exec-finish')
command -nargs=* Run call s:Run(<q-args>)
command -nargs=* Arguments call s:SendResumingCommand('-exec-arguments ' . <q-args>)
@ -866,7 +869,8 @@ func s:InstallCommands()
an 1.200 PopUp.-SEP3- <Nop>
an 1.210 PopUp.Set\ breakpoint :Break<CR>
an 1.220 PopUp.Clear\ breakpoint :Clear<CR>
an 1.230 PopUp.Evaluate :Evaluate<CR>
an 1.230 PopUp.Run\ until :Until<CR>
an 1.240 PopUp.Evaluate :Evaluate<CR>
endif
endif
@ -894,6 +898,7 @@ func s:DeleteCommands()
delcommand Clear
delcommand Step
delcommand Over
delcommand Until
delcommand Finish
delcommand Run
delcommand Arguments
@ -937,26 +942,35 @@ func s:DeleteCommands()
aunmenu PopUp.-SEP3-
aunmenu PopUp.Set\ breakpoint
aunmenu PopUp.Clear\ breakpoint
aunmenu PopUp.Run\ until
aunmenu PopUp.Evaluate
endif
endif
exe 'sign unplace ' . s:pc_id
for [id, entries] in items(s:breakpoints)
for subid in keys(entries)
exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
endfor
endfor
call sign_unplace('TermDebug')
unlet s:breakpoints
unlet s:breakpoint_locations
sign undefine debugPC
for val in s:BreakpointSigns
exe "sign undefine debugBreakpoint" . val
endfor
call sign_undefine('debugPC')
call sign_undefine(s:BreakpointSigns->map("'debugBreakpoint' .. v:val"))
let s:BreakpointSigns = []
endfunc
" :Until - Execute until past a specified position or current line
func s:Until(at)
if s:stopped
" reset s:stopped here, it may take a bit of time before we get a response
let s:stopped = 0
call ch_log('assume that program is running after this command')
" Use the fname:lnum format
let at = empty(a:at) ?
\ fnameescape(expand('%:p')) . ':' . line('.') : a:at
call s:SendCommand('-exec-until ' . at)
else
call ch_log('dropping command, program is running: exec-until')
endif
endfunc
" :Break - Set a breakpoint at the cursor position.
func s:SetBreakpoint(at)
" Setting a breakpoint may not work while the program is running.
@ -990,7 +1004,8 @@ func s:ClearBreakpoint()
" Assume this always works, the reply is simply "^done".
call s:SendCommand('-break-delete ' . id)
for subid in keys(s:breakpoints[id])
exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
call sign_unplace('TermDebug',
\ #{id: s:Breakpoint2SignNumber(id, subid)})
endfor
unlet s:breakpoints[id]
unlet s:breakpoint_locations[bploc][idx]
@ -1205,8 +1220,8 @@ func s:GotoAsmwinOrCreateIt()
call s:SendCommand('disassemble $pc')
endif
else
exe 'sign unplace ' . s:asm_id
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
call sign_unplace('TermDebug', #{id: s:asm_id})
call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
endif
endfunc
@ -1241,8 +1256,8 @@ func s:HandleCursor(msg)
if lnum == 0
call s:SendCommand('disassemble $pc')
else
exe 'sign unplace ' . s:asm_id
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
call sign_unplace('TermDebug', #{id: s:asm_id})
call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
call win_gotoid(curwinid)
@ -1279,8 +1294,9 @@ echomsg 'different fname: "' .. expand('%:p') .. '" vs "' .. fnamemodify(fname,
endif
exe lnum
normal! zv
exe 'sign unplace ' . s:pc_id
exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC priority=110 file=' . fname
call sign_unplace('TermDebug', #{id: s:pc_id})
call sign_place(s:pc_id, 'TermDebug', 'debugPC', fname,
\ #{lnum: lnum, priority: 110})
if !exists('b:save_signcolumn')
let b:save_signcolumn = &signcolumn
call add(s:signcolumn_buflist, bufnr())
@ -1288,7 +1304,7 @@ echomsg 'different fname: "' .. expand('%:p') .. '" vs "' .. fnamemodify(fname,
setlocal signcolumn=yes
endif
elseif !s:stopped || fname != ''
exe 'sign unplace ' . s:pc_id
call sign_unplace('TermDebug', #{id: s:pc_id})
endif
call win_gotoid(wid)
@ -1305,7 +1321,9 @@ func s:CreateBreakpoint(id, subid, enabled)
else
let hiName = "debugBreakpoint"
endif
exe "sign define debugBreakpoint" . nr . " text=" . substitute(nr, '\..*', '', '') . " texthl=" . hiName
call sign_define('debugBreakpoint' .. nr,
\ #{text: substitute(nr, '\..*', '', ''),
\ texthl: hiName})
endif
endfunc
@ -1383,7 +1401,9 @@ endfunc
func s:PlaceSign(id, subid, entry)
let nr = printf('%d.%d', a:id, a:subid)
exe 'sign place ' . s:Breakpoint2SignNumber(a:id, a:subid) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint' . nr . ' priority=110 file=' . a:entry['fname']
call sign_place(s:Breakpoint2SignNumber(a:id, a:subid), 'TermDebug',
\ 'debugBreakpoint' .. nr, a:entry['fname'],
\ #{lnum: a:entry['lnum'], priority: 110})
let a:entry['placed'] = 1
endfunc
@ -1397,7 +1417,8 @@ func s:HandleBreakpointDelete(msg)
if has_key(s:breakpoints, id)
for [subid, entry] in items(s:breakpoints[id])
if has_key(entry, 'placed')
exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
call sign_unplace('TermDebug',
\ #{id: s:Breakpoint2SignNumber(id, subid)})
unlet entry['placed']
endif
endfor

458
runtime/syntax/krl.vim Normal file
View File

@ -0,0 +1,458 @@
" Vim syntax file
" Language: Kuka Robot Language
" Maintainer: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
" Version: 3.0.0
" Last Change: 18. Apr 2022
" Credits: Thanks for contributions to this to Michael Jagusch
" Thanks for beta testing to Thomas Baginski
"
" Note to self:
" for testing perfomance
" open a 1000 lines file.
" :syntime on
" G
" hold down CTRL-U until reaching top
" :syntime report
" Init {{{
if exists("b:current_syntax")
finish
endif
let s:keepcpo = &cpo
set cpo&vim
" if colorscheme is tortus(less)? krlGroupName defaults to 1
if get(g:, 'colors_name', " ") =~ '\<tortus'
\&& !exists("g:krlGroupName")
let g:krlGroupName=1
endif
" krlGroupName defaults to 0 if it's not initialized yet or 0
if !get(g:, "krlGroupName", 0)
let g:krlGroupName = 0
endif
" krl does ignore case
syn case ignore
" take #, $ and & into keyword (syntax only)
syn iskeyword @,48-57,_,192-255,#,$,&
" spell checking
syn spell notoplevel
" }}} init
" Comment and Folding {{{
" Special Comment
" TODO Comment
syn keyword krlTodo contained TODO FIXME XXX
highlight default link krlTodo Todo
" Debug Comment
syn keyword krlDebug contained DEBUG
highlight default link krlDebug Debug
" Comment
" none move fold comment until second ;
syn match krlFoldComment /\c\v^\s*;\s*%(end)?fold>[^;]*/ containedin=krlFold contains=krlSingleQuoteString,krlInteger,krlFloat,krlMovement,krlDelimiter,krlBoolean
highlight default link krlFoldComment Comment
" move fold comment until second ;
syn match krlMoveFoldComment /\c\v^\s*;\s*fold>[^;]*<s?%(ptp|lin|circ|spl)(_rel)?>[^;]*/ containedin=krlFold contains=krlInteger,krlFloat,krlMovement,krlDelimiter
highlight default link krlMoveFoldComment Comment
" things to highlight in a fold line
syn keyword krlFoldHighlights CONT IN SYN OUT containedin=krlFoldComment
syn match krlFoldHighlights /\c\v<(M|F|E|A|t|i|bin|binin|UP|SPSMAKRO)\d+>/ containedin=krlFoldComment
if g:krlGroupName
highlight default link krlFoldHighlights Sysvars
else
" default color for Fold Highlights
endif
syn keyword krlVkrcFoldConstants EIN AUS containedin=krlFoldComment
highlight default link krlVkrcFoldConstants Boolean
" Comment without Fold, also includes endfold lines and fold line part after second ;
syn match krlComment /\c\v;\s*%(<%(end)?fold>)@!.*$/ containedin=krlFold contains=krlTodo,krlDebug,@Spell
" Commented out Fold line: "; ;FOLD PTP..."
syn match krlComment /\c\v^\s*;\s*;.*$/ contains=krlTodo,krlDebug
highlight default link krlComment Comment
if has("conceal") && get(g:, 'krlConcealFoldTail', 1)
syn match krlConcealFoldTail /\c\v(^\s*;\s*fold[^;]*)@250<=;%(--|\s*<fold>|\s*<endfold>)@!.*$/ transparent containedin=krlComment conceal cchar=*
endif
" }}} Comment and Folding
" Header {{{
syn match krlHeader /&\a\w*/
highlight default link krlHeader PreProc
" }}} Header
" Operator {{{
" Boolean operator
syn keyword krlBoolOperator and or exor not b_and b_or b_exor b_not
highlight default link krlBoolOperator Operator
" Arithmetic operator
syn match krlArithOperator /[+-]/ containedin=krlFloat
syn match krlArithOperator /[*/]/
highlight default link krlArithOperator Operator
" Compare operator
syn match krlCompOperator /[<>=]/
highlight default link krlCompOperator Operator
" Geometric operator
" Do not move the : operator
" Must be present befor krlParamdef
syn match krlGeomOperator /[:]/
" syn match krlGeomOperator /[:]/ containedin=krlLabel,krlParamdef
highlight default link krlGeomOperator Operator
" }}} Operator
" Type, StorageClass and Typedef {{{
" Simple data types
syn keyword krlType bool char real int containedin=krlAnyType
" External program and function
syn keyword krlType ext extfct extfctp extp containedin=krlAnyType
" Communication
syn keyword krlType signal channel containedin=krlAnyType
highlight default link krlType Type
" StorageClass
syn keyword krlStorageClass decl global const struc enum
highlight default link krlStorageClass StorageClass
" .dat file public
syn keyword krlDatStorageClass public
highlight default link krlDatStorageClass StorageClass
" Parameter StorageClass
" Do not move the :in/:out
" Must be present after krlGeomOperator
syn match krlParamdef /[:]\s*in\>/
syn match krlParamdef /[:]\s*out\>/
highlight default link krlParamdef StorageClass
" Not a typedef but I like to have those highlighted
" different then types, structures or strorage classes
syn keyword krlTypedef DEF DEFFCT ENDFCT DEFDAT ENDDAT
syn match krlTypedef /^\s*END\>/
highlight default link krlTypedef Typedef
" }}} Type, StorageClass and Typedef
" Delimiter {{{
syn match krlDelimiter /[\[\](),\\]/
highlight default link krlDelimiter Delimiter
" }}} Delimiter
" Constant values {{{
" Boolean
syn keyword krlBoolean true false containedin=krlStructVal
highlight default link krlBoolean Boolean
" Binary integer
syn match krlBinaryInt /'b[01]\+'/ containedin=krlStructVal
highlight default link krlBinaryInt Number
" Hexadecimal integer
syn match krlHexInt /'h[0-9a-fA-F]\+'/ containedin=krlStructVal
highlight default link krlHexInt Number
" Integer
syn match krlInteger /\W\@1<=[+-]\?\d\+/ containedin=krlStructVal,krlFloat contains=krlArithOperator
highlight default link krlInteger Number
" Float
syn match krlFloat /\v\W@1<=[+-]?\d+\.?\d*%(\s*[eE][+-]?\d+)?/ containedin=krlStructVal
highlight default link krlFloat Float
" String
syn region krlString start=/"/ end=/"/ oneline containedin=krlStructVal contains=@Spell
highlight default link krlString String
syn match krlSpecialChar /[|]/ containedin=krlString
highlight default link krlSpecialChar SpecialChar
" String within a fold line
syn region krlSingleQuoteString start=/'/ end=/'/ oneline contained contains=@Spell
highlight default link krlSingleQuoteString String
" Enum
syn match krlEnumVal /#\s*\a\w*/ containedin=krlStructVal
highlight default link krlEnumVal Constant
" }}} Constant values
" Predefined Structure and Enum {{{
" Predefined structures and enums found in
" /r1/mada/$*.dat, /r1/steu/$*.dat and
" /r1/system/$config.dat as well as
" basisTech, gripperTech and spotTech
"
" Predefined data types found in krc1
syn keyword krlStructure servopara keymove powermodul trace techangle tech techfct techcps techfctctrl axis_inc axis_cal date display_var pro_ip con bus
syn keyword krlEnum ident_state sig_state move_state async_state emt_mode boxmode msg_prm_typ msg_typ cmd_stat asys trace_state trace_mode direction techsys techgeoref techclass techmode hpu_key_val pro_state eax transsys mode_move cosys device rotsys emstop cause_t
"
" Predefined data types found in kss functions
syn keyword krlEnum ediagstate rdc_fs_state ret_c_psync_e var_type cancel_psync_e sys_vars
syn keyword krlStructure siginf rw_rdc_file rw_mam_file diagpar_t error_t stopmess case_sense_t msgbuf_t e3pos e3axis diagopt_t
"
" Predefined structures for movement
syn keyword krlStructure frame e6pos pos e6axis axis
syn keyword krlStructure fdat ldat pdat
syn keyword krlStructure load inertia
"
" Predefined structures for shapes
syn keyword krlStructure axbox cylinder box
"
" Predefined structures and enums found in /r1/mada/$machine.dat
syn keyword krlStructure cp fra acc_car jerk_struc dhart spin trpspin ex_kin et_ax maxtool
syn keyword krlEnum individual_mames supply_voltage kinclass main_axis wrist_axis sw_onoff
"
" Predefined structures and enums found in /r1/mada/$robcor.dat
" syn keyword krlStructure
syn keyword krlEnum adap_acc model_type control_parameter eko_mode
"
" Predefined structures and enums found in /steu/mada/$custom.dat
syn keyword krlStructure pro_io_t ser ext_mod_t coop_krc ws_config bin_type coop_update_t ldc_reaction
syn keyword krlEnum axis_of_coordinates spline_para_variant target_status cp_vel_type cp_statmon
"
" Predefined structures and enums found in /steu/mada/$machine.dat
syn keyword krlStructure emstop_path boxstatesafein boxstatesafeout
syn keyword krlEnum digincode
"
" Predefined structures and enums found in /steu/mada/$option.dat
syn keyword krlStructure msg_t
" syn keyword krlEnum
"
" Predefined structures and enums found in /r1/system/$config.dat
" BasisTech
syn keyword krlStructure dig_out_type ctrl_in_t ctrl_out_t fct_out_t fct_in_t odat basis_sugg_t out_sugg_t md_state machine_def_t machine_tool_t machine_frame_t trigger_para constvel_para condstop_para adat tm_sugg_t tqm_tqdat_t sps_prog_type
syn keyword krlEnum bas_command out_modetype ipo_m_t apo_mode_t funct_type p00_command timer_actiontype
"
" GripperTech
syn keyword krlStructure grp_typ grp_types grp_sugg_t
syn keyword krlEnum on_off_typ apo_typ
"
" SpotTech
syn keyword krlStructure spot_type spot_sugg_t
syn keyword krlEnum s_command s_pair_slct command_retr
"
" VW
syn keyword krlStructure vw_mpara_typ zangentyp zangenbedingung ibszangentyp last_ibs_typ verr_typ verrcheck_t t_fb_state kollisionsdaten state_t modus_t
syn keyword krlEnum synctype dir_typ subtype ari_typ bool_typ vw_command ibgn_command vw_user_cmd move_types adv_t_type bas_type ibs_mode_typ vw_user_cmd pro_mode mode_op
"
" ProgCoop
syn keyword krlStructure ydat
" syn keyword krlEnum
"
" bas.src
syn keyword krlStructure cont
syn keyword krlEnum esys ipo_mode circ_mode circ_type ori_type var_state
"
" MsgLib.src
syn keyword krlStructure KrlMsg_T KrlMsgParType_T KrlMsgPar_T KrlMsgOpt_T KrlMsgDlgSK_T
syn keyword krlEnum EKrlMsgType
"
highlight default link krlStructure Structure
highlight default link krlEnum Structure
" }}} Predefined Structure and Enum
" System variable {{{
syn match krlSysvars /\<\$\a[a-zA-Z0-9_.]*/
if g:krlGroupName
highlight default link krlSysvars Sysvars
else
" default color for Sysvars
endif
" }}} System variable
" Statements, keywords et al {{{
" continue
syn keyword krlContinue continue
if g:krlGroupName
highlight default link krlContinue Continue
else
highlight default link krlContinue Statement
endif
" interrupt
syn match krlStatement /\v\c%(<global>\s+)?<INTERRUPT>%(\s+<decl>)?/ contains=krlStorageClass
" keywords
syn keyword krlStatement wait on off enable disable stop trigger with when distance onstart delay do prio import is minimum maximum confirm on_error_proceed
syn match krlStatement /\v\c%(<wait\s+)@7<=<sec>/
syn match krlStatement /\v\c%(<when\s+)@7<=<path>/
highlight default link krlStatement Statement
" Conditional
syn keyword krlConditional if then else endif switch case default endswitch skip endskip
highlight default link krlConditional Conditional
" Repeat
syn keyword krlRepeat for to step endfor while endwhile repeat until loop endloop exit
highlight default link krlRepeat Repeat
" Label
syn keyword krlLabel goto
syn match krlLabel /^\s*\w\+:\ze\s*\%(;.*\)\?$/
highlight default link krlLabel Label
" Keyword
syn keyword krlKeyword anin anout digin
highlight default link krlKeyword Keyword
" Exception
syn keyword krlException return resume halt
highlight default link krlException Exception
" }}} Statements, keywords et al
" special keywords for movement commands {{{
syn keyword krlMovement PTP PTP_REL LIN LIN_REL CIRC CIRC_REL SPL SPL_REL SPTP SPTP_REL SLIN SLIN_REL SCIRC SCIRC_REL
syn keyword krlMovement ASYPTP ASYCONT ASYSTOP ASYCANCEL MOVE_EMI
syn match krlMovement /\v\c^\s*<BRAKE(\s+F)?>/
if g:krlGroupName
highlight default link krlMovement Movement
else
highlight default link krlMovement Special
endif
" movement modifiers
syn match krlMoveBlockInst /\c\v^\s*TIME_BLOCK\s+(START|PART|END)/
syn match krlMoveBlockInst /\c\v^\s*CONST_VEL\s+(START|END)/
syn keyword krlMoveBlockInst ptp_spline spline endspline
highlight default link krlMoveBlockInst Statement
syn keyword krlMoveMod ca c_ptp c_dis c_vel c_ori c_spl
if g:krlGroupName
highlight default link krlMoveMod Movement
else
highlight default link krlMoveMod Special
endif
" }}} special keywords for movement commands
" Structure value {{{
" avoid coloring structure component names
syn match krlNames /\.[a-zA-Z_][.a-zA-Z0-9_$]*/
syn match krlNames contained /[a-zA-Z_][.a-zA-Z0-9_$]*/
" highlight default link krlNames None
" Structure value
syn region krlStructVal start=/{/ end=/}/ oneline containedin=krlStructVal contains=krlNames
highlight default link krlStructVal Delimiter
" }}} Structure value
" BuildInFunction {{{
syn keyword krlBuildInFunction contained Pulse
syn keyword krlBuildInFunction contained m_comment
syn keyword krlBuildInFunction contained is_key_pressed
syn keyword krlBuildInFunction contained set_opt_filter
syn keyword krlBuildInFunction contained timer_limit
syn keyword krlBuildInFunction contained tool_adj
syn keyword krlBuildInFunction contained FRand
syn keyword krlBuildInFunction contained ExecFunc eb_test EB EK EO LK mbx_rec
" safe robot
syn keyword krlbuildinfunction contained get_AxesMask get_BrakeTest_Time
" math
syn keyword krlBuildInFunction contained Abs Sin Cos Acos Tan Atan Atan2 Sqrt
syn keyword krlBuildInFunction contained Forward Inverse inv_pos
" cFoo sFoo
syn keyword krlBuildInFunction contained cClose cOpen cRead cWrite sRead sWrite
" string
syn keyword krlBuildInFunction contained StrToBool StrToInt StrToReal StrToString StrToFrame StrToPos StrToE3Pos StrToE6Pos StrToAxis StrToE3Axis StrToE6Axis
syn keyword krlBuildInFunction contained StrAdd StrClear StrCopy StrComp StrFind StrLen StrDeclLen StrToBool StrToInt StrToReal StrToString
" diag
syn keyword krlBuildInFunction contained diag_start diag_stop get_DiagState
" rdc mam pid
syn keyword krlBuildInFunction contained CheckPidOnRdc check_mam_on_rdc get_rdc_fs_state
syn keyword krlBuildInFunction contained set_mam_on_hd copy_mam_hd_to_rdc copy_mam_rdc_to_hd
syn keyword krlBuildInFunction contained PidToHd PidToRdc
syn keyword krlBuildInFunction contained cal_to_rdc rdc_file_to_hd
syn keyword krlBuildInFunction contained delete_pid_on_rdc delete_rdc_content
syn keyword krlBuildInFunction contained create_rdc_archive restore_rdc_archive
" ioctl
syn keyword krlBuildInFunction contained IOCtl cIOCtl
syn keyword krlBuildInFunction contained WSpaceGive WSpaceTake
" sync
syn keyword krlBuildInFunction contained Sync SyncCmd CancelProgSync
" remote
syn keyword krlBuildInFunction contained RemoteCmd RemoteRead
" msg/dlg
syn keyword krlBuildInFunction contained IsMessageSet clear_KrlMsg get_MsgBuffer exists_KrlDlg exists_KrlMsg set_KrlDlg set_KrlDlgAnswer set_KrlMsg
" robvers
syn keyword krlBuildInFunction contained maximize_UsedxRobvers set_UsedxRobvers
" md_foo
syn keyword krlBuildInFunction contained md_Cmd md_GetState md_SetState md_Asgn
" emi
syn keyword krlBuildInFunction contained emi_ActPos emi_EndPos emi_StartPos emi_RecState emi_RecName
" var
syn keyword krlBuildInFunction contained cast_from cast_to
syn keyword krlBuildInFunction contained GetVarsize GetCycDef get_sig_inf get_decl_place VarType VarState
" sys
syn keyword krlBuildInFunction contained GetSysState get_system_data set_system_data set_system_data_delayed
" err
syn keyword krlBuildInFunction contained err_clear err_raise
" motion
syn keyword krlBuildInFunction contained delete_backward_buffer rob_stop rob_stop_release set_brake_delay suppress_repositioning VectorMoveOn VectorMoveOff
" torque
syn keyword krlBuildInFunction contained set_torque_limits reset_torque_limits
" krc1
syn keyword krlBuildInFunction contained cLcopy cCurpos cNew cClear cRelease cKey
if g:krlGroupName
highlight default link krlBuildInFunction BuildInFunction
else
highlight default link krlBuildInFunction Function
endif
" }}} BuildInFunction
" Function {{{
syn match krlFunction /[a-zA-Z_]\w* *(/me=e-1 contains=krlBuildInFunction
highlight default link krlFunction Function
" }}} Function
" Error {{{
if get(g:, 'krlShowError', 1)
" some more or less common typos
"
" vars or funcs >24 chars are not possible in krl. a234567890123456789012345
syn match krlError0 /\w\{25,}/ containedin=krlFunction,krlNames,krlLabel,krlAnyType,krlEnumVal,krlSysvars
"
" should be interrupt (on|off) \w+
syn match krlError1 /\vinterrupt[ \t(]+[_$a-zA-Z0-9]+[_$a-zA-Z0-9.\[\]()+\-*/]*[ \t)]+o%(n|ff)>/
"
" for bla==5 to 7...
" ||
syn match krlError3 /\v%(^\s*for%(\(|\s)+[_$a-zA-Z]+[_$a-zA-Z0-9.\[\]()+\-*/ ]*\s*)@<=[:=]\=/
"
" TODO optimize performance
" wait for a=b
" |
syn match krlError4 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;<>=])@<=\=[^=]/
"
" wait for a><b
" ||
syn match krlError5 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+)@<=\>\s*\</
"
" if (a==5) (b==6) ...
" |||
syn match krlError6 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;])@<=\)\s*\(/
"
" TODO optimize performance
" a == b + 1
" a := b + 1
" ||
syn match krlError7 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;])@1<!%(^\s*[_$a-zA-Z]+[_$a-zA-Z0-9.\[\],+\-*/]*\s*)@<=[:=]\=/
syn match krlError7 /\v\c%(^\s*%(decl\s+)%(global\s+)?%(const\s+)?\w+\s+\w+\s*)@<=[:=]\=/
syn match krlError7 /\v\c%(^\s*%(decl\s+)?%(global\s+)?%(const\s+)?%(bool\s+|int\s+|real\s+|char\s+)\w+\s*)@<=[:=]\=/
"
" this one is tricky. Make sure this does not match trigger instructions; OK, next try, now search for false positives
" TODO optimize performance
" a = b and c or (int1=int2)
" |
syn match krlError8 /\v(^\s*[_$a-zA-Z]+[_$a-zA-Z0-9.\[\]()+\-*/]*\s*\=[^;]*[^;<>=])@<=\=\ze[^=]/
"
" <(distance|delay|prio)> :=
" <(distance|delay|prio)> ==
" ||
syn match krlError9 /\v(^[^;]*<(distance|delay|prio|minimum|maximum)\s*)@<=[:=]\=/
"
" 'for', 'while' or 'repeat' followed by 'do'
syn match krlError10 /\c\v^\s*(until|while|for)>[^;]*<do>/
"
highlight default link krlError0 Error
highlight default link krlError1 Error
highlight default link krlError2 Error
highlight default link krlError3 Error
highlight default link krlError4 Error
highlight default link krlError5 Error
highlight default link krlError6 Error
highlight default link krlError7 Error
highlight default link krlError8 Error
highlight default link krlError9 Error
highlight default link krlError10 Error
endif
" }}} Error
" Finish {{{
let &cpo = s:keepcpo
unlet s:keepcpo
let b:current_syntax = "krl"
" }}} Finish
" vim:sw=2 sts=2 et fdm=marker

129
runtime/syntax/openscad.vim Normal file
View File

@ -0,0 +1,129 @@
" Vim syntax file
" Language: OpenSCAD
" Maintainer: Niklas Adam <adam@oddodd.org>
" Last change: 2022-04-15
"
"
" From salkin-mada/openscad.nvim
" Building on the work of Sirtaj Singh Kang and others for vim-openscad
"
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
syntax case ignore
setlocal iskeyword=a-z,A-Z,48-57,_
syn match openscadAoperator "{"
syn match openscadAoperator "}"
syn match openscadLi "\["
syn match openscadLi "\]"
syn match openscadPar "("
syn match openscadPar ")"
syn match openscadSpecialVariable "\$[a-zA-Z_]\+\>" display
syn match openscadModifier "^\s*[\*\!\#\%]" display
syn match openscadBinaryoperator "+"
syn match openscadBinaryoperator "-"
syn match openscadBinaryoperator "*"
syn match openscadBinaryoperator "/"
syn match openscadBinaryoperator "%"
syn match openscadBinaryoperator "\*\*"
syn match openscadBinaryoperator "<"
syn match openscadBinaryoperator "<="
syn match openscadBinaryoperator ">"
syn match openscadBinaryoperator ">="
syn match openscadBinaryoperator "="
syn match openscadBinaryoperator "=="
syn match openscadBinaryoperator "==="
syn match openscadBinaryoperator "!="
syn match openscadBinaryoperator "!=="
syn match openscadBinaryoperator "&"
syn match openscadBinaryoperator "|"
syn match openscadBinaryoperator "<!"
syn match openscadBinaryoperator "?"
syn match openscadBinaryoperator "??"
syn match openscadBinaryoperator "!?"
syn match openscadBinaryoperator "!"
syn match openscadBinaryoperator "#"
syn match openscadBinaryoperator "_"
syn match openscadBinaryoperator "\.\."
syn match openscadBinaryoperator "\.\.\."
syn match openscadBinaryoperator "`"
syn match openscadBinaryoperator ":"
syn keyword openscadFunctionDef function nextgroup=openscadFunction skipwhite skipempty
syn match openscadFunction /\<\h\w*\>/ contained display
syn keyword openscadModuleDef module nextgroup=openscadModule skipwhite skipempty
syn match openscadModule /\<\h\w*\>/ contained display
syn keyword openscadStatement echo assign let assert
syn keyword openscadConditional if else
syn keyword openscadRepeat for intersection_for
syn keyword openscadInclude include use
syn keyword openscadCsgKeyword union difference intersection render intersection_for
syn keyword openscadTransform scale rotate translate resize mirror multmatrix color minkowski hull projection linear_extrude rotate_extrude offset
syn keyword openscadPrimitiveSolid cube sphere cylinder polyhedron surface
syn keyword openscadPrimitive2D square circle polygon import_dxf text
syn keyword openscadPrimitiveImport import child children
syn match openscadNumbers "\<\d\|\.\d" contains=openscadNumber display transparent
syn match openscadNumber "\d\+" display contained
syn match openscadNumber "\.\d\+" display contained
syn region openscadString start=/"/ skip=/\\"/ end=/"/
syn keyword openscadBoolean true false
syn keyword openscadCommentTodo TODO FIXME XXX NOTE contained display
syn match openscadInlineComment ://.*$: contains=openscadCommentTodo
syn region openscadBlockComment start=:/\*: end=:\*/: fold contains=openscadCommentTodo
syn region openscadBlock start="{" end="}" transparent fold
syn region openscadVector start="\[" end="\]" transparent fold
syn keyword openscadBuiltin abs acos asin atan atan2 ceil cos exp floor ln log
syn keyword openscadBuiltin lookup max min pow rands round sign sin sqrt tan
syn keyword openscadBuiltin str len search version version_num concat chr ord cross norm
syn keyword openscadBuiltin parent_module
syn keyword openscadBuiltin dxf_cross dxf_dim
syn keyword openscadBuiltinSpecial PI undef
"""""""""""""""""""""""""""""""""""""""""
" linkage
"""""""""""""""""""""""""""""""""""""""""
hi def link openscadFunctionDef Structure
hi def link openscadAoperator Function
hi def link openscadLi Function
" hi def link openscadPar Structure
hi def link openscadBuiltinSpecial Special
hi def link openscadBinaryoperator Special
hi def link openscadFunction Function
hi def link openscadModuleDef Structure
hi def link openscadModule Function
hi def link openscadBlockComment Comment
hi def link openscadBoolean Boolean
hi def link openscadBuiltin Function
hi def link openscadConditional Conditional
hi def link openscadCsgKeyword Structure
hi def link openscadInclude Include
hi def link openscadInlineComment Comment
hi def link openscadModifier Special
hi def link openscadStatement Statement
hi def link openscadNumbers Number
hi def link openscadNumber Number
hi def link openscadPrimitiveSolid Keyword
hi def link openscadPrimitive2D Keyword
hi def link openscadPrimitiveImport Keyword
hi def link openscadRepeat Repeat
hi def link openscadSpecialVariable Special
hi def link openscadString String
hi def link openscadTransform Statement
hi def link openscadCommentTodo Todo
let b:current_syntax = 'openscad'

View File

@ -1,6 +1,6 @@
" Vim syntax support file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Apr 13
" Last Change: 2022 Apr 12
" This file sets up for syntax highlighting.
" It is loaded from "syntax.vim" and "manual.vim".

View File

@ -1,6 +1,6 @@
" Vim syntax support file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2001 Sep 04
" Last Change: 2022 Apr 12
" This file is used for ":syntax on".
" It installs the autocommands and starts highlighting for all buffers.

View File

@ -1,8 +1,8 @@
" Vim syntax file
" Language: Vim 8.2 script
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Last Change: April 08, 2022
" Version: 8.2-33
" Last Change: April 10, 2022
" Version: 8.2-34
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
" Automatically generated keyword lists: {{{1
@ -74,7 +74,7 @@ syn keyword vimAutoEvent contained BufCreate BufEnter BufFilePre BufLeave BufNew
syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo
" Default highlighting groups {{{2
syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineFold CursorLineNr CursorLineSign DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr LineNrAbove LineNrBelow MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC StatusLineTerm TabLine TabLineFill TabLineSel Terminal Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu
syn keyword vimHLGroup contained ColorColumn CurSearch Cursor CursorColumn CursorIM CursorLine CursorLineFold CursorLineNr CursorLineSign DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr LineNrAbove LineNrBelow MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC StatusLineTerm TabLine TabLineFill TabLineSel Terminal Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu
syn match vimHLGroup contained "Conceal"
syn case match

View File

@ -2411,7 +2411,8 @@ mch_init_g(void)
* Otherwise the default "findstr /n" is used.
*/
if (!executable_exists("findstr.exe", NULL, TRUE, FALSE))
set_option_value((char_u *)"grepprg", 0, (char_u *)"grep -n", 0);
set_option_value_give_err((char_u *)"grepprg",
0, (char_u *)"grep -n", 0);
# ifdef FEAT_CLIPBOARD
win_clip_init();

File diff suppressed because it is too large Load Diff