1
0
forked from aniani/vim

Update runtime files.

This commit is contained in:
Bram Moolenaar 2021-01-11 19:40:15 +01:00
parent 48e11c1054
commit 82be4849ee
24 changed files with 481 additions and 162 deletions

1
.github/CODEOWNERS vendored
View File

@ -164,6 +164,7 @@ runtime/syntax/nsis.vim @k-takata
runtime/syntax/pdf.vim @tpope runtime/syntax/pdf.vim @tpope
runtime/syntax/php.vim @TysonAndre runtime/syntax/php.vim @TysonAndre
runtime/syntax/privoxy.vim @dkearns runtime/syntax/privoxy.vim @dkearns
runtime/syntax/prolog.vim @XVilka
runtime/syntax/rc.vim @chrisbra runtime/syntax/rc.vim @chrisbra
runtime/syntax/rpcgen.vim @cecamp runtime/syntax/rpcgen.vim @cecamp
runtime/syntax/ruby.vim @dkearns runtime/syntax/ruby.vim @dkearns

View File

@ -1,4 +1,4 @@
*editing.txt* For Vim version 8.2. Last change: 2020 Dec 19 *editing.txt* For Vim version 8.2. Last change: 2021 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -1014,7 +1014,7 @@ to write anyway add a '!' to the command.
*write-permissions* *write-permissions*
When writing a new file the permissions are read-write. For unix the mask is When writing a new file the permissions are read-write. For unix the mask is
0666 with additionally umask applied. When writing a file that was read Vim 0o666 with additionally umask applied. When writing a file that was read Vim
will preserve the permissions, but clear the s-bit. will preserve the permissions, but clear the s-bit.
*write-readonly* *write-readonly*

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 8.2. Last change: 2020 Dec 21 *options.txt* For Vim version 8.2. Last change: 2021 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -438,7 +438,7 @@ the system, mostly it is something like 256 or 1024 characters.
CTRL-? CTRL-H CTRL-? CTRL-H
not CTRL-? CTRL-? not CTRL-? CTRL-?
(CTRL-? is 0177 octal, 0x7f hex) (CTRL-? is 0o177 octal, 0x7f hex)
If your delete key terminal code is wrong, but the If your delete key terminal code is wrong, but the
code for backspace is alright, you can put this in code for backspace is alright, you can put this in

View File

@ -1,4 +1,4 @@
*os_vms.txt* For Vim version 8.2. Last change: 2020 Dec 30 *os_vms.txt* For Vim version 8.2. Last change: 2021 Jan 04
VIM REFERENCE MANUAL VIM REFERENCE MANUAL
@ -767,8 +767,10 @@ GNU_TOOLS.ZIP package downloadable from http://www.polarhome.com/vim/
Version 8.2 Version 8.2
- make all changes needed for clean compile build of v8.2 on VMS on all platforms - make all changes needed for clean compile build of v8.2 on VMS on all platforms
- test on VSI OpenVMS platforms - fix the call mkdir bug (vicente_polo@yahoo.es)
- added XPM support - Motif GUI with toolbar on all platforms - test on VSI OpenVMS Alpha and Itanium platforms
- added LUA support
- added XPM support - Motif GUI with toolbar on all platforms
- XPM v3.4.11 libraries for IA64, AXP and VAX are added - XPM v3.4.11 libraries for IA64, AXP and VAX are added
- start integrating the new test scripts - start integrating the new test scripts

View File

@ -1,4 +1,4 @@
*pattern.txt* For Vim version 8.2. Last change: 2020 Dec 25 *pattern.txt* For Vim version 8.2. Last change: 2021 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -1179,7 +1179,7 @@ x A single character, with no special meaning, matches itself
\b <BS> \b <BS>
\n line break, see above |/[\n]| \n line break, see above |/[\n]|
\d123 decimal number of character \d123 decimal number of character
\o40 octal number of character up to 0377 \o40 octal number of character up to 0o377
\x20 hexadecimal number of character up to 0xff \x20 hexadecimal number of character up to 0xff
\u20AC hex. number of multibyte character up to 0xffff \u20AC hex. number of multibyte character up to 0xffff
\U1234 hex. number of multibyte character up to 0xffffffff \U1234 hex. number of multibyte character up to 0xffffffff
@ -1217,7 +1217,8 @@ x A single character, with no special meaning, matches itself
\%d123 Matches the character specified with a decimal number. Must be \%d123 Matches the character specified with a decimal number. Must be
followed by a non-digit. followed by a non-digit.
\%o40 Matches the character specified with an octal number up to 0377. \%o40 Matches the character specified with an octal number up to 0377.
Numbers below 040 must be followed by a non-octal digit or a non-digit. Numbers below 0o40 must be followed by a non-octal digit or a
non-digit.
\%x2a Matches the character specified with up to two hexadecimal characters. \%x2a Matches the character specified with up to two hexadecimal characters.
\%u20AC Matches the character specified with up to four hexadecimal \%u20AC Matches the character specified with up to four hexadecimal
characters. characters.

View File

@ -1783,6 +1783,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
09.2 usr_09.txt /*09.2* 09.2 usr_09.txt /*09.2*
09.3 usr_09.txt /*09.3* 09.3 usr_09.txt /*09.3*
09.4 usr_09.txt /*09.4* 09.4 usr_09.txt /*09.4*
0o eval.txt /*0o*
0x eval.txt /*0x*
10.1 usr_10.txt /*10.1* 10.1 usr_10.txt /*10.1*
10.2 usr_10.txt /*10.2* 10.2 usr_10.txt /*10.2*
10.3 usr_10.txt /*10.3* 10.3 usr_10.txt /*10.3*
@ -1994,6 +1996,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:AdaTagFile ft_ada.txt /*:AdaTagFile* :AdaTagFile ft_ada.txt /*:AdaTagFile*
:AdaTypes ft_ada.txt /*:AdaTypes* :AdaTypes ft_ada.txt /*:AdaTypes*
:Arguments terminal.txt /*:Arguments* :Arguments terminal.txt /*:Arguments*
:Asm terminal.txt /*:Asm*
:Break terminal.txt /*:Break* :Break terminal.txt /*:Break*
:Cfilter quickfix.txt /*:Cfilter* :Cfilter quickfix.txt /*:Cfilter*
:Clear terminal.txt /*:Clear* :Clear terminal.txt /*:Clear*
@ -5756,6 +5759,7 @@ characterwise motion.txt /*characterwise*
characterwise-register change.txt /*characterwise-register* characterwise-register change.txt /*characterwise-register*
characterwise-visual visual.txt /*characterwise-visual* characterwise-visual visual.txt /*characterwise-visual*
charclass() eval.txt /*charclass()* charclass() eval.txt /*charclass()*
charcol() eval.txt /*charcol()*
charconvert_from-variable eval.txt /*charconvert_from-variable* charconvert_from-variable eval.txt /*charconvert_from-variable*
charconvert_to-variable eval.txt /*charconvert_to-variable* charconvert_to-variable eval.txt /*charconvert_to-variable*
charidx() eval.txt /*charidx()* charidx() eval.txt /*charidx()*
@ -6951,6 +6955,7 @@ getbufvar() eval.txt /*getbufvar()*
getchangelist() eval.txt /*getchangelist()* getchangelist() eval.txt /*getchangelist()*
getchar() eval.txt /*getchar()* getchar() eval.txt /*getchar()*
getcharmod() eval.txt /*getcharmod()* getcharmod() eval.txt /*getcharmod()*
getcharpos() eval.txt /*getcharpos()*
getcharsearch() eval.txt /*getcharsearch()* getcharsearch() eval.txt /*getcharsearch()*
getcmdline() eval.txt /*getcmdline()* getcmdline() eval.txt /*getcmdline()*
getcmdpos() eval.txt /*getcmdpos()* getcmdpos() eval.txt /*getcmdpos()*
@ -6958,6 +6963,7 @@ getcmdtype() eval.txt /*getcmdtype()*
getcmdwintype() eval.txt /*getcmdwintype()* getcmdwintype() eval.txt /*getcmdwintype()*
getcompletion() eval.txt /*getcompletion()* getcompletion() eval.txt /*getcompletion()*
getcurpos() eval.txt /*getcurpos()* getcurpos() eval.txt /*getcurpos()*
getcursorcharpos() eval.txt /*getcursorcharpos()*
getcwd() eval.txt /*getcwd()* getcwd() eval.txt /*getcwd()*
getenv() eval.txt /*getenv()* getenv() eval.txt /*getenv()*
getfontname() eval.txt /*getfontname()* getfontname() eval.txt /*getfontname()*
@ -8260,6 +8266,7 @@ notation intro.txt /*notation*
notepad gui_w32.txt /*notepad* notepad gui_w32.txt /*notepad*
nr2char() eval.txt /*nr2char()* nr2char() eval.txt /*nr2char()*
nroff.vim syntax.txt /*nroff.vim* nroff.vim syntax.txt /*nroff.vim*
null vim9.txt /*null*
null-variable eval.txt /*null-variable* null-variable eval.txt /*null-variable*
number_relativenumber options.txt /*number_relativenumber* number_relativenumber options.txt /*number_relativenumber*
numbered-function eval.txt /*numbered-function* numbered-function eval.txt /*numbered-function*
@ -8871,8 +8878,10 @@ set-spc-auto spell.txt /*set-spc-auto*
setbufline() eval.txt /*setbufline()* setbufline() eval.txt /*setbufline()*
setbufvar() eval.txt /*setbufvar()* setbufvar() eval.txt /*setbufvar()*
setcellwidths() eval.txt /*setcellwidths()* setcellwidths() eval.txt /*setcellwidths()*
setcharpos() eval.txt /*setcharpos()*
setcharsearch() eval.txt /*setcharsearch()* setcharsearch() eval.txt /*setcharsearch()*
setcmdpos() eval.txt /*setcmdpos()* setcmdpos() eval.txt /*setcmdpos()*
setcursorcharpos() eval.txt /*setcursorcharpos()*
setenv() eval.txt /*setenv()* setenv() eval.txt /*setenv()*
setfperm() eval.txt /*setfperm()* setfperm() eval.txt /*setfperm()*
setline() eval.txt /*setline()* setline() eval.txt /*setline()*
@ -9553,6 +9562,7 @@ termdebug-prompt terminal.txt /*termdebug-prompt*
termdebug-starting terminal.txt /*termdebug-starting* termdebug-starting terminal.txt /*termdebug-starting*
termdebug-stepping terminal.txt /*termdebug-stepping* termdebug-stepping terminal.txt /*termdebug-stepping*
termdebug-variables terminal.txt /*termdebug-variables* termdebug-variables terminal.txt /*termdebug-variables*
termdebug_disasm_window terminal.txt /*termdebug_disasm_window*
termdebug_map_K terminal.txt /*termdebug_map_K* termdebug_map_K terminal.txt /*termdebug_map_K*
termdebug_popup terminal.txt /*termdebug_popup* termdebug_popup terminal.txt /*termdebug_popup*
termdebug_shortcuts terminal.txt /*termdebug_shortcuts* termdebug_shortcuts terminal.txt /*termdebug_shortcuts*
@ -10086,6 +10096,7 @@ vim9-reload vim9.txt /*vim9-reload*
vim9-scopes vim9.txt /*vim9-scopes* vim9-scopes vim9.txt /*vim9-scopes*
vim9-script-intro usr_46.txt /*vim9-script-intro* vim9-script-intro usr_46.txt /*vim9-script-intro*
vim9-types vim9.txt /*vim9-types* vim9-types vim9.txt /*vim9-types*
vim9-user-command vim9.txt /*vim9-user-command*
vim9.txt vim9.txt /*vim9.txt* vim9.txt vim9.txt /*vim9.txt*
vim9script vim9.txt /*vim9script* vim9script vim9.txt /*vim9script*
vim: options.txt /*vim:* vim: options.txt /*vim:*

View File

@ -1,4 +1,4 @@
*terminal.txt* For Vim version 8.2. Last change: 2020 Dec 28 *terminal.txt* For Vim version 8.2. Last change: 2021 Jan 04
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -1330,6 +1330,8 @@ Other commands ~
*:Program* jump to the window with the running program *:Program* jump to the window with the running program
*:Source* jump to the window with the source code, create it if there *:Source* jump to the window with the source code, create it if there
isn't one isn't one
*:Asm* jump to the window with the disassembly, create it if there
isn't one
Prompt mode ~ Prompt mode ~
@ -1352,6 +1354,12 @@ Prompt mode can be used even when the |+terminal| feature is present with: >
The K key is normally mapped to :Evaluate. If you do not want this use: > The K key is normally mapped to :Evaluate. If you do not want this use: >
let g:termdebug_map_K = 0 let g:termdebug_map_K = 0
<
*termdebug_disasm_window*
If you want the Asm window shown by default, set this to 1. Setting to
any value greater than 1 will set the Asm window height to that value: >
let g:termdebug_disasm_window = 15
<
Communication ~ Communication ~
*termdebug-communication* *termdebug-communication*

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.2. Last change: 2021 Jan 02 *todo.txt* For Vim version 8.2. Last change: 2021 Jan 11
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -38,18 +38,29 @@ browser use: https://github.com/vim/vim/issues/1234
*known-bugs* *known-bugs*
-------------------- Known bugs and current work ----------------------- -------------------- Known bugs and current work -----------------------
Reload: How to make sure type of script function hasn't changed? no error for:
echo extend([0], ['a', true])
Valgrind: test_vim9_cmd: uses uninitialized var like it does for:
echo extend([0], ['a'])
At script level this does not give an error:
echo map([0], (_, v) => [])
Or:
var l: list<number> = [0]
echo map(l, (_, v) => [])
Vim9 - Make everything work: Vim9 - Make everything work:
- Expand `=expr` in :next, :argedit, :argadd, :argdelete, :drop
- Expand `=expr` in :vimgrep, :vimgrepadd, :lvimgrep, :lvimgrepadd
- Expand `=expr` in :mkspell
- Unlet with range: "unlet list[a : b]"
- Implement "export {one, two three}". - Implement "export {one, two three}".
- Use "null" for v:null, like true and false? #7495
- ISN_CHECKTYPE could use check_argtype() - ISN_CHECKTYPE could use check_argtype()
- Using a script variable inside a :def function doesn't work if the variable - Using a script variable inside a :def function doesn't work if the variable
is inside a block, see Test_nested_function(). Should it work? is inside a block, see Test_nested_function(). Should it work?
- give error for variable name: - give error for variable name:
let p = function('NoSuchFunc') let p = function('NoSuchFunc')
- Make closures work better:
- Create closure in a loop. Need to make a list of them.
- If a :def function is called with a function reference, compile it to get - If a :def function is called with a function reference, compile it to get
the function type. the function type.
def Filter(x: string, Cond: func(string): bool) def Filter(x: string, Cond: func(string): bool)
@ -63,25 +74,18 @@ Vim9 - Make everything work:
statement statement
statement statement
} }
- implement { cmd } compiled
- implement { cmd } at script level
- Expand `=expr` in :next, :argedit, :argadd, :argdelete, :drop
- Expand `=expr` in :vimgrep, :vimgrepadd, :lvimgrep, :lvimgrepadd
- Expand `=expr` in :mkspell
- Does this work already: can use func as reference: - Does this work already: can use func as reference:
def SomeFunc() ... def SomeFunc() ...
map(list, SomeFunc) map(list, SomeFunc)
- For builtin functions using tv_get_string*() use check_for_string() to be - For builtin functions using tv_get_string*() use check_for_string() to be
more strict about the argument type. more strict about the argument type.
- Possible memory leaks in test_vim9_func
- Implement :lockvar and :unlockvar. How about local variables? Perhaps only - Implement :lockvar and :unlockvar. How about local variables? Perhaps only
allow this for global variables. Use :final or :const otherwise. allow this for global variables. Use :final or :const otherwise.
- Allow function names that will be script-local to start with lower case - Allow function names that will be script-local to start with lower case
letter? Or also require names with s: prefix to use upper case? letter? Or also require names with s: prefix to use upper case?
Also apply this function references "var ref = SomeFunc" Also apply this function references "var ref = SomeFunc"
- Support passing v:none to use the default argument value. (#6504) - Support passing v:none to use the default argument value. (#6504)
- Make map() give an error if the resulting type of the first argument is
wrong. Only works if the type is known? Is this slow (need to go over all
items)?
- Run the same tests in :def and Vim9 script, like in Test_expr7_not() - Run the same tests in :def and Vim9 script, like in Test_expr7_not()
- Check many more builtin function arguments at compile time. - Check many more builtin function arguments at compile time.
- make 0 == 'string' fail on the script level, like inside :def. - make 0 == 'string' fail on the script level, like inside :def.
@ -105,57 +109,59 @@ Vim9 - Make everything work:
- Implement "as Name" in "import Item as Name from ..." - Implement "as Name" in "import Item as Name from ..."
- Implement using imported items at script level from "import * as X" in - Implement using imported items at script level from "import * as X" in
eval_variable(). Should pass the ".xxx" that follows and return that. eval_variable(). Should pass the ".xxx" that follows and return that.
- Disallow unlet for local/script/imported vars
- Make "++nr" work. "++g:count" doesn't work, thinks it is a range. - Make "++nr" work. "++g:count" doesn't work, thinks it is a range.
- Make closures work: - Reload: How to make sure type of script function hasn't changed?
- Create closure in a loop. Need to make a list of them.
- nested closure only uses one context, not all (#7150)
- expandcmd() with `=expr` in filename uses legacy expression. - expandcmd() with `=expr` in filename uses legacy expression.
- eval_expr() in ex_cexpr() - eval_expr() in ex_cexpr()
- eval_expr() call in dbg_parsearg() and debuggy_find() - eval_expr() call in dbg_parsearg() and debuggy_find()
Improve error checking: - compile "skip" argument of searchpair()
- "echo Func()" is an error if Func() does not return anything. - compile "expr" and "call" expression of a channel in channel_exe_cmd()?
Before launch: - give an error for "echo Func()" if Func() does not return anything.
Once Vim9 is stable:
- Change the help to prefer Vim9 syntax where appropriate
- Use Vim9 for runtime files.
PR #7497 for autoload/ccomplete.vim
- Add all the error numbers in a good place in documentation. - Add all the error numbers in a good place in documentation.
- In the generic eval docs, point out the Vim9 syntax where it differs. - In the generic eval docs, point out the Vim9 syntax where it differs.
Also:
- For range: make table of first ASCII character with flag to quickly check if Also for Vim9:
it can be a Vim9 command. E.g. "+" can, but "." can't.
- better implementation for partial and tests for that. - better implementation for partial and tests for that.
- Make "g:imported = Export.exported" work in Vim9 script. - Make "g:imported = Export.exported" work in Vim9 script.
- Make Foo.Bar() work to call the dict function. (#5676) - Make Foo.Bar() work to call the dict function. (#5676)
- Error in any command in "vim9script" aborts sourcing. - Error in any command in "vim9script" aborts sourcing.
- Find a way to test expressions in legacy and Vim9 script without duplication - Find a way to test expressions in legacy and Vim9 script without duplication
- Test each level of expressions properly, with type checking
- Test try/catch and throw better, also nested. - Test try/catch and throw better, also nested.
Test return inside try/finally jumps to finally and then returns. Test that return inside try/finally jumps to finally and then returns.
- Test that a function defined inside a :def function is local to that - 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 function, g: functions can be defined and script-local functions cannot be
defined. defined.
- implement :type - compile options that are an expression, e.g. "expr:" in 'spellsuggest',
- import type declaration? 'foldexpr', 'foldtext', 'printexpr', 'diffexpr', 'patchexpr', 'charconvert',
'balloonexpr', 'includeexpr', 'indentexpr', 'formatexpr'.
Give an error if compilation fails. (#7625)
Use the location where the option was set for deciding whether it's to be
evaluated in Vim9 script context.
- implement :type; import type declaration.
- implement enum; import enum.
- Future work: See |vim9-classes| - Future work: See |vim9-classes|
- implement enum Define the keywords and commands to make sure it will be backwards
- Make accessing varargs faster: arg[expr] compatible.
EVAL expr
LOADVARARG (varargs idx)
- Make debugging work - at least per function. Need to recompile a function - Make debugging work - at least per function. Need to recompile a function
to step through it line-by-line? Evaluate the stack and variables on the to step through it line-by-line? Evaluate the stack and variables on the
stack? stack?
- Make profiling work - Add ISN_PROFILE instructions after every line? - Make profiling work - Add ISN_PROFILE instructions after every line?
- List commands when 'verbose' is set or :verbose is used. - List commands when 'verbose' is set or :verbose is used.
Once Vim9 is stable:
- Change the help to prefer Vim9 syntax where appropriate Further Vim9 improvements, possibly after launch:
- Use Vim9 for runtime files. - For range: make table of first ASCII character with flag to quickly check if
PR #7497 for autoload/ccomplete.vim it can be a Vim9 command. E.g. "+" can, but "." can't.
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 get_lambda_tv() in popup_add_timeout()
- inline call to map() and filter() - inline call to map() and filter()
- compile "skip" argument of searchpair() - Make accessing varargs faster: arg[expr]
- compile "expr" and "call" expression of a channel in channel_exe_cmd()? EVAL expr
LOADVARARG (varargs idx)
Popup windows: Popup windows:
- Add a flag to make a popup window focusable? - Add a flag to make a popup window focusable?
@ -308,6 +314,18 @@ Any way to convert "$" back by using a special value? (#6901)
Can we detect true color support? https://gist.github.com/XVilka/8346728 Can we detect true color support? https://gist.github.com/XVilka/8346728
Try setting a color then request the current color, like using t_u7. Try setting a color then request the current color, like using t_u7.
Regexp to search for duplicate lines does not work correctly:
/\(^.*\n\)\1 (Chris Morgan, #6239)
Changing a capturing group to non-capturing changes the result: #7607
:echo matchstr('aaa bbb', '\(.\{-1,}\>\)\|.*')
aaa
:echo matchstr('aaa bbb', '\%(.\{-1,}\>\)\|.*')
aaa bbb
Should also work without any group:
:echo matchstr('aaa bbb', '.\{-1,}\>\|.*')
aaa bbb (should be aaa)
Check out PR #543 (Roland Puntaier). Check out PR #543 (Roland Puntaier).
Patch for multibyte characters in langmap and applying a mapping on them. Patch for multibyte characters in langmap and applying a mapping on them.
(Christian Brabandt, 2015 Jun 12, update July 25) (Christian Brabandt, 2015 Jun 12, update July 25)
@ -393,9 +411,6 @@ corruption. (#6631)
When 'lazyredraw' is set sometimes the title is not updated. When 'lazyredraw' is set sometimes the title is not updated.
(Jason Franklin, 2020 Feb 3) Looks like a race condition. (Jason Franklin, 2020 Feb 3) Looks like a race condition.
Regexp to search for duplicate lines does not work correctly:
/\(^.*\n\)\1 (Chris Morgan, #6239)
With bash ":make" does not set v:shell_error. Possible solution: set With bash ":make" does not set v:shell_error. Possible solution: set
'shellpipe' to "2>&1| tee %s; exit ${PIPESTATUS[0]}" #5994 'shellpipe' to "2>&1| tee %s; exit ${PIPESTATUS[0]}" #5994
@ -1152,7 +1167,7 @@ Overlong utf-8 sequence is displayed wrong. (Harm te Hennepe, 2017 Sep 14,
#2089) Patch with possible solution by Björn Linse. #2089) Patch with possible solution by Björn Linse.
The change list index is local to a buffer, but it doesn't make sense using it The change list index is local to a buffer, but it doesn't make sense using it
for another buffer. (lacygolil) Copy w_changelistidx to wininfo_S and back. for another buffer. (lacygoill) Copy w_changelistidx to wininfo_S and back.
X11: Putting more than about 262040 characters of text on the clipboard and X11: Putting more than about 262040 characters of text on the clipboard and
pasting it in another Vim doesn't work. (Dominique Pelle, 2008 Aug 21-23) pasting it in another Vim doesn't work. (Dominique Pelle, 2008 Aug 21-23)
@ -5474,7 +5489,7 @@ Mappings and Abbreviations:
not the <Space>. not the <Space>.
8 Give a warning when using CTRL-C in the lhs of a mapping. It will never 8 Give a warning when using CTRL-C in the lhs of a mapping. It will never
(?) work. (?) work.
7 Add <0x8f> (hex), <033> (octal) and <123> (decimal) to <> notation? 7 Add <0x8f> (hex), <0o33> (octal) and <123> (decimal) to <> notation?
7 When someone tries to unmap with a trailing space, and it fails, try 7 When someone tries to unmap with a trailing space, and it fails, try
unmapping without the trailing space. Helps for ":unmap xx | unmap yy". unmapping without the trailing space. Helps for ":unmap xx | unmap yy".
6 Context-sensitive abbreviations: Specify syntax group(s) in which the 6 Context-sensitive abbreviations: Specify syntax group(s) in which the

View File

@ -50,7 +50,7 @@ which moves to the previous end of a word:
This is a line with example text ~ This is a line with example text ~
<----<----x---->------------> <----<----x---->------------>
2ge ge e we 2ge ge e 2e
If you are at the last word of a line, the "w" command will take you to the If you are at the last word of a line, the "w" command will take you to the
first word in the next line. Thus you can use this to move through a first word in the next line. Thus you can use this to move through a

View File

@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 8.2. Last change: 2020 Dec 19 *usr_41.txt* For Vim version 8.2. Last change: 2021 Jan 08
VIM USER MANUAL - by Bram Moolenaar VIM USER MANUAL - by Bram Moolenaar
@ -122,14 +122,14 @@ starts with a zero. "017" is decimal 15. A binary number starts with "0b" or
decimal number, it will be interpreted as an octal number! decimal number, it will be interpreted as an octal number!
The ":echo" command always prints decimal numbers. Example: > The ":echo" command always prints decimal numbers. Example: >
:echo 0x7f 036 :echo 0x7f 0o36
< 127 30 ~ < 127 30 ~
A number is made negative with a minus sign. This also works for hexadecimal, A number is made negative with a minus sign. This also works for hexadecimal,
octal and binary numbers. A minus sign is also used for subtraction. Compare octal and binary numbers. A minus sign is also used for subtraction. Compare
this with the previous example: > this with the previous example: >
:echo 0x7f -036 :echo 0x7f -0o36
< 97 ~ < 97 ~
White space in an expression is ignored. However, it's recommended to use it White space in an expression is ignored. However, it's recommended to use it
@ -137,7 +137,7 @@ for separating items, to make the expression easier to read. For example, to
avoid the confusion with a negative number above, put a space between the avoid the confusion with a negative number above, put a space between the
minus sign and the following number: > minus sign and the following number: >
:echo 0x7f - 036 :echo 0x7f - 0o36
============================================================================== ==============================================================================
*41.2* Variables *41.2* Variables

View File

@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2021 Jan 03 *vim9.txt* For Vim version 8.2. Last change: 2021 Jan 10
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -52,8 +52,9 @@ The Vim9 script syntax and semantics are used in:
- a script file where the first command is `vim9script` - a script file where the first command is `vim9script`
- an autocommand defined in the context of the above - an autocommand defined in the context of the above
When using `:function` in a Vim9 script file the legacy syntax is used. When using `:function` in a Vim9 script file the legacy syntax is used, with
However, this can be confusing and is therefore discouraged. the highest |scriptversion|. However, this can be confusing and is therefore
discouraged.
Vim9 script and legacy Vim script can be mixed. There is no requirement to Vim9 script and legacy Vim script can be mixed. There is no requirement to
rewrite old scripts, they keep working as before. You may want to use a few rewrite old scripts, they keep working as before. You may want to use a few
@ -70,28 +71,29 @@ Overview ~
Brief summary of the differences you will most often encounter when using Vim9 Brief summary of the differences you will most often encounter when using Vim9
script and `:def` functions; details are below: script and `:def` functions; details are below:
- Comments start with #, not ": > - Comments start with #, not ": >
echo "hello" # comment echo "hello" # comment
- Using a backslash for line continuation is hardly ever needed: > - Using a backslash for line continuation is hardly ever needed: >
echo "hello " echo "hello "
.. yourName .. yourName
.. ", how are you?" .. ", how are you?"
- White space is required in many places. - White space is required in many places.
- Assign values without `:let`, declare variables with `:var`: > - Assign values without `:let`, declare variables with `:var`: >
var count = 0 var count = 0
count += 3 count += 3
- Constants can be declared with `:final` and `:const`: > - Constants can be declared with `:final` and `:const`: >
final matches = [] # add matches final matches = [] # add matches
const names = ['Betty', 'Peter'] # cannot be changed const names = ['Betty', 'Peter'] # cannot be changed
- `:final` cannot be used as an abbreviation of `:finally`. - `:final` cannot be used as an abbreviation of `:finally`.
- Variables and functions are script-local by default. - Variables and functions are script-local by default.
- Functions are declared with argument types and return type: > - Functions are declared with argument types and return type: >
def CallMe(count: number, message: string): bool def CallMe(count: number, message: string): bool
- Call functions without `:call`: > - Call functions without `:call`: >
writefile(['done'], 'file.txt') writefile(['done'], 'file.txt')
- You cannot use `:xit`, `:t`, `:append`, `:change`, `:insert` or curly-braces - You cannot use `:xit`, `:t`, `:append`, `:change`, `:insert` or curly-braces
names. names.
- A range before a command must be prefixed with a colon: > - A range before a command must be prefixed with a colon: >
:%s/this/that :%s/this/that
- Unless mentioned specifically, the highest |scriptversion| is used.
Comments starting with # ~ Comments starting with # ~
@ -315,7 +317,7 @@ The constant only applies to the value itself, not what it refers to. >
NAMES[0] = ["Jack"] # Error! NAMES[0] = ["Jack"] # Error!
NAMES[0][0] = "Jack" # Error! NAMES[0][0] = "Jack" # Error!
NAMES[1] = ["Emma"] # Error! NAMES[1] = ["Emma"] # Error!
Names[1][0] = "Emma" # OK, now females[0] == "Emma" NAMES[1][0] = "Emma" # OK, now females[0] == "Emma"
< *E1092* < *E1092*
Declaring more than one variable at a time, using the unpack notation, is Declaring more than one variable at a time, using the unpack notation, is
@ -432,7 +434,7 @@ possible just before or after the operator. For example: >
.. middle .. middle
.. end .. end
var total = start + var total = start +
end - end -
correction correction
var result = positive var result = positive
? PosFunc(arg) ? PosFunc(arg)
@ -629,9 +631,9 @@ one: >
When using "!" for inverting, there is no error for using any type and the When using "!" for inverting, there is no error for using any type and the
result is a boolean. "!!" can be used to turn any value into boolean: > result is a boolean. "!!" can be used to turn any value into boolean: >
!'yes' == false !'yes' == false
!![] == false !![] == false
!![1, 2, 3] == true !![1, 2, 3] == true
When using "`.."` for string concatenation arguments of simple types are When using "`.."` for string concatenation arguments of simple types are
always converted to string: > always converted to string: >
@ -651,6 +653,14 @@ byte indexes. Example: >
echo 'bár'[1] echo 'bár'[1]
In legacy script this results in the character 0xc3 (an illegal byte), in Vim9 In legacy script this results in the character 0xc3 (an illegal byte), in Vim9
script this results in the string 'á'. script this results in the string 'á'.
A negative index is counting from the end, "[-1]" is the last character.
If the index is out of range then an empty string results.
In legacy script "++var" and "--var" would be silently accepted and have no
effect. This is an error in Vim9 script.
Numbers starting with zero are not considered to be octal, only numbers
starting with "0o" are octal: "0o744". |scriptversion-4|
What to watch out for ~ What to watch out for ~
@ -689,7 +699,7 @@ Vim9 functions are compiled as a whole: >
if !has('feature') if !has('feature')
return return
endif endif
use-feature # May give compilation error use-feature # May give a compilation error
enddef enddef
For a workaround, split it in two functions: > For a workaround, split it in two functions: >
func Maybe() func Maybe()
@ -709,6 +719,25 @@ evaluates to false: >
use-feature use-feature
endif endif
enddef enddef
< *vim9-user-command*
Another side effect of compiling a function is that the precense of a user
command is checked at compile time. If the user command is defined later an
error will result. This works: >
command -nargs=1 MyCommand echom <q-args>
def Works()
MyCommand 123
enddef
This will give an error for "MyCommand" not being defined: >
def Works()
command -nargs=1 MyCommand echom <q-args>
MyCommand 123
enddef
A workaround is to invoke the command indirectly with `:execute`: >
def Works()
command -nargs=1 MyCommand echom <q-args>
execute 'MyCommand 123'
enddef
Note that for unrecognized commands there is no check for "|" and a following Note that for unrecognized commands there is no check for "|" and a following
command. This will give an error for missing `endif`: > command. This will give an error for missing `endif`: >
def Maybe() def Maybe()
@ -946,6 +975,12 @@ an error, thus breaking backwards compatibility. For example:
- Using a string value when setting a number options. - Using a string value when setting a number options.
- Using a number where a string is expected. *E1024* - Using a number where a string is expected. *E1024*
One consequence is that the item type of a list or dict given to map() must
not change. This will give an error in compiled code: >
map([1, 2, 3], (i, v) => 'item ' .. i)
E1012: Type mismatch; expected list<number> but got list<string>
Instead use |mapnew()|.
============================================================================== ==============================================================================
5. Namespace, Import and Export 5. Namespace, Import and Export
@ -1055,14 +1090,14 @@ actually needed. A recommended mechanism:
1. In the plugin define user commands, functions and/or mappings that refer to 1. In the plugin define user commands, functions and/or mappings that refer to
an autoload script. > an autoload script. >
command -nargs=1 SearchForStuff call searchfor#Stuff(<f-args>) command -nargs=1 SearchForStuff call searchfor#Stuff(<f-args>)
< This goes in .../plugin/anyname.vim. "anyname.vim" can be freely chosen. < This goes in .../plugin/anyname.vim. "anyname.vim" can be freely chosen.
2. In the autoload script do the actual work. You can import items from 2. In the autoload script do the actual work. You can import items from
other files to split up functionality in appropriate pieces. > other files to split up functionality in appropriate pieces. >
vim9script vim9script
import FilterFunc from "../import/someother.vim" import FilterFunc from "../import/someother.vim"
def searchfor#Stuff(arg: string) def searchfor#Stuff(arg: string)
var filtered = FilterFunc(arg) var filtered = FilterFunc(arg)
... ...

View File

@ -1,87 +1,83 @@
" Vim ftplugin file " Vim ftplugin file
" Language: Erlang " Language: Erlang (http://www.erlang.org)
" Maintainer: Csaba Hoch <csaba.hoch@gmail.com>
" Author: Oscar Hellström <oscar@oscarh.net> " Author: Oscar Hellström <oscar@oscarh.net>
" Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com> " Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
" Eduardo Lopez (http://github.com/tapichu) " Eduardo Lopez (http://github.com/tapichu)
" Arvid Bjurklint (http://github.com/slarwise)
" Last Update: 2021-Jan-08
" License: Vim license " License: Vim license
" Version: 2012/01/25 " URL: https://github.com/vim-erlang/vim-erlang-runtime
if exists('b:did_ftplugin') if exists('b:did_ftplugin')
finish finish
else
let b:did_ftplugin = 1
endif
if exists('s:did_function_definitions')
call s:SetErlangOptions()
finish
else
let s:did_function_definitions = 1
endif endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo let s:cpo_save = &cpo
set cpo&vim set cpo&vim
if !exists('g:erlang_keywordprg') let &l:keywordprg = get(g:, 'erlang_keywordprg', 'erl -man')
let g:erlang_keywordprg = 'erl -man'
if get(g:, 'erlang_folding', 0)
setlocal foldmethod=expr
setlocal foldexpr=GetErlangFold(v:lnum)
setlocal foldtext=ErlangFoldText()
endif endif
if !exists('g:erlang_folding') setlocal comments=:%%%,:%%,:%
let g:erlang_folding = 0 setlocal commentstring=%%s
endif
setlocal formatoptions+=ro
setlocal suffixesadd=.erl,.hrl
let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")'
let &l:define = '^\s*-\%(define\|record\|type\|opaque\)'
let s:erlang_fun_begin = '^\a\w*(.*$' let s:erlang_fun_begin = '^\a\w*(.*$'
let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$' let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$'
function s:SetErlangOptions() if !exists('*GetErlangFold')
if g:erlang_folding function GetErlangFold(lnum)
setlocal foldmethod=expr let lnum = a:lnum
setlocal foldexpr=GetErlangFold(v:lnum) let line = getline(lnum)
setlocal foldtext=ErlangFoldText()
endif
setlocal comments=:%%%,:%%,:% if line =~ s:erlang_fun_end
setlocal commentstring=%%s return '<1'
endif
setlocal formatoptions+=ro if line =~ s:erlang_fun_begin && foldlevel(lnum - 1) == 1
let &l:keywordprg = g:erlang_keywordprg return '1'
endfunction endif
function GetErlangFold(lnum) if line =~ s:erlang_fun_begin
let lnum = a:lnum return '>1'
let line = getline(lnum) endif
if line =~ s:erlang_fun_end return '='
return '<1' endfunction
endif endif
if line =~ s:erlang_fun_begin && foldlevel(lnum - 1) == 1 if !exists('*ErlangFoldText')
return '1' function ErlangFoldText()
endif let line = getline(v:foldstart)
let foldlen = v:foldend - v:foldstart + 1
let lines = ' ' . foldlen . ' lines: ' . substitute(line, "[\ \t]*", '', '')
if foldlen < 10
let lines = ' ' . lines
endif
let retval = '+' . v:folddashes . lines
if line =~ s:erlang_fun_begin return retval
return '>1' endfunction
endif endif
return '=' let b:undo_ftplugin = "setlocal keywordprg< foldmethod< foldexpr< foldtext<"
endfunction \ . " comments< commentstring< formatoptions< suffixesadd< include<"
\ . " define<"
function ErlangFoldText()
let line = getline(v:foldstart)
let foldlen = v:foldend - v:foldstart + 1
let lines = ' ' . foldlen . ' lines: ' . substitute(line, "[\ \t]*", '', '')
if foldlen < 10
let lines = ' ' . lines
endif
let retval = '+' . v:folddashes . lines
return retval
endfunction
call s:SetErlangOptions()
let b:undo_ftplugin = "setlocal foldmethod< foldexpr< foldtext<"
\ . " comments< commentstring< formatoptions<"
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save
" vim: sw=2 et

View File

@ -2,7 +2,7 @@
" Language: fstab file " Language: fstab file
" Maintainer: Radu Dineiu <radu.dineiu@gmail.com> " Maintainer: Radu Dineiu <radu.dineiu@gmail.com>
" URL: https://raw.github.com/rid9/vim-fstab/master/ftplugin/fstab.vim " URL: https://raw.github.com/rid9/vim-fstab/master/ftplugin/fstab.vim
" Last Change: 2020 Dec 29 " Last Change: 2021 Jan 02
" Version: 1.0 " Version: 1.0
" "
" Credits: " Credits:
@ -16,4 +16,4 @@ let b:did_ftplugin = 1
setlocal commentstring=#%s setlocal commentstring=#%s
let b:undo_ftplugin = "setlocal commentstring<" let b:undo_ftplugin = "setlocal commentstring<"
" vim: ts=8 ft=vim " vim: ts=8 ft=vim

View File

@ -6,7 +6,16 @@
" See https://swift.org/LICENSE.txt for license information " See https://swift.org/LICENSE.txt for license information
" See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors " See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
" "
" Vim maintainer: Emir SARI <bitigchi@me.com> " Vim maintainer: Emir SARI <bitigchi@me.com>
" Last Change: 2021 Jan 08
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let b:undo_ftplugin = "setlocal comments< expandtab< tabstop< shiftwidth< smartindent<"
setlocal comments=s1:/*,mb:*,ex:*/,:///,:// setlocal comments=s1:/*,mb:*,ex:*/,:///,://
setlocal expandtab setlocal expandtab

View File

@ -1,7 +1,7 @@
" Vim filetype plugin " Vim filetype plugin
" Language: Vim " Language: Vim
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Aug 14 " Last Change: 2021 Jan 05
" Only do this when not done yet for this buffer " Only do this when not done yet for this buffer
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
@ -48,18 +48,23 @@ setlocal isk+=#
" Use :help to lookup the keyword under the cursor with K. " Use :help to lookup the keyword under the cursor with K.
setlocal keywordprg=:help setlocal keywordprg=:help
" Set 'comments' to format dashed lists in comments if "\n" .. getline(1, 10)->join("\n") =~# '\n\s*vim9\%[script]\>'
" Avoid that #{} starts a comment. " Set 'comments' to format dashed lists in comments
setlocal com=sO:\"\ -,mO:\"\ \ ,sO:#\ -,mO:#\ \ ,eO:##,:\",b:# setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:#
" Comments start with a double quote in a legacy script;
" with # in a Vim9 script
setlocal commentstring=\"%s
else
setlocal com=sO:\"\ -,mO:\"\ \ ,:\"
setlocal commentstring=#%s
endif
" Format comments to be up to 78 characters long " Format comments to be up to 78 characters long
if &tw == 0 if &tw == 0
setlocal tw=78 setlocal tw=78
endif endif
" Comments start with a double quote; in Vim9 script # would also work
setlocal commentstring=\"%s
if !exists("no_plugin_maps") && !exists("no_vim_maps") if !exists("no_plugin_maps") && !exists("no_vim_maps")
let b:did_add_maps = 1 let b:did_add_maps = 1

View File

@ -227,4 +227,4 @@ endfunction
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save
" vim:sw=2 " vim:sw=2

View File

@ -21,8 +21,27 @@ let cmd =
" END_INDENT " END_INDENT
" START_INDENT
" INDENT_EXE let g:vim_indent_cont = 5
let list = [
\ 'one',
\ 'two']
" END_INDENT
" START_INDENT " START_INDENT
" INDENT_EXE unlet g:vim_indent_cont " INDENT_EXE unlet g:vim_indent_cont
let list = [
'one',
'two',
]
echo
" END_INDENT
" START_INDENT
" INDENT_AT this-line " INDENT_AT this-line
func Some() func Some()
let f = x " this-line let f = x " this-line

View File

@ -21,8 +21,27 @@ let cmd =
" END_INDENT " END_INDENT
" START_INDENT
" INDENT_EXE let g:vim_indent_cont = 5
let list = [
\ 'one',
\ 'two']
" END_INDENT
" START_INDENT " START_INDENT
" INDENT_EXE unlet g:vim_indent_cont " INDENT_EXE unlet g:vim_indent_cont
let list = [
'one',
'two',
]
echo
" END_INDENT
" START_INDENT
" INDENT_AT this-line " INDENT_AT this-line
func Some() func Some()
let f = x " this-line let f = x " this-line

View File

@ -1,7 +1,7 @@
" Vim indent file " Vim indent file
" Language: Vim script " Language: Vim script
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Sep 27 " Last Change: 2021 Jan 06
" Only load this indent file when no other was loaded. " Only load this indent file when no other was loaded.
if exists("b:did_indent") if exists("b:did_indent")
@ -52,6 +52,7 @@ function GetVimIndentIntern()
return 0 return 0
endif endif
let prev_text = getline(lnum) let prev_text = getline(lnum)
let found_cont = 0
" Add a 'shiftwidth' after :if, :while, :try, :catch, :finally, :function " Add a 'shiftwidth' after :if, :while, :try, :catch, :finally, :function
" and :else. Add it three times for a line that starts with '\' or '"\ ' " and :else. Add it three times for a line that starts with '\' or '"\ '
@ -83,6 +84,7 @@ function GetVimIndentIntern()
endif endif
if cur_text =~ s:lineContPat && v:lnum > 1 && prev_text !~ s:lineContPat if cur_text =~ s:lineContPat && v:lnum > 1 && prev_text !~ s:lineContPat
let found_cont = 1
if exists("g:vim_indent_cont") if exists("g:vim_indent_cont")
let ind = ind + g:vim_indent_cont let ind = ind + g:vim_indent_cont
else else
@ -114,10 +116,50 @@ function GetVimIndentIntern()
endif endif
endif endif
" For a line starting with "}" find the matching "{". If it is at the start
" of the line align with it, probably end of a block.
" Use the mapped "%" from matchit to find the match, otherwise we may match
" a { inside a comment or string.
if cur_text =~ '^\s*}'
if maparg('%') != ''
exe v:lnum
silent! normal %
if line('.') < v:lnum && getline('.') =~ '^\s*{'
let ind = indent('.')
endif
else
" todo: use searchpair() to find a match
endif
endif
" Below a line starting with "}" find the matching "{". If it is at the
" end of the line we must be below the end of a dictionary.
if prev_text =~ '^\s*}'
if maparg('%') != ''
exe lnum
silent! normal %
if line('.') == lnum || getline('.') !~ '^\s*{'
let ind = ind - shiftwidth()
endif
else
" todo: use searchpair() to find a match
endif
endif
" Below a line starting with "]" we must be below the end of a list.
if prev_text =~ '^\s*]'
let ind = ind - shiftwidth()
endif
" A line ending in "{"/"[} is most likely the start of a dict/list literal,
" indent the next line more. Not for a continuation line.
if prev_text =~ '[{[]\s*$' && !found_cont
let ind = ind + shiftwidth()
endif
" Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry,
" :endfun, :enddef, :else and :augroup END. " :endfun, :enddef, :else and :augroup END.
if cur_text =~ '^\s*\(ene\@!\|}\|cat\|finall\|el\|aug\%[roup]\s\+[eE][nN][dD]\)' if cur_text =~ '^\s*\(ene\@!\|cat\|finall\|el\|aug\%[roup]\s\+[eE][nN][dD]\)'
let ind = ind - shiftwidth() let ind = ind - shiftwidth()
endif endif

View File

@ -1,3 +1,3 @@
" Menu Translations: Turkish " Menu Translations: Turkish
source <sfile>:p:h/menu_tr_tr.cp1254.vim source <sfile>:p:h/menu_tr_tr.cp1254.vim

View File

@ -1,3 +1,3 @@
" Menu Translations: Turkish " Menu Translations: Turkish
source <sfile>:p:h/menu_tr_tr.iso_8859-9.vim source <sfile>:p:h/menu_tr_tr.iso_8859-9.vim

View File

@ -2,7 +2,7 @@
" "
" Author: Bram Moolenaar " Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license" " Copyright: Vim license applies, see ":help license"
" Last Change: 2020 Dec 07 " Last Change: 2021 Jan 03
" "
" WORK IN PROGRESS - Only the basics work " WORK IN PROGRESS - Only the basics work
" Note: On MS-Windows you need a recent version of gdb. The one included with " Note: On MS-Windows you need a recent version of gdb. The one included with
@ -70,9 +70,14 @@ if !exists('g:termdebugger')
endif endif
let s:pc_id = 12 let s:pc_id = 12
let s:break_id = 13 " breakpoint number is added to this let s:asm_id = 13
let s:break_id = 14 " breakpoint number is added to this
let s:stopped = 1 let s:stopped = 1
let s:parsing_disasm_msg = 0
let s:asm_lines = []
let s:asm_addr = ''
" Take a breakpoint number as used by GDB and turn it into an integer. " Take a breakpoint number as used by GDB and turn it into an integer.
" The breakpoint may contain a dot: 123.4 -> 123004 " The breakpoint may contain a dot: 123.4 -> 123004
" The main breakpoint has a zero subid. " The main breakpoint has a zero subid.
@ -114,6 +119,7 @@ func s:StartDebug_internal(dict)
let s:ptywin = 0 let s:ptywin = 0
let s:pid = 0 let s:pid = 0
let s:asmwin = 0
" Uncomment this line to write logging in "debuglog". " Uncomment this line to write logging in "debuglog".
" call ch_logfile('debuglog', 'w') " call ch_logfile('debuglog', 'w')
@ -153,6 +159,14 @@ func s:StartDebug_internal(dict)
else else
call s:StartDebug_term(a:dict) call s:StartDebug_term(a:dict)
endif endif
if exists('g:termdebug_disasm_window')
if g:termdebug_disasm_window
let curwinid = win_getid(winnr())
call s:GotoAsmwinOrCreateIt()
call win_gotoid(curwinid)
endif
endif
endfunc endfunc
" Use when debugger didn't start or ended. " Use when debugger didn't start or ended.
@ -546,6 +560,14 @@ func s:GetFullname(msg)
return name return name
endfunc endfunc
" Extract the "addr" value from a gdb message with addr="0x0001234".
func s:GetAsmAddr(msg)
if a:msg !~ 'addr='
return ''
endif
let addr = s:DecodeMessage(substitute(a:msg, '.*addr=', '', ''))
return addr
endfunc
func s:EndTermDebug(job, status) func s:EndTermDebug(job, status)
exe 'bwipe! ' . s:commbuf exe 'bwipe! ' . s:commbuf
unlet s:gdbwin unlet s:gdbwin
@ -609,6 +631,69 @@ func s:EndPromptDebug(job, status)
call ch_log("Returning from EndPromptDebug()") call ch_log("Returning from EndPromptDebug()")
endfunc endfunc
" Disassembly window - added by Michael Sartain
"
" - CommOutput: disassemble $pc
" - CommOutput: &"disassemble $pc\n"
" - CommOutput: ~"Dump of assembler code for function main(int, char**):\n"
" - CommOutput: ~" 0x0000555556466f69 <+0>:\tpush rbp\n"
" ...
" - CommOutput: ~" 0x0000555556467cd0:\tpop rbp\n"
" - CommOutput: ~" 0x0000555556467cd1:\tret \n"
" - CommOutput: ~"End of assembler dump.\n"
" - CommOutput: ^done
" - CommOutput: disassemble $pc
" - CommOutput: &"disassemble $pc\n"
" - CommOutput: &"No function contains specified address.\n"
" - CommOutput: ^error,msg="No function contains specified address."
func s:HandleDisasmMsg(msg)
if a:msg =~ '^\^done'
let curwinid = win_getid(winnr())
if win_gotoid(s:asmwin)
silent normal! gg0"_dG
call setline(1, s:asm_lines)
set nomodified
set filetype=asm
let lnum = search('^' . s:asm_addr)
if lnum != 0
exe 'sign unplace ' . s:asm_id
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
endif
call win_gotoid(curwinid)
endif
let s:parsing_disasm_msg = 0
let s:asm_lines = []
elseif a:msg =~ '^\^error,msg='
if s:parsing_disasm_msg == 1
" Disassemble call ran into an error. This can happen when gdb can't
" find the function frame address, so let's try to disassemble starting
" at current PC
call s:SendCommand('disassemble $pc,+100')
endif
let s:parsing_disasm_msg = 0
elseif a:msg =~ '\&\"disassemble \$pc'
if a:msg =~ '+100'
" This is our second disasm attempt
let s:parsing_disasm_msg = 2
endif
else
let value = substitute(a:msg, '^\~\"[ ]*', '', '')
let value = substitute(value, '^=>[ ]*', '', '')
let value = substitute(value, '\\n\" $', '', '')
let value = substitute(value, '\\n\"$', '', '')
let value = substitute(value, ' ', '', '')
let value = substitute(value, '\\t', ' ', 'g')
if value != '' || !empty(s:asm_lines)
call add(s:asm_lines, value)
endif
endif
endfunc
" Handle a message received from gdb on the GDB/MI interface. " Handle a message received from gdb on the GDB/MI interface.
func s:CommOutput(chan, msg) func s:CommOutput(chan, msg)
let msgs = split(a:msg, "\r") let msgs = split(a:msg, "\r")
@ -618,7 +703,10 @@ func s:CommOutput(chan, msg)
if msg[0] == "\n" if msg[0] == "\n"
let msg = msg[1:] let msg = msg[1:]
endif endif
if msg != ''
if s:parsing_disasm_msg
call s:HandleDisasmMsg(msg)
elseif msg != ''
if msg =~ '^\(\*stopped\|\*running\|=thread-selected\)' if msg =~ '^\(\*stopped\|\*running\|=thread-selected\)'
call s:HandleCursor(msg) call s:HandleCursor(msg)
elseif msg =~ '^\^done,bkpt=' || msg =~ '^=breakpoint-created,' elseif msg =~ '^\^done,bkpt=' || msg =~ '^=breakpoint-created,'
@ -631,6 +719,9 @@ func s:CommOutput(chan, msg)
call s:HandleEvaluate(msg) call s:HandleEvaluate(msg)
elseif msg =~ '^\^error,msg=' elseif msg =~ '^\^error,msg='
call s:HandleError(msg) call s:HandleError(msg)
elseif msg =~ '^disassemble'
let s:parsing_disasm_msg = 1
let s:asm_lines = []
endif endif
endif endif
endfor endfor
@ -671,6 +762,7 @@ func s:InstallCommands()
command Gdb call win_gotoid(s:gdbwin) command Gdb call win_gotoid(s:gdbwin)
command Program call s:GotoProgram() command Program call s:GotoProgram()
command Source call s:GotoSourcewinOrCreateIt() command Source call s:GotoSourcewinOrCreateIt()
command Asm call s:GotoAsmwinOrCreateIt()
command Winbar call s:InstallWinbar() command Winbar call s:InstallWinbar()
if !exists('g:termdebug_map_K') || g:termdebug_map_K if !exists('g:termdebug_map_K') || g:termdebug_map_K
@ -724,6 +816,7 @@ func s:DeleteCommands()
delcommand Gdb delcommand Gdb
delcommand Program delcommand Program
delcommand Source delcommand Source
delcommand Asm
delcommand Winbar delcommand Winbar
if exists('s:k_map_saved') if exists('s:k_map_saved')
@ -923,6 +1016,48 @@ func s:GotoSourcewinOrCreateIt()
endif endif
endfunc endfunc
func s:GotoAsmwinOrCreateIt()
if !win_gotoid(s:asmwin)
if win_gotoid(s:sourcewin)
exe 'rightbelow new'
else
exe 'new'
endif
let s:asmwin = win_getid(winnr())
setlocal nowrap
setlocal number
setlocal noswapfile
setlocal buftype=nofile
let asmbuf = bufnr('Termdebug-asm-listing')
if asmbuf > 0
exe 'buffer' . asmbuf
else
exe 'file Termdebug-asm-listing'
endif
if exists('g:termdebug_disasm_window')
if g:termdebug_disasm_window > 1
exe 'resize ' . g:termdebug_disasm_window
endif
endif
endif
if s:asm_addr != ''
let lnum = search('^' . s:asm_addr)
if lnum == 0
if s:stopped
call s:SendCommand('disassemble $pc')
endif
else
exe 'sign unplace ' . s:asm_id
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
endif
endif
endfunc
" Handle stopping and running message from gdb. " Handle stopping and running message from gdb.
" Will update the sign that shows the current position. " Will update the sign that shows the current position.
func s:HandleCursor(msg) func s:HandleCursor(msg)
@ -941,6 +1076,27 @@ func s:HandleCursor(msg)
else else
let fname = '' let fname = ''
endif endif
if a:msg =~ 'addr='
let asm_addr = s:GetAsmAddr(a:msg)
if asm_addr != ''
let s:asm_addr = asm_addr
let curwinid = win_getid(winnr())
if win_gotoid(s:asmwin)
let lnum = search('^' . s:asm_addr)
if lnum == 0
call s:SendCommand('disassemble $pc')
else
exe 'sign unplace ' . s:asm_id
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
endif
call win_gotoid(curwinid)
endif
endif
endif
if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname) if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname)
let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '') let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '')
if lnum =~ '^[0-9]*$' if lnum =~ '^[0-9]*$'

View File

@ -1,7 +1,7 @@
" Vim ABAP syntax file " Vim ABAP syntax file
" Language: SAP - ABAP/R4 " Language: SAP - ABAP/R4
" Maintainer: Marius Piedallu van Wyk <lailoken@gmail.com> " Maintainer: Marius Piedallu van Wyk <lailoken@gmail.com>
" Last Change: 2018 Dec 12 " Last Change: 2021 Jan 02
" Comment: Thanks to EPI-USE Labs for all your assistance. :) " Comment: Thanks to EPI-USE Labs for all your assistance. :)
" Quit when a syntax file was already loaded " Quit when a syntax file was already loaded
@ -193,4 +193,4 @@ hi def link abapHex Number
let b:current_syntax = "abap" let b:current_syntax = "abap"
" vim: ts=8 sw=2 " vim: ts=8 sw=2

View File

@ -1,7 +1,7 @@
" Vim syntax file " Vim syntax file
" Language: PROLOG " Language: PROLOG
" Maintainer: Anton Kochkov <anton.kochkov@gmail.com> " Maintainer: Anton Kochkov <anton.kochkov@gmail.com>
" Last Change: 2019 Aug 29 " Last Change: 2021 Jan 05
" There are two sets of highlighting in here: " There are two sets of highlighting in here:
" If the "prolog_highlighting_clean" variable exists, it is rather sparse. " If the "prolog_highlighting_clean" variable exists, it is rather sparse.
@ -21,16 +21,16 @@ syn case match
" Very simple highlighting for comments, clause heads and " Very simple highlighting for comments, clause heads and
" character codes. It respects prolog strings and atoms. " character codes. It respects prolog strings and atoms.
syn region prologCComment start=+/\*+ end=+\*/+ syn region prologCComment start=+/\*+ end=+\*/+ contains=@Spell
syn match prologComment +%.*+ syn match prologComment +%.*+ contains=@Spell
if !exists("prolog_highlighting_no_keyword") if !exists("prolog_highlighting_no_keyword")
syn keyword prologKeyword module meta_predicate multifile dynamic syn keyword prologKeyword module meta_predicate multifile dynamic
endif endif
syn match prologCharCode +0'\\\=.+ syn match prologCharCode +0'\\\=.+
syn region prologString start=+"+ skip=+\\\\\|\\"+ end=+"+ syn region prologString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
syn region prologAtom start=+'+ skip=+\\\\\|\\'+ end=+'+ syn region prologAtom start=+'+ skip=+\\\\\|\\'+ end=+'+
syn region prologClause matchgroup=prologClauseHead start=+^\s*[a-z]\w*+ matchgroup=Normal end=+\.\s\|\.$+ contains=ALLBUT,prologClause syn region prologClause matchgroup=prologClauseHead start=+^\s*[a-z]\w*+ matchgroup=Normal end=+\.\s\|\.$+ contains=ALLBUT,prologClause contains=@NoSpell
if !exists("prolog_highlighting_clean") if !exists("prolog_highlighting_clean")