-*change.txt* For Vim version 8.2. Last change: 2020 Apr 11
+*change.txt* For Vim version 8.2. Last change: 2020 Apr 26
VIM REFERENCE MANUAL by Bram Moolenaar
5. Copying and moving text *copy-move*
*quote*
-"{a-zA-Z0-9.%#:-"} Use register {a-zA-Z0-9.%#:-"} for next delete, yank
- or put (use uppercase character to append with
- delete and yank) ({.%#:} only work with put).
+"{register} Use {register} for next delete, yank or put. Use
+ an uppercase character to append with delete and yank.
+ Registers ".", "%", "#" and ":" only work with put.
*:reg* *:registers*
:reg[isters] Display the type and contents of all numbered and
-*cmdline.txt* For Vim version 8.2. Last change: 2020 Feb 29
+*cmdline.txt* For Vim version 8.2. Last change: 2020 Apr 23
VIM REFERENCE MANUAL by Bram Moolenaar
:tcl
:tcldo
:tclfile
+ :terminal
:vglobal
:windo
:write !
none remove all text properties
prop_find({props} [, {direction}])
Dict search for a text property
-prop_list({lnum} [, {props}) List text properties in {lnum}
+prop_list({lnum} [, {props}]) List text properties in {lnum}
prop_remove({props} [, {lnum} [, {lnum-end}]])
Number remove a text property
prop_type_add({name}, {props}) none define a new property type
none change an existing property type
prop_type_delete({name} [, {props}])
none delete a property type
-prop_type_get([{name} [, {props}])
+prop_type_get([{name} [, {props}]])
Dict get property type values
prop_type_list([{props}]) List get list of property types
pum_getpos() Dict position and size of pum if visible
{winnr} can be the window number or the |window-ID|.
*argv()*
-argv([{nr} [, {winid}])
+argv([{nr} [, {winid}]])
The result is the {nr}th file in the argument list. See
|arglist|. "argv(0)" is the first one. Example: >
:let i = 0
Note that to skip code that has a syntax error when the
feature is not available, Vim may skip the rest of the line
- and miss a following `endif`. Therfore put the `endif` on a
+ and miss a following `endif`. Therefore put the `endif` on a
separate line: >
if has('feature')
let x = this->breaks->without->the->feature
|os_amiga.txt| Amiga
|os_beos.txt| BeOS and BeBox
|os_dos.txt| MS-DOS and MS-Windows common items
+|os_haiku.txt| Haiku
|os_mac.txt| Macintosh
|os_mint.txt| Atari MiNT
|os_msdos.txt| MS-DOS (plain DOS and DOS box under Windows)
|os_os2.txt| OS/2
|os_qnx.txt| QNX
|os_risc.txt| RISC-OS
-|os_haiku.txt| Haiku
|os_unix.txt| Unix
|os_vms.txt| VMS
|os_win32.txt| MS-Windows
-*index.txt* For Vim version 8.2. Last change: 2020 Mar 27
+*index.txt* For Vim version 8.2. Last change: 2020 Apr 26
VIM REFERENCE MANUAL by Bram Moolenaar
2 filter Nmove text through the {filter}
command
|!!| !!{filter} 2 filter N lines through the {filter} command
-|quote| "{a-zA-Z0-9.%#:-"} use register {a-zA-Z0-9.%#:-"} for next
- delete, yank or put (uppercase to append)
+|quote| "{register} use {register} for next delete, yank or put
({.%#:} only work with put)
|#| # 1 search backward for the Nth occurrence of
the ident under the cursor
|t_CTRL-W_:| CTRL-W : enter an Ex command
|t_CTRL-W_.| CTRL-W . type CTRL-W in the terminal
CTRL-W CTRL-\ send a CTRL-\ to the job in the terminal
-|t_CTRL-W_quote| CTRL-W " {0-9a-z"%#*:=}
+|t_CTRL-W_quote| CTRL-W " {register}
paste register in the terminal
|t_CTRL-W_CTRL-C| CTRL-W CTRL-C forcefully ends the job
|t_CTRL-W_CTRL-W| CTRL-W CTRL-W move focus to the next window
-*insert.txt* For Vim version 8.2. Last change: 2020 Mar 25
+*insert.txt* For Vim version 8.2. Last change: 2020 Apr 30
VIM REFERENCE MANUAL by Bram Moolenaar
ends CTRL-X mode (any key that is not a valid CTRL-X mode command) is mapped.
Also, when doing completion with 'complete' mappings apply as usual.
- *E565*
+ *E578* *E565*
Note: While completion is active Insert mode can't be used recursively and
buffer text cannot be changed. Mappings that somehow invoke ":normal i.."
will generate an E565 error.
-*map.txt* For Vim version 8.2. Last change: 2019 Dec 19
+*map.txt* For Vim version 8.2. Last change: 2020 Apr 23
VIM REFERENCE MANUAL by Bram Moolenaar
<bang> (See the '-bang' attribute) Expands to a ! if the
command was executed with a ! modifier, otherwise
expands to nothing.
- *<mods>*
+ *<mods>* *:command-modifiers*
<mods> The command modifiers, if specified. Otherwise, expands to
nothing. Supported modifiers are |:aboveleft|, |:belowright|,
|:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|,
9. The meta key modifier |haiku-meta|
10. Mouse key mappings |haiku-mouse|
11. Color names |haiku-colors|
-12. Credits |haiku-support-credits|
-13. Bugs & to-do |haiku-bugs|
+12. GUI Toolbar Images |haiku-toolbar-images|
+13. Credits |haiku-support-credits|
+14. Bugs & to-do |haiku-bugs|
1. General *haiku-general*
Thank you, all!
-13. Bugs & to-do *haiku-bugs*
+14. Bugs & to-do *haiku-bugs*
The port is under development now and far away from the perfect state. For bug
reports, patches and wishes, please use the Vim mailing list or Vim Github
SCO declares this behavior required for backwards compatibility with 16bit
DOS/Windows environments. The two commands below demonstrate the behavior:
>
- echo Hello > file.bat~
+ echo Hello > file.bat~
dir > file.bat
<
The result is that the "dir" command updates the "file.bat~" file, instead
-*repeat.txt* For Vim version 8.2. Last change: 2019 Dec 07
+*repeat.txt* For Vim version 8.2. Last change: 2020 Apr 26
VIM REFERENCE MANUAL by Bram Moolenaar
[addr] (default is current line).
:[addr]@ *:@@*
-:[addr]@@ Repeat the previous :@{0-9a-z"}. First set cursor at
+:[addr]@@ Repeat the previous :@{register}. First set cursor at
line [addr] (default is current line).
==============================================================================
:command-completion-custom map.txt /*:command-completion-custom*
:command-completion-customlist map.txt /*:command-completion-customlist*
:command-count map.txt /*:command-count*
+:command-modifiers map.txt /*:command-modifiers*
:command-nargs map.txt /*:command-nargs*
:command-range map.txt /*:command-range*
:command-register map.txt /*:command-register*
E562 if_cscop.txt /*E562*
E563 if_cscop.txt /*E563*
E564 if_cscop.txt /*E564*
+E565 insert.txt /*E565*
E566 if_cscop.txt /*E566*
E567 if_cscop.txt /*E567*
E568 if_cscop.txt /*E568*
E575 starting.txt /*E575*
E576 starting.txt /*E576*
E577 starting.txt /*E577*
+E578 insert.txt /*E578*
E579 eval.txt /*E579*
E580 eval.txt /*E580*
E581 eval.txt /*E581*
vim.vim syntax.txt /*vim.vim*
vim7 version7.txt /*vim7*
vim8 version8.txt /*vim8*
+vim9 vim9.txt /*vim9*
vim9-differences vim9.txt /*vim9-differences*
vim9-export vim9.txt /*vim9-export*
vim9-import vim9.txt /*vim9-import*
-*terminal.txt* For Vim version 8.2. Last change: 2020 Mar 26
+*terminal.txt* For Vim version 8.2. Last change: 2020 Apr 23
VIM REFERENCE MANUAL by Bram Moolenaar
You can also create menus similar to terminal mode mappings, but you have to
use |:tlmenu| instead of |:tmenu|.
-< *options-in-terminal*
+ *options-in-terminal*
After opening the terminal window and setting 'buftype' to "terminal" the
TerminalOpen autocommand event is triggered. This makes it possible to set
options specifically for the window and buffer. Example: >
keep the terminal open in Terminal-Normal mode. This
can be changed with the ++close argument.
+ No Vim command can follow, any | is included in
+ [command]. Use `:execute` if you must have a Vim
+ command following in the same line.
+
A new buffer will be created, using [command] or
'shell' as the name, prefixed with a "!". If a buffer
by this name already exists a number is added in
prop_type_add({name}, {props}) define a new property type
prop_type_change({name}, {props}) change an existing property type
prop_type_delete({name} [, {props}]) delete a property type
-prop_type_get([{name} [, {props}]) get property type values
+prop_type_get([{name} [, {props}]]) get property type values
prop_type_list([{props}]) get list of property types
prop_clear({lnum} [, {lnum-end} [, {bufnr}]])
remove all text properties
prop_find({props} [, {direction}]) search for a text property
-prop_list({lnum} [, {props}) text properties in {lnum}
+prop_list({lnum} [, {props}]) text properties in {lnum}
prop_remove({props} [, {lnum} [, {lnum-end}]])
remove a text property
Can also be used as a |method|: >
GetPropName()->prop_type_delete()
-prop_type_get([{name} [, {props}]) *prop_type_get()*
+prop_type_get([{name} [, {props}]]) *prop_type_get()*
Returns the properties of property type {name}. This is a
dictionary with the same fields as was given to
prop_type_add().
-*todo.txt* For Vim version 8.2. Last change: 2020 Apr 20
+*todo.txt* For Vim version 8.2. Last change: 2020 Apr 30
VIM REFERENCE MANUAL by Bram Moolenaar
-------------------- Known bugs and current work -----------------------
Vim9 script:
-more tests for # comments:
- check all calls to ends_excmd() and test that space before # is needed.
- next: ex_findpat()
-func and partial types:
-- Calling unknown user function does not give proper error message:
- assert_equal('123text', RefDef2Arg()) typo for "RetDef2Arg"
-- "func" inside "vim9script" doesn't work? (Ben Jackson, #5670)
-- :func inside vim9script must still use a:arg
-- define function and create funcref in one step:
- let ref = def(arg: type): rettype
- body
- enddef
+Big changes, need design:
+- Make closures work:
+ Grab the part of the stack that has the arguments and local vars.
+ Pass a pointer and offset to the closure where this stack fragment is (frame
+ pointer).
+ When a closure disappears at end of the function - nothing to do.
+ When a closure remains at end of the function: copy frame, attach to closure.
+- At the vim9 script level: Allow using a function that is defined later.
+ Requires compiling functions only when the whole script has been sourced.
+ Like Javascript "hoisting", but only at the script level:
+ 1. Discovery phase: Read the file to find all functions, variable
+ declarations and imports If a variable has a constant expression we get
+ the type, otherwise it will be "any". Follow imports recursively.
+ 2. Compilation phase: compile :def function bodies, using declared types
+ 3. Execution phase: Execute imports when encountered. (skip over functions)
+- When sourcing a script again, also delete script-local variables.
+Making everything work:
- Test that a script-local function in Vim9 script cannot be deleted.
- Test that a function defined inside a :def function is local to that
function, g: functions can be defined and script-local functions cannot be
defined.
-Also:
-- When wildcards are expanded, find `=expr` and evaluate it before invoking
- the command. For example: :edit `=filename`
+- Check that when using a user function name without prefix, it does not find
+ a global function. Prefixing g: is required.
+- Compile let [var, var] = expr
+- Compile replacement of :s command: s/pat/\=expr/
+- Compile redir to local variable: var_redir_start().
+- Compile builtin functions that access local variables:
+ islocked()
+- Expand `=expr` in :next, :argedit, :argadd, :argdelete, :drop
+- Expand `=expr` in :vimgrep, :vimgrepadd, :lvimgrep, :lvimgrepadd
+- Expand `=expr` in :mkspell
+- Support type for ":let"/":const" at script level for Vim9 script.
+ (Ben Jackson, #5671)
+ Can we share the code from ex_let_const() between direct execution and
+ compiling?
+- Disallow unlet for local/script/imported vars
+- Make "++nr" work.
+- expandcmd() with `=expr` in filename uses legacy expression.
+- eval_expr() in ex_cexpr()
+- eval_expr() call in dbg_parsearg() and debuggy_find()
+New syntax and functionality:
+- define function and create funcref in one step:
+ let ref = def(arg: type): rettype
+ body
+ enddef
+Improve error checking:
- "echo Func()" is an error if Func() does not return anything.
-- Check all Ex commands, give error if they use an expression and should be
- compiled.
+Also:
- For range: make table of first ASCII character with flag to quickly check if
it can be a Vim9 command. E.g. "+" can, but "." can't.
- better implementation for partial and tests for that.
- Make "g:imported = Export.exported" work in Vim9 script.
- Make Foo.Bar() work to call the dict function. (#5676)
-- Support type for ":let"/":const" at script level for Vim9 script.
- (Ben Jackson, #5671)
- Can we share the code for :let between direct execution and compiling?
-- Disallow unlet for local/script/imported vars
-- Make "++nr" work.
- Check that import in legacy script works and puts item in s:
- Error in any command in "vim9script" aborts sourcing.
- Find a way to test expressions in legacy and Vim9 script without duplication
- Make accessing varargs faster: arg[expr]
EVAL expr
LOADVARARG (varags idx)
+Further improvements:
+- compile options that are an expression, e.g. "expr:" in 'spellsuggest',
+ 'foldexpr', 'foldtext', 'printexpr', 'diffexpr', 'patchexpr', 'charconvert',
+ 'balloonexpr', 'includeexpr', 'indentexpr', 'formatexpr'.
+- compile get_lambda_tv() in popup_add_timeout()
+- compile "skip" argument of searchpair()
+- compile "expr" and "call" expression of a channel in channel_exe_cmd()?
Popup windows:
- With some sequence get get hidden finished terminal buffer. (#5768)
conversions.
Error numbers available:
-E453, E454, E460, E489, E491, E565, E578, E610, E611, E653,
+E453, E454, E460, E489, E491, E610, E611, E653,
E856, E857, E861, E900
Buffer autocommands are a bit inconsistent. Add a separate set of
Patch to add "-d" to xxd. (#5616)
+Patch for the Haiku port: #5961
+
Patch to add Turkish manual. (Emir Sarı, #5641)
+Patch to support different color for undercurl in cterm.
+(Timur Celik, #6011)
+
Patch to support cindent option to handle pragmas differently.
(Max Rumpf, #5468)
Athena is OK.
Motif: Build on Ubuntu can't enter any text in dialog text fields.
+:map output does not clear the reset of the command line.
+(#5623, also see #5962)
+
Patch to properly break CJK lines: Anton Kochkov, #3875
Flag in 'formatoptions' is not used in the tests.
When 'lazyredraw' is set sometimes the title is not updated.
(Jason Franklin, 2020 Feb 3) Looks like a race condition.
-Patch to delete BeOS code. (#5817)
+Patch to delete BeOS code. (#5817) Anyone who wants to keep it?
+
+With bash ":make" does not set v:shell_error. Possible solution: set
+'shellpipe' to "2>&1| tee %s; exit ${PIPESTATUS[0]}" #5994
Strange sequence of BufWipeout and BufNew events while doing omni-complete.
(Paul Jolly, #5656)
Patch to include reduce() function. (#5481)
+When SIGTSTP is ignored, don't let CTRL-Z suspend Vim? (Kurtis Rader, #5990)
+
Statusline highlighting error, off by one. (#5599)
Enable 'termbidi' if $VTE_VERSION >= 5703 ?
The :syntax cchar value can only be a single character. It would be useful to
support combining characters. (Charles Campbell) Also #4687
-Include Haiku port. (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24)
-It can replace the BeOS code, which is likely not used anymore.
-Now on github: #1856. Updated Oct 2017
-Got permission to include this under the Vim license.
-
"--cleanFOO" does not result in an error. (#5537)
Add "t" action to settagstack(): truncate and add new entries. (#5405)
"main.c" file, then make a split and show the differences: >
:edit main.c
- :vertical diffsplit main.c~
+ :vertical diffsplit main.c~
The ":vertical" command is used to make the window split vertically. If you
omit this, you will get a horizontal split.
lowercase. This can be shortened to "guu". "gUgU" is shortened to "gUU" and
"g~g~" to "g~~". Example: >
- g~~
+ g~~
< Some GIRLS have Fun ----> sOME girls HAVE fUN ~
==============================================================================
-*vim9.txt* For Vim version 8.2. Last change: 2020 Apr 19
+*vim9.txt* For Vim version 8.2. Last change: 2020 Apr 30
VIM REFERENCE MANUAL by Bram Moolenaar
THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE
-Vim9 script commands and expressions.
+Vim9 script commands and expressions. *vim9*
Most expression help is in |eval.txt|. This file is about the new syntax and
features in Vim9 script.
THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE
-Vim script has been growing over time, while keeping backwards compatibility.
-That means bad choices from the past often can't be changed. Execution is
-quite slow, every line is parsed every time it is executed.
+Vim script has been growing over time, while preserving backwards
+compatibility. That means bad choices from the past often can't be changed
+and compability with Vi restricts possible solutions. Execution is quite
+slow, each line is parsed every time it is executed.
-The main goal of Vim9 script is to drastically improve performance. An
-increase in execution speed of 10 to 100 times can be expected. A secondary
-goal is to avoid Vim-specific constructs and get closer to commonly used
-programming languages, such as JavaScript, TypeScript and Java.
+The main goal of Vim9 script is to drastically improve performance. This is
+accomplished by compiling commands into instructions that can be efficiently
+executed. An increase in execution speed of 10 to 100 times can be expected.
+
+A secondary goal is to avoid Vim-specific constructs and get closer to
+commonly used programming languages, such as JavaScript, TypeScript and Java.
The performance improvements can only be achieved by not being 100% backwards
compatible. For example, in a function the arguments are not available in the
-"a:" dictionary, as creating that dictionary adds quite a lot of overhead.
-Other differences are more subtle, such as how errors are handled.
+"a:" dictionary, because creating that dictionary adds quite a lot of
+overhead. Other differences are more subtle, such as how errors are handled.
The Vim9 script syntax and semantics are used in:
- a function defined with the `:def` command
- a script file where the first command is `vim9script`
When using `:function` in a Vim9 script file the legacy syntax is used.
-However, this is discouraged.
+However, this can be confusing and is therefore discouraged.
-Vim9 script and legacy Vim script can be mixed. There is no need to rewrite
-old scripts, they keep working as before.
+Vim9 script and legacy Vim script can be mixed. There is no requirement to
+rewrite old scripts, they keep working as before.
==============================================================================
In Vim script comments normally start with double quote. That can also be the
start of a string, thus in many places it cannot be used. In Vim9 script a
-comment can also start with #. Normally this is a command to list text with
+comment can also start with #. In Vi this is a command to list text with
numbers, but you can also use `:number` for that. >
- let count = 0 # number of occurences of Ni!
+ let count = 0 # number of occurences
To improve readability there must be a space between the command and the #
that starts a comment. Note that #{ is the start of a dictionary, therefore
Vim9 functions ~
+A function defined with `:def` is compiled. Execution is many times faster,
+often 10x to 100x times.
+
+Many errors are already found when compiling, before the function is called.
+The syntax is strict, to enforce code that is easy to read and understand.
+
`:def` has no extra arguments like `:function` does: "range", "abort", "dict"
or "closure". A `:def` function always aborts on an error, does not get a
range passed and cannot be a "dict" function.
-In the function body:
-- Arguments are accessed by name, without "a:".
-- There is no "a:" dictionary or "a:000" list. Variable arguments are defined
- with a name and have a list type: >
- def MyFunc(...itemlist: list<type>)
+The argument types and return type need to be specified. The "any" type can
+be used, type checking will then be done at runtime, like with legacy
+functions.
+
+Arguments are accessed by name, without "a:". There is no "a:" dictionary or
+"a:000" list.
+
+Variable arguments are defined as the last argument, with a name and have a
+list type, similar to Typescript. For example, a list of numbers: >
+ def MyFunc(...itemlist: list<number>)
for item in itemlist
...
-Functions are script-local by default ~
+Functions and variables are script-local by default ~
When using `:function` or `:def` to specify a new function at the script level
in a Vim9 script, the function is local to the script, as if "s:" was
-prefixed. To define a global function the "g:" prefix must be used.
+prefixed. Using the "s:" prefix is optional.
+
+To define or use a global function or variable the "g:" prefix must be used.
When using `:function` or `:def` to specify a new function inside a function,
the function is local to the function. It is not possible to define a
-script-local function inside a function. To define a global function the "g:"
-prefix must be used.
+script-local function inside a function. It is possible to define a global
+function, using the "g:" prefix.
When referring to a function and no "s:" or "g:" prefix is used, Vim will
search for the function in this order:
-- Local to the current function scope.
+- Local to the current scope and outer scopes up to the function scope.
- Local to the current script file.
- Imported functions, see `:import`.
-- Global.
+In all cases the function must be defined before used. To make a call cycle a
+global function needs to be used. (TODO: can we fix this?)
+
+The result is that functions and variables without a namespace can always be
+found in the script, either defined there or imported. Global functions and
+variables could be defined anywhere (good luck finding where!).
Global functions can be defined and deleted at nearly any time. In Vim9
script script-local functions are defined once when the script is sourced and
-cannot be deleted.
+cannot be deleted. Except that when the same script is sourced again all
+existing script-local functions and variables are deleted.
Variable declarations with :let and :const ~
Variables cannot shadow previously defined variables.
Variables may shadow Ex commands, rename the variable if needed.
-Global variables must be prefixed with "g:", also at the script level.
-However, global user defined functions are used without "g:". >
+Global variables and user defined functions must be prefixed with "g:", also
+at the script level. >
vim9script
let script_local = 'text'
let g:global = 'value'
- let Funcref = ThatFunction
+ let Funcref = g:ThatFunction
Since "&opt = value" is now assigning a value to option "opt", ":&" cannot be
used to repeat a `:substitute` command.
" Vim filetype plugin file
" Language: man
-" Maintainer: SungHyun Nam <goweol@gmail.com>
-" Last Change: 2020 Apr 13
+" Maintainer: Jason Franklin <vim@justemail.net>
+" Previous Maintainer: SungHyun Nam <goweol@gmail.com>
+" Last Change: 2020 Apr 30
" To make the ":Man" command available before editing a manual page, source
" this script from your startup vimrc file.
endif
let env_cmd = s:env_has_u ? 'env -u MANPAGER' : 'env MANPAGER=cat'
let env_cmd .= ' GROFF_NO_SGR=1'
- let man_cmd = env_cmd . ' man ' . s:GetCmdArg(sect, page) . ' | col -b'
+ let man_cmd = env_cmd . ' man ' . s:GetCmdArg(sect, page) . ' 2>/dev/null | col -b'
silent exec "r !" . man_cmd
if unsetwidth
" Maintainer: Debian Vim Maintainers
" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
" Wichert Akkerman <wakkerma@debian.org>
-" Last Change: 2020 Feb 02
+" Last Change: 2020 Apr 27
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim
" Standard syntax initialization
\ 'wheezy', 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm',
\ 'sid', 'rc-buggy',
\
- \ 'trusty', 'xenial', 'bionic', 'eoan', 'focal', 'devel'
+ \ 'trusty', 'xenial', 'bionic', 'eoan', 'focal', 'groovy', 'devel'
\ ]
let s:unsupported = [
\ 'frozen', 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato',
" Language: Debian sources.list
" Maintainer: Debian Vim Maintainers
" Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl>
-" Last Change: 2020 Feb 02
+" Last Change: 2020 Apr 27
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim
" Standard syntax initialization
\ 'wheezy', 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm',
\ 'sid', 'rc-buggy',
\
- \ 'trusty', 'xenial', 'bionic', 'eoan', 'focal', 'devel'
+ \ 'trusty', 'xenial', 'bionic', 'eoan', 'focal', 'groovy', 'devel'
\ ]
let s:unsupported = [
\ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato',
" Vim syntax file
-" Language: Lex
+" Language: Lex and Flex
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
-" Last Change: Aug 31, 2016
-" Version: 17
-" URL: http://mysite.verizon.net/astronaut/vim/index.html#SYNTAX_LEX
-"
-" Option:
-" lex_uses_cpp : if this variable exists, then C++ is loaded rather than C
+" Contributor: Robert A. van Engelen <engelen@acm.org>
+" Last Change: Apr 24, 2020
+" Version: 18
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
-" Read the C/C++ syntax to start with
-let s:Cpath= fnameescape(expand("<sfile>:p:h").(exists("g:lex_uses_cpp")? "/cpp.vim" : "/c.vim"))
+" Read the C++ syntax to start with
+let s:Cpath= fnameescape(expand("<sfile>:p:h")."/cpp.vim")
if !filereadable(s:Cpath)
- for s:Cpath in split(globpath(&rtp,(exists("g:lex_uses_cpp")? "syntax/cpp.vim" : "syntax/c.vim")),"\n")
+ for s:Cpath in split(globpath(&rtp,"syntax/cpp.vim"),"\n")
if filereadable(fnameescape(s:Cpath))
let s:Cpath= fnameescape(s:Cpath)
break
" --- Lex stuff ---
" --- ========= ---
-" Options Section
-syn match lexOptions '^%\s*option\>.*$' contains=lexPatString
+" Definitions
+" %%
+" Rules
+" %%
+" User Code
+"
+" --- ======= ---
+" --- Example ---
+" --- ======= ---
+"
+" // this is a valid lex file
+" // indented initial code block
+" #include <stdlib.h>
+" %{
+" // initial code block
+" #include <stdio.h>
+" const char *sep = "";
+" %}
+" %option outfile="scanner.c" noyywrap nodefault
+" %x COMMENT
+" id [A-Za-z_][A-Za-z0-9_]*
+" %%
+" // indented initial action code block
+" printf("BEGIN");
+" {id} printf("%s%s", sep, yytext); sep = "";
+" . |
+" \n { sep = "\n"; }
+" "/*" { BEGIN COMMENT; }
+" "//".* { }
+" <COMMENT>{
+" "*/" { BEGIN INITIAL; }
+" .|\n
+" }
+" <*><<EOF>> { // end of file
+" printf("\nEND\n");
+" yyterminate();
+" }
+" %%
+" void scan()
+" {
+" while (yylex())
+" continue;
+" }
+" /* main program */
+" int main()
+" {
+" scan();
+" }
-" Abbreviations Section
+" Definitions Section with initial code blocks, abbreviations, options, states
if has("folding")
- syn region lexAbbrvBlock fold start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState
+ syn region lexAbbrvBlock fold start="^\S" end="^\ze%%" skipnl nextgroup=lexPatBlock contains=lexOptions,lexAbbrv,lexInitialCodeBlock,lexInclude,lexAbbrvComment,lexStartState
else
- syn region lexAbbrvBlock start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState
+ syn region lexAbbrvBlock start="^\S" end="^\ze%%" skipnl nextgroup=lexPatBlock contains=lexOptions,lexAbbrv,lexInitialCodeBlock,lexInclude,lexAbbrvComment,lexStartState
endif
-syn match lexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=lexAbbrvRegExp
-syn match lexAbbrv "^%[sx]" contained
-syn match lexAbbrvRegExp "\s\S.*$"lc=1 contained nextgroup=lexAbbrv,lexInclude
+syn match lexOptions "^%\a\+\(\s.*\|[^{]*\)$" contains=lexOptionsEq,lexPatString,lexSlashQuote,lexBrace,lexSlashBrace
+syn match lexOptionsEq "=" skipwhite contained
+syn match lexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=lexAbbrvPat
+syn match lexAbbrvPat "\s\S.*$"lc=1 contained contains=lexPatAbbrv,lexPatString,lexSlashQuote,lexBrace,lexSlashBrace nextgroup=lexAbbrv,lexInclude
+syn match lexStartState "^%\(xs\?\|s\)\(t\(a\(t\(e\?\)\?\)\?\)\?\)\?\(\s\+\I\i*\)\+\s*$" contained contains=lexStartStateCmd
+syn match lexStartStateCmd '^%\(xs\?\|s\)\(t\(a\(t\(e\?\)\?\)\?\)\?\)\?' contained
if has("folding")
- syn region lexInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=@lexCcode
- syn region lexAbbrvComment fold start="^\s\+/\*" end="\*/" contains=@Spell
- syn region lexAbbrvComment fold start="\%^/\*" end="\*/" contains=@Spell
- syn region lexStartState fold matchgroup=lexAbbrv start="^%\a\+" end="$" contained
+ syn region lexInitialCodeBlock fold start="^\s\+" end="^\S"me=e-1 contains=@lexCcode
+ syn region lexInclude fold matchgroup=lexSep start="^%\a*{" end="^%\?}" contained contains=@lexCcode,lexCFunctions
+ syn region lexAbbrvComment fold start="^\s*//" end="$" contains=@Spell
+ syn region lexAbbrvComment fold start="^\s*/\*" end="\*/" contains=@Spell
else
- syn region lexInclude matchgroup=lexSep start="^%{" end="%}" contained contains=@lexCcode
- syn region lexAbbrvComment start="^\s\+/\*" end="\*/" contains=@Spell
- syn region lexAbbrvComment start="\%^/\*" end="\*/" contains=@Spell
- syn region lexStartState matchgroup=lexAbbrv start="^%\a\+" end="$" contained
+ syn region lexInitialCodeBlock start="^\s\+" end="^\S"me=e-1 contains=@lexCcode
+ syn region lexInclude matchgroup=lexSep start="^%\a*{" end="^%\?}" contained contains=@lexCcode,lexCFunctions
+ syn region lexAbbrvComment start="^\s*//" end="$" contains=@Spell
+ syn region lexAbbrvComment start="^\s*/\*" end="\*/" contains=@Spell
endif
-"%% : Patterns {Actions}
+" Rules Section with patterns and actions
if has("folding")
- syn region lexPatBlock fold matchgroup=Todo start="^%%$" matchgroup=Todo end="^%\ze%$" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude
- syn region lexPat fold start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPattern contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace
- syn region lexPatInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=lexPatCode
- syn region lexBrace fold start="\[" skip=+\\\\\|\\+ end="]" contained
- syn region lexPatString fold matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained
+ syn region lexPatBlock fold matchgroup=Todo start="^%%" matchgroup=Todo end="^\ze%%" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude
+ syn region lexPat fold start="\S" skip="\\\\\|\\\s" end="\ze\(\s*$\|\s\+\(\h\|{\W\|{$\|[-+*]\|//\|/\*\)\)" skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPatEnd contains=lexPatTag,lexPatString,lexSlashQuote,lexPatAbbrv,lexBrace,lexSlashBrace
+ syn region lexPatInclude fold matchgroup=lexSep start="^%{" end="^%}" contained contains=@lexCcode
+ syn region lexBrace fold matchgroup=Character start="\[" skip="\\.\|\[:\a\+:\]\|\[\.\a\+\.\]\|\[=.=\]" end="\]" contained
+ syn region lexPatString fold matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained
else
- syn region lexPatBlock matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude
- syn region lexPat start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPattern contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace
- syn region lexPatInclude matchgroup=lexSep start="^%{" end="%}" contained contains=lexPatCode
- syn region lexBrace start="\[" skip=+\\\\\|\\+ end="]" contained
- syn region lexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained
+ syn region lexPatBlock matchgroup=Todo start="^%%" matchgroup=Todo end="^\ze%%" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude
+ syn region lexPat start="\S" skip="\\\\\|\\\s" end="\ze\(\s*$\|\s\+\(\h\|{\W\|{$\|[-+*]\|//\|/\*\)\)" skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPatEnd contains=lexPatTag,lexPatString,lexSlashQuote,lexPatAbbrv,lexBrace,lexSlashBrace
+ syn region lexPatInclude matchgroup=lexSep start="^%{" end="^%}" contained contains=@lexCcode
+ syn region lexBrace matchgroup=Character start="\[" skip="\\.\|\[:\a\+:\]\|\[\.\a\+\.\]\|\[=.=\]" end="\]" contained
+ syn region lexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained
endif
-syn match lexPatTag "^<\I\i*\(,\I\i*\)*>" contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep
-syn match lexPatTagZone "^<\I\i*\(,\I\i*\)*>\s\+\ze{" contained nextgroup=lexPatTagZoneStart
-syn match lexPatTag +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+ contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep
-
-" Lex Patterns
-syn region lexPattern start='[^ \t{}]' end="$" contained contains=lexPatRange
-syn region lexPatRange matchgroup=Delimiter start='\[' skip='\\\\\|\\.' end='\]' contains=lexEscape
-syn match lexEscape '\%(\\\\\)*\\.' contained
+syn match lexPatAbbrv "{\I\i*}"hs=s+1,he=e-1 contained
+syn match lexPatTag "^<\^\?\(\I\i*\|\*\)\(,\^\?\(\I\i*\|\*\)\)*>" contained nextgroup=lexPat,lexMorePat,lexPatSep,lexPatEnd
+syn match lexPatTagZone "^<\^\?\(\I\i*\|\*\)\(,\^\?\(\I\i*\|\*\)\)*>\s*{$"me=e-1 contained nextgroup=lexPatTagZoneStart
if has("folding")
- syn region lexPatTagZoneStart matchgroup=lexPatTag fold start='{' end='}' contained contains=lexPat,lexPatComment
- syn region lexPatComment start="\s\+/\*" end="\*/" fold skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
+ syn region lexPatTagZoneStart fold matchgroup=lexPatTag start='{$' end='^}' skipnl skipwhite contained contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude
+ syn region lexPatComment fold start="//" end="$" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
+ syn region lexPatComment fold start="/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
else
- syn region lexPatTagZoneStart matchgroup=lexPatTag start='{' end='}' contained contains=lexPat,lexPatComment
- syn region lexPatComment start="\s\+/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
+ syn region lexPatTagZoneStart matchgroup=lexPatTag start='{' end='^}' skipnl skipwhitecontained contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude
+ syn region lexPatComment start="//" end="$" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
+ syn region lexPatComment start="/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
endif
-syn match lexPatCodeLine "[^{\[].*" contained contains=@lexCcode
-syn match lexMorePat "\s*|\s*$" skipnl contained nextgroup=lexPat,lexPatTag,lexPatComment
-syn match lexPatSep "\s\+" contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine
+syn match lexPatEnd "\s*$" skipnl contained
+syn match lexPatCodeLine "[^{\[].*" contained contains=@lexCcode,lexCFunctions
+syn match lexMorePat "\s*|\s*$" skipnl contained nextgroup=lexPat,lexPatTag,lexPatComment
+syn match lexPatSep "\s\+" contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine
syn match lexSlashQuote +\(\\\\\)*\\"+ contained
+syn match lexSlashBrace +\(\\\\\)*\\\[+ contained
if has("folding")
- syn region lexPatCode matchgroup=Delimiter start="{" end="}" fold skipnl contained contains=@lexCcode,lexCFunctions
+ syn region lexPatCode fold matchgroup=Delimiter start="{" end="}" skipnl contained contains=@lexCcode,lexCFunctions
else
- syn region lexPatCode matchgroup=Delimiter start="{" end="}" skipnl contained contains=@lexCcode,lexCFunctions
+ syn region lexPatCode matchgroup=Delimiter start="{" end="}" skipnl contained contains=@lexCcode,lexCFunctions
endif
-" Lex "functions" which may appear in C/C++ code blocks
-syn keyword lexCFunctions BEGIN input unput woutput yyleng yylook yytext
-syn keyword lexCFunctions ECHO output winput wunput yyless yymore yywrap
+" User Code Section with final code block
+syn region lexFinalCodeBlock matchgroup=Todo start="^%%" end="\%$" contained contains=@lexCcode
-" %%
-" lexAbbrevBlock
-" %%
-" lexPatBlock
-" %%
-" lexFinalCodeBlock
-syn region lexFinalCodeBlock matchgroup=Todo start="%$"me=e-1 end="\%$" contained contains=@lexCcode
+" Lex macros which may appear in C/C++ code blocks
+syn keyword lexCFunctions BEGIN ECHO REJECT yytext YYText yyleng YYLeng yymore yyless yywrap yylook
+syn keyword lexCFunctions yyrestart yyterminate yylineno yycolumno yyin yyout
+syn keyword lexCFunctions input unput output winput wunput woutput
+syn keyword lexCFunctions yyinput yyunput yyoutput yywinput yywunput yywoutput
" <c.vim> includes several ALLBUTs; these have to be treated so as to exclude lex* groups
-syn cluster cParenGroup add=lex.*
+syn cluster cParenGroup add=lex.*
syn cluster cDefineGroup add=lex.*
syn cluster cPreProcGroup add=lex.*
-syn cluster cMultiGroup add=lex.*
+syn cluster cMultiGroup add=lex.*
" Synchronization
syn sync clear
syn sync minlines=500
syn sync match lexSyncPat grouphere lexPatBlock "^%[a-zA-Z]"
syn sync match lexSyncPat groupthere lexPatBlock "^<$"
-syn sync match lexSyncPat groupthere lexPatBlock "^%%$"
+syn sync match lexSyncPat groupthere lexPatBlock "^%%"
" The default highlighting.
if !exists("skip_lex_syntax_inits")
hi def link lexAbbrvComment lexPatComment
- hi def link lexAbbrvRegExp Macro
- hi def link lexAbbrv SpecialChar
- hi def link lexBrace lexPat
- hi def link lexCFunctions Function
- hi def link lexCstruct cStructure
- hi def link lexMorePat SpecialChar
- hi def link lexOptions PreProc
+ hi def link lexAbbrvPat lexPat
+ hi def link lexAbbrv Special
+ hi def link lexBrace lexPat
+ hi def link lexCFunctions PreProc
+ hi def link lexMorePat Special
+ hi def link lexOptions PreProc
+ hi def link lexOptionsEq Operator
hi def link lexPatComment Comment
hi def link lexPat Function
- hi def link lexPatString Function
- hi def link lexPatTag Special
+ hi def link lexPatString lexPat
+ hi def link lexPatAbbrv Special
+ hi def link lexPatTag Statement
hi def link lexPatTagZone lexPatTag
hi def link lexSep Delimiter
hi def link lexSlashQuote lexPat
- hi def link lexStartState Statement
+ hi def link lexSlashBrace lexPat
+ hi def link lexStartState lexPatTag
+ hi def link lexStartStateCmd Special
endif
let b:current_syntax = "lex"
-" vim:ts=10
+" vim:ts=8
" Vim syntax file
" Language: Man page
-" Maintainer: SungHyun Nam <goweol@gmail.com>
+" Maintainer: Jason Franklin <vim@justemail.net>
+" Previous Maintainer: SungHyun Nam <goweol@gmail.com>
" Previous Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com>
" Version Info:
-" Last Change: 2020 Apr 15
+" Last Change: 2020 Apr 30
" Additional highlighting by Johannes Tanzler <johannes.tanzler@aon.at>:
" * manSubHeading
syn case ignore
-syn match manHeader '\%1l.*'
-exe 'syn match manFooter ''\%' . line('$') . 'l.*'''
-
syn match manReference "\f\+([1-9][a-z]\=)"
syn match manSectionHeading "^[a-z][a-z -]*[a-z]$"
syn match manSubHeading "^\s\{3\}[a-z][a-z -]*[a-z]$"
syn match manLongOptionDesc "^\s*--[a-z0-9-]\S*"
" syn match manHistory "^[a-z].*last change.*$"
+syn match manHeader '\%1l.*'
+exe 'syn match manFooter ''\%' . line('$') . 'l.*'''
+
if getline(1) =~ '^[a-zA-Z_]\+([23])'
syntax include @cCode <sfile>:p:h/c.vim
syn match manCFuncDefinition display "\<\h\w*\>\s*("me=e-1 contained