mirror of
https://github.com/vim/vim
synced 2025-07-15 16:51:57 +00:00
Update runtime files
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 8.2. Last change: 2022 Jun 02
|
||||
*options.txt* For Vim version 8.2. Last change: 2022 Jun 07
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
@ -1916,6 +1916,8 @@ $quote eval.txt /*$quote*
|
||||
40.3 usr_40.txt /*40.3*
|
||||
41.1 usr_41.txt /*41.1*
|
||||
41.10 usr_41.txt /*41.10*
|
||||
41.11 usr_41.txt /*41.11*
|
||||
41.12 usr_41.txt /*41.12*
|
||||
41.2 usr_41.txt /*41.2*
|
||||
41.3 usr_41.txt /*41.3*
|
||||
41.4 usr_41.txt /*41.4*
|
||||
@ -1950,6 +1952,7 @@ $quote eval.txt /*$quote*
|
||||
45.5 usr_45.txt /*45.5*
|
||||
50.1 usr_50.txt /*50.1*
|
||||
50.2 usr_50.txt /*50.2*
|
||||
50.3 usr_50.txt /*50.3*
|
||||
51.1 usr_51.txt /*51.1*
|
||||
51.2 usr_51.txt /*51.2*
|
||||
51.3 usr_51.txt /*51.3*
|
||||
@ -8046,6 +8049,7 @@ lcs-conceal options.txt /*lcs-conceal*
|
||||
lcs-eol options.txt /*lcs-eol*
|
||||
lcs-extends options.txt /*lcs-extends*
|
||||
lcs-lead options.txt /*lcs-lead*
|
||||
lcs-leadmultispace options.txt /*lcs-leadmultispace*
|
||||
lcs-multispace options.txt /*lcs-multispace*
|
||||
lcs-nbsp options.txt /*lcs-nbsp*
|
||||
lcs-precedes options.txt /*lcs-precedes*
|
||||
|
@ -1,4 +1,4 @@
|
||||
*terminal.txt* For Vim version 8.2. Last change: 2022 May 23
|
||||
*terminal.txt* For Vim version 8.2. Last change: 2022 Jun 09
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -101,7 +101,7 @@ The special key combination CTRL-\ CTRL-N can be used to switch to Normal
|
||||
mode, just like this works in any other mode.
|
||||
*t_CTRL-W_CTRL-C*
|
||||
CTRL-W CTRL-C can be typed to forcefully end the job. On MS-Windows a
|
||||
CTRL-BREAK will also kill the job.
|
||||
CTRL-Break will also kill the job.
|
||||
|
||||
If you type CTRL-C the effect depends on what the pty has been configured to
|
||||
do. For simple commands this causes a SIGINT to be sent to the job, which
|
||||
|
@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 8.2. Last change: 2022 Jun 05
|
||||
*todo.txt* For Vim version 8.2. Last change: 2022 Jun 09
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -245,6 +245,9 @@ Memory leaks in test_channel? (or is it because of fork())
|
||||
|
||||
PR to support %e and %k in 'errorformat'. #9624
|
||||
|
||||
With a window height of 6 and 'scrolloff' set to 3, using "j" does not scroll
|
||||
evenly. (#10545)
|
||||
|
||||
Idea: when typing ":e /some/dir/" and "dir" does not exist, highlight in red.
|
||||
|
||||
":set &shellpipe" and ":set &shellredir" should use the logic from
|
||||
@ -306,6 +309,8 @@ inconsistent with the documentation.
|
||||
|
||||
globpath() does not use 'wildignorecase' at all? (related to #8350)
|
||||
|
||||
Add a "--gui-dialog-file" argument, to be used in tests to avoid getting stuck.
|
||||
|
||||
Add 'termguiattr' option, use "gui=" attributes in the terminal? Would work
|
||||
with 'termguicolors'. #1740
|
||||
|
||||
|
@ -17,8 +17,10 @@ script. There are a lot of them, therefore this is a long chapter.
|
||||
|41.6| Using functions
|
||||
|41.7| Defining a function
|
||||
|41.8| Lists and Dictionaries
|
||||
|41.9| Exceptions
|
||||
|41.10| Various remarks
|
||||
|41.9| White space
|
||||
|41.10| Line continuation
|
||||
|41.11| Comments
|
||||
|41.12| Fileformat
|
||||
|
||||
Next chapter: |usr_42.txt| Add new menus
|
||||
Previous chapter: |usr_40.txt| Make new commands
|
||||
@ -112,7 +114,7 @@ the links if you are impatient.
|
||||
TRYING OUT EXAMPLES
|
||||
|
||||
You can easily try out most examples in these help files without saving the
|
||||
commands in a file. For example, to try out the "for" loop above do this:
|
||||
commands to a file. For example, to try out the "for" loop above do this:
|
||||
1. position the cursor on the "for"
|
||||
2. start Visual mode with "v"
|
||||
3. move down to the "endfor"
|
||||
@ -195,7 +197,7 @@ cannot start with a digit. Valid variable names are:
|
||||
CamelCaseName
|
||||
LENGTH
|
||||
|
||||
Invalid names are "foo+bar" and "6var".
|
||||
Invalid names are "foo.bar" and "6var".
|
||||
|
||||
Some variables are global. To see a list of currently defined global
|
||||
variables type this command: >
|
||||
@ -684,8 +686,8 @@ search() function uses its first argument as a search pattern and the second
|
||||
one as flags. The "W" flag means the search doesn't wrap around the end of
|
||||
the file.
|
||||
|
||||
Using the `call` command is optional in |Vim9| script. This works the same
|
||||
way and also works in legacy script and on the command line: >
|
||||
Using the `call` command is optional in |Vim9| script. It is required in
|
||||
legacy script and on the command line: >
|
||||
|
||||
call search("Date: ", "W")
|
||||
|
||||
@ -711,7 +713,7 @@ statements is equal to: >
|
||||
|
||||
:substitute/\a/*/g
|
||||
|
||||
Using the functions becomes more interesting when you do more work before and
|
||||
Using the functions becomes interesting when you do more work before and
|
||||
after the substitute() call.
|
||||
|
||||
|
||||
@ -1402,8 +1404,9 @@ Let's assign the variable "smaller" the value of the smallest number: >
|
||||
smaller = num2
|
||||
endif
|
||||
|
||||
The variable "smaller" is a local variable. Variables used inside a function
|
||||
are local unless prefixed by something like "g:", "w:", or "s:".
|
||||
The variable "smaller" is a local variable. It is declared to be a number,
|
||||
that way Vim can warn you for any mistakes. Variables used inside a function
|
||||
are local unless prefixed by something like "g:", "w:", or "b:".
|
||||
|
||||
Note:
|
||||
To access a global variable from inside a function you must prepend
|
||||
@ -1469,6 +1472,10 @@ For a function that does not return anything simply leave out the return type: >
|
||||
echo text
|
||||
enddef
|
||||
|
||||
If you want to return any kind of value, you can use the "any" return type: >
|
||||
def GetValue(): any
|
||||
This disables type checking for the return value, use only when needed.
|
||||
|
||||
It is also possible to define a legacy function with `function` and
|
||||
`endfunction`. These do not have types and are not compiled. Therefore they
|
||||
execute much slower.
|
||||
@ -1485,47 +1492,12 @@ once for every line in the range, with the cursor in that line. Example: >
|
||||
|
||||
If you call this function with: >
|
||||
|
||||
:10,15call Number()
|
||||
:10,15Number()
|
||||
|
||||
The function will be called six times, starting on line 10 and ending on line
|
||||
15.
|
||||
|
||||
|
||||
VARIABLE NUMBER OF ARGUMENTS
|
||||
|
||||
Vim enables you to define functions that have a variable number of arguments.
|
||||
The following command, for instance, defines a function that must have 1
|
||||
argument (start) and can have up to 20 additional arguments: >
|
||||
|
||||
def Show(start: string, ...items: list<string>)
|
||||
|
||||
The variable "items" will be a list in the function containing the extra
|
||||
arguments. You can use it like any list, for example: >
|
||||
|
||||
def Show(start: string, ...items: list<string>)
|
||||
echohl Title
|
||||
echo "start is " .. start
|
||||
echohl None
|
||||
for index in range(len(items))
|
||||
echon $" Arg {index} is {items[index]}"
|
||||
endfor
|
||||
echo
|
||||
enddef
|
||||
|
||||
You can call it like this: >
|
||||
|
||||
Show('Title', 'one', 'two', 'three')
|
||||
< start is Title Arg 0 is one Arg 1 is two Arg 2 is three ~
|
||||
|
||||
This uses the `echohl` command to specify the highlighting used for the
|
||||
following `echo` command. `echohl None` stops it again. The `echon` command
|
||||
works like `echo`, but doesn't output a line break.
|
||||
|
||||
If you call it with one argument the "items" list will be empty.
|
||||
`range(len(items))` returns a list with the indexes, what `for` loops over,
|
||||
we'll explain that further down.
|
||||
|
||||
|
||||
LISTING FUNCTIONS
|
||||
|
||||
The `function` command lists the names and arguments of all user-defined
|
||||
@ -1606,6 +1578,11 @@ Note that the name of a variable that holds a function reference must start
|
||||
with a capital. Otherwise it could be confused with the name of a builtin
|
||||
function.
|
||||
|
||||
|
||||
FURTHER READING
|
||||
|
||||
Using a variable number of arguments is introduced in section |50.2|.
|
||||
|
||||
More information about defining your own functions here: |user-functions|.
|
||||
|
||||
==============================================================================
|
||||
@ -1766,95 +1743,16 @@ need to use a List, it stores items in an ordered sequence.
|
||||
For further reading see |Dictionaries|.
|
||||
|
||||
==============================================================================
|
||||
*41.9* Exceptions
|
||||
|
||||
Let's start with an example: >
|
||||
|
||||
try
|
||||
read ~/templates/pascal.tmpl
|
||||
catch /E484:/
|
||||
echo "Sorry, the Pascal template file cannot be found."
|
||||
endtry
|
||||
|
||||
The `read` command will fail if the file does not exist. Instead of
|
||||
generating an error message, this code catches the error and gives the user a
|
||||
message with more information.
|
||||
|
||||
For the commands in between `try` and `endtry` errors are turned into
|
||||
exceptions. An exception is a string. In the case of an error the string
|
||||
contains the error message. And every error message has a number. In this
|
||||
case, the error we catch contains "E484:". This number is guaranteed to stay
|
||||
the same (the text may change, e.g., it may be translated).
|
||||
|
||||
Besides being able to give a nice error message, Vim will also continue
|
||||
executing commands after the `:endtry`. Otherwise, once an uncaught error is
|
||||
encountered, execution of the script/function/mapping will be aborted.
|
||||
|
||||
When the `read` command causes another error, the pattern "E484:" will not
|
||||
match in it. Thus this exception will not be caught and result in the usual
|
||||
error message and execution is aborted.
|
||||
|
||||
You might be tempted to do this: >
|
||||
|
||||
try
|
||||
read ~/templates/pascal.tmpl
|
||||
catch
|
||||
echo "Sorry, the Pascal template file cannot be found."
|
||||
endtry
|
||||
|
||||
This means all errors are caught. But then you will not see an error that
|
||||
would indicate a completely different problem, such as "E21: Cannot make
|
||||
changes, 'modifiable' is off". Think twice before you catch any error!
|
||||
|
||||
Another useful mechanism is the `finally` command: >
|
||||
|
||||
var tmp = tempname()
|
||||
try
|
||||
exe ":.,$write " .. tmp
|
||||
exe "!filter " .. tmp
|
||||
:.,$delete
|
||||
exe ":$read " .. tmp
|
||||
finally
|
||||
delete(tmp)
|
||||
endtry
|
||||
|
||||
This filters the lines from the cursor until the end of the file through the
|
||||
"filter" command, which takes a file name argument. No matter if the
|
||||
filtering works, if something goes wrong in between `try` and `finally` or the
|
||||
user cancels the filtering by pressing CTRL-C, the `delete(tmp)` call is
|
||||
always executed. This makes sure you don't leave the temporary file behind.
|
||||
|
||||
The `finally` does not catch the exception, the error will still abort
|
||||
further execution.
|
||||
|
||||
More information about exception handling can be found in the reference
|
||||
manual: |exception-handling|.
|
||||
|
||||
==============================================================================
|
||||
*41.10* Various remarks
|
||||
|
||||
Here are a few items that are useful to know when writing Vim scripts.
|
||||
|
||||
|
||||
FILEFORMAT
|
||||
|
||||
The end-of-line character depends on the system. For Vim scripts it is
|
||||
recommended to always use the Unix fileformat. This also works on any other
|
||||
system. That way you can copy your Vim scripts from MS-Windows to Unix and
|
||||
they still work. See |:source_crnl|. To be sure it is set right, do this
|
||||
before writing the file: >
|
||||
|
||||
:setlocal fileformat=unix
|
||||
|
||||
|
||||
WHITE SPACE
|
||||
*41.9* White space
|
||||
|
||||
Blank lines are allowed and ignored.
|
||||
|
||||
Leading whitespace characters (blanks and TABs) are always ignored.
|
||||
|
||||
Trailing whitespace is often ignored, but not always. One command that
|
||||
includes it is `map`.
|
||||
includes it is `map`. You have to watch out for that, it can cause hard to
|
||||
understand mistakes. A generic solution is to never use trailing white space,
|
||||
unless you really need it.
|
||||
|
||||
To include a whitespace character in the value of an option, it must be
|
||||
escaped by a "\" (backslash) as in the following example: >
|
||||
@ -1876,8 +1774,39 @@ intentionally to make sure scripts are easy to read and to avoid mistakes.
|
||||
If you use white space sensibly it will just work. When not you will get an
|
||||
error message telling you where white space is missing or should be removed.
|
||||
|
||||
==============================================================================
|
||||
*41.10* Line continuation
|
||||
|
||||
COMMENTS
|
||||
In legacy Vim script line continuation is done by preceding a continuation
|
||||
line with a backslash: >
|
||||
let mylist = [
|
||||
\ 'one',
|
||||
\ 'two',
|
||||
\ ]
|
||||
|
||||
This requires the 'cpo' option to exclude the "C" flag. Normally this is done
|
||||
by putting this at the start of the script: >
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
And restore the option at the end of the script: >
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
A few more details can be found here: |line-continuation|.
|
||||
|
||||
In |Vim9| script the backslash can still be used, but in most places it is not
|
||||
needed: >
|
||||
var mylist = [
|
||||
'one',
|
||||
'two',
|
||||
]
|
||||
|
||||
Also, the 'cpo' option does not need to be changed. See
|
||||
|vim9-line-continuation| for details.
|
||||
|
||||
==============================================================================
|
||||
*41.11* Comments
|
||||
|
||||
In |Vim9| script the character # starts a comment. That character and
|
||||
everything after it until the end-of-line is considered a comment and
|
||||
@ -1933,11 +1862,21 @@ script executable, and it also works in legacy script: >
|
||||
echo "this is a Vim script"
|
||||
quit
|
||||
|
||||
==============================================================================
|
||||
*41.12* Fileformat
|
||||
|
||||
Advance information about writing Vim script is in |usr_50.txt|.
|
||||
The end-of-line character depends on the system. For Vim scripts it is
|
||||
recommended to always use the Unix fileformat. This also works on any other
|
||||
system. That way you can copy your Vim scripts from MS-Windows to Unix and
|
||||
they still work. See |:source_crnl|. To be sure it is set right, do this
|
||||
before writing the file: >
|
||||
|
||||
:setlocal fileformat=unix
|
||||
|
||||
==============================================================================
|
||||
|
||||
Advance information about writing Vim script is in |usr_50.txt|.
|
||||
|
||||
Next chapter: |usr_42.txt| Add new menus
|
||||
|
||||
Copyright: see |manual-copyright| vim:tw=78:ts=8:noet:ft=help:norl:
|
||||
|
@ -5,46 +5,116 @@
|
||||
Advanced Vim script writing
|
||||
|
||||
|
||||
|50.1| Line continuation
|
||||
|50.2| Restoring the view
|
||||
|50.1| Exceptions
|
||||
|50.2| Function with variable number of arguments
|
||||
|50.3| Restoring the view
|
||||
|
||||
Next chapter: |usr_51.txt| Create a plugin
|
||||
Previous chapter: |usr_45.txt| Select your language (local)
|
||||
Table of contents: |usr_toc.txt|
|
||||
|
||||
==============================================================================
|
||||
*50.1* Line continuation
|
||||
*50.1* Exceptions
|
||||
|
||||
In legacy Vim script line continuation is done by preceding a continuation
|
||||
line with a backslash: >
|
||||
let mylist = [
|
||||
\ 'one',
|
||||
\ 'two',
|
||||
\ ]
|
||||
Let's start with an example: >
|
||||
|
||||
This requires the 'cpo' option to exclude the "C" flag. Normally this is done
|
||||
by putting this at the start of the script: >
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
try
|
||||
read ~/templates/pascal.tmpl
|
||||
catch /E484:/
|
||||
echo "Sorry, the Pascal template file cannot be found."
|
||||
endtry
|
||||
|
||||
And restore the option at the end of the script: >
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
The `read` command will fail if the file does not exist. Instead of
|
||||
generating an error message, this code catches the error and gives the user a
|
||||
message with more information.
|
||||
|
||||
A few more details can be found here: |line-continuation|.
|
||||
For the commands in between `try` and `endtry` errors are turned into
|
||||
exceptions. An exception is a string. In the case of an error the string
|
||||
contains the error message. And every error message has a number. In this
|
||||
case, the error we catch contains "E484:". This number is guaranteed to stay
|
||||
the same (the text may change, e.g., it may be translated).
|
||||
|
||||
In |Vim9| script the backslash can still be used, but in most places it is not
|
||||
needed: >
|
||||
var mylist = [
|
||||
'one',
|
||||
'two',
|
||||
]
|
||||
Besides being able to give a nice error message, Vim will also continue
|
||||
executing commands after the `:endtry`. Otherwise, once an uncaught error is
|
||||
encountered, execution of the script/function/mapping will be aborted.
|
||||
|
||||
Also, the 'cpo' option does not need to be changed. See
|
||||
|vim9-line-continuation| for details.
|
||||
When the `read` command causes another error, the pattern "E484:" will not
|
||||
match in it. Thus this exception will not be caught and result in the usual
|
||||
error message and execution is aborted.
|
||||
|
||||
You might be tempted to do this: >
|
||||
|
||||
try
|
||||
read ~/templates/pascal.tmpl
|
||||
catch
|
||||
echo "Sorry, the Pascal template file cannot be found."
|
||||
endtry
|
||||
|
||||
This means all errors are caught. But then you will not see an error that
|
||||
would indicate a completely different problem, such as "E21: Cannot make
|
||||
changes, 'modifiable' is off". Think twice before you catch any error!
|
||||
|
||||
Another useful mechanism is the `finally` command: >
|
||||
|
||||
var tmp = tempname()
|
||||
try
|
||||
exe ":.,$write " .. tmp
|
||||
exe "!filter " .. tmp
|
||||
:.,$delete
|
||||
exe ":$read " .. tmp
|
||||
finally
|
||||
delete(tmp)
|
||||
endtry
|
||||
|
||||
This filters the lines from the cursor until the end of the file through the
|
||||
"filter" command, which takes a file name argument. No matter if the
|
||||
filtering works, if something goes wrong in between `try` and `finally` or the
|
||||
user cancels the filtering by pressing CTRL-C, the `delete(tmp)` call is
|
||||
always executed. This makes sure you don't leave the temporary file behind.
|
||||
|
||||
The `finally` does not catch the exception, the error will still abort
|
||||
further execution.
|
||||
|
||||
More information about exception handling can be found in the reference
|
||||
manual: |exception-handling|.
|
||||
|
||||
==============================================================================
|
||||
*50.2* Restoring the view
|
||||
*50.2* Function with variable number of arguments
|
||||
|
||||
Vim enables you to define functions that have a variable number of arguments.
|
||||
The following command, for instance, defines a function that must have 1
|
||||
argument (start) and can have up to 20 additional arguments: >
|
||||
|
||||
def Show(start: string, ...items: list<string>)
|
||||
|
||||
The variable "items" will be a list in the function containing the extra
|
||||
arguments. You can use it like any list, for example: >
|
||||
|
||||
def Show(start: string, ...items: list<string>)
|
||||
echohl Title
|
||||
echo "start is " .. start
|
||||
echohl None
|
||||
for index in range(len(items))
|
||||
echon $" Arg {index} is {items[index]}"
|
||||
endfor
|
||||
echo
|
||||
enddef
|
||||
|
||||
You can call it like this: >
|
||||
|
||||
Show('Title', 'one', 'two', 'three')
|
||||
< start is Title Arg 0 is one Arg 1 is two Arg 2 is three ~
|
||||
|
||||
This uses the `echohl` command to specify the highlighting used for the
|
||||
following `echo` command. `echohl None` stops it again. The `echon` command
|
||||
works like `echo`, but doesn't output a line break.
|
||||
|
||||
If you call it with one argument the "items" list will be empty.
|
||||
`range(len(items))` returns a list with the indexes, what `for` loops over,
|
||||
we'll explain that further down.
|
||||
|
||||
==============================================================================
|
||||
*50.3* Restoring the view
|
||||
|
||||
Sometimes you want to make a change and go back to where the cursor was.
|
||||
Restoring the relative position would also be nice, so that the same line
|
||||
|
@ -304,8 +304,10 @@ Make Vim work as you like it.
|
||||
|41.6| Using functions
|
||||
|41.7| Defining a function
|
||||
|41.8| Lists and Dictionaries
|
||||
|41.9| Exceptions
|
||||
|41.10| Various remarks
|
||||
|41.9| White space
|
||||
|41.10| Line continuation
|
||||
|41.11| Comments
|
||||
|41.12| Fileformat
|
||||
|
||||
|usr_42.txt| Add new menus
|
||||
|42.1| Introduction
|
||||
@ -342,8 +344,9 @@ Make Vim work as you like it.
|
||||
Writing Vim script ~
|
||||
|
||||
|usr_50.txt| Advanced Vim script writing
|
||||
|50.1| Line continuation
|
||||
|50.2| Restoring the view
|
||||
|50.1| Exceptions
|
||||
|50.2| Function with variable number of arguments
|
||||
|50.3| Restoring the view
|
||||
|
||||
|usr_51.txt| Write plugins
|
||||
|51.1| Writing a generic plugin
|
||||
|
@ -86,7 +86,7 @@ script and `:def` functions; details are below:
|
||||
var count = 0
|
||||
count += 3
|
||||
- Constants can be declared with `:final` and `:const`: >
|
||||
final matches = [] # add matches
|
||||
final matches = [] # add to the list later
|
||||
const names = ['Betty', 'Peter'] # cannot be changed
|
||||
- `:final` cannot be used as an abbreviation of `:finally`.
|
||||
- Variables and functions are script-local by default.
|
||||
@ -177,12 +177,12 @@ created yet. In this case you can call `execute()` to invoke it at runtime. >
|
||||
`:def` has no options like `:function` does: "range", "abort", "dict" or
|
||||
"closure". A `:def` function always aborts on an error (unless `:silent!` was
|
||||
used for the command or the error was caught a `:try` block), does not get a
|
||||
range passed cannot be a "dict" function, and can always be a closure.
|
||||
range passed, cannot be a "dict" function, and can always be a closure.
|
||||
*vim9-no-dict-function*
|
||||
Later classes will be added, which replaces the "dict function" mechanism.
|
||||
For now you will need to pass the dictionary explicitly: >
|
||||
def DictFunc(d: dict<any>, arg: string)
|
||||
echo d[arg]
|
||||
def DictFunc(self: dict<any>, arg: string)
|
||||
echo self[arg]
|
||||
enddef
|
||||
var ad = {item: 'value', func: DictFunc}
|
||||
ad.func(ad, 'item')
|
||||
@ -223,7 +223,7 @@ The argument "_" (an underscore) can be used to ignore the argument. This is
|
||||
most useful in callbacks where you don't need it, but do need to give an
|
||||
argument to match the call. E.g. when using map() two arguments are passed,
|
||||
the key and the value, to ignore the key: >
|
||||
map(myList, (_, v) => v * 2)
|
||||
map(numberList, (_, v) => v * 2)
|
||||
There is no error for using the "_" argument multiple times. No type needs to
|
||||
be given.
|
||||
|
||||
@ -234,7 +234,7 @@ 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. Like prefixing "s:" in
|
||||
legacy script. To define a global function or variable the "g:" prefix must
|
||||
be used. For functions in a script that is to be imported and in an autoload
|
||||
script "export" needs to be used. >
|
||||
script "export" needs to be used for those to be used elsewhere. >
|
||||
def ThisFunction() # script-local
|
||||
def g:ThatFunction() # global
|
||||
export def Function() # for import and import autoload
|
||||
@ -250,13 +250,20 @@ argument, pass the function reference itself: >
|
||||
var Fok = function(Inner) # OK
|
||||
var Fbad = function('Inner') # does not work
|
||||
|
||||
It is not possible to define a script-local function. It is possible to
|
||||
define a global function by using the "g:" prefix.
|
||||
Detail: this is because "Inner" will actually become a function reference to a
|
||||
function with a generated name.
|
||||
|
||||
It is not possible to define a script-local function in a function. You can
|
||||
define a local function and assign it to a script-local funcref (it must have
|
||||
been declared at the script level). It is possible to define a global
|
||||
function by using the "g:" prefix.
|
||||
|
||||
When referring to a function and no "s:" or "g:" prefix is used, Vim will
|
||||
search for the function:
|
||||
- in the function scope, in block scopes
|
||||
- in the script scope, possibly imported
|
||||
- in the script scope
|
||||
|
||||
Imported functions are found with the prefix from the `:import` command.
|
||||
|
||||
Since a script-local function reference can be used without "s:" the name must
|
||||
start with an upper case letter even when using the "s:" prefix. In legacy
|
||||
@ -272,6 +279,7 @@ variables and functions in a legacy script do use "s:", while in a Vim9 script
|
||||
they do not use "s:". This matches what you see in the rest of the file.
|
||||
|
||||
In legacy functions the use of "s:" for script items is required, as before.
|
||||
No matter if the script is Vim9 or legacy.
|
||||
|
||||
In all cases the function must be defined before used. That is when it is
|
||||
called, when `:defcompile` causes it to be compiled, or when code that calls
|
||||
@ -279,11 +287,13 @@ it is being compiled (to figure out the return type).
|
||||
|
||||
The result is that functions and variables without a namespace can usually be
|
||||
found in the script, either defined there or imported. Global functions and
|
||||
variables could be defined anywhere (good luck finding out where!).
|
||||
variables could be defined anywhere (good luck finding out where! You can
|
||||
often see where it was last set using |:verbose|).
|
||||
*E1102*
|
||||
Global functions can still 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 or replaced.
|
||||
and cannot be deleted or replaced by itself (it can be by reloading the
|
||||
script).
|
||||
|
||||
When compiling a function and a function call is encountered for a function
|
||||
that is not (yet) defined, the |FuncUndefined| autocommand is not triggered.
|
||||
@ -350,6 +360,13 @@ The declaration must be done earlier: >
|
||||
inner = 0
|
||||
endif
|
||||
echo inner
|
||||
|
||||
Although this is shorter and faster for simple values: >
|
||||
var inner = 0
|
||||
if cond
|
||||
inner = 5
|
||||
endif
|
||||
echo inner
|
||||
< *E1025* *E1128*
|
||||
To intentionally hide a variable from code that follows, a block can be
|
||||
used: >
|
||||
@ -1945,13 +1962,14 @@ We can also remove clutter, mainly things that were done to make Vim script
|
||||
backwards compatible with the good old Vi commands.
|
||||
|
||||
Examples:
|
||||
- Drop `:call` for calling a function and `:eval` for manipulating data.
|
||||
- Drop `:call` for calling a function and `:eval` for evaluating an
|
||||
expression.
|
||||
- Drop using a leading backslash for line continuation, automatically figure
|
||||
out where an expression ends.
|
||||
|
||||
However, this does require that some things need to change:
|
||||
- Comments start with # instead of ", to avoid confusing them with strings.
|
||||
This is good anyway, it is known from several popular languages.
|
||||
This is good anyway, it is also used by several popular languages.
|
||||
- Ex command ranges need to be prefixed with a colon, to avoid confusion with
|
||||
expressions (single quote can be a string or a mark, "/" can be divide or a
|
||||
search command, etc.).
|
||||
@ -2081,12 +2099,13 @@ values are accepted:
|
||||
false: `false`, `v:false`, `0`, `0 > 9`
|
||||
Note that the number zero is false and the number one is true. This is more
|
||||
permissive than most other languages. It was done because many builtin
|
||||
functions return these values.
|
||||
functions return these values, and changing that causes more problems than it
|
||||
solves. After using this for a while it turned out to work well.
|
||||
|
||||
If you have any type of value and want to use it as a boolean, use the `!!`
|
||||
operator:
|
||||
true: `!!'text'`, `!![99]`, `!!{'x': 1}`, `!!99`
|
||||
false: `!!''`, `!![]`, `!!{}`
|
||||
true: `!!'text'` `!![99]` `!!{'x': 1}` `!!99`
|
||||
false: `!!''` `!![]` `!!{}`
|
||||
|
||||
From a language like JavaScript we have this handy construct: >
|
||||
GetName() || 'unknown'
|
||||
@ -2108,19 +2127,20 @@ In Vim9 script a mechanism very similar to the JavaScript import and export
|
||||
mechanism is supported. It is a variant to the existing `:source` command
|
||||
that works like one would expect:
|
||||
- Instead of making everything global by default, everything is script-local,
|
||||
unless exported.
|
||||
some of these are exported.
|
||||
- When importing a script the symbols that are imported are explicitly listed,
|
||||
avoiding name conflicts and failures if functionality is added later.
|
||||
- The mechanism allows for writing a big, long script with a very clear API:
|
||||
the exported function(s) and class(es).
|
||||
the exported functions, variables and classes.
|
||||
- By using relative paths loading can be much faster for an import inside of a
|
||||
package, no need to search many directories.
|
||||
- Once an import has been used, it can be cached and loading it again can be
|
||||
avoided.
|
||||
- Once an import has been used, its items are cached and loading it again is
|
||||
not needed.
|
||||
- The Vim-specific use of "s:" to make things script-local can be dropped.
|
||||
|
||||
When sourcing a Vim9 script from a legacy script, only the items defined
|
||||
globally can be used, not the exported items. Alternatives considered:
|
||||
When sourcing a Vim9 script (from a Vim9 or legacy script), only the items
|
||||
defined globally can be used, not the exported items. Alternatives
|
||||
considered:
|
||||
- All the exported items become available as script-local items. This makes
|
||||
it uncontrollable what items get defined and likely soon leads to trouble.
|
||||
- Use the exported items and make them global. Disadvantage is that it's then
|
||||
@ -2128,7 +2148,7 @@ globally can be used, not the exported items. Alternatives considered:
|
||||
- Completely disallow sourcing a Vim9 script, require using `:import`. That
|
||||
makes it difficult to use scripts for testing, or sourcing them from the
|
||||
command line to try them out.
|
||||
Note that you can also use `:import` in legacy Vim script, see above.
|
||||
Note that you CAN also use `:import` in legacy Vim script, see above.
|
||||
|
||||
|
||||
Compiling functions early ~
|
||||
@ -2146,17 +2166,17 @@ figure out their type, so that forward references are found, and only then
|
||||
execute the script and compile the functions. This means the script has to be
|
||||
parsed twice, which is slower, and some conditions at the script level, such
|
||||
as checking if a feature is supported, are hard to use. An attempt was made
|
||||
to see if it works, but it turned out to be impossible to make work nicely.
|
||||
to see if it works, but it turned out to be impossible to make work well.
|
||||
|
||||
It would be possible to compile all the functions at the end of the script.
|
||||
The drawback is that if a function never gets called, the overhead of
|
||||
compiling it counts anyway. Since startup speed is very important, in most
|
||||
cases it's better to do it later and accept that syntax and type errors are
|
||||
only reported then. In case these errors should be found early, e.g. when
|
||||
testing, the `:defcompile` command will help out.
|
||||
testing, a `:defcompile` command at the end of the script will help out.
|
||||
|
||||
|
||||
Why not use an embedded language? ~
|
||||
Why not use an existing embedded language? ~
|
||||
|
||||
Vim supports interfaces to Perl, Python, Lua, Tcl and a few others. But
|
||||
these interfaces have never become widely used, for various reasons. When
|
||||
@ -2165,8 +2185,8 @@ and concentrate on Vim script.
|
||||
|
||||
Still, plugin writers may find other languages more familiar, want to use
|
||||
existing libraries or see a performance benefit. We encourage plugin authors
|
||||
to write code in any language and run it as an external tool, using jobs and
|
||||
channels. We can try to make this easier somehow.
|
||||
to write code in any language and run it as an external process, using jobs
|
||||
and channels. We can try to make this easier somehow.
|
||||
|
||||
Using an external tool also has disadvantages. An alternative is to convert
|
||||
the tool into Vim script. For that to be possible without too much
|
||||
@ -2182,9 +2202,10 @@ dictionary. With some care this can be made to work, but it does not look
|
||||
like real classes. On top of that, it's quite slow, because of the use of
|
||||
dictionaries.
|
||||
|
||||
The support of classes in Vim9 script is a "minimal common functionality" of
|
||||
class support in most languages. It works much like Java, which is the most
|
||||
popular programming language.
|
||||
It would be good to support real classes, and this is planned for a leter
|
||||
version. The support is a "minimal common functionality" of class support in
|
||||
most languages. It will work much like Java, which is the most popular
|
||||
programming language.
|
||||
|
||||
|
||||
|
||||
|
@ -1,29 +1,43 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: C#
|
||||
" Maintainer: Johannes Zellner <johannes@zellner.org>
|
||||
" Last Change: Tue, 09 Mar 2004 14:09:33 CET
|
||||
" Language: C#
|
||||
" Maintainer: Nick Jensen <nickspoon@gmail.com>
|
||||
" Former Maintainer: Johannes Zellner <johannes@zellner.org>
|
||||
" Last Change: 2021-12-07
|
||||
" License: Vim (see :h license)
|
||||
" Repository: https://github.com/nickspoons/vim-cs
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Don't load another plugin for this buffer
|
||||
let b:did_ftplugin = 1
|
||||
let s:keepcpo= &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:save_cpo = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
" Set 'formatoptions' to break comment lines but not other lines,
|
||||
" and insert the comment leader when hitting <CR> or using "o".
|
||||
setlocal fo-=t fo+=croql
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
" Set 'comments' to format dashed lists in comments.
|
||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
|
||||
|
||||
if has("gui_win32") && !exists("b:browsefilter")
|
||||
let b:browsefilter = "C# Source Files (*.cs)\t*.cs\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
let b:undo_ftplugin = 'setl com< fo<'
|
||||
|
||||
if exists('loaded_matchit') && !exists('b:match_words')
|
||||
" #if/#endif support included by default
|
||||
let b:match_words = '\%(^\s*\)\@<=#\s*region\>:\%(^\s*\)\@<=#\s*endregion\>,'
|
||||
let b:undo_ftplugin .= ' | unlet! b:match_words'
|
||||
endif
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter')
|
||||
let b:browsefilter = "C# Source Files (*.cs *.csx)\t*.cs;*.csx\n" .
|
||||
\ "C# Project Files (*.csproj)\t*.csproj\n" .
|
||||
\ "Visual Studio Solution Files (*.sln)\t*.sln\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
let b:undo_ftplugin .= ' | unlet! b:browsefilter'
|
||||
endif
|
||||
|
||||
let &cpoptions = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:et:sw=2:sts=2
|
||||
|
2
runtime/import/dist/vimhelp.vim
vendored
2
runtime/import/dist/vimhelp.vim
vendored
@ -7,7 +7,7 @@ export def HighlightGroups()
|
||||
var buf: number = bufnr('%')
|
||||
var lnum: number = search('\*highlight-groups\*', 'cn')
|
||||
while getline(lnum) !~ '===' && lnum < line('$')
|
||||
var word: string = getline(lnum)->matchstr('^\w\+\ze\t')
|
||||
var word: string = getline(lnum)->matchstr('^\w\+\ze\s')
|
||||
if word->hlexists()
|
||||
var name = 'help-hl-' .. word
|
||||
if prop_type_list({bufnr: buf})->match(name) == -1
|
||||
|
@ -3,13 +3,10 @@
|
||||
" Maintainer: Nick Jensen <nickspoon@gmail.com>
|
||||
" Former Maintainers: Aquila Deus
|
||||
" Johannes Zellner <johannes@zellner.org>
|
||||
" Last Change: 2018-11-21
|
||||
" Filenames: *.cs
|
||||
" Last Change: 2020-03-26
|
||||
" License: Vim (see :h license)
|
||||
" Repository: https://github.com/nickspoons/vim-cs
|
||||
"
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
@ -22,19 +19,23 @@ set cpoptions&vim
|
||||
setlocal indentexpr=GetCSIndent(v:lnum)
|
||||
|
||||
function! s:IsCompilerDirective(line)
|
||||
return a:line =~? '^\s*#'
|
||||
" Exclude #region and #endregion - these should be indented normally
|
||||
return a:line =~# '^\s*#' && !s:IsRegionDirective(a:line)
|
||||
endf
|
||||
|
||||
function! s:IsRegionDirective(line)
|
||||
return a:line =~# '^\s*#\s*region' || a:line =~# '^\s*#\s*endregion'
|
||||
endf
|
||||
|
||||
function! s:IsAttributeLine(line)
|
||||
return a:line =~? '^\s*\[[A-Za-z]' && a:line =~? '\]$'
|
||||
return a:line =~# '^\s*\[[A-Za-z]' && a:line =~# '\]$'
|
||||
endf
|
||||
|
||||
function! s:FindPreviousNonCompilerDirectiveLine(start_lnum)
|
||||
for delta in range(0, a:start_lnum)
|
||||
let lnum = a:start_lnum - delta
|
||||
let line = getline(lnum)
|
||||
let is_directive = s:IsCompilerDirective(line)
|
||||
if !is_directive
|
||||
if !s:IsCompilerDirective(line) && !s:IsRegionDirective(line)
|
||||
return lnum
|
||||
endif
|
||||
endfor
|
||||
@ -58,8 +59,9 @@ function! GetCSIndent(lnum) abort
|
||||
let lnum = s:FindPreviousNonCompilerDirectiveLine(a:lnum - 1)
|
||||
let previous_code_line = getline(lnum)
|
||||
if s:IsAttributeLine(previous_code_line)
|
||||
let ind = indent(lnum)
|
||||
return ind
|
||||
return indent(lnum)
|
||||
elseif s:IsRegionDirective(this_line)
|
||||
return cindent(lnum)
|
||||
else
|
||||
return cindent(a:lnum)
|
||||
endif
|
||||
|
@ -3,13 +3,16 @@
|
||||
" Maintainer: Nick Jensen <nickspoon@gmail.com>
|
||||
" Former Maintainers: Anduin Withers <awithers@anduin.com>
|
||||
" Johannes Zellner <johannes@zellner.org>
|
||||
" Last Change: 2020-11-23
|
||||
" Last Change: 2022-03-01
|
||||
" Filenames: *.cs
|
||||
" License: Vim (see :h license)
|
||||
" Repository: https://github.com/nickspoons/vim-cs
|
||||
"
|
||||
" REFERENCES:
|
||||
" [1] ECMA TC39: C# Language Specification (WD13Oct01.doc)
|
||||
" References:
|
||||
" - ECMA-334 5th Edition: C# Language Specification
|
||||
" https://www.ecma-international.org/publications-and-standards/standards/ecma-334/
|
||||
" - C# Language Design: Draft 6th Edition and later proposals
|
||||
" https://github.com/dotnet/csharplang
|
||||
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
@ -19,37 +22,72 @@ let s:save_cpo = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
syn keyword csType bool byte char decimal double float int long object sbyte short string T uint ulong ushort var void dynamic
|
||||
syn keyword csStorage delegate enum interface namespace struct
|
||||
syn keyword csType nint nuint " contextual
|
||||
|
||||
syn keyword csStorage enum interface namespace struct
|
||||
syn match csStorage "\<delegate\>"
|
||||
syn keyword csRepeat break continue do for foreach goto return while
|
||||
syn keyword csConditional else if switch
|
||||
syn keyword csLabel case default
|
||||
syn match csOperatorError display +::+
|
||||
syn match csGlobal display +global::+
|
||||
" user labels (see [1] 8.6 Statements)
|
||||
syn match csLabel display +^\s*\I\i*\s*:\%([^:]\)\@=+
|
||||
syn keyword csModifier abstract const extern internal override private protected public readonly sealed static virtual volatile
|
||||
syn keyword csConstant false null true
|
||||
syn keyword csException try catch finally throw when
|
||||
syn keyword csLinq ascending by descending equals from group in into join let on orderby select where
|
||||
syn keyword csAsync async await
|
||||
|
||||
syn keyword csUnspecifiedStatement as base checked event fixed in is lock nameof operator out params ref sizeof stackalloc this unchecked unsafe using
|
||||
syn keyword csUnsupportedStatement add remove value
|
||||
syn match csNamespaceAlias "@\=\h\w*\ze\_s*::" display
|
||||
syn match csGlobalNamespaceAlias "global\ze\_s*::" display
|
||||
syn cluster csNamespaceAlias contains=csGlobalNamespaceAlias,csNamespaceAlias,csNamespaceAliasQualifier
|
||||
|
||||
" user labels
|
||||
syn match csLabel display +^\s*\I\i*\s*:\%([^:]\)\@=+
|
||||
|
||||
" Function pointers
|
||||
syn match csType "\<delegate\s*\*" contains=csOpSymbols nextgroup=csManagedModifier skipwhite skipempty
|
||||
syn keyword csManagedModifier managed unmanaged contained
|
||||
|
||||
" Modifiers
|
||||
syn match csUsingModifier "\<global\ze\_s\+using\>"
|
||||
syn keyword csAccessModifier internal private protected public
|
||||
" TODO: in new out
|
||||
syn keyword csModifier abstract const event override readonly sealed static virtual volatile
|
||||
syn match csModifier "\<\%(extern\|fixed\|unsafe\)\>"
|
||||
syn match csModifier "\<partial\ze\_s\+\%(class\|struct\|interface\|record\|void\)\>"
|
||||
|
||||
syn keyword csException try catch finally throw when
|
||||
syn keyword csLinq ascending by descending equals from group in into join let on orderby select
|
||||
syn match csLinq "\<where\>"
|
||||
|
||||
" Type parameter constraint clause
|
||||
syn match csStorage "\<where\>\ze\_s\+@\=\h\w*\_s*:"
|
||||
|
||||
" Async
|
||||
syn keyword csAsyncModifier async
|
||||
syn keyword csAsyncOperator await
|
||||
|
||||
syn match csStorage "\<extern\ze\s\+alias\>"
|
||||
syn match csStorage "\%(\<extern\s\+\)\@16<=alias\>"
|
||||
|
||||
syn match csStatement "\<\%(checked\|unchecked\|unsafe\)\ze\_s*{"
|
||||
syn match csStatement "\<fixed\ze\_s*("
|
||||
syn keyword csStatement lock
|
||||
syn match csStatement "\<yield\ze\_s\+\%(return\|break\)\>"
|
||||
|
||||
syn match csAccessor "\<\%(get\|set\|init\|add\|remove\)\ze\_s*\%([;{]\|=>\)"
|
||||
|
||||
syn keyword csAccess base
|
||||
syn match csAccess "\<this\>"
|
||||
|
||||
" Extension method parameter modifier
|
||||
syn match csModifier "\<this\ze\_s\+@\=\h"
|
||||
|
||||
syn keyword csUnspecifiedStatement as in is nameof operator out params ref sizeof stackalloc using
|
||||
syn keyword csUnsupportedStatement value
|
||||
syn keyword csUnspecifiedKeyword explicit implicit
|
||||
|
||||
" Contextual Keywords
|
||||
syn match csContextualStatement /\<yield[[:space:]\n]\+\%(return\|break\)/me=s+5
|
||||
syn match csContextualStatement /\<partial[[:space:]\n]\+\%(class\|struct\|interface\)/me=s+7
|
||||
syn match csContextualStatement /\<\%(get\|set\)\%(;\|[[:space:]\n]*{\)/me=s+3
|
||||
syn match csContextualStatement /\<\%(get\|set\)\s*=>/me=s+3
|
||||
syn match csContextualStatement /\<where\>[^:]\+:/me=s+5
|
||||
|
||||
" Operators
|
||||
syn keyword csTypeOf typeof contained
|
||||
syn region csTypeOfStatement start="typeof(" end=")" contains=csType, csTypeOf
|
||||
syn keyword csTypeOf typeof nextgroup=csTypeOfOperand,csTypeOfError skipwhite skipempty
|
||||
syn region csTypeOfOperand matchgroup=csParens start="(" end=")" contained contains=csType
|
||||
syn match csTypeOfError "[^([:space:]]" contained
|
||||
syn match csKeywordOperator "\<\%(checked\|unchecked\)\ze\_s*("
|
||||
|
||||
" Punctuation
|
||||
syn match csBraces "[{}\[\]]" display
|
||||
syn match csBraces "[{}[\]]" display
|
||||
syn match csParens "[()]" display
|
||||
syn match csOpSymbols "+\{1,2}" display
|
||||
syn match csOpSymbols "-\{1,2}" display
|
||||
@ -64,128 +102,173 @@ syn match csLogicSymbols "&&" display
|
||||
syn match csLogicSymbols "||" display
|
||||
syn match csLogicSymbols "?" display
|
||||
syn match csLogicSymbols ":" display
|
||||
syn match csNamespaceAliasQualifier "::" display
|
||||
|
||||
" Generics
|
||||
syn region csGeneric matchgroup=csGenericBraces start="<" end=">" oneline contains=csType,csGeneric,csUserType,csUserIdentifier,csUserInterface,csUserMethod
|
||||
syn region csGeneric matchgroup=csGenericBraces start="<" end=">" oneline contains=csType,csGeneric,@csNamespaceAlias,csUserType,csUserIdentifier,csUserInterface,csUserMethod
|
||||
|
||||
" Comments
|
||||
"
|
||||
" PROVIDES: @csCommentHook
|
||||
syn keyword csTodo contained TODO FIXME XXX NOTE HACK TBD
|
||||
syn region csComment start="/\*" end="\*/" contains=@csCommentHook,csTodo,@Spell
|
||||
syn match csComment "//.*$" contains=@csCommentHook,csTodo,@Spell
|
||||
syn region csBlockComment start="/\*" end="\*/" contains=@csCommentHook,csTodo,@Spell
|
||||
syn match csLineComment "//.*$" contains=@csCommentHook,csTodo,@Spell
|
||||
syn cluster csComment contains=csLineComment,csBlockComment
|
||||
|
||||
" xml markup inside '///' comments
|
||||
syn cluster xmlRegionHook add=csXmlCommentLeader
|
||||
syn cluster xmlCdataHook add=csXmlCommentLeader
|
||||
syn cluster xmlStartTagHook add=csXmlCommentLeader
|
||||
syn keyword csXmlTag contained Libraries Packages Types Excluded ExcludedTypeName ExcludedLibraryName
|
||||
syn keyword csXmlTag contained ExcludedBucketName TypeExcluded Type TypeKind TypeSignature AssemblyInfo
|
||||
syn keyword csXmlTag contained AssemblyName AssemblyPublicKey AssemblyVersion AssemblyCulture Base
|
||||
syn keyword csXmlTag contained BaseTypeName Interfaces Interface InterfaceName Attributes Attribute
|
||||
syn keyword csXmlTag contained AttributeName Members Member MemberSignature MemberType MemberValue
|
||||
syn keyword csXmlTag contained ReturnValue ReturnType Parameters Parameter MemberOfPackage
|
||||
syn keyword csXmlTag contained ThreadingSafetyStatement Docs devdoc example overload remarks returns summary
|
||||
syn keyword csXmlTag contained threadsafe value internalonly nodoc exception param permission platnote
|
||||
syn keyword csXmlTag contained seealso b c i pre sub sup block code note paramref see subscript superscript
|
||||
syn keyword csXmlTag contained list listheader item term description altcompliant altmember
|
||||
syn region csSummary start="^\s*/// <summary" end="^\%\(\s*///\)\@!" transparent fold keepend
|
||||
|
||||
syn cluster xmlTagHook add=csXmlTag
|
||||
" xml markup inside '///' and /**...*/ comments
|
||||
syn cluster xmlRegionHook add=csXmlLineCommentLeader,csXmlBlockCommentMiddle
|
||||
syn cluster xmlCdataHook add=csXmlLineCommentLeader,csXmlBlockCommentMiddle
|
||||
syn cluster xmlStartTagHook add=csXmlLineCommentLeader,csXmlBlockCommentMiddle
|
||||
syn cluster xmlTagHook add=csXmlTag
|
||||
syn cluster xmlAttribHook add=csXmlAttrib
|
||||
|
||||
syn match csXmlCommentLeader "///" contained
|
||||
syn match csXmlComment "///.*$" contains=csXmlCommentLeader,@csXml,@Spell keepend
|
||||
" https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/recommended-tags
|
||||
syn keyword csXmlTag contained summary remarks
|
||||
syn keyword csXmlTag contained returns param paramref exception value
|
||||
syn keyword csXmlTag contained para list c code example
|
||||
syn keyword csXmlTag contained inheritdoc include
|
||||
syn keyword csXmlTag contained see seealso
|
||||
syn keyword csXmlTag contained typeparam typeparamref
|
||||
syn keyword csXmlTag contained b i u br a
|
||||
syn keyword csXmlAttrib contained cref href
|
||||
|
||||
syn match csXmlLineCommentLeader "///" contained
|
||||
syn match csXmlLineComment "///.*$" contains=csXmlLineCommentLeader,@csXml,@Spell keepend
|
||||
syn match csXmlBlockCommentMiddle "^\s*\zs\*" contained
|
||||
syn region csXmlBlockComment start="/\*\*" end="\*/" contains=@csXml,@Spell,csXmlBlockCommentMiddle keepend
|
||||
syn include @csXml syntax/xml.vim
|
||||
hi def link xmlRegion Comment
|
||||
|
||||
" Since syntax/xml.vim contains `syn spell toplevel`, we need to set it back to `default` here.
|
||||
syn spell default
|
||||
|
||||
" [1] 9.5 Pre-processing directives
|
||||
syn region csPreCondit start="^\s*#\s*\%(define\|undef\|if\|elif\|else\|endif\|line\|error\|warning\|pragma\)\>" skip="\\$" end="$" contains=csComment keepend
|
||||
syn region csRegion matchgroup=csPreCondit start="^\s*#\s*region.*$" end="^\s*#\s*endregion" transparent fold contains=TOP
|
||||
syn region csSummary start="^\s*/// <summary" end="^\%\(\s*///\)\@!" transparent fold keepend
|
||||
" Pre-processing directives
|
||||
syn region csPreProcDeclaration start="^\s*\zs#\s*\%(define\|undef\)\>" end="$" contains=csLineComment keepend
|
||||
syn region csPreProcConditional start="^\s*\zs#\s*\%(if\|elif\)\>" end="$" contains=csLineComment keepend
|
||||
syn region csPreProcConditional start="^\s*\zs#\s*\%(else\|endif\)\>" end="$" contains=csLineComment keepend
|
||||
syn region csPreProcLine start="^\s*\zs#\s*line\>" end="$" contains=csLineComment keepend
|
||||
syn region csPreProcDiagnostic start="^\s*\zs#\s*\%(error\|warning\)\>" end="$"
|
||||
syn region csPreProcConditionalSection matchgroup=csPreProcRegion start="^\s*#\s*region\>.*" end="^\s*#\s*endregion\>.*" transparent fold contains=TOP
|
||||
syn region csPreProcPragma start="^\s*\zs#\s*pragma\>" end="$" contains=csLineComment keepend
|
||||
syn region csPreProcNullable start="^\s*\zs#\s*nullable\>" end="$" contains=csLineComment keepend
|
||||
|
||||
if expand('%:e') == 'csx' || getline('1') =~ '^#!.*\<dotnet-script\>'
|
||||
syn region csPreProcInclude start="^\s*\zs#\s*\%(load\|r\)\>" end="$" contains=csLineComment keepend
|
||||
syn match csShebang "\%^#!.*" display
|
||||
endif
|
||||
|
||||
syn region csClassType start="@\@1<!\<class\>"hs=s+6 end="[:\n{]"me=e-1 contains=csClass
|
||||
syn cluster csPreProcessor contains=csPreProc.*
|
||||
|
||||
syn region csClassType start="\<class\>"hs=s+6 end=">" end="[:{]"me=e-1 contains=csClass
|
||||
" csUserType may be defined by user scripts/plugins - it should be contained in csNewType
|
||||
syn region csNewType start="@\@1<!\<new\>"hs=s+4 end="[;\n{(<\[]"me=e-1 contains=csNew,csUserType
|
||||
syn region csNewType start="\<new\>"hs=s+4 end="[;\n{(<\[]"me=e-1 contains=csNew,@csNamespaceAlias,csUserType
|
||||
syn region csIsType start=" is "hs=s+4 end="[A-Za-z0-9]\+" oneline contains=csIsAs
|
||||
syn region csIsType start=" as "hs=s+4 end="[A-Za-z0-9]\+" oneline contains=csIsAs
|
||||
syn keyword csNew new contained
|
||||
syn keyword csClass class contained
|
||||
syn keyword csIsAs is as
|
||||
|
||||
syn keyword csBoolean false true
|
||||
syn keyword csNull null
|
||||
|
||||
" Strings and constants
|
||||
syn match csSpecialError "\\." contained
|
||||
syn match csSpecialCharError "[^']" contained
|
||||
" [1] 9.4.4.4 Character literals
|
||||
syn match csSpecialChar +\\["\\'0abfnrtvx]+ contained display
|
||||
syn match csUnicodeNumber +\\x\x\{2,4}+ contained contains=csUnicodeSpecifier display
|
||||
" Character literals
|
||||
syn match csSpecialChar +\\["\\'0abfnrtv]+ contained display
|
||||
syn match csUnicodeNumber +\\x\x\{1,4}+ contained contains=csUnicodeSpecifier display
|
||||
syn match csUnicodeNumber +\\u\x\{4}+ contained contains=csUnicodeSpecifier display
|
||||
syn match csUnicodeNumber +\\U\x\{8}+ contained contains=csUnicodeSpecifier display
|
||||
syn match csUnicodeSpecifier +\\[uU]+ contained display
|
||||
syn match csUnicodeNumber +\\U00\x\{6}+ contained contains=csUnicodeSpecifier display
|
||||
syn match csUnicodeSpecifier +\\[uUx]+ contained display
|
||||
|
||||
syn region csString matchgroup=csQuote start=+"+ end=+"+ end=+$+ extend contains=csSpecialChar,csSpecialError,csUnicodeNumber,@Spell
|
||||
syn match csCharacter "'[^']*'" contains=csSpecialChar,csSpecialCharError,csUnicodeNumber display
|
||||
syn match csCharacter "'\\''" contains=csSpecialChar display
|
||||
syn match csCharacter "'[^\\]'" display
|
||||
syn match csNumber "\<0[0-7]*[lL]\=\>" display
|
||||
syn match csNumber "\<0[xX][[:xdigit:]_]\+[lL]\=\>" display
|
||||
syn match csNumber "\<0[bB][01_]\+[lL]\=\>" display
|
||||
syn match csNumber "\<[[:digit:]_]\+[lL]\=\>" display
|
||||
syn match csNumber "\<[[:digit:]_]\+\.[[:digit:]_]*\%\([eE][-+]\=[[:digit:]_]\+\)\=[fFdDmM]\=" display
|
||||
syn match csNumber "\.[[:digit:]_]\+\%\([eE][-+]\=[[:digit:]_]\+\)\=[fFdDmM]\=" display
|
||||
syn match csNumber "\<[[:digit:]_]\+[eE][-+]\=[[:digit:]_]\+[fFdDmM]\=\>" display
|
||||
syn match csNumber "\<[[:digit:]_]\+\%\([eE][-+]\=[[:digit:]_]\+\)\=[fFdDmM]\>" display
|
||||
|
||||
" Numbers
|
||||
syn case ignore
|
||||
syn match csInteger "\<0b[01_]*[01]\%([lu]\|lu\|ul\)\=\>" display
|
||||
syn match csInteger "\<\d\+\%(_\+\d\+\)*\%([lu]\|lu\|ul\)\=\>" display
|
||||
syn match csInteger "\<0x[[:xdigit:]_]*\x\%([lu]\|lu\|ul\)\=\>" display
|
||||
syn match csReal "\<\d\+\%(_\+\d\+\)*\.\d\+\%(_\+\d\+\)*\%\(e[-+]\=\d\+\%(_\+\d\+\)*\)\=[fdm]\=" display
|
||||
syn match csReal "\.\d\+\%(_\+\d\+\)*\%(e[-+]\=\d\+\%(_\+\d\+\)*\)\=[fdm]\=\>" display
|
||||
syn match csReal "\<\d\+\%(_\+\d\+\)*e[-+]\=\d\+\%(_\+\d\+\)*[fdm]\=\>" display
|
||||
syn match csReal "\<\d\+\%(_\+\d\+\)*[fdm]\>" display
|
||||
syn case match
|
||||
syn cluster csNumber contains=csInteger,csReal
|
||||
|
||||
syn region csInterpolatedString matchgroup=csQuote start=+\$"+ end=+"+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,@Spell
|
||||
|
||||
syn region csInterpolation matchgroup=csInterpolationDelimiter start=+{+ end=+}+ keepend contained contains=@csAll,csBraced,csBracketed,csInterpolationAlign,csInterpolationFormat
|
||||
syn match csEscapedInterpolation "{{" transparent contains=NONE display
|
||||
syn match csEscapedInterpolation "}}" transparent contains=NONE display
|
||||
syn region csInterpolationAlign matchgroup=csInterpolationAlignDel start=+,+ end=+}+ end=+:+me=e-1 contained contains=csNumber,csConstant,csCharacter,csParens,csOpSymbols,csString,csBracketed display
|
||||
syn region csInterpolationAlign matchgroup=csInterpolationAlignDel start=+,+ end=+}+ end=+:+me=e-1 contained contains=@csNumber,csBoolean,csConstant,csCharacter,csParens,csOpSymbols,csString,csBracketed display
|
||||
syn match csInterpolationFormat +:[^}]\+}+ contained contains=csInterpolationFormatDel display
|
||||
syn match csInterpolationAlignDel +,+ contained display
|
||||
syn match csInterpolationFormatDel +:+ contained display
|
||||
|
||||
syn region csVerbatimString matchgroup=csQuote start=+@"+ end=+"+ skip=+""+ extend contains=csVerbatimQuote,@Spell
|
||||
syn match csVerbatimQuote +""+ contained
|
||||
syn match csQuoteError +@$"+he=s+2,me=s+2
|
||||
|
||||
syn region csInterVerbString matchgroup=csQuote start=+\$@"+ end=+"+ skip=+""+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,csVerbatimQuote,@Spell
|
||||
syn region csInterVerbString matchgroup=csQuote start=+$@"+ start=+@$"+ end=+"+ skip=+""+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,csVerbatimQuote,@Spell
|
||||
|
||||
syn cluster csString contains=csString,csInterpolatedString,csVerbatimString,csInterVerbString
|
||||
|
||||
syn cluster csLiteral contains=csBoolean,@csNumber,csCharacter,@csString,csNull
|
||||
|
||||
syn region csBracketed matchgroup=csParens start=+(+ end=+)+ extend contained transparent contains=@csAll,csBraced,csBracketed
|
||||
syn region csBraced matchgroup=csParens start=+{+ end=+}+ extend contained transparent contains=@csAll,csBraced,csBracketed
|
||||
|
||||
syn cluster csAll contains=csCharacter,csClassType,csComment,csContextualStatement,csEndColon,csIsType,csLabel,csLogicSymbols,csNewType,csConstant,csNumber,csOpSymbols,csOperatorError,csParens,csPreCondit,csRegion,csString,csSummary,csType,csUnicodeNumber,csUnicodeSpecifier,csInterpolatedString,csVerbatimString,csInterVerbString,csUserType,csUserIdentifier,csUserInterface,csUserMethod
|
||||
syn cluster csAll contains=@csLiteral,csClassType,@csComment,csEndColon,csIsType,csLabel,csLogicSymbols,csNewType,csOpSymbols,csParens,@csPreProcessor,csSummary,@csNamespaceAlias,csType,csUnicodeNumber,csUserType,csUserIdentifier,csUserInterface,csUserMethod
|
||||
|
||||
" Keyword identifiers
|
||||
syn match csIdentifier "@\h\w*"
|
||||
|
||||
" The default highlighting.
|
||||
hi def link csType Type
|
||||
hi def link csClassType Type
|
||||
hi def link csIsType Type
|
||||
hi def link csStorage Structure
|
||||
hi def link csClass Structure
|
||||
hi def link csRepeat Repeat
|
||||
hi def link csConditional Conditional
|
||||
hi def link csLabel Label
|
||||
hi def link csModifier StorageClass
|
||||
hi def link csConstant Constant
|
||||
hi def link csException Exception
|
||||
hi def link csTypeOf Keyword
|
||||
hi def link csTypeOfStatement Typedef
|
||||
hi def link csUnspecifiedStatement Statement
|
||||
hi def link csUnsupportedStatement Statement
|
||||
hi def link csUnspecifiedKeyword Keyword
|
||||
|
||||
hi def link csGlobalNamespaceAlias Include
|
||||
|
||||
hi def link csType Type
|
||||
hi def link csClassType Type
|
||||
hi def link csIsType Type
|
||||
|
||||
hi def link csStorage Structure
|
||||
hi def link csClass Structure
|
||||
hi def link csNew Statement
|
||||
hi def link csLinq Statement
|
||||
hi def link csIsAs Keyword
|
||||
hi def link csAsync Keyword
|
||||
hi def link csContextualStatement Statement
|
||||
hi def link csOperatorError Error
|
||||
hi def link csAccessor Keyword
|
||||
hi def link csAccess Keyword
|
||||
|
||||
hi def link csLinq Statement
|
||||
|
||||
hi def link csStatement Statement
|
||||
hi def link csRepeat Repeat
|
||||
hi def link csConditional Conditional
|
||||
hi def link csLabel Label
|
||||
hi def link csException Exception
|
||||
|
||||
hi def link csModifier StorageClass
|
||||
hi def link csAccessModifier csModifier
|
||||
hi def link csAsyncModifier csModifier
|
||||
hi def link csManagedModifier csModifier
|
||||
hi def link csUsingModifier csModifier
|
||||
|
||||
hi def link csTodo Todo
|
||||
hi def link csComment Comment
|
||||
hi def link csLineComment csComment
|
||||
hi def link csBlockComment csComment
|
||||
|
||||
hi def link csKeywordOperator Keyword
|
||||
hi def link csAsyncOperator csKeywordOperator
|
||||
hi def link csTypeOf csKeywordOperator
|
||||
hi def link csTypeOfOperand Typedef
|
||||
hi def link csTypeOfError Error
|
||||
hi def link csOpSymbols Operator
|
||||
hi def link csLogicSymbols Operator
|
||||
|
||||
@ -193,15 +276,29 @@ hi def link csSpecialError Error
|
||||
hi def link csSpecialCharError Error
|
||||
hi def link csString String
|
||||
hi def link csQuote String
|
||||
hi def link csQuoteError Error
|
||||
hi def link csInterpolatedString String
|
||||
hi def link csVerbatimString String
|
||||
hi def link csInterVerbString String
|
||||
hi def link csVerbatimQuote SpecialChar
|
||||
hi def link csPreCondit PreCondit
|
||||
|
||||
hi def link csPreProc PreProc
|
||||
hi def link csPreProcDeclaration Define
|
||||
hi def link csPreProcConditional PreCondit
|
||||
hi def link csPreProcLine csPreProc
|
||||
hi def link csPreProcDiagnostic csPreProc
|
||||
hi def link csPreProcRegion csPreProc
|
||||
hi def link csPreProcPragma csPreProc
|
||||
hi def link csPreProcNullable csPreProc
|
||||
hi def link csPreProcInclude csPreProc
|
||||
hi def link csShebang csPreProc
|
||||
|
||||
hi def link csConstant Constant
|
||||
hi def link csNull Constant
|
||||
hi def link csBoolean Boolean
|
||||
hi def link csCharacter Character
|
||||
hi def link csSpecialChar SpecialChar
|
||||
hi def link csNumber Number
|
||||
hi def link csInteger Number
|
||||
hi def link csReal Float
|
||||
hi def link csUnicodeNumber SpecialChar
|
||||
hi def link csUnicodeSpecifier SpecialChar
|
||||
hi def link csInterpolationDelimiter Delimiter
|
||||
@ -212,9 +309,12 @@ hi def link csInterpolationFormatDel csInterpolationDelimiter
|
||||
hi def link csGenericBraces csBraces
|
||||
|
||||
" xml markup
|
||||
hi def link csXmlCommentLeader Comment
|
||||
hi def link csXmlComment Comment
|
||||
hi def link csXmlLineCommentLeader Comment
|
||||
hi def link csXmlLineComment Comment
|
||||
hi def link csXmlBlockComment Comment
|
||||
hi def link csXmlBlockCommentMiddle csXmlBlockComment
|
||||
hi def link csXmlTag Statement
|
||||
hi def link csXmlAttrib Statement
|
||||
|
||||
let b:current_syntax = 'cs'
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Language: Java
|
||||
" Maintainer: Claudio Fleiner <claudio@fleiner.com>
|
||||
" URL: https://github.com/fleiner/vim/blob/master/runtime/syntax/java.vim
|
||||
" Last Change: 2018 July 26
|
||||
" Last Change: 2022 Jun 08
|
||||
|
||||
" Please check :help java.vim for comments on some of the options available.
|
||||
|
||||
@ -23,8 +23,6 @@ set cpo&vim
|
||||
syn match javaError "[\\@`]"
|
||||
syn match javaError "<<<\|\.\.\|=>\|||=\|&&=\|\*\/"
|
||||
|
||||
syn match javaOK "\.\.\."
|
||||
|
||||
" use separate name so that it can be deleted in javacc.vim
|
||||
syn match javaError2 "#\|=<"
|
||||
hi def link javaError2 javaError
|
||||
@ -59,8 +57,12 @@ syn match javaUserLabelRef "\k\+" contained
|
||||
syn match javaVarArg "\.\.\."
|
||||
syn keyword javaScopeDecl public protected private abstract
|
||||
|
||||
function s:isModuleInfoDeclarationCurrentBuffer() abort
|
||||
return fnamemodify(bufname("%"), ":t") =~ '^module-info\%(\.class\>\)\@!'
|
||||
endfunction
|
||||
|
||||
" Java Modules(Since Java 9, for "module-info.java" file)
|
||||
if fnamemodify(bufname("%"), ":t") == "module-info.java"
|
||||
if s:isModuleInfoDeclarationCurrentBuffer()
|
||||
syn keyword javaModuleStorageClass module transitive
|
||||
syn keyword javaModuleStmt open requires exports opens uses provides
|
||||
syn keyword javaModuleExternal to with
|
||||
@ -72,20 +74,42 @@ if exists("java_highlight_java_lang_ids")
|
||||
endif
|
||||
if exists("java_highlight_all") || exists("java_highlight_java") || exists("java_highlight_java_lang")
|
||||
" java.lang.*
|
||||
syn match javaLangClass "\<System\>"
|
||||
syn keyword javaR_JavaLang NegativeArraySizeException ArrayStoreException IllegalStateException RuntimeException IndexOutOfBoundsException UnsupportedOperationException ArrayIndexOutOfBoundsException ArithmeticException ClassCastException EnumConstantNotPresentException StringIndexOutOfBoundsException IllegalArgumentException IllegalMonitorStateException IllegalThreadStateException NumberFormatException NullPointerException TypeNotPresentException SecurityException
|
||||
"
|
||||
" The keywords of javaR_JavaLang, javaC_JavaLang, javaE_JavaLang,
|
||||
" and javaX_JavaLang are sub-grouped according to the Java version
|
||||
" of their introduction, and sub-group keywords (that is, class
|
||||
" names) are arranged in alphabetical order, so that future newer
|
||||
" keywords can be pre-sorted and appended without disturbing
|
||||
" the current keyword placement. The below _match_es follow suit.
|
||||
|
||||
syn keyword javaR_JavaLang ArithmeticException ArrayIndexOutOfBoundsException ArrayStoreException ClassCastException IllegalArgumentException IllegalMonitorStateException IllegalThreadStateException IndexOutOfBoundsException NegativeArraySizeException NullPointerException NumberFormatException RuntimeException SecurityException StringIndexOutOfBoundsException IllegalStateException UnsupportedOperationException EnumConstantNotPresentException TypeNotPresentException IllegalCallerException LayerInstantiationException
|
||||
syn cluster javaTop add=javaR_JavaLang
|
||||
syn cluster javaClasses add=javaR_JavaLang
|
||||
hi def link javaR_JavaLang javaR_Java
|
||||
syn keyword javaC_JavaLang Process RuntimePermission StringKeySet CharacterData01 Class ThreadLocal ThreadLocalMap CharacterData0E Package Character StringCoding Long ProcessImpl ProcessEnvironment Short AssertionStatusDirectives 1PackageInfoProxy UnicodeBlock InheritableThreadLocal AbstractStringBuilder StringEnvironment ClassLoader ConditionalSpecialCasing CharacterDataPrivateUse StringBuffer StringDecoder Entry StringEntry WrappedHook StringBuilder StrictMath State ThreadGroup Runtime CharacterData02 MethodArray Object CharacterDataUndefined Integer Gate Boolean Enum Variable Subset StringEncoder Void Terminator CharsetSD IntegerCache CharacterCache Byte CharsetSE Thread SystemClassLoaderAction CharacterDataLatin1 StringValues StackTraceElement Shutdown ShortCache String ConverterSD ByteCache Lock EnclosingMethodInfo Math Float Value Double SecurityManager LongCache ProcessBuilder StringEntrySet Compiler Number UNIXProcess ConverterSE ExternalData CaseInsensitiveComparator CharacterData00 NativeLibrary
|
||||
" Member enumerations:
|
||||
syn match javaC_JavaLang "\%(\<Thread\.\)\@<=\<State\>"
|
||||
syn match javaC_JavaLang "\%(\<Character\.\)\@<=\<UnicodeScript\>"
|
||||
syn match javaC_JavaLang "\%(\<ProcessBuilder\.Redirect\.\)\@<=\<Type\>"
|
||||
syn match javaC_JavaLang "\%(\<StackWalker\.\)\@<=\<Option\>"
|
||||
syn match javaC_JavaLang "\%(\<System\.Logger\.\)\@<=\<Level\>"
|
||||
" Member classes:
|
||||
syn match javaC_JavaLang "\%(\<Character\.\)\@<=\<Subset\>"
|
||||
syn match javaC_JavaLang "\%(\<Character\.\)\@<=\<UnicodeBlock\>"
|
||||
syn match javaC_JavaLang "\%(\<ProcessBuilder\.\)\@<=\<Redirect\>"
|
||||
syn match javaC_JavaLang "\%(\<ModuleLayer\.\)\@<=\<Controller\>"
|
||||
syn match javaC_JavaLang "\%(\<Runtime\.\)\@<=\<Version\>"
|
||||
syn match javaC_JavaLang "\%(\<System\.\)\@<=\<LoggerFinder\>"
|
||||
syn match javaC_JavaLang "\%(\<Enum\.\)\@<=\<EnumDesc\>"
|
||||
syn keyword javaC_JavaLang Boolean Character Class ClassLoader Compiler Double Float Integer Long Math Number Object Process Runtime SecurityManager String StringBuffer Thread ThreadGroup Byte Short Void InheritableThreadLocal Package RuntimePermission ThreadLocal StrictMath StackTraceElement Enum ProcessBuilder StringBuilder ClassValue Module ModuleLayer StackWalker Record
|
||||
syn match javaC_JavaLang "\<System\>" " See javaDebug.
|
||||
syn cluster javaTop add=javaC_JavaLang
|
||||
syn cluster javaClasses add=javaC_JavaLang
|
||||
hi def link javaC_JavaLang javaC_Java
|
||||
syn keyword javaE_JavaLang IncompatibleClassChangeError InternalError UnknownError ClassCircularityError AssertionError ThreadDeath IllegalAccessError NoClassDefFoundError ClassFormatError UnsupportedClassVersionError NoSuchFieldError VerifyError ExceptionInInitializerError InstantiationError LinkageError NoSuchMethodError Error UnsatisfiedLinkError StackOverflowError AbstractMethodError VirtualMachineError OutOfMemoryError
|
||||
syn keyword javaE_JavaLang AbstractMethodError ClassCircularityError ClassFormatError Error IllegalAccessError IncompatibleClassChangeError InstantiationError InternalError LinkageError NoClassDefFoundError NoSuchFieldError NoSuchMethodError OutOfMemoryError StackOverflowError ThreadDeath UnknownError UnsatisfiedLinkError VerifyError VirtualMachineError ExceptionInInitializerError UnsupportedClassVersionError AssertionError BootstrapMethodError
|
||||
syn cluster javaTop add=javaE_JavaLang
|
||||
syn cluster javaClasses add=javaE_JavaLang
|
||||
hi def link javaE_JavaLang javaE_Java
|
||||
syn keyword javaX_JavaLang CloneNotSupportedException Exception NoSuchMethodException IllegalAccessException NoSuchFieldException Throwable InterruptedException ClassNotFoundException InstantiationException
|
||||
syn keyword javaX_JavaLang ClassNotFoundException CloneNotSupportedException Exception IllegalAccessException InstantiationException InterruptedException NoSuchMethodException Throwable NoSuchFieldException ReflectiveOperationException
|
||||
syn cluster javaTop add=javaX_JavaLang
|
||||
syn cluster javaClasses add=javaX_JavaLang
|
||||
hi def link javaX_JavaLang javaX_Java
|
||||
@ -118,7 +142,7 @@ if exists("java_space_errors")
|
||||
endif
|
||||
endif
|
||||
|
||||
syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":" contains=javaNumber,javaCharacter,javaString
|
||||
syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" end="->" matchgroup=NONE end=":" contains=javaNumber,javaCharacter,javaString
|
||||
syn match javaUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel
|
||||
syn keyword javaLabel default
|
||||
|
||||
@ -126,7 +150,7 @@ syn keyword javaLabel default
|
||||
" annoying. Was: if !exists("java_allow_cpp_keywords")
|
||||
|
||||
" The following cluster contains all java groups except the contained ones
|
||||
syn cluster javaTop add=javaExternal,javaError,javaError,javaBranch,javaLabelRegion,javaLabel,javaConditional,javaRepeat,javaBoolean,javaConstant,javaTypedef,javaOperator,javaType,javaType,javaStatement,javaStorageClass,javaAssert,javaExceptions,javaMethodDecl,javaClassDecl,javaClassDecl,javaClassDecl,javaScopeDecl,javaError,javaError2,javaUserLabel,javaLangObject,javaAnnotation,javaVarArg
|
||||
syn cluster javaTop add=javaExternal,javaError,javaBranch,javaLabelRegion,javaLabel,javaConditional,javaRepeat,javaBoolean,javaConstant,javaTypedef,javaOperator,javaType,javaStatement,javaStorageClass,javaAssert,javaExceptions,javaMethodDecl,javaClassDecl,javaScopeDecl,javaError2,javaUserLabel,javaLangObject,javaAnnotation,javaVarArg
|
||||
|
||||
|
||||
" Comments
|
||||
@ -153,7 +177,7 @@ syn cluster javaTop add=javaComment,javaLineComment
|
||||
if !exists("java_ignore_javadoc") && main_syntax != 'jsp'
|
||||
syntax case ignore
|
||||
" syntax coloring for javadoc comments (HTML)
|
||||
syntax include @javaHtml <sfile>:p:h/html.vim
|
||||
syntax include @javaHtml syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
" HTML enables spell checking for all text that is not in a syntax item. This
|
||||
" is wrong for Java (all identifiers would be spell-checked), so it's undone
|
||||
@ -336,7 +360,7 @@ hi def link htmlComment Special
|
||||
hi def link htmlCommentPart Special
|
||||
hi def link javaSpaceError Error
|
||||
|
||||
if fnamemodify(bufname("%"), ":t") == "module-info.java"
|
||||
if s:isModuleInfoDeclarationCurrentBuffer()
|
||||
hi def link javaModuleStorageClass StorageClass
|
||||
hi def link javaModuleStmt Statement
|
||||
hi def link javaModuleExternal Include
|
||||
@ -348,6 +372,7 @@ if main_syntax == 'java'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
delfunction! s:isModuleInfoDeclarationCurrentBuffer
|
||||
let b:spell_options="contained"
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
@ -7,7 +7,7 @@
|
||||
" (ss) repaired several quoting and grouping glitches
|
||||
" (ss) fixed regex parsing issue with multiple qualifiers [gi]
|
||||
" (ss) additional factoring of keywords, globals, and members
|
||||
" Last Change: 2021 Mar 30
|
||||
" Last Change: 2022 Jun 09
|
||||
" 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke)
|
||||
" 2018 Apr 14: adjusted javaScriptRegexpString (LongJohnCoder)
|
||||
|
||||
@ -39,9 +39,16 @@ syn region javaScriptStringT start=+`+ skip=+\\\\\|\\`+ end=+`+ contai
|
||||
|
||||
syn region javaScriptEmbed start=+${+ end=+}+ contains=@javaScriptEmbededExpr
|
||||
|
||||
" number handling by Christopher Leonard chris.j.leonard@gmx.com
|
||||
syn match javaScriptSpecialCharacter "'\\.'"
|
||||
syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
||||
syn match javaScriptNumber "-\=\<\d\+\%(_\d\+\)*\>"
|
||||
syn match javaScriptNumber "\<0[bB][0-1]\+\(_[0-1]\+\)*\>"
|
||||
syn match javaScriptNumber "\<0[oO][0-7]\+\(_[0-7]\+\)*\>"
|
||||
syn match javaScriptNumber "\<0\([0-7]\+\(_[0-7]\+\)*\)\?\>"
|
||||
syn match javaScriptNumber "\<0[xX][0-9a-fA-F]\+\(_[0-9a-fA-F]\+\)*\>"
|
||||
syn match javaScriptNumber "\<\d\+\(_\d\+\)*[eE][+-]\?\d\+\>"
|
||||
syn match javaScriptNumber "\<[1-9]\d*\(_\d\+\)*\(\.\(\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\)\?\)\?\>"
|
||||
syn match javaScriptNumber "\<\(\d\+\(_\d\+\)*\)\?\.\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\>"
|
||||
syn match javaScriptNumber "\<\d\+\(_\d\+\)*\.\(\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\)\?\>"
|
||||
syn region javaScriptRegexpString start=+[,(=+]\s*/[^/*]+ms=e-1,me=e-1 skip=+\\\\\|\\/+ end=+/[gimuys]\{0,2\}\s*$+ end=+/[gimuys]\{0,2\}\s*[+;.,)\]}]+me=e-1 end=+/[gimuys]\{0,2\}\s\+\/+me=e-1 contains=@htmlPreproc,javaScriptComment oneline
|
||||
|
||||
syn keyword javaScriptConditional if else switch
|
||||
|
@ -21,6 +21,7 @@ endif
|
||||
syn match m4Variable contained "\$\d\+"
|
||||
syn match m4Special contained "$[@*#]"
|
||||
syn match m4Comment "\<\(m4_\)\=dnl\>.*" contains=SpellErrors
|
||||
syn match m4Comment "#.*" contains=SpellErrors
|
||||
syn match m4Constants "\<\(m4_\)\=__file__"
|
||||
syn match m4Constants "\<\(m4_\)\=__line__"
|
||||
syn keyword m4Constants divnum sysval m4_divnum m4_sysval
|
||||
@ -32,7 +33,7 @@ syn region m4Command matchgroup=m4builtin start="\<\(m4_\)\=\(len\|index\|regex
|
||||
syn keyword m4Statement divert undivert
|
||||
syn region m4Command matchgroup=m4Type start="\<\(m4_\)\=\(undefine\|popdef\)("he=e-1 end=")" contains=@m4Top
|
||||
syn region m4Function matchgroup=m4Type start="\<[_A-Z][_A-Z0-9]*("he=e-1 end=")" contains=@m4Top
|
||||
syn region m4String start="`" end="'" contained contains=@m4Top,@m4StringContents,SpellErrors
|
||||
syn region m4String start="`" end="'" contains=SpellErrors
|
||||
syn cluster m4Top contains=m4Comment,m4Constants,m4Special,m4Variable,m4String,m4Paren,m4Command,m4Statement,m4Function
|
||||
|
||||
" Define the default highlighting.
|
||||
|
@ -34,9 +34,9 @@ syn region webmacroList contained matchgroup=Structure start="\[" matchgroup=Str
|
||||
|
||||
syn region webmacroIf start="#if" start="#else" end="{"me=e-1 contains=webmacroVariable,webmacroNumber,webmacroString,webmacroBoolean,webmacroList nextgroup=webmacroBraces
|
||||
syn region webmacroForeach start="#foreach" end="{"me=e-1 contains=webmacroVariable,webmacroNumber,webmacroString,webmacroBoolean,webmacroList nextgroup=webmacroBraces
|
||||
syn match webmacroSet "#set .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
|
||||
syn match webmacroInclude "#include .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
|
||||
syn match webmacroParse "#parse .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
|
||||
syn match webmacroSet "#set .*$" contains=webmacroVariable,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
|
||||
syn match webmacroInclude "#include .*$" contains=webmacroVariable,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
|
||||
syn match webmacroParse "#parse .*$" contains=webmacroVariable,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
|
||||
syn region webmacroUse matchgroup=PreProc start="#use .*" matchgroup=PreProc end="^-.*" contains=webmacroHash,@HtmlTop
|
||||
syn region webmacroBraces matchgroup=Structure start="{" matchgroup=Structure end="}" contained transparent
|
||||
syn match webmacroBracesError "[{}]"
|
||||
|
@ -13,7 +13,8 @@ silent g/^#, c-format\n#/.d
|
||||
silent g/^#\..*\n#/.d
|
||||
|
||||
" c-format comments have no effect, the check.vim scripts checks it.
|
||||
silent g/^#, c-format$/d
|
||||
" But they might still be useful?
|
||||
" silent g/^#, c-format$/d
|
||||
|
||||
silent g/^#[:~] /d
|
||||
silent g/^#, fuzzy\(, .*\)\=\nmsgid ""\@!/.+1,/^$/-1s/^/#\~ /
|
||||
|
1827
src/po/sr.po
1827
src/po/sr.po
File diff suppressed because it is too large
Load Diff
292
src/po/tr.po
292
src/po/tr.po
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user