Compare commits
137 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95d2e7634c | ||
|
|
b10ff5c1b3 | ||
|
|
e7a74d5375 | ||
|
|
2995e5cf4e | ||
|
|
2e17fef225 | ||
|
|
f35fd8e5d4 | ||
|
|
61efa16932 | ||
|
|
1d9cef769d | ||
|
|
155b088208 | ||
|
|
da6d42c35a | ||
|
|
4f6e772c9c | ||
|
|
4c8b546da2 | ||
|
|
d597ab00d7 | ||
|
|
21dc8f1527 | ||
|
|
5cffa8df7e | ||
|
|
fe8e9f6740 | ||
|
|
9323ca51c2 | ||
|
|
056678184f | ||
|
|
139575de66 | ||
|
|
48f69cdfa4 | ||
|
|
96923b7a14 | ||
|
|
1a572e9b3b | ||
|
|
8d5e514d77 | ||
|
|
1fdf84e033 | ||
|
|
977525fea6 | ||
|
|
10792feebd | ||
|
|
7a73252063 | ||
|
|
7d42840033 | ||
|
|
6e2e2cc95b | ||
|
|
129e33e44b | ||
|
|
5c68617d39 | ||
|
|
b29b96806f | ||
|
|
424da7aa48 | ||
|
|
5f823d1e73 | ||
|
|
533870a985 | ||
|
|
e850439a56 | ||
|
|
754d2b4036 | ||
|
|
4f3321f704 | ||
|
|
986b0fd0c5 | ||
|
|
badf04f5c2 | ||
|
|
8b530b3158 | ||
|
|
d0b7bfa957 | ||
|
|
bbf84e2737 | ||
|
|
5b4f8a0e84 | ||
|
|
e2adcf3974 | ||
|
|
fb43cfc2c6 | ||
|
|
f52fac2ed9 | ||
|
|
0a4e098f32 | ||
|
|
176711f069 | ||
|
|
dbf8094b17 | ||
|
|
20fb28b1dc | ||
|
|
873f8243f6 | ||
|
|
e406ff87c8 | ||
|
|
1b1df95f1a | ||
|
|
53ba6ca5b2 | ||
|
|
bf40e90dfe | ||
|
|
48f83c31d1 | ||
|
|
cf6662082f | ||
|
|
81da16b53f | ||
|
|
f8691004b0 | ||
|
|
56b84b1728 | ||
|
|
f2832ad965 | ||
|
|
f01a653ac5 | ||
|
|
f3507a517c | ||
|
|
1588bc8ebe | ||
|
|
ed0c62e7b1 | ||
|
|
673bcb10eb | ||
|
|
0b40d086b3 | ||
|
|
8acb9cc620 | ||
|
|
08238045e7 | ||
|
|
d8f8629b1b | ||
|
|
6ca883dd8a | ||
|
|
88dd6523fa | ||
|
|
936dc6014c | ||
|
|
127969cf98 | ||
|
|
d523c7be5c | ||
|
|
655b734ee8 | ||
|
|
9eccee0e85 | ||
|
|
525eba00ef | ||
|
|
9fb7b42935 | ||
|
|
b2175220da | ||
|
|
b29ae15977 | ||
|
|
df1bbea436 | ||
|
|
c12dc47b8f | ||
|
|
204852ae2a | ||
|
|
e1d1211799 | ||
|
|
330a388e18 | ||
|
|
f78ee2b49f | ||
|
|
24d9c0557e | ||
|
|
f07751457c | ||
|
|
196c3850db | ||
|
|
6aca4d3c2b | ||
|
|
d979d64fa2 | ||
|
|
21efafe4c2 | ||
|
|
0e1574c406 | ||
|
|
28bf649a57 | ||
|
|
1fc34225ac | ||
|
|
35d8c2010e | ||
|
|
fe9112e630 | ||
|
|
e4e1a1e1c8 | ||
|
|
2f87a99b6e | ||
|
|
b9c5108593 | ||
|
|
8ccbbeb620 | ||
|
|
7f687aaca9 | ||
|
|
8d5daf267e | ||
|
|
c6e9d7063d | ||
|
|
f6b0c79742 | ||
|
|
7a22224875 | ||
|
|
f01af9c4e6 | ||
|
|
3e7637bd26 | ||
|
|
1983f1aa31 | ||
|
|
5de4c4372d | ||
|
|
afd4ae35d6 | ||
|
|
5c52be40fb | ||
|
|
cbef12e60b | ||
|
|
6caeda2fce | ||
|
|
00333cb3b3 | ||
|
|
29ab6ce9f3 | ||
|
|
c51cf03298 | ||
|
|
e41c1dd889 | ||
|
|
4df5b33f20 | ||
|
|
5a2d4a3ecb | ||
|
|
416b5f4894 | ||
|
|
9383a3afb6 | ||
|
|
62628d97c4 | ||
|
|
ae49aa8434 | ||
|
|
05c1734c4f | ||
|
|
68afde4c9b | ||
|
|
0e71b7d4ce | ||
|
|
5c6edf41f9 | ||
|
|
5ec633b9b0 | ||
|
|
4d56b971cb | ||
|
|
38b85cb4d7 | ||
|
|
9c9be05b17 | ||
|
|
3c620b0c03 | ||
|
|
dea5ab0fc5 | ||
|
|
fa02616718 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -96,5 +96,10 @@ src/shadow-*
|
||||
src/runtime
|
||||
src/pixmaps
|
||||
|
||||
# other possible files build by tools
|
||||
# other files possibly created by tools
|
||||
src/cscope.out
|
||||
|
||||
# Linter/language server files
|
||||
/.cache/clangd/
|
||||
/.ccls-cache/
|
||||
/compile_commands.json
|
||||
|
||||
3
Filelist
3
Filelist
@@ -198,7 +198,6 @@ SRC_ALL = \
|
||||
src/testdir/view_util.vim \
|
||||
src/testdir/test[0-9]*.ok \
|
||||
src/testdir/test77a.ok \
|
||||
src/testdir/test83-tags? \
|
||||
src/testdir/test77a.com \
|
||||
src/testdir/test_*.vim \
|
||||
src/testdir/python2/*.py \
|
||||
@@ -632,6 +631,7 @@ SRC_DOS_BIN = \
|
||||
src/xpm/x86/lib-vc14/libXpm.lib \
|
||||
src/xpm/x86/lib/libXpm.a \
|
||||
src/xpm/x86/lib/libXpm.lib \
|
||||
runtime/bitmaps/vim.ico \
|
||||
nsis/icons.zip \
|
||||
|
||||
# source files for Amiga, DOS, etc. (also in the extra archive)
|
||||
@@ -1000,6 +1000,7 @@ LANG_GEN = \
|
||||
runtime/doc/*-tr.1 \
|
||||
runtime/doc/*-tr.UTF-8.1 \
|
||||
runtime/lang/README.txt \
|
||||
runtime/lang/Makefile \
|
||||
runtime/lang/menu_*.vim \
|
||||
runtime/keymap/README.txt \
|
||||
runtime/keymap/*.vim \
|
||||
|
||||
@@ -403,6 +403,9 @@ Section "$(str_section_exe)" id_section_exe
|
||||
SetOutPath $0\autoload\xml
|
||||
File ${VIMRT}\autoload\xml\*.*
|
||||
|
||||
SetOutPath $0\bitmaps
|
||||
File ${VIMSRC}\vim.ico
|
||||
|
||||
SetOutPath $0\syntax
|
||||
File ${VIMRT}\syntax\*.*
|
||||
|
||||
|
||||
12
runtime/autoload/dist/ft.vim
vendored
12
runtime/autoload/dist/ft.vim
vendored
@@ -3,7 +3,7 @@ vim9script
|
||||
# Vim functions for file type detection
|
||||
#
|
||||
# Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
# Last Change: 2022 Feb 05
|
||||
# Last Change: 2022 Mar 05
|
||||
|
||||
# These functions are moved here from runtime/filetype.vim to make startup
|
||||
# faster.
|
||||
@@ -182,7 +182,7 @@ export def FTent()
|
||||
break
|
||||
endif
|
||||
lnum += 1
|
||||
endw
|
||||
endwhile
|
||||
setf dtd
|
||||
enddef
|
||||
|
||||
@@ -206,6 +206,10 @@ export def EuphoriaCheck()
|
||||
enddef
|
||||
|
||||
export def DtraceCheck()
|
||||
if did_filetype()
|
||||
# Filetype was already detected
|
||||
return
|
||||
endif
|
||||
var lines = getline(1, min([line("$"), 100]))
|
||||
if match(lines, '^module\>\|^import\>') > -1
|
||||
# D files often start with a module and/or import statement.
|
||||
@@ -478,7 +482,7 @@ export def FTprogress_asm()
|
||||
break
|
||||
endif
|
||||
lnum += 1
|
||||
endw
|
||||
endwhile
|
||||
setf progress
|
||||
enddef
|
||||
|
||||
@@ -505,7 +509,7 @@ export def FTprogress_pascal()
|
||||
break
|
||||
endif
|
||||
lnum += 1
|
||||
endw
|
||||
endwhile
|
||||
setf progress
|
||||
enddef
|
||||
|
||||
|
||||
BIN
runtime/bitmaps/vim.ico
Normal file
BIN
runtime/bitmaps/vim.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -1,7 +1,7 @@
|
||||
" Vim compiler file
|
||||
" Compiler: Jest
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2018 May 15
|
||||
" Last Change: 2021 Nov 20
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
@@ -15,12 +15,14 @@ endif
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" CompilerSet makeprg=npx\ jest\ --no-colors
|
||||
" CompilerSet makeprg=npx\ --no-install\ jest\ --no-colors
|
||||
|
||||
CompilerSet makeprg=jest\ --no-colors
|
||||
CompilerSet errorformat=%E\ \ ●\ %m,
|
||||
CompilerSet errorformat=%-A\ \ ●\ Console,
|
||||
\%E\ \ ●\ %m,
|
||||
\%Z\ %\\{4}%.%#Error:\ %f:\ %m\ (%l:%c):%\\=,
|
||||
\%Z\ %\\{6}at\ %\\S%#\ (%f:%l:%c),
|
||||
\%Z\ %\\{6}at\ %\\S%#\ %f:%l:%c,
|
||||
\%+C\ %\\{4}%\\w%.%#,
|
||||
\%+C\ %\\{4}%[-+]%.%#,
|
||||
\%-C%.%#,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim compiler file
|
||||
" Compiler: SML/NJ Compiler
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2020 Feb 10
|
||||
" Last Change: 2022 Feb 09
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
@@ -16,10 +16,10 @@ let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
CompilerSet makeprg=sml
|
||||
CompilerSet errorformat=%f:%l.%c-%\\d%\\+.%\\d%\\+\ %trror:\ %m,
|
||||
CompilerSet errorformat=%f:%l.%c-%e.%k\ %trror:\ %m,
|
||||
\%f:%l.%c\ %trror:\ %m,
|
||||
\%trror:\ %m
|
||||
\%f:%l.%c-%\\d%\\+.%\\d%\\+\ %tarning:\ %m,
|
||||
\%trror:\ %m,
|
||||
\%f:%l.%c-%e.%k\ %tarning:\ %m,
|
||||
\%f:%l.%c\ %tarning:\ %m,
|
||||
\%tarning:\ %m,
|
||||
\%-G%.%#
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" The default vimrc file.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last change: 2021 Nov 17
|
||||
" Last change: 2022 Mar 03
|
||||
"
|
||||
" This is loaded if no vimrc file was found.
|
||||
" Except when Vim is run with "-u NONE" or "-C".
|
||||
@@ -64,9 +64,10 @@ if has('win32')
|
||||
set guioptions-=t
|
||||
endif
|
||||
|
||||
" Don't use Ex mode, use Q for formatting.
|
||||
" Don't use Q for Ex mode, use it for formatting. Except for Select mode.
|
||||
" Revert with ":unmap Q".
|
||||
map Q gq
|
||||
sunmap Q
|
||||
|
||||
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
|
||||
" so that you can undo CTRL-U after inserting a line break.
|
||||
|
||||
@@ -153,6 +153,7 @@ DOCS = \
|
||||
version6.txt \
|
||||
version7.txt \
|
||||
version8.txt \
|
||||
version9.txt \
|
||||
vi_diff.txt \
|
||||
vim9.txt \
|
||||
visual.txt \
|
||||
@@ -298,6 +299,7 @@ HTMLS = \
|
||||
version6.html \
|
||||
version7.html \
|
||||
version8.html \
|
||||
version9.html \
|
||||
vi_diff.html \
|
||||
vimindex.html \
|
||||
vim9.html \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*autocmd.txt* For Vim version 8.2. Last change: 2022 Feb 09
|
||||
*autocmd.txt* For Vim version 8.2. Last change: 2022 Mar 04
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -63,7 +63,7 @@ effects. Be careful not to destroy your text.
|
||||
they were given.
|
||||
See |autocmd-nested| for [++nested]. "nested"
|
||||
(without the ++) can also be used, for backwards
|
||||
compatibility.
|
||||
compatibility, but not in |Vim9| script. *E1078*
|
||||
*autocmd-once*
|
||||
If [++once] is supplied the command is executed once,
|
||||
then removed ("one shot").
|
||||
@@ -365,6 +365,7 @@ Name triggered by ~
|
||||
|InsertEnter| starting Insert mode
|
||||
|InsertChange| when typing <Insert> while in Insert or Replace mode
|
||||
|InsertLeave| when leaving Insert mode
|
||||
|InsertLeavePre| just before leaving Insert mode
|
||||
|InsertCharPre| when a character was typed in Insert mode, before
|
||||
inserting it
|
||||
|
||||
@@ -1639,7 +1640,7 @@ Examples for reading and writing compressed files: >
|
||||
: autocmd BufReadPre,FileReadPre *.gz set bin
|
||||
: autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip
|
||||
: autocmd BufReadPost,FileReadPost *.gz set nobin
|
||||
: autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r")
|
||||
: autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " .. expand("%:r")
|
||||
: autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r
|
||||
: autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r
|
||||
|
||||
@@ -1738,7 +1739,7 @@ To insert the current date and time in a *.html file when writing it: >
|
||||
: else
|
||||
: let l = line("$")
|
||||
: endif
|
||||
: exe "1," . l . "g/Last modified: /s/Last modified: .*/Last modified: " .
|
||||
: exe "1," .. l .. "g/Last modified: /s/Last modified: .*/Last modified: " ..
|
||||
: \ strftime("%Y %b %d")
|
||||
:endfun
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*builtin.txt* For Vim version 8.2. Last change: 2022 Feb 18
|
||||
*builtin.txt* For Vim version 8.2. Last change: 2022 Mar 08
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -854,7 +854,7 @@ argv([{nr} [, {winid}]])
|
||||
:let i = 0
|
||||
:while i < argc()
|
||||
: let f = escape(fnameescape(argv(i)), '.')
|
||||
: exe 'amenu Arg.' . f . ' :e ' . f . '<CR>'
|
||||
: exe 'amenu Arg.' .. f .. ' :e ' .. f .. '<CR>'
|
||||
: let i = i + 1
|
||||
:endwhile
|
||||
< Without the {nr} argument, or when {nr} is -1, a |List| with
|
||||
@@ -1134,7 +1134,7 @@ bufwinid({buf}) *bufwinid()*
|
||||
see |bufname()| above. If buffer {buf} doesn't exist or
|
||||
there is no such window, -1 is returned. Example: >
|
||||
|
||||
echo "A window containing buffer 1 is " . (bufwinid(1))
|
||||
echo "A window containing buffer 1 is " .. (bufwinid(1))
|
||||
<
|
||||
Only deals with the current tab page.
|
||||
|
||||
@@ -1147,7 +1147,7 @@ bufwinnr({buf}) *bufwinnr()*
|
||||
If buffer {buf} doesn't exist or there is no such window, -1
|
||||
is returned. Example: >
|
||||
|
||||
echo "A window containing buffer 1 is " . (bufwinnr(1))
|
||||
echo "A window containing buffer 1 is " .. (bufwinnr(1))
|
||||
|
||||
< The number can be used with |CTRL-W_w| and ":wincmd w"
|
||||
|:wincmd|.
|
||||
@@ -1197,7 +1197,7 @@ byteidx({expr}, {nr}) *byteidx()*
|
||||
byteidxcomp({expr}, {nr}) *byteidxcomp()*
|
||||
Like byteidx(), except that a composing character is counted
|
||||
as a separate character. Example: >
|
||||
let s = 'e' . nr2char(0x301)
|
||||
let s = 'e' .. nr2char(0x301)
|
||||
echo byteidx(s, 1)
|
||||
echo byteidxcomp(s, 1)
|
||||
echo byteidxcomp(s, 2)
|
||||
@@ -1392,7 +1392,7 @@ col({expr}) The result is a Number, which is the byte index of the column
|
||||
col(".") column of cursor
|
||||
col("$") length of cursor line plus one
|
||||
col("'t") column of mark t
|
||||
col("'" . markname) column of mark markname
|
||||
col("'" .. markname) column of mark markname
|
||||
< The first column is 1. 0 is returned for an error.
|
||||
For an uppercase mark the column may actually be in another
|
||||
buffer.
|
||||
@@ -1401,7 +1401,7 @@ col({expr}) The result is a Number, which is the byte index of the column
|
||||
line. This can be used to obtain the column in Insert mode: >
|
||||
:imap <F2> <C-O>:let save_ve = &ve<CR>
|
||||
\<C-O>:set ve=all<CR>
|
||||
\<C-O>:echo col(".") . "\n" <Bar>
|
||||
\<C-O>:echo col(".") .. "\n" <Bar>
|
||||
\let &ve = save_ve<CR>
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
@@ -2247,12 +2247,12 @@ expand({string} [, {nosuf} [, {list}]]) *expand()*
|
||||
:e extension only
|
||||
|
||||
Example: >
|
||||
:let &tags = expand("%:p:h") . "/tags"
|
||||
:let &tags = expand("%:p:h") .. "/tags"
|
||||
< Note that when expanding a string that starts with '%', '#' or
|
||||
'<', any following text is ignored. This does NOT work: >
|
||||
:let doesntwork = expand("%:h.bak")
|
||||
< Use this: >
|
||||
:let doeswork = expand("%:h") . ".bak"
|
||||
:let doeswork = expand("%:h") .. ".bak"
|
||||
< Also note that expanding "<cfile>" and others only returns the
|
||||
referenced file name without further expansion. If "<cfile>"
|
||||
is "~/.cshrc", you need to do another expand() to have the
|
||||
@@ -2633,7 +2633,7 @@ fnameescape({string}) *fnameescape()*
|
||||
and |:write|). And a "-" by itself (special after |:cd|).
|
||||
Example: >
|
||||
:let fname = '+some str%nge|name'
|
||||
:exe "edit " . fnameescape(fname)
|
||||
:exe "edit " .. fnameescape(fname)
|
||||
< results in executing: >
|
||||
edit \+some\ str\%nge\|name
|
||||
<
|
||||
@@ -2814,7 +2814,7 @@ function({name} [, {arglist}] [, {dict}])
|
||||
< The Dictionary is only useful when calling a "dict" function.
|
||||
In that case the {dict} is passed in as "self". Example: >
|
||||
function Callback() dict
|
||||
echo "called for " . self.name
|
||||
echo "called for " .. self.name
|
||||
endfunction
|
||||
...
|
||||
let context = {"name": "example"}
|
||||
@@ -3013,7 +3013,7 @@ getbufvar({buf}, {varname} [, {def}]) *getbufvar()*
|
||||
string is returned, there is no error message.
|
||||
Examples: >
|
||||
:let bufmodified = getbufvar(1, "&mod")
|
||||
:echo "todo myvar = " . getbufvar("todo", "myvar")
|
||||
:echo "todo myvar = " .. getbufvar("todo", "myvar")
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
GetBufnr()->getbufvar(varname)
|
||||
@@ -3074,9 +3074,9 @@ getchar([expr]) *getchar()*
|
||||
This example positions the mouse as it would normally happen: >
|
||||
let c = getchar()
|
||||
if c == "\<LeftMouse>" && v:mouse_win > 0
|
||||
exe v:mouse_win . "wincmd w"
|
||||
exe v:mouse_win .. "wincmd w"
|
||||
exe v:mouse_lnum
|
||||
exe "normal " . v:mouse_col . "|"
|
||||
exe "normal " .. v:mouse_col .. "|"
|
||||
endif
|
||||
<
|
||||
When using bracketed paste only the first character is
|
||||
@@ -3230,7 +3230,8 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
|
||||
arglist file names in argument list
|
||||
augroup autocmd groups
|
||||
buffer buffer names
|
||||
behave :behave suboptions
|
||||
behave |:behave| suboptions
|
||||
breakpoint |:breakadd| and |:breakdel| suboptions
|
||||
color color schemes
|
||||
command Ex command
|
||||
cmdline |cmdline-completion| result
|
||||
@@ -3247,7 +3248,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
|
||||
function function name
|
||||
help help subjects
|
||||
highlight highlight groups
|
||||
history :history suboptions
|
||||
history |:history| suboptions
|
||||
locale locale names (as output of locale -a)
|
||||
mapclear buffer argument
|
||||
mapping mapping name
|
||||
@@ -3873,7 +3874,7 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
|
||||
empty string is returned, there is no error message.
|
||||
Examples: >
|
||||
:let list_is_on = gettabwinvar(1, 2, '&list')
|
||||
:echo "myvar = " . gettabwinvar(3, 1, 'myvar')
|
||||
:echo "myvar = " .. gettabwinvar(3, 1, 'myvar')
|
||||
<
|
||||
To obtain all window-local variables use: >
|
||||
gettabwinvar({tabnr}, {winnr}, '&')
|
||||
@@ -4006,7 +4007,7 @@ getwinvar({winnr}, {varname} [, {def}]) *getwinvar()*
|
||||
Like |gettabwinvar()| for the current tabpage.
|
||||
Examples: >
|
||||
:let list_is_on = getwinvar(2, '&list')
|
||||
:echo "myvar = " . getwinvar(1, 'myvar')
|
||||
:echo "myvar = " .. getwinvar(1, 'myvar')
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
GetWinnr()->getwinvar(varname)
|
||||
@@ -4261,7 +4262,7 @@ histdel({history} [, {item}]) *histdel()*
|
||||
The following three are equivalent: >
|
||||
:call histdel("search", histnr("search"))
|
||||
:call histdel("search", -1)
|
||||
:call histdel("search", '^'.histget("search", -1).'$')
|
||||
:call histdel("search", '^' .. histget("search", -1) .. '$')
|
||||
<
|
||||
To delete the last search pattern and use the last-but-one for
|
||||
the "n" command and 'hlsearch': >
|
||||
@@ -4280,7 +4281,7 @@ histget({history} [, {index}]) *histget()*
|
||||
|
||||
Examples:
|
||||
Redo the second last search from history. >
|
||||
:execute '/' . histget("search", -2)
|
||||
:execute '/' .. histget("search", -2)
|
||||
|
||||
< Define an Ex command ":H {num}" that supports re-execution of
|
||||
the {num}th entry from the output of |:history|. >
|
||||
@@ -4526,7 +4527,7 @@ input({prompt} [, {text} [, {completion}]]) *input()*
|
||||
|:execute| or |:normal|.
|
||||
|
||||
Example with a mapping: >
|
||||
:nmap \x :call GetFoo()<CR>:exe "/" . Foo<CR>
|
||||
:nmap \x :call GetFoo()<CR>:exe "/" .. Foo<CR>
|
||||
:function GetFoo()
|
||||
: call inputsave()
|
||||
: let g:Foo = input("enter search pattern: ")
|
||||
@@ -4700,7 +4701,7 @@ items({dict}) *items()*
|
||||
order. Also see |keys()| and |values()|.
|
||||
Example: >
|
||||
for [key, value] in items(mydict)
|
||||
echo key . ': ' . value
|
||||
echo key .. ': ' .. value
|
||||
endfor
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
@@ -4715,7 +4716,7 @@ join({list} [, {sep}]) *join()*
|
||||
{sep} is omitted a single space is used.
|
||||
Note that {sep} is not added at the end. You might want to
|
||||
add it there too: >
|
||||
let lines = join(mylist, "\n") . "\n"
|
||||
let lines = join(mylist, "\n") .. "\n"
|
||||
< String items are used as-is. |Lists| and |Dictionaries| are
|
||||
converted into a string like with |string()|.
|
||||
The opposite function is |split()|.
|
||||
@@ -4927,7 +4928,7 @@ line({expr} [, {winid}]) *line()*
|
||||
line(".") line number of the cursor
|
||||
line(".", winid) idem, in window "winid"
|
||||
line("'t") line number of mark t
|
||||
line("'" . marker) line number of mark marker
|
||||
line("'" .. marker) line number of mark marker
|
||||
<
|
||||
To jump to the last known position when opening a file see
|
||||
|last-position-jump|.
|
||||
@@ -5161,7 +5162,7 @@ map({expr1}, {expr2}) *map()*
|
||||
current byte. For a |String| |v:key| has the index of the
|
||||
current character.
|
||||
Example: >
|
||||
:call map(mylist, '"> " . v:val . " <"')
|
||||
:call map(mylist, '"> " .. v:val .. " <"')
|
||||
< This puts "> " before and " <" after each item in "mylist".
|
||||
|
||||
Note that {expr2} is the result of an expression and is then
|
||||
@@ -5175,19 +5176,19 @@ map({expr1}, {expr2}) *map()*
|
||||
The function must return the new value of the item. Example
|
||||
that changes each value by "key-value": >
|
||||
func KeyValue(key, val)
|
||||
return a:key . '-' . a:val
|
||||
return a:key .. '-' .. a:val
|
||||
endfunc
|
||||
call map(myDict, function('KeyValue'))
|
||||
< It is shorter when using a |lambda|: >
|
||||
call map(myDict, {key, val -> key . '-' . val})
|
||||
call map(myDict, {key, val -> key .. '-' .. val})
|
||||
< If you do not use "val" you can leave it out: >
|
||||
call map(myDict, {key -> 'item: ' . key})
|
||||
call map(myDict, {key -> 'item: ' .. key})
|
||||
< If you do not use "key" you can use a short name: >
|
||||
call map(myDict, {_, val -> 'item: ' . val})
|
||||
call map(myDict, {_, val -> 'item: ' .. val})
|
||||
<
|
||||
The operation is done in-place for a |List| and |Dictionary|.
|
||||
If you want it to remain unmodified make a copy first: >
|
||||
:let tlist = map(copy(mylist), ' v:val . "\t"')
|
||||
:let tlist = map(copy(mylist), ' v:val .. "\t"')
|
||||
|
||||
< Returns {expr1}, the |List| or |Dictionary| that was filtered,
|
||||
or a new |Blob| or |String|.
|
||||
@@ -5263,7 +5264,7 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
|
||||
then the global mappings.
|
||||
This function can be used to map a key even when it's already
|
||||
mapped, and have it do the original mapping too. Sketch: >
|
||||
exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n')
|
||||
exe 'nnoremap <Tab> ==' .. maparg('<Tab>', 'n')
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
GetKey()->maparg('n')
|
||||
@@ -5572,7 +5573,7 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()*
|
||||
empty list is returned. If length of {str} is greater than
|
||||
256, then returns an empty list.
|
||||
|
||||
Refer to |fuzzy-match| for more information about fuzzy
|
||||
Refer to |fuzzy-matching| for more information about fuzzy
|
||||
matching strings.
|
||||
|
||||
Example: >
|
||||
@@ -5786,7 +5787,7 @@ mkdir({name} [, {path} [, {prot}]])
|
||||
{name}. Thus if you create /tmp/foo/bar then /tmp/foo will be
|
||||
created with 0o755.
|
||||
Example: >
|
||||
:call mkdir($HOME . "/tmp/foo/bar", "p", 0o700)
|
||||
:call mkdir($HOME .. "/tmp/foo/bar", "p", 0o700)
|
||||
|
||||
< This function is not available in the |sandbox|.
|
||||
|
||||
@@ -6227,7 +6228,7 @@ prompt_setcallback({buf}, {expr}) *prompt_setcallback()*
|
||||
stopinsert
|
||||
close
|
||||
else
|
||||
call append(line('$') - 1, 'Entered: "' . a:text . '"')
|
||||
call append(line('$') - 1, 'Entered: "' .. a:text .. '"')
|
||||
" Reset 'modified' to allow the buffer to be closed.
|
||||
set nomodified
|
||||
endif
|
||||
@@ -6424,7 +6425,7 @@ readdir({directory} [, {expr} [, {dict}]]) *readdir()*
|
||||
function! s:tree(dir)
|
||||
return {a:dir : map(readdir(a:dir),
|
||||
\ {_, x -> isdirectory(x) ?
|
||||
\ {x : s:tree(a:dir . '/' . x)} : x})}
|
||||
\ {x : s:tree(a:dir .. '/' .. x)} : x})}
|
||||
endfunction
|
||||
echo s:tree(".")
|
||||
<
|
||||
@@ -6686,7 +6687,7 @@ remote_peek({serverid} [, {retvar}]) *remote_peek()*
|
||||
{only available when compiled with the |+clientserver| feature}
|
||||
Examples: >
|
||||
:let repl = ""
|
||||
:echo "PEEK: ".remote_peek(id, "repl").": ".repl
|
||||
:echo "PEEK: " .. remote_peek(id, "repl") .. ": " .. repl
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
ServerId()->remote_peek()
|
||||
@@ -6724,12 +6725,12 @@ remote_send({server}, {string} [, {idvar}])
|
||||
Note: Any errors will be reported in the server and may mess
|
||||
up the display.
|
||||
Examples: >
|
||||
:echo remote_send("gvim", ":DropAndReply ".file, "serverid").
|
||||
:echo remote_send("gvim", ":DropAndReply " .. file, "serverid") ..
|
||||
\ remote_read(serverid)
|
||||
|
||||
:autocmd NONE RemoteReply *
|
||||
\ echo remote_read(expand("<amatch>"))
|
||||
:echo remote_send("gvim", ":sleep 10 | echo ".
|
||||
:echo remote_send("gvim", ":sleep 10 | echo " ..
|
||||
\ 'server2client(expand("<client>"), "HELLO")<CR>')
|
||||
<
|
||||
Can also be used as a |method|: >
|
||||
@@ -6754,7 +6755,7 @@ remove({list}, {idx} [, {end}]) *remove()*
|
||||
points to an item before {idx} this is an error.
|
||||
See |list-index| for possible values of {idx} and {end}.
|
||||
Example: >
|
||||
:echo "last item: " . remove(mylist, -1)
|
||||
:echo "last item: " .. remove(mylist, -1)
|
||||
:call remove(mylist, 0, 9)
|
||||
<
|
||||
Use |delete()| to remove a file.
|
||||
@@ -6770,13 +6771,13 @@ remove({blob}, {idx} [, {end}])
|
||||
byte as {end} a |Blob| with one byte is returned. When {end}
|
||||
points to a byte before {idx} this is an error.
|
||||
Example: >
|
||||
:echo "last byte: " . remove(myblob, -1)
|
||||
:echo "last byte: " .. remove(myblob, -1)
|
||||
:call remove(mylist, 0, 9)
|
||||
|
||||
remove({dict}, {key})
|
||||
Remove the entry from {dict} with key {key} and return it.
|
||||
Example: >
|
||||
:echo "removed " . remove(dict, "one")
|
||||
:echo "removed " .. remove(dict, "one")
|
||||
< If there is no {key} in {dict} this is an error.
|
||||
|
||||
rename({from}, {to}) *rename()*
|
||||
@@ -6907,7 +6908,7 @@ screencol() *screencol()*
|
||||
column inside the command line, which is 1 when the command is
|
||||
executed. To get the cursor position in the file use one of
|
||||
the following mappings: >
|
||||
nnoremap <expr> GG ":echom ".screencol()."\n"
|
||||
nnoremap <expr> GG ":echom " .. screencol() .. "\n"
|
||||
nnoremap <silent> GG :echom screencol()<CR>
|
||||
nnoremap GG <Cmd>echom screencol()<CR>
|
||||
<
|
||||
@@ -7031,7 +7032,7 @@ search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
|
||||
Example (goes over all files in the argument list): >
|
||||
:let n = 1
|
||||
:while n <= argc() " loop over all files in arglist
|
||||
: exe "argument " . n
|
||||
: exe "argument " .. n
|
||||
: " start at the last char in the file and wrap for the
|
||||
: " first search to find match at start of file
|
||||
: normal G$
|
||||
@@ -7115,11 +7116,11 @@ searchcount([{options}]) *searchcount()*
|
||||
return printf(' /%s [%d/%d]', @/,
|
||||
\ result.current, result.total)
|
||||
endfunction
|
||||
let &statusline .= '%{LastSearchCount()}'
|
||||
let &statusline ..= '%{LastSearchCount()}'
|
||||
|
||||
" Or if you want to show the count only when
|
||||
" 'hlsearch' was on
|
||||
" let &statusline .=
|
||||
" let &statusline ..=
|
||||
" \ '%{v:hlsearch ? LastSearchCount() : ""}'
|
||||
<
|
||||
You can also update the search count, which can be useful in a
|
||||
@@ -7943,10 +7944,10 @@ shellescape({string} [, {special}]) *shellescape()*
|
||||
character inside single quotes.
|
||||
|
||||
Example of use with a |:!| command: >
|
||||
:exe '!dir ' . shellescape(expand('<cfile>'), 1)
|
||||
:exe '!dir ' .. shellescape(expand('<cfile>'), 1)
|
||||
< This results in a directory listing for the file under the
|
||||
cursor. Example of use with |system()|: >
|
||||
:call system("chmod +w -- " . shellescape(expand("%")))
|
||||
:call system("chmod +w -- " .. shellescape(expand("%")))
|
||||
< See also |::S|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
@@ -8160,8 +8161,7 @@ sound_playfile({path} [, {callback}])
|
||||
< Can also be used as a |method|: >
|
||||
GetSoundPath()->sound_playfile()
|
||||
|
||||
< There is no error *E538* , but can listen to 538.nl.
|
||||
{only available when compiled with the |+sound| feature}
|
||||
< {only available when compiled with the |+sound| feature}
|
||||
|
||||
|
||||
sound_stop({id}) *sound_stop()*
|
||||
@@ -8719,7 +8719,7 @@ substitute({string}, {pat}, {sub}, {flags}) *substitute()*
|
||||
When {sub} starts with "\=", the remainder is interpreted as
|
||||
an expression. See |sub-replace-expression|. Example: >
|
||||
:echo substitute(s, '%\(\x\x\)',
|
||||
\ '\=nr2char("0x" . submatch(1))', 'g')
|
||||
\ '\=nr2char("0x" .. submatch(1))', 'g')
|
||||
|
||||
< When {sub} is a Funcref that function is called, with one
|
||||
optional argument. Example: >
|
||||
@@ -8727,7 +8727,7 @@ substitute({string}, {pat}, {sub}, {flags}) *substitute()*
|
||||
< The optional argument is a list which contains the whole
|
||||
matched string and up to nine submatches, like what
|
||||
|submatch()| returns. Example: >
|
||||
:echo substitute(s, '%\(\x\x\)', {m -> '0x' . m[1]}, 'g')
|
||||
:echo substitute(s, '%\(\x\x\)', {m -> '0x' .. m[1]}, 'g')
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
GetString()->substitute(pat, sub, flags)
|
||||
@@ -8916,8 +8916,8 @@ system({expr} [, {input}]) *system()* *E677*
|
||||
This is not to be used for interactive commands.
|
||||
|
||||
The result is a String. Example: >
|
||||
:let files = system("ls " . shellescape(expand('%:h')))
|
||||
:let files = system('ls ' . expand('%:h:S'))
|
||||
:let files = system('ls ' .. shellescape(expand('%:h')))
|
||||
:let files = system('ls ' .. expand('%:h:S'))
|
||||
|
||||
< To make the result more system-independent, the shell output
|
||||
is filtered to replace <CR> with <NL> for Macintosh, and
|
||||
@@ -9098,7 +9098,7 @@ tempname() *tempname()* *temp-file-name*
|
||||
doesn't exist. It can be used for a temporary file. The name
|
||||
is different for at least 26 consecutive calls. Example: >
|
||||
:let tmpfile = tempname()
|
||||
:exe "redir > " . tmpfile
|
||||
:exe "redir > " .. tmpfile
|
||||
< For Unix, the file will be in a private directory |tempfile|.
|
||||
For MS-Windows forward slashes are used when the 'shellslash'
|
||||
option is set, or when 'shellcmdflag' starts with '-' and
|
||||
@@ -9295,7 +9295,7 @@ trim({text} [, {mask} [, {dir}]]) *trim()*
|
||||
Examples: >
|
||||
echo trim(" some text ")
|
||||
< returns "some text" >
|
||||
echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") . "_TAIL"
|
||||
echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") .. "_TAIL"
|
||||
< returns "RESERVE_TAIL" >
|
||||
echo trim("rm<Xrm<>X>rrm", "rm<>")
|
||||
< returns "Xrm<>X" (characters in the middle are not removed) >
|
||||
@@ -9486,7 +9486,7 @@ visualmode([{expr}]) *visualmode()*
|
||||
character-wise, line-wise, or block-wise Visual mode
|
||||
respectively.
|
||||
Example: >
|
||||
:exe "normal " . visualmode()
|
||||
:exe "normal " .. visualmode()
|
||||
< This enters the same Visual mode as before. It is also useful
|
||||
in scripts if you wish to act differently depending on the
|
||||
Visual mode that was used.
|
||||
@@ -9690,7 +9690,7 @@ winheight({nr}) *winheight()*
|
||||
An existing window always has a height of zero or more.
|
||||
This excludes any window toolbar line.
|
||||
Examples: >
|
||||
:echo "The current window has " . winheight(0) . " lines."
|
||||
:echo "The current window has " .. winheight(0) .. " lines."
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
GetWinid()->winheight()
|
||||
@@ -9831,7 +9831,7 @@ winwidth({nr}) *winwidth()*
|
||||
returned. When window {nr} doesn't exist, -1 is returned.
|
||||
An existing window always has a width of zero or more.
|
||||
Examples: >
|
||||
:echo "The current window has " . winwidth(0) . " columns."
|
||||
:echo "The current window has " .. winwidth(0) .. " columns."
|
||||
:if winwidth(0) <= 50
|
||||
: 50 wincmd |
|
||||
:endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*change.txt* For Vim version 8.2. Last change: 2022 Feb 04
|
||||
*change.txt* For Vim version 8.2. Last change: 2022 Mar 05
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -778,8 +778,8 @@ matched pattern is deleted. The separator after {pattern} can also be left
|
||||
out then. Example: >
|
||||
:%s/TESTING
|
||||
This deletes "TESTING" from all lines, but only one per line.
|
||||
|
||||
For compatibility with Vi these two exceptions are allowed:
|
||||
*E1270*
|
||||
For compatibility with Vi these two exceptions are allowed in legacy script:
|
||||
"\/{string}/" and "\?{string}?" do the same as "//{string}/r".
|
||||
"\&{string}&" does the same as "//{string}/".
|
||||
*pattern-delimiter* *E146* *E1241* *E1242*
|
||||
@@ -946,7 +946,7 @@ Consider using a character like "@" or ":". There is no problem if the result
|
||||
of the expression contains the separation character.
|
||||
|
||||
Examples: >
|
||||
:s@\n@\="\r" . expand("$HOME") . "\r"@
|
||||
:s@\n@\="\r" .. expand("$HOME") .. "\r"@
|
||||
This replaces an end-of-line with a new line containing the value of $HOME. >
|
||||
|
||||
s/E/\="\<Char-0x20ac>"/g
|
||||
@@ -1123,7 +1123,7 @@ inside of strings can change! Also see 'softtabstop' option. >
|
||||
the command. You need to escape the '|' and '"'
|
||||
characters to prevent them from terminating the
|
||||
command. Example: >
|
||||
:put ='path' . \",/test\"
|
||||
:put ='path' .. \",/test\"
|
||||
< If there is no expression after '=', Vim uses the
|
||||
previous expression. You can see it with ":dis =".
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*channel.txt* For Vim version 8.2. Last change: 2021 Nov 28
|
||||
*channel.txt* For Vim version 8.2. Last change: 2022 Feb 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -91,7 +91,7 @@ And you should see the message in Vim. You can move the cursor a word forward:
|
||||
|
||||
To handle asynchronous communication a callback needs to be used: >
|
||||
func MyHandler(channel, msg)
|
||||
echo "from the handler: " . a:msg
|
||||
echo "from the handler: " .. a:msg
|
||||
endfunc
|
||||
call ch_sendexpr(channel, 'hello!', {'callback': "MyHandler"})
|
||||
Vim will not wait for a response. Now the server can send the response later
|
||||
@@ -136,7 +136,7 @@ When using an IPv6 address, enclose it within square brackets. E.g.,
|
||||
gets two arguments: the channel and the received message.
|
||||
Example: >
|
||||
func Handle(channel, msg)
|
||||
echo 'Received: ' . a:msg
|
||||
echo 'Received: ' .. a:msg
|
||||
endfunc
|
||||
let channel = ch_open("localhost:8765", {"callback": "Handle"})
|
||||
<
|
||||
@@ -1288,18 +1288,18 @@ prompt. >
|
||||
" Create a channel log so we can see what happens.
|
||||
call ch_logfile('logfile', 'w')
|
||||
|
||||
" Function handling a line of text has been typed.
|
||||
" Function handling a line of text that has been typed.
|
||||
func TextEntered(text)
|
||||
" Send the text to a shell with Enter appended.
|
||||
call ch_sendraw(g:shell_job, a:text .. "\n")
|
||||
endfunc
|
||||
|
||||
" Function handling output from the shell: Added above the prompt.
|
||||
" Function handling output from the shell: Add it above the prompt.
|
||||
func GotOutput(channel, msg)
|
||||
call append(line("$") - 1, "- " . a:msg)
|
||||
call append(line("$") - 1, "- " .. a:msg)
|
||||
endfunc
|
||||
|
||||
" Function handling the shell exist: close the window.
|
||||
" Function handling the shell exits: close the window.
|
||||
func JobExit(job, status)
|
||||
quit!
|
||||
endfunc
|
||||
@@ -1310,7 +1310,6 @@ prompt. >
|
||||
\ err_cb: function('GotOutput'),
|
||||
\ exit_cb: function('JobExit'),
|
||||
\ })
|
||||
let shell_ch = job_getchannel(shell_job)
|
||||
|
||||
new
|
||||
set buftype=prompt
|
||||
@@ -1321,6 +1320,46 @@ prompt. >
|
||||
" start accepting shell commands
|
||||
startinsert
|
||||
<
|
||||
The same in |Vim9| script: >
|
||||
|
||||
vim9script
|
||||
|
||||
# Create a channel log so we can see what happens.
|
||||
ch_logfile('logfile', 'w')
|
||||
|
||||
var shell_job: job
|
||||
|
||||
# Function handling a line of text that has been typed.
|
||||
def TextEntered(text: string)
|
||||
# Send the text to a shell with Enter appended.
|
||||
ch_sendraw(shell_job, text .. "\n")
|
||||
enddef
|
||||
|
||||
# Function handling output from the shell: Add it above the prompt.
|
||||
def GotOutput(channel: channel, msg: string)
|
||||
append(line("$") - 1, "- " .. msg)
|
||||
enddef
|
||||
|
||||
# Function handling the shell exits: close the window.
|
||||
def JobExit(job: job, status: number)
|
||||
quit!
|
||||
enddef
|
||||
|
||||
# Start a shell in the background.
|
||||
shell_job = job_start(["/bin/sh"], {
|
||||
out_cb: GotOutput,
|
||||
err_cb: GotOutput,
|
||||
exit_cb: JobExit,
|
||||
})
|
||||
|
||||
new
|
||||
set buftype=prompt
|
||||
var buf = bufnr('')
|
||||
prompt_setcallback(buf, TextEntered)
|
||||
prompt_setprompt(buf, "shell command: ")
|
||||
|
||||
# start accepting shell commands
|
||||
startinsert
|
||||
|
||||
|
||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||
|
||||
@@ -227,7 +227,7 @@ CTRL-\ e {expr} *c_CTRL-\_e*
|
||||
Example: >
|
||||
:cmap <F7> <C-\>eAppendSome()<CR>
|
||||
:func AppendSome()
|
||||
:let cmd = getcmdline() . " Some()"
|
||||
:let cmd = getcmdline() .. " Some()"
|
||||
:" place the cursor on the )
|
||||
:call setcmdpos(strlen(cmd))
|
||||
:return cmd
|
||||
|
||||
@@ -382,13 +382,13 @@ Example (this does almost the same as 'diffexpr' being empty): >
|
||||
function MyDiff()
|
||||
let opt = ""
|
||||
if &diffopt =~ "icase"
|
||||
let opt = opt . "-i "
|
||||
let opt = opt .. "-i "
|
||||
endif
|
||||
if &diffopt =~ "iwhite"
|
||||
let opt = opt . "-b "
|
||||
let opt = opt .. "-b "
|
||||
endif
|
||||
silent execute "!diff -a --binary " . opt . v:fname_in . " " . v:fname_new .
|
||||
\ " > " . v:fname_out
|
||||
silent execute "!diff -a --binary " .. opt .. v:fname_in .. " " .. v:fname_new ..
|
||||
\ " > " .. v:fname_out
|
||||
redraw!
|
||||
endfunction
|
||||
|
||||
@@ -445,8 +445,8 @@ Example (this does the same as 'patchexpr' being empty): >
|
||||
|
||||
set patchexpr=MyPatch()
|
||||
function MyPatch()
|
||||
:call system("patch -o " . v:fname_out . " " . v:fname_in .
|
||||
\ " < " . v:fname_diff)
|
||||
:call system("patch -o " .. v:fname_out .. " " .. v:fname_in ..
|
||||
\ " < " .. v:fname_diff)
|
||||
endfunction
|
||||
|
||||
Make sure that using the "patch" program doesn't have unwanted side effects.
|
||||
|
||||
@@ -444,9 +444,9 @@ does apply like to other wildcards.
|
||||
|
||||
Environment variables in the expression are expanded when evaluating the
|
||||
expression, thus this works: >
|
||||
:e `=$HOME . '/.vimrc'`
|
||||
:e `=$HOME .. '/.vimrc'`
|
||||
This does not work, $HOME is inside a string and used literally: >
|
||||
:e `='$HOME' . '/.vimrc'`
|
||||
:e `='$HOME' .. '/.vimrc'`
|
||||
|
||||
If the expression returns a string then names are to be separated with line
|
||||
breaks. When the result is a |List| then each item is used as a name. Line
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 8.2. Last change: 2022 Feb 20
|
||||
*eval.txt* For Vim version 8.2. Last change: 2022 Mar 05
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -470,7 +470,7 @@ It is also possible to put remaining items in a List variable: >
|
||||
:for [i, j; rest] in listlist
|
||||
: call Doit(i, j)
|
||||
: if !empty(rest)
|
||||
: echo "remainder: " . string(rest)
|
||||
: echo "remainder: " .. string(rest)
|
||||
: endif
|
||||
:endfor
|
||||
|
||||
@@ -498,11 +498,11 @@ Functions that are useful with a List: >
|
||||
:let list = split("a b c") " create list from items in a string
|
||||
:let string = join(list, ', ') " create string from list items
|
||||
:let s = string(list) " String representation of list
|
||||
:call map(list, '">> " . v:val') " prepend ">> " to each item
|
||||
:call map(list, '">> " .. v:val') " prepend ">> " to each item
|
||||
|
||||
Don't forget that a combination of features can make things simple. For
|
||||
example, to add up all the numbers in a list: >
|
||||
:exe 'let sum = ' . join(nrlist, '+')
|
||||
:exe 'let sum = ' .. join(nrlist, '+')
|
||||
|
||||
|
||||
1.4 Dictionaries ~
|
||||
@@ -568,7 +568,7 @@ turn the Dictionary into a List and pass it to |:for|.
|
||||
|
||||
Most often you want to loop over the keys, using the |keys()| function: >
|
||||
:for key in keys(mydict)
|
||||
: echo key . ': ' . mydict[key]
|
||||
: echo key .. ': ' .. mydict[key]
|
||||
:endfor
|
||||
|
||||
The List of keys is unsorted. You may want to sort them first: >
|
||||
@@ -576,13 +576,13 @@ The List of keys is unsorted. You may want to sort them first: >
|
||||
|
||||
To loop over the values use the |values()| function: >
|
||||
:for v in values(mydict)
|
||||
: echo "value: " . v
|
||||
: echo "value: " .. v
|
||||
:endfor
|
||||
|
||||
If you want both the key and the value use the |items()| function. It returns
|
||||
a List in which each item is a List with two items, the key and the value: >
|
||||
:for [key, value] in items(mydict)
|
||||
: echo key . ': ' . value
|
||||
: echo key .. ': ' .. value
|
||||
:endfor
|
||||
|
||||
|
||||
@@ -677,7 +677,7 @@ Functions that can be used with a Dictionary: >
|
||||
:let small = min(dict) " minimum value in dict
|
||||
:let xs = count(dict, 'x') " count nr of times 'x' appears in dict
|
||||
:let s = string(dict) " String representation of dict
|
||||
:call map(dict, '">> " . v:val') " prepend ">> " to each item
|
||||
:call map(dict, '">> " .. v:val') " prepend ">> " to each item
|
||||
|
||||
|
||||
1.5 Blobs ~
|
||||
@@ -921,13 +921,13 @@ Expression nesting is limited to 1000 levels deep (300 when build with MSVC)
|
||||
to avoid running out of stack and crashing. *E1169*
|
||||
|
||||
|
||||
expr1 *expr1* *trinary* *falsy-operator* *??* *E109*
|
||||
expr1 *expr1* *ternary* *falsy-operator* *??* *E109*
|
||||
-----
|
||||
|
||||
The trinary operator: expr2 ? expr1 : expr1
|
||||
The ternary operator: expr2 ? expr1 : expr1
|
||||
The falsy operator: expr2 ?? expr1
|
||||
|
||||
Trinary operator ~
|
||||
Ternary operator ~
|
||||
|
||||
In legacy script the expression before the '?' is evaluated to a number. If
|
||||
it evaluates to |TRUE|, the result is the value of the expression between the
|
||||
@@ -1530,7 +1530,7 @@ option *expr-option* *E112* *E113*
|
||||
&l:option local option value
|
||||
|
||||
Examples: >
|
||||
echo "tabstop is " . &tabstop
|
||||
echo "tabstop is " .. &tabstop
|
||||
if &insertmode
|
||||
|
||||
Any option name can be used here. See |options|. When using the local value
|
||||
@@ -1820,7 +1820,7 @@ maintain a counter: >
|
||||
echo "script executed for the first time"
|
||||
else
|
||||
let s:counter = s:counter + 1
|
||||
echo "script executed " . s:counter . " times now"
|
||||
echo "script executed " .. s:counter .. " times now"
|
||||
endif
|
||||
|
||||
Note that this means that filetype plugins don't get a different set of script
|
||||
@@ -1834,6 +1834,7 @@ Some variables can be set by the user, but the type cannot be changed.
|
||||
*v:argv* *argv-variable*
|
||||
v:argv The command line arguments Vim was invoked with. This is a
|
||||
list of strings. The first item is the Vim command.
|
||||
See |v:progpath| for the command with full path.
|
||||
|
||||
*v:beval_col* *beval_col-variable*
|
||||
v:beval_col The number of the column, over which the mouse pointer is.
|
||||
@@ -1955,7 +1956,7 @@ v:completed_item
|
||||
*v:count* *count-variable*
|
||||
v:count The count given for the last Normal mode command. Can be used
|
||||
to get the count before a mapping. Read-only. Example: >
|
||||
:map _x :<C-U>echo "the count is " . v:count<CR>
|
||||
:map _x :<C-U>echo "the count is " .. v:count<CR>
|
||||
< Note: The <C-U> is required to remove the line range that you
|
||||
get when typing ':' after a count.
|
||||
When there are two counts, as in "3d2w", they are multiplied,
|
||||
@@ -2215,6 +2216,8 @@ v:none An empty String. Used to put an empty item in JSON. See
|
||||
< v:none ~
|
||||
That is so that eval() can parse the string back to the same
|
||||
value. Read-only.
|
||||
Note that using `== v:none` and `!= v:none` will often give
|
||||
an error. Instead, use `is v:none` and `isnot v:none` .
|
||||
|
||||
*v:null* *null-variable*
|
||||
v:null An empty String. Used to put "null" in JSON. See
|
||||
@@ -2225,7 +2228,10 @@ v:null An empty String. Used to put "null" in JSON. See
|
||||
< v:null ~
|
||||
That is so that eval() can parse the string back to the same
|
||||
value. Read-only.
|
||||
In |Vim9| script "null" can be used without "v:".
|
||||
In |Vim9| script `null` can be used without "v:".
|
||||
In some places `v:null` and `null` can be used for a List,
|
||||
Dict, Job, etc. that is not set. That is slightly different
|
||||
than an empty List, Dict, etc.
|
||||
|
||||
*v:numbermax* *numbermax-variable*
|
||||
v:numbermax Maximum value of a number.
|
||||
@@ -2829,9 +2835,9 @@ Example: >
|
||||
: echohl Title
|
||||
: echo a:title
|
||||
: echohl None
|
||||
: echo a:0 . " items:"
|
||||
: echo a:0 .. " items:"
|
||||
: for s in a:000
|
||||
: echon ' ' . s
|
||||
: echon ' ' .. s
|
||||
: endfor
|
||||
:endfunction
|
||||
|
||||
@@ -2874,7 +2880,7 @@ This function can then be called with: >
|
||||
this works:
|
||||
*function-range-example* >
|
||||
:function Mynumber(arg)
|
||||
: echo line(".") . " " . a:arg
|
||||
: echo line(".") .. " " .. a:arg
|
||||
:endfunction
|
||||
:1,5call Mynumber(getline("."))
|
||||
<
|
||||
@@ -2885,7 +2891,7 @@ This function can then be called with: >
|
||||
Example of a function that handles the range itself: >
|
||||
|
||||
:function Cont() range
|
||||
: execute (a:firstline + 1) . "," . a:lastline . 's/^/\t\\ '
|
||||
: execute (a:firstline + 1) .. "," .. a:lastline .. 's/^/\t\\ '
|
||||
:endfunction
|
||||
:4,8call Cont()
|
||||
<
|
||||
@@ -3077,7 +3083,7 @@ declarations and assignments do not use a command. |vim9-declaration|
|
||||
This cannot be used to add an item to a |List|.
|
||||
This cannot be used to set a byte in a String. You
|
||||
can do that like this: >
|
||||
:let var = var[0:2] . 'X' . var[4:]
|
||||
:let var = var[0:2] .. 'X' .. var[4:]
|
||||
< When {var-name} is a |Blob| then {idx} can be the
|
||||
length of the blob, in which case one byte is
|
||||
appended.
|
||||
@@ -3147,7 +3153,7 @@ declarations and assignments do not use a command. |vim9-declaration|
|
||||
is just like using the |:set| command: both the local
|
||||
value and the global value are changed.
|
||||
Example: >
|
||||
:let &path = &path . ',/usr/local/include'
|
||||
:let &path = &path .. ',/usr/local/include'
|
||||
< This also works for terminal codes in the form t_xx.
|
||||
But only for alphanumerical names. Example: >
|
||||
:let &t_k1 = "\<Esc>[234;"
|
||||
@@ -3423,14 +3429,17 @@ text...
|
||||
opposite of |:lockvar|.
|
||||
|
||||
:if {expr1} *:if* *:end* *:endif* *:en* *E171* *E579* *E580*
|
||||
:en[dif] Execute the commands until the next matching ":else"
|
||||
or ":endif" if {expr1} evaluates to non-zero.
|
||||
:en[dif] Execute the commands until the next matching `:else`
|
||||
or `:endif` if {expr1} evaluates to non-zero.
|
||||
Although the short forms work, it is recommended to
|
||||
always use `:endif` to avoid confusion and to make
|
||||
auto-indenting work properly.
|
||||
|
||||
From Vim version 4.5 until 5.0, every Ex command in
|
||||
between the ":if" and ":endif" is ignored. These two
|
||||
between the `:if` and `:endif` is ignored. These two
|
||||
commands were just to allow for future expansions in a
|
||||
backward compatible way. Nesting was allowed. Note
|
||||
that any ":else" or ":elseif" was ignored, the "else"
|
||||
that any `:else` or `:elseif` was ignored, the `else`
|
||||
part was not executed either.
|
||||
|
||||
You can use this to remain compatible with older
|
||||
@@ -3439,32 +3448,38 @@ text...
|
||||
: version-5-specific-commands
|
||||
:endif
|
||||
< The commands still need to be parsed to find the
|
||||
"endif". Sometimes an older Vim has a problem with a
|
||||
new command. For example, ":silent" is recognized as
|
||||
a ":substitute" command. In that case ":execute" can
|
||||
`endif`. Sometimes an older Vim has a problem with a
|
||||
new command. For example, `:silent` is recognized as
|
||||
a `:substitute` command. In that case `:execute` can
|
||||
avoid problems: >
|
||||
:if version >= 600
|
||||
: execute "silent 1,$delete"
|
||||
:endif
|
||||
<
|
||||
NOTE: The ":append" and ":insert" commands don't work
|
||||
properly in between ":if" and ":endif".
|
||||
In |Vim9| script `:endif` cannot be shortened, to
|
||||
improve script readability.
|
||||
NOTE: The `:append` and `:insert` commands don't work
|
||||
properly in between `:if` and `:endif`.
|
||||
|
||||
*:else* *:el* *E581* *E583*
|
||||
:el[se] Execute the commands until the next matching ":else"
|
||||
or ":endif" if they previously were not being
|
||||
:el[se] Execute the commands until the next matching `:else`
|
||||
or `:endif` if they previously were not being
|
||||
executed.
|
||||
In |Vim9| script `:else` cannot be shortened, to
|
||||
improve script readability.
|
||||
|
||||
*:elseif* *:elsei* *E582* *E584*
|
||||
:elsei[f] {expr1} Short for ":else" ":if", with the addition that there
|
||||
is no extra ":endif".
|
||||
:elsei[f] {expr1} Short for `:else` `:if`, with the addition that there
|
||||
is no extra `:endif`.
|
||||
In |Vim9| script `:elseif` cannot be shortened, to
|
||||
improve script readability.
|
||||
|
||||
:wh[ile] {expr1} *:while* *:endwhile* *:wh* *:endw*
|
||||
*E170* *E585* *E588* *E733*
|
||||
:endw[hile] Repeat the commands between ":while" and ":endwhile",
|
||||
:endw[hile] Repeat the commands between `:while` and `:endwhile`,
|
||||
as long as {expr1} evaluates to non-zero.
|
||||
When an error is detected from a command inside the
|
||||
loop, execution continues after the "endwhile".
|
||||
loop, execution continues after the `endwhile`.
|
||||
Example: >
|
||||
:let lnum = 1
|
||||
:while lnum <= line("$")
|
||||
@@ -3472,12 +3487,14 @@ text...
|
||||
:let lnum = lnum + 1
|
||||
:endwhile
|
||||
<
|
||||
NOTE: The ":append" and ":insert" commands don't work
|
||||
properly inside a ":while" and ":for" loop.
|
||||
In |Vim9| script `:while` and `:endwhile` cannot be
|
||||
shortened, to improve script readability.
|
||||
NOTE: The `:append` and `:insert` commands don't work
|
||||
properly inside a `:while` and `:for` loop.
|
||||
|
||||
:for {var} in {object} *:for* *E690* *E732*
|
||||
:endfo[r] *:endfo* *:endfor*
|
||||
Repeat the commands between ":for" and ":endfor" for
|
||||
Repeat the commands between `:for` and `:endfor` for
|
||||
each item in {object}. {object} can be a |List| or
|
||||
a |Blob|. *E1177*
|
||||
|
||||
@@ -3487,7 +3504,7 @@ text...
|
||||
global/window/tab/buffer variable.
|
||||
|
||||
When an error is detected for a command inside the
|
||||
loop, execution continues after the "endfor".
|
||||
loop, execution continues after the `endfor`.
|
||||
Changing {object} inside the loop affects what items
|
||||
are used. Make a copy if this is unwanted: >
|
||||
:for item in copy(mylist)
|
||||
@@ -3512,9 +3529,12 @@ text...
|
||||
iterate over. Unlike with |List|, modifying the
|
||||
|Blob| does not affect the iteration.
|
||||
|
||||
In |Vim9| script `:endfor` cannot be shortened, to
|
||||
improve script readability.
|
||||
|
||||
:for [{var1}, {var2}, ...] in {listlist}
|
||||
:endfo[r] *E1140*
|
||||
Like ":for" above, but each item in {listlist} must be
|
||||
Like `:for` above, but each item in {listlist} must be
|
||||
a list, of which each item is assigned to {var1},
|
||||
{var2}, etc. Example: >
|
||||
:for [lnum, col] in [[1, 3], [2, 5], [3, 8]]
|
||||
@@ -3522,39 +3542,44 @@ text...
|
||||
:endfor
|
||||
<
|
||||
*:continue* *:con* *E586*
|
||||
:con[tinue] When used inside a ":while" or ":for" loop, jumps back
|
||||
:con[tinue] When used inside a `:while` or `:for` loop, jumps back
|
||||
to the start of the loop.
|
||||
If it is used after a |:try| inside the loop but
|
||||
before the matching |:finally| (if present), the
|
||||
commands following the ":finally" up to the matching
|
||||
|:endtry| are executed first. This process applies to
|
||||
all nested ":try"s inside the loop. The outermost
|
||||
":endtry" then jumps back to the start of the loop.
|
||||
If it is used after a `:try` inside the loop but
|
||||
before the matching `:finally` (if present), the
|
||||
commands following the `:finally` up to the matching
|
||||
`:endtry` are executed first. This process applies to
|
||||
all nested `:try`s inside the loop. The outermost
|
||||
`:endtry` then jumps back to the start of the loop.
|
||||
|
||||
In |Vim9| script `:cont` is the shortest form, to
|
||||
improve script readability.
|
||||
*:break* *:brea* *E587*
|
||||
:brea[k] When used inside a ":while" or ":for" loop, skips to
|
||||
the command after the matching ":endwhile" or
|
||||
":endfor".
|
||||
If it is used after a |:try| inside the loop but
|
||||
before the matching |:finally| (if present), the
|
||||
commands following the ":finally" up to the matching
|
||||
|:endtry| are executed first. This process applies to
|
||||
all nested ":try"s inside the loop. The outermost
|
||||
":endtry" then jumps to the command after the loop.
|
||||
:brea[k] When used inside a `:while` or `:for` loop, skips to
|
||||
the command after the matching `:endwhile` or
|
||||
`:endfor`.
|
||||
If it is used after a `:try` inside the loop but
|
||||
before the matching `:finally` (if present), the
|
||||
commands following the `:finally` up to the matching
|
||||
`:endtry` are executed first. This process applies to
|
||||
all nested `:try`s inside the loop. The outermost
|
||||
`:endtry` then jumps to the command after the loop.
|
||||
|
||||
In |Vim9| script `:break` cannot be shortened, to
|
||||
improve script readability.
|
||||
|
||||
:try *:try* *:endt* *:endtry*
|
||||
*E600* *E601* *E602* *E1032*
|
||||
:endt[ry] Change the error handling for the commands between
|
||||
":try" and ":endtry" including everything being
|
||||
executed across ":source" commands, function calls,
|
||||
`:try` and `:endtry` including everything being
|
||||
executed across `:source` commands, function calls,
|
||||
or autocommand invocations.
|
||||
|
||||
When an error or interrupt is detected and there is
|
||||
a |:finally| command following, execution continues
|
||||
after the ":finally". Otherwise, or when the
|
||||
":endtry" is reached thereafter, the next
|
||||
(dynamically) surrounding ":try" is checked for
|
||||
a corresponding ":finally" etc. Then the script
|
||||
a `:finally` command following, execution continues
|
||||
after the `:finally`. Otherwise, or when the
|
||||
`:endtry` is reached thereafter, the next
|
||||
(dynamically) surrounding `:try` is checked for
|
||||
a corresponding `:finally` etc. Then the script
|
||||
processing is terminated. Whether a function
|
||||
definition has an "abort" argument does not matter.
|
||||
Example: >
|
||||
@@ -3562,9 +3587,9 @@ text...
|
||||
echomsg "not reached"
|
||||
<
|
||||
Moreover, an error or interrupt (dynamically) inside
|
||||
":try" and ":endtry" is converted to an exception. It
|
||||
can be caught as if it were thrown by a |:throw|
|
||||
command (see |:catch|). In this case, the script
|
||||
`:try` and `:endtry` is converted to an exception. It
|
||||
can be caught as if it were thrown by a `:throw`
|
||||
command (see `:catch`). In this case, the script
|
||||
processing is not terminated.
|
||||
|
||||
The value "Vim:Interrupt" is used for an interrupt
|
||||
@@ -3579,13 +3604,16 @@ text...
|
||||
try | sleep 100 | catch /^Vim:Interrupt$/ | endtry
|
||||
try | edit | catch /^Vim(edit):E\d\+/ | echo "error" | endtry
|
||||
<
|
||||
In |Vim9| script `:endtry` cannot be shortened, to
|
||||
improve script readability.
|
||||
|
||||
*:cat* *:catch*
|
||||
*E603* *E604* *E605* *E654* *E1033*
|
||||
:cat[ch] /{pattern}/ The following commands until the next |:catch|,
|
||||
|:finally|, or |:endtry| that belongs to the same
|
||||
|:try| as the ":catch" are executed when an exception
|
||||
:cat[ch] /{pattern}/ The following commands until the next `:catch`,
|
||||
`:finally`, or `:endtry` that belongs to the same
|
||||
`:try` as the `:catch` are executed when an exception
|
||||
matching {pattern} is being thrown and has not yet
|
||||
been caught by a previous ":catch". Otherwise, these
|
||||
been caught by a previous `:catch`. Otherwise, these
|
||||
commands are skipped.
|
||||
When {pattern} is omitted all errors are caught.
|
||||
Examples: >
|
||||
@@ -3607,29 +3635,35 @@ text...
|
||||
NOTE: It is not reliable to ":catch" the TEXT of
|
||||
an error message because it may vary in different
|
||||
locales.
|
||||
In |Vim9| script `:catch` cannot be shortened, to
|
||||
improve script readability.
|
||||
|
||||
*:fina* *:finally* *E606* *E607*
|
||||
:fina[lly] The following commands until the matching |:endtry|
|
||||
:fina[lly] The following commands until the matching `:endtry`
|
||||
are executed whenever the part between the matching
|
||||
|:try| and the ":finally" is left: either by falling
|
||||
through to the ":finally" or by a |:continue|,
|
||||
|:break|, |:finish|, or |:return|, or by an error or
|
||||
interrupt or exception (see |:throw|).
|
||||
`:try` and the `:finally` is left: either by falling
|
||||
through to the `:finally` or by a `:continue`,
|
||||
`:break`, `:finish`, or `:return`, or by an error or
|
||||
interrupt or exception (see `:throw`).
|
||||
|
||||
In |Vim9| script `:finally` cannot be shortened, to
|
||||
improve script readability and avoid confusion with
|
||||
`:final`.
|
||||
|
||||
*:th* *:throw* *E608* *E1129*
|
||||
:th[row] {expr1} The {expr1} is evaluated and thrown as an exception.
|
||||
If the ":throw" is used after a |:try| but before the
|
||||
first corresponding |:catch|, commands are skipped
|
||||
until the first ":catch" matching {expr1} is reached.
|
||||
If there is no such ":catch" or if the ":throw" is
|
||||
used after a ":catch" but before the |:finally|, the
|
||||
commands following the ":finally" (if present) up to
|
||||
the matching |:endtry| are executed. If the ":throw"
|
||||
is after the ":finally", commands up to the ":endtry"
|
||||
If the ":throw" is used after a `:try` but before the
|
||||
first corresponding `:catch`, commands are skipped
|
||||
until the first `:catch` matching {expr1} is reached.
|
||||
If there is no such `:catch` or if the ":throw" is
|
||||
used after a `:catch` but before the `:finally`, the
|
||||
commands following the `:finally` (if present) up to
|
||||
the matching `:endtry` are executed. If the `:throw`
|
||||
is after the `:finally`, commands up to the `:endtry`
|
||||
are skipped. At the ":endtry", this process applies
|
||||
again for the next dynamically surrounding ":try"
|
||||
again for the next dynamically surrounding `:try`
|
||||
(which may be found in a calling function or sourcing
|
||||
script), until a matching ":catch" has been found.
|
||||
script), until a matching `:catch` has been found.
|
||||
If the exception is not caught, the command processing
|
||||
is terminated.
|
||||
Example: >
|
||||
@@ -3638,13 +3672,16 @@ text...
|
||||
for when an error causes the parsing to skip the whole
|
||||
line and not see the "|" that separates the commands.
|
||||
|
||||
In |Vim9| script `:throw` cannot be shortened, to
|
||||
improve script readability.
|
||||
|
||||
*:ec* *:echo*
|
||||
:ec[ho] {expr1} .. Echoes each {expr1}, with a space in between. The
|
||||
first {expr1} starts on a new line.
|
||||
Also see |:comment|.
|
||||
Use "\n" to start a new line. Use "\r" to move the
|
||||
cursor to the first column.
|
||||
Uses the highlighting set by the |:echohl| command.
|
||||
Uses the highlighting set by the `:echohl` command.
|
||||
Cannot be followed by a comment.
|
||||
Example: >
|
||||
:echo "the value of 'shell' is" &shell
|
||||
@@ -3653,21 +3690,21 @@ text...
|
||||
And since Vim mostly postpones redrawing until it's
|
||||
finished with a sequence of commands this happens
|
||||
quite often. To avoid that a command from before the
|
||||
":echo" causes a redraw afterwards (redraws are often
|
||||
`:echo` causes a redraw afterwards (redraws are often
|
||||
postponed until you type something), force a redraw
|
||||
with the |:redraw| command. Example: >
|
||||
with the `:redraw` command. Example: >
|
||||
:new | redraw | echo "there is a new window"
|
||||
<
|
||||
*:echon*
|
||||
:echon {expr1} .. Echoes each {expr1}, without anything added. Also see
|
||||
|:comment|.
|
||||
Uses the highlighting set by the |:echohl| command.
|
||||
Uses the highlighting set by the `:echohl` command.
|
||||
Cannot be followed by a comment.
|
||||
Example: >
|
||||
:echon "the value of 'shell' is " &shell
|
||||
<
|
||||
Note the difference between using ":echo", which is a
|
||||
Vim command, and ":!echo", which is an external shell
|
||||
Note the difference between using `:echo`, which is a
|
||||
Vim command, and `:!echo`, which is an external shell
|
||||
command: >
|
||||
:!echo % --> filename
|
||||
< The arguments of ":!" are expanded, see |:_%|. >
|
||||
@@ -3683,8 +3720,8 @@ text...
|
||||
|
||||
*:echoh* *:echohl*
|
||||
:echoh[l] {name} Use the highlight group {name} for the following
|
||||
|:echo|, |:echon| and |:echomsg| commands. Also used
|
||||
for the |input()| prompt. Example: >
|
||||
`:echo`, `:echon` and `:echomsg` commands. Also used
|
||||
for the `input()` prompt. Example: >
|
||||
:echohl WarningMsg | echo "Don't panic!" | echohl None
|
||||
< Don't forget to set the group back to "None",
|
||||
otherwise all following echo's will be highlighted.
|
||||
@@ -3693,14 +3730,14 @@ text...
|
||||
:echom[sg] {expr1} .. Echo the expression(s) as a true message, saving the
|
||||
message in the |message-history|.
|
||||
Spaces are placed between the arguments as with the
|
||||
|:echo| command. But unprintable characters are
|
||||
`:echo` command. But unprintable characters are
|
||||
displayed, not interpreted.
|
||||
The parsing works slightly different from |:echo|,
|
||||
more like |:execute|. All the expressions are first
|
||||
The parsing works slightly different from `:echo`,
|
||||
more like `:execute`. All the expressions are first
|
||||
evaluated and concatenated before echoing anything.
|
||||
If expressions does not evaluate to a Number or
|
||||
String, string() is used to turn it into a string.
|
||||
Uses the highlighting set by the |:echohl| command.
|
||||
Uses the highlighting set by the `:echohl` command.
|
||||
Example: >
|
||||
:echomsg "It's a Zizzer Zazzer Zuzz, as you can plainly see."
|
||||
< See |:echo-redraw| to avoid the message disappearing
|
||||
@@ -3710,12 +3747,12 @@ text...
|
||||
message in the |message-history|. When used in a
|
||||
script or function the line number will be added.
|
||||
Spaces are placed between the arguments as with the
|
||||
|:echomsg| command. When used inside a try conditional,
|
||||
`:echomsg` command. When used inside a try conditional,
|
||||
the message is raised as an error exception instead
|
||||
(see |try-echoerr|).
|
||||
Example: >
|
||||
:echoerr "This script just failed!"
|
||||
< If you just want a highlighted message use |:echohl|.
|
||||
< If you just want a highlighted message use `:echohl`.
|
||||
And to get a beep: >
|
||||
:exe "normal \<Esc>"
|
||||
|
||||
@@ -4028,7 +4065,7 @@ exception most recently caught as long it is not finished.
|
||||
|
||||
:function! Caught()
|
||||
: if v:exception != ""
|
||||
: echo 'Caught "' . v:exception . '" in ' . v:throwpoint
|
||||
: echo 'Caught "' . v:exception .. '" in ' .. v:throwpoint
|
||||
: else
|
||||
: echo 'Nothing caught'
|
||||
: endif
|
||||
@@ -4431,8 +4468,8 @@ a script in order to catch unexpected things.
|
||||
:catch /^Vim:Interrupt$/
|
||||
: echo "Script interrupted"
|
||||
:catch /.*/
|
||||
: echo "Internal error (" . v:exception . ")"
|
||||
: echo " - occurred at " . v:throwpoint
|
||||
: echo "Internal error (" .. v:exception .. ")"
|
||||
: echo " - occurred at " .. v:throwpoint
|
||||
:endtry
|
||||
:" end of script
|
||||
|
||||
@@ -4628,7 +4665,7 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
|
||||
|
||||
:function! CheckRange(a, func)
|
||||
: if a:a < 0
|
||||
: throw "EXCEPT:MATHERR:RANGE(" . a:func . ")"
|
||||
: throw "EXCEPT:MATHERR:RANGE(" .. a:func .. ")"
|
||||
: endif
|
||||
:endfunction
|
||||
:
|
||||
@@ -4655,7 +4692,7 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
|
||||
: try
|
||||
: execute "write" fnameescape(a:file)
|
||||
: catch /^Vim(write):/
|
||||
: throw "EXCEPT:IO(" . getcwd() . ", " . a:file . "):WRITEERR"
|
||||
: throw "EXCEPT:IO(" .. getcwd() .. ", " .. a:file .. "):WRITEERR"
|
||||
: endtry
|
||||
:endfunction
|
||||
:
|
||||
@@ -4674,9 +4711,9 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
|
||||
: let dir = substitute(v:exception, '.*(\(.\+\),\s*.\+).*', '\1', "")
|
||||
: let file = substitute(v:exception, '.*(.\+,\s*\(.\+\)).*', '\1', "")
|
||||
: if file !~ '^/'
|
||||
: let file = dir . "/" . file
|
||||
: let file = dir .. "/" .. file
|
||||
: endif
|
||||
: echo 'I/O error for "' . file . '"'
|
||||
: echo 'I/O error for "' .. file .. '"'
|
||||
:
|
||||
:catch /^EXCEPT/
|
||||
: echo "Unspecified error"
|
||||
@@ -4744,7 +4781,7 @@ clauses, however, is executed.
|
||||
: echo "inner finally"
|
||||
: endtry
|
||||
:catch
|
||||
: echo 'outer catch-all caught "' . v:exception . '"'
|
||||
: echo 'outer catch-all caught "' .. v:exception .. '"'
|
||||
: finally
|
||||
: echo "outer finally"
|
||||
:endtry
|
||||
@@ -4806,7 +4843,7 @@ Printing in Binary ~
|
||||
: let n = a:nr
|
||||
: let r = ""
|
||||
: while n
|
||||
: let r = '01'[n % 2] . r
|
||||
: let r = '01'[n % 2] .. r
|
||||
: let n = n / 2
|
||||
: endwhile
|
||||
: return r
|
||||
@@ -4817,7 +4854,7 @@ Printing in Binary ~
|
||||
:func String2Bin(str)
|
||||
: let out = ''
|
||||
: for ix in range(strlen(a:str))
|
||||
: let out = out . '-' . Nr2Bin(char2nr(a:str[ix]))
|
||||
: let out = out .. '-' .. Nr2Bin(char2nr(a:str[ix]))
|
||||
: endfor
|
||||
: return out[1:]
|
||||
:endfunc
|
||||
|
||||
@@ -507,7 +507,7 @@ Note the use of backslashes to avoid some characters to be interpreted by the
|
||||
:function MyFoldText()
|
||||
: let line = getline(v:foldstart)
|
||||
: let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
|
||||
: return v:folddashes . sub
|
||||
: return v:folddashes .. sub
|
||||
:endfunction
|
||||
|
||||
Evaluating 'foldtext' is done in the |sandbox|. The current window is set to
|
||||
|
||||
@@ -47,20 +47,20 @@ Numbers, subscripts and superscripts are available with 's' and 'S':
|
||||
|
||||
But some don't come defined by default. Those are digraph definitions you can
|
||||
add in your ~/.vimrc file. >
|
||||
exec 'digraph \\ '.char2nr('∖')
|
||||
exec 'digraph \< '.char2nr('≼')
|
||||
exec 'digraph \> '.char2nr('≽')
|
||||
exec 'digraph (L '.char2nr('⊈')
|
||||
exec 'digraph )L '.char2nr('⊉')
|
||||
exec 'digraph (/ '.char2nr('⊄')
|
||||
exec 'digraph )/ '.char2nr('⊅')
|
||||
exec 'digraph )/ '.char2nr('⊅')
|
||||
exec 'digraph U+ '.char2nr('⊎')
|
||||
exec 'digraph 0- '.char2nr('⊖')
|
||||
exec 'digraph \\ ' .. char2nr('∖')
|
||||
exec 'digraph \< ' .. char2nr('≼')
|
||||
exec 'digraph \> ' .. char2nr('≽')
|
||||
exec 'digraph (L ' .. char2nr('⊈')
|
||||
exec 'digraph )L ' .. char2nr('⊉')
|
||||
exec 'digraph (/ ' .. char2nr('⊄')
|
||||
exec 'digraph )/ ' .. char2nr('⊅')
|
||||
exec 'digraph )/ ' .. char2nr('⊅')
|
||||
exec 'digraph U+ ' .. char2nr('⊎')
|
||||
exec 'digraph 0- ' .. char2nr('⊖')
|
||||
" Euler's constant
|
||||
exec 'digraph ne '.char2nr('𝑒')
|
||||
exec 'digraph ne ' .. char2nr('𝑒')
|
||||
" Raku's atomic operations marker
|
||||
exec 'digraph @@ '.char2nr('⚛')
|
||||
exec 'digraph @@ ' .. char2nr('⚛')
|
||||
|
||||
Alternatively, you can write Insert mode abbreviations that convert ASCII-
|
||||
based operators into their single-character Unicode equivalent. >
|
||||
|
||||
@@ -26,7 +26,7 @@ behavior of the plugin.
|
||||
g:rustc_path~
|
||||
Set this option to the path to rustc for use in the |:RustRun| and
|
||||
|:RustExpand| commands. If unset, "rustc" will be located in $PATH: >
|
||||
let g:rustc_path = $HOME."/bin/rustc"
|
||||
let g:rustc_path = $HOME .. "/bin/rustc"
|
||||
<
|
||||
|
||||
*g:rustc_makeprg_no_percent*
|
||||
@@ -87,7 +87,7 @@ g:rust_bang_comment_leader~
|
||||
g:ftplugin_rust_source_path~
|
||||
Set this option to a path that should be prepended to 'path' for Rust
|
||||
source files: >
|
||||
let g:ftplugin_rust_source_path = $HOME.'/dev/rust'
|
||||
let g:ftplugin_rust_source_path = $HOME .. '/dev/rust'
|
||||
<
|
||||
|
||||
*g:rustfmt_command*
|
||||
|
||||
@@ -109,8 +109,8 @@ must be configurable. The filetype plugin attempts to define many of the
|
||||
standard objects, plus many additional ones. In order to make this as
|
||||
flexible as possible, you can override the list of objects from within your
|
||||
|vimrc| with the following: >
|
||||
let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' .
|
||||
\ ',schema,service,publication,database,datatype,domain' .
|
||||
let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' ..
|
||||
\ ',schema,service,publication,database,datatype,domain' ..
|
||||
\ ',index,subscription,synchronization,view,variable'
|
||||
|
||||
The following |Normal| mode and |Visual| mode maps have been created which use
|
||||
@@ -131,10 +131,10 @@ Repeatedly pressing ]} will cycle through each of these create statements: >
|
||||
create index i1 on t1 (c1);
|
||||
|
||||
The default setting for g:ftplugin_sql_objects is: >
|
||||
let g:ftplugin_sql_objects = 'function,procedure,event,' .
|
||||
\ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' .
|
||||
\ 'table,trigger' .
|
||||
\ ',schema,service,publication,database,datatype,domain' .
|
||||
let g:ftplugin_sql_objects = 'function,procedure,event,' ..
|
||||
\ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' ..
|
||||
\ 'table,trigger' ..
|
||||
\ ',schema,service,publication,database,datatype,domain' ..
|
||||
\ ',index,subscription,synchronization,view,variable'
|
||||
|
||||
The above will also handle these cases: >
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*gui.txt* For Vim version 8.2. Last change: 2021 Jun 27
|
||||
*gui.txt* For Vim version 8.2. Last change: 2022 Mar 02
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -147,7 +147,8 @@ task bar with the 'guiheadroom' option.
|
||||
*:win* *:winsize* *E465*
|
||||
:win[size] {width} {height}
|
||||
Set the window height to {width} by {height} characters.
|
||||
Obsolete, use ":set lines=11 columns=22".
|
||||
It is recommended to use `:set lines=11 columns=22` instead,
|
||||
since it's easy to see what the numbers mean.
|
||||
If you get less lines than expected, check the 'guiheadroom'
|
||||
option.
|
||||
|
||||
@@ -155,8 +156,8 @@ If you are running the X Window System, you can get information about the
|
||||
window Vim is running in with these commands: >
|
||||
:!xwininfo -id $WINDOWID
|
||||
:!xprop -id $WINDOWID
|
||||
:execute '!xwininfo -id ' . v:windowid
|
||||
:execute '!xprop -id ' . v:windowid
|
||||
:execute '!xwininfo -id ' .. v:windowid
|
||||
:execute '!xprop -id ' .. v:windowid
|
||||
<
|
||||
*gui-IME* *iBus*
|
||||
Input methods for international characters in X that rely on the XIM
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*help.txt* For Vim version 8.2. Last change: 2021 Dec 27
|
||||
*help.txt* For Vim version 8.2. Last change: 2022 Feb 26
|
||||
|
||||
VIM - main help file
|
||||
k
|
||||
@@ -197,6 +197,7 @@ Versions ~
|
||||
|version6.txt| Differences between Vim version 5.7 and 6.x
|
||||
|version7.txt| Differences between Vim version 6.4 and 7.x
|
||||
|version8.txt| Differences between Vim version 7.4 and 8.x
|
||||
|version9.txt| Differences between Vim version 8.2 and 9.0
|
||||
*sys-file-list*
|
||||
Remarks about specific systems ~
|
||||
|os_390.txt| OS/390 Unix
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*if_pyth.txt* For Vim version 8.2. Last change: 2022 Feb 07
|
||||
*if_pyth.txt* For Vim version 8.2. Last change: 2022 Feb 22
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Paul Moore
|
||||
@@ -25,6 +25,10 @@ The Python 3 interface is available only when Vim was compiled with the
|
||||
|+python3| feature.
|
||||
Both can be available at the same time, but read |python-2-and-3|.
|
||||
|
||||
NOTE: Python 2 is old and no longer being developed. Using Python 3 is highly
|
||||
recommended. Python 2 support will be dropped when it does not work properly
|
||||
anymore.
|
||||
|
||||
==============================================================================
|
||||
1. Commands *python-commands*
|
||||
|
||||
@@ -923,7 +927,7 @@ The `:pyxdo` command works similar to `:pydo`.
|
||||
*has-pythonx*
|
||||
You can test if pyx* commands are available with: >
|
||||
if has('pythonx')
|
||||
echo 'pyx* commands are available. (Python ' . &pyx . ')'
|
||||
echo 'pyx* commands are available. (Python ' .. &pyx .. ')'
|
||||
endif
|
||||
|
||||
When compiled with only one of |+python| or |+python3|, the has() returns 1.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*index.txt* For Vim version 8.2. Last change: 2022 Feb 09
|
||||
*index.txt* For Vim version 8.2. Last change: 2022 Mar 05
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1170,7 +1170,7 @@ tag command action ~
|
||||
be remapped
|
||||
|:args| :ar[gs] print the argument list
|
||||
|:argadd| :arga[dd] add items to the argument list
|
||||
:argdedupe :argdedupe remove duplicates from the argument list
|
||||
|:argdedupe| :argded[upe] remove duplicates from the argument list
|
||||
|:argdelete| :argd[elete] delete items from the argument list
|
||||
|:argedit| :arge[dit] add item to the argument list and edit it
|
||||
|:argdo| :argdo do a command on all items in the argument list
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*insert.txt* For Vim version 8.2. Last change: 2021 Dec 29
|
||||
*insert.txt* For Vim version 8.2. Last change: 2022 Mar 06
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -283,8 +283,8 @@ start allow backspacing over the start position of insert; CTRL-W and
|
||||
When 'backspace' is empty, Vi compatible backspacing is used. You cannot
|
||||
backspace over autoindent, before column 1 or before where insert started.
|
||||
|
||||
For backwards compatibility the values "0", "1" and "2" are also allowed, see
|
||||
|'backspace'|.
|
||||
For backwards compatibility the values "0", "1", "2" and "3" are also allowed,
|
||||
see |'backspace'|.
|
||||
|
||||
If the 'backspace' option does contain "eol" and the cursor is in column 1
|
||||
when one of the three keys is used, the current line is joined with the
|
||||
@@ -818,6 +818,7 @@ CTRL-X CTRL-K Search the files given with the 'dictionary' option
|
||||
the 'dictionary' option is empty.
|
||||
For suggestions where to find a list of words, see the
|
||||
'dictionary' option.
|
||||
'ignorecase', 'smartcase' and 'infercase' apply.
|
||||
|
||||
CTRL-K or
|
||||
CTRL-N Search forward for next matching keyword. This
|
||||
@@ -879,9 +880,9 @@ Groß): >
|
||||
endif
|
||||
let res = []
|
||||
let h = ''
|
||||
for l in systemlist('aiksaurus '.shellescape(a:base))
|
||||
for l in systemlist('aiksaurus ' .. shellescape(a:base))
|
||||
if l[:3] == '=== '
|
||||
let h = '('.substitute(l[4:], ' =*$', ')', '')
|
||||
let h = '(' .. substitute(l[4:], ' =*$', ')', '')
|
||||
elseif l ==# 'Alphabetically similar known words are: '
|
||||
let h = "\U0001f52e"
|
||||
elseif l[0] =~ '\a' || (h ==# "\U0001f52e" && l[0] ==# "\t")
|
||||
@@ -1266,7 +1267,7 @@ An example that completes the names of the months: >
|
||||
" find months matching with "a:base"
|
||||
let res = []
|
||||
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
|
||||
if m =~ '^' . a:base
|
||||
if m =~ '^' .. a:base
|
||||
call add(res, m)
|
||||
endif
|
||||
endfor
|
||||
@@ -1288,7 +1289,7 @@ The same, but now pretending searching for matches is slow: >
|
||||
else
|
||||
" find months matching with "a:base"
|
||||
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
|
||||
if m =~ '^' . a:base
|
||||
if m =~ '^' .. a:base
|
||||
call complete_add(m)
|
||||
endif
|
||||
sleep 300m " simulate searching for next match
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*intro.txt* For Vim version 8.2. Last change: 2021 Sep 29
|
||||
*intro.txt* For Vim version 8.2. Last change: 2022 Mar 03
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -701,7 +701,8 @@ Q Switch to "Ex" mode. This is a bit like typing ":"
|
||||
Use the ":vi" command |:visual| to exit "Ex" mode.
|
||||
Note: In older versions of Vim "Q" formatted text,
|
||||
that is now done with |gq|. But if you use the
|
||||
|vimrc_example.vim| script "Q" works like "gq".
|
||||
|vimrc_example.vim| script or |defaults.vim|, "Q"
|
||||
works like "gq". Except for Select mode.
|
||||
|
||||
*gQ*
|
||||
gQ Switch to "Ex" mode like with "Q", but really behave
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*map.txt* For Vim version 8.2. Last change: 2022 Jan 23
|
||||
*map.txt* For Vim version 8.2. Last change: 2022 Mar 03
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -80,6 +80,8 @@ modes.
|
||||
where the map command applies. Disallow mapping of
|
||||
{rhs}, to avoid nested and recursive mappings. Often
|
||||
used to redefine a command.
|
||||
Note: When <Plug> appears in the {rhs} this part is
|
||||
always applied even if remapping is disallowed.
|
||||
|
||||
|
||||
:unm[ap] {lhs} |mapmode-nvo| *:unm* *:unmap*
|
||||
@@ -314,7 +316,7 @@ Here is an example that inserts a list number that increases: >
|
||||
|
||||
func ListItem()
|
||||
let g:counter += 1
|
||||
return g:counter . '. '
|
||||
return g:counter .. '. '
|
||||
endfunc
|
||||
|
||||
func ListReset()
|
||||
@@ -387,7 +389,7 @@ contain special characters like function keys.
|
||||
1.3 MAPPING AND MODES *:map-modes*
|
||||
*mapmode-nvo* *mapmode-n* *mapmode-v* *mapmode-o*
|
||||
|
||||
There are six sets of mappings
|
||||
There are seven sets of mappings
|
||||
- For Normal mode: When typing commands.
|
||||
- For Visual mode: When typing commands while the Visual area is highlighted.
|
||||
- For Select mode: like Visual mode but typing text replaces the selection.
|
||||
@@ -395,6 +397,7 @@ There are six sets of mappings
|
||||
etc.). See below: |omap-info|.
|
||||
- For Insert mode. These are also used in Replace mode.
|
||||
- For Command-line mode: When entering a ":" or "/" command.
|
||||
- For Terminal mode: When typing in a |:terminal| buffer.
|
||||
|
||||
Special case: While typing a count for a command in Normal mode, mapping zero
|
||||
is disabled. This makes it possible to map zero without making it impossible
|
||||
@@ -1444,7 +1447,7 @@ See |:verbose-cmd| for more information.
|
||||
|
||||
|
||||
Command attributes ~
|
||||
|
||||
*command-attributes*
|
||||
User-defined commands are treated by Vim just like any other Ex commands. They
|
||||
can have arguments, or have a range specified. Arguments are subject to
|
||||
completion as filenames, buffers, etc. Exactly how this works depends upon the
|
||||
@@ -1561,9 +1564,11 @@ The function arguments are:
|
||||
The function may use these for determining context. For the "custom"
|
||||
argument, it is not necessary to filter candidates against the (implicit
|
||||
pattern in) ArgLead. Vim will filter the candidates with its regexp engine
|
||||
after function return, and this is probably more efficient in most cases. For
|
||||
the "customlist" argument, Vim will not filter the returned completion
|
||||
candidates and the user supplied function should filter the candidates.
|
||||
after function return, and this is probably more efficient in most cases. If
|
||||
'wildoptions' contains "fuzzy", then the candidates will be filtered using
|
||||
|fuzzy-matching|. For the "customlist" argument, Vim will not
|
||||
filter the returned completion candidates and the user supplied function
|
||||
should filter the candidates.
|
||||
|
||||
The following example lists user names to a Finger command >
|
||||
:com -complete=custom,ListUsers -nargs=1 Finger !finger <args>
|
||||
@@ -1697,12 +1702,12 @@ The valid escape sequences are
|
||||
Examples: >
|
||||
command! -nargs=+ -complete=file MyEdit
|
||||
\ for f in expand(<q-args>, 0, 1) |
|
||||
\ exe '<mods> split ' . f |
|
||||
\ exe '<mods> split ' .. f |
|
||||
\ endfor
|
||||
|
||||
function! SpecialEdit(files, mods)
|
||||
for f in expand(a:files, 0, 1)
|
||||
exe a:mods . ' split ' . f
|
||||
exe a:mods .. ' split ' .. f
|
||||
endfor
|
||||
endfunction
|
||||
command! -nargs=+ -complete=file Sedit
|
||||
@@ -1778,7 +1783,7 @@ This will invoke: >
|
||||
: let i = 0
|
||||
: while i < argc()
|
||||
: if filereadable(argv(i))
|
||||
: execute "e " . argv(i)
|
||||
: execute "e " .. argv(i)
|
||||
: execute a:command
|
||||
: endif
|
||||
: let i = i + 1
|
||||
|
||||
@@ -1019,7 +1019,7 @@ These commands are not marks themselves, but jump to a mark:
|
||||
:let lnum = line(".")
|
||||
:keepjumps normal gg
|
||||
:call SetLastChange()
|
||||
:keepjumps exe "normal " . lnum . "G"
|
||||
:keepjumps exe "normal " .. lnum .. "G"
|
||||
<
|
||||
Note that ":keepjumps" must be used for every command.
|
||||
When invoking a function the commands in that function
|
||||
|
||||
@@ -1142,7 +1142,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
If you like to keep a lot of backups, you could use a BufWritePre
|
||||
autocommand to change 'backupext' just before writing the file to
|
||||
include a timestamp. >
|
||||
:au BufWritePre * let &bex = '-' . strftime("%Y%b%d%X") . '~'
|
||||
:au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~'
|
||||
< Use 'backupdir' to put the backup in a different directory.
|
||||
|
||||
*'backupskip'* *'bsk'*
|
||||
@@ -1167,7 +1167,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
|
||||
Note that environment variables are not expanded. If you want to use
|
||||
$HOME you must expand it explicitly, e.g.: >
|
||||
:let &backupskip = escape(expand('$HOME'), '\') . '/tmp/*'
|
||||
:let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*'
|
||||
|
||||
< Note that the default also makes sure that "crontab -e" works (when a
|
||||
backup would be made by renaming the original file crontab won't see
|
||||
@@ -1218,10 +1218,10 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
The evaluation of the expression must not have side effects!
|
||||
Example: >
|
||||
function MyBalloonExpr()
|
||||
return 'Cursor is at line ' . v:beval_lnum .
|
||||
\', column ' . v:beval_col .
|
||||
\ ' of file ' . bufname(v:beval_bufnr) .
|
||||
\ ' on word "' . v:beval_text . '"'
|
||||
return 'Cursor is at line ' .. v:beval_lnum ..
|
||||
\ ', column ' .. v:beval_col ..
|
||||
\ ' of file ' .. bufname(v:beval_bufnr) ..
|
||||
\ ' on word "' .. v:beval_text .. '"'
|
||||
endfunction
|
||||
set bexpr=MyBalloonExpr()
|
||||
set ballooneval
|
||||
@@ -1537,7 +1537,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
If the default value taken from $CDPATH is not what you want, include
|
||||
a modified version of the following command in your vimrc file to
|
||||
override it: >
|
||||
:let &cdpath = ',' . substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g')
|
||||
:let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g')
|
||||
< This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||
security reasons.
|
||||
(parts of 'cdpath' can be passed to the shell to expand file names).
|
||||
@@ -1582,8 +1582,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
set charconvert=CharConvert()
|
||||
fun CharConvert()
|
||||
system("recode "
|
||||
\ . v:charconvert_from . ".." . v:charconvert_to
|
||||
\ . " <" . v:fname_in . " >" v:fname_out)
|
||||
\ .. v:charconvert_from .. ".." .. v:charconvert_to
|
||||
\ .. " <" .. v:fname_in .. " >" .. v:fname_out)
|
||||
return v:shell_error
|
||||
endfun
|
||||
< The related Vim variables are:
|
||||
@@ -4887,7 +4887,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
|+multi_lang| features}
|
||||
Language to use for menu translation. Tells which file is loaded
|
||||
from the "lang" directory in 'runtimepath': >
|
||||
"lang/menu_" . &langmenu . ".vim"
|
||||
"lang/menu_" .. &langmenu .. ".vim"
|
||||
< (without the spaces). For example, to always use the Dutch menus, no
|
||||
matter what $LANG is set to: >
|
||||
:set langmenu=nl_NL.ISO_8859-1
|
||||
@@ -5901,7 +5901,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
< To use an environment variable, you probably need to replace the
|
||||
separator. Here is an example to append $INCL, in which directory
|
||||
names are separated with a semi-colon: >
|
||||
:let &path = &path . "," . substitute($INCL, ';', ',', 'g')
|
||||
:let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
|
||||
< Replace the ';' with a ':' or whatever separator is used. Note that
|
||||
this doesn't work when $INCL contains a comma or white space.
|
||||
|
||||
@@ -8318,7 +8318,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
This option cannot be set in a modeline when 'modelineexpr' is off.
|
||||
|
||||
Example: >
|
||||
:auto BufEnter * let &titlestring = hostname() . "/" . expand("%:p")
|
||||
:auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p")
|
||||
:set title titlestring=%<%F%=%l/%L-%P titlelen=70
|
||||
< The value of 'titlelen' is used to align items in the middle or right
|
||||
of the available space.
|
||||
@@ -9087,6 +9087,14 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
feature}
|
||||
A list of words that change how |cmdline-completion| is done.
|
||||
The following values are supported:
|
||||
fuzzy Use |fuzzy-matching| to find completion matches. When
|
||||
this value is specified, wildcard expansion will not
|
||||
be used for completion. The matches will be sorted by
|
||||
the "best match" rather than alphabetically sorted.
|
||||
This will find more matches than the wildcard
|
||||
expansion. Currently fuzzy matching based completion
|
||||
is not supported for file and directory names and
|
||||
instead wildcard expansion is used.
|
||||
pum Display the completion matches using the popupmenu
|
||||
in the same style as the |ins-completion-menu|.
|
||||
tagfile When using CTRL-D to list matching tags, the kind of
|
||||
|
||||
@@ -603,13 +603,13 @@ program to the new diff on VMS. Add this to your .vimrc file: >
|
||||
function MyDiff()
|
||||
let opt = ""
|
||||
if &diffopt =~ "icase"
|
||||
let opt = opt . "-i "
|
||||
let opt = opt .. "-i "
|
||||
endif
|
||||
if &diffopt =~ "iwhite"
|
||||
let opt = opt . "-b "
|
||||
let opt = opt .. "-b "
|
||||
endif
|
||||
silent execute "!mc GNU:diff.exe -a " . opt . v:fname_in . " " . v:fname_new .
|
||||
\ " > " . v:fname_out
|
||||
silent execute "!mc GNU:diff.exe -a " .. opt .. v:fname_in .. " " .. v:fname_new ..
|
||||
\ " > " .. v:fname_out
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*pattern.txt* For Vim version 8.2. Last change: 2022 Feb 04
|
||||
*pattern.txt* For Vim version 8.2. Last change: 2022 Mar 04
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -19,7 +19,7 @@ explanations are in chapter 27 |usr_27.txt|.
|
||||
8. Composing characters |patterns-composing|
|
||||
9. Compare with Perl patterns |perl-patterns|
|
||||
10. Highlighting matches |match-highlight|
|
||||
11. Fuzzy matching |fuzzy-match|
|
||||
11. Fuzzy matching |fuzzy-matching|
|
||||
|
||||
==============================================================================
|
||||
1. Search commands *search-commands*
|
||||
@@ -164,9 +164,12 @@ index, on which the cursor is. This can look like this: >
|
||||
Note: the count does not take offset into account.
|
||||
|
||||
When no match is found you get the error: *E486* Pattern not found
|
||||
Note that for the |:global| command this behaves like a normal message, for Vi
|
||||
compatibility. For the |:s| command the "e" flag can be used to avoid the
|
||||
error message |:s_flags|.
|
||||
Note that for the `:global` command, when used in legacy script, you get a
|
||||
normal message "Pattern not found", for Vi compatibility.
|
||||
In |Vim9| script you get E486 for "pattern not found" or *E538* when the pattern
|
||||
matches in every line with `:vglobal`.
|
||||
For the |:s| command the "e" flag can be used to avoid the error message
|
||||
|:s_flags|.
|
||||
|
||||
*search-offset* *{offset}*
|
||||
These commands search for the specified pattern. With "/" and "?" an
|
||||
@@ -963,7 +966,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
|
||||
the cursor moves the display isn't updated for this change. An update
|
||||
is done when using the |CTRL-L| command (the whole screen is updated).
|
||||
Example, to highlight the column where the cursor currently is: >
|
||||
:exe '/\%' . col(".") . 'c'
|
||||
:exe '/\%' .. col(".") .. 'c'
|
||||
< Alternatively use: >
|
||||
/\%.c
|
||||
< When 'hlsearch' is set and you move the cursor around and make changes
|
||||
@@ -1457,7 +1460,7 @@ Finally, these constructs are unique to Perl:
|
||||
":2match" for another plugin.
|
||||
|
||||
==============================================================================
|
||||
11. Fuzzy matching *fuzzy-match*
|
||||
11. Fuzzy matching *fuzzy-matching*
|
||||
|
||||
Fuzzy matching refers to matching strings using a non-exact search string.
|
||||
Fuzzy matching will match a string, if all the characters in the search string
|
||||
|
||||
@@ -968,7 +968,7 @@ itself:
|
||||
fun! NetReadFixup(method, line1, line2)
|
||||
if method == 3 " ftp (no <.netrc>)
|
||||
let fourblanklines= line2 - 3
|
||||
silent fourblanklines.",".line2."g/^\s*/d"
|
||||
silent fourblanklines .. "," .. line2 .. "g/^\s*/d"
|
||||
endif
|
||||
endfunction
|
||||
endif
|
||||
@@ -1975,7 +1975,7 @@ To use this function, simply assign its output to |g:netrw_list_hide| option. >
|
||||
Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file')
|
||||
Function can take additional files with git-ignore patterns.
|
||||
|
||||
Example: g:netrw_list_hide= netrw_gitignore#Hide() . '.*\.swp$'
|
||||
Example: let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
|
||||
Combining 'netrw_gitignore#Hide' with custom patterns.
|
||||
<
|
||||
|
||||
@@ -2825,7 +2825,7 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
|
||||
Examples:
|
||||
let g:netrw_list_hide= '.*\.swp$'
|
||||
let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$'
|
||||
let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
|
||||
default: ""
|
||||
|
||||
*g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin
|
||||
|
||||
@@ -139,28 +139,28 @@ If there is no error, return zero or an empty string.
|
||||
The default for non MS-Windows or VMS systems is to simply use "lpr" to print
|
||||
the file: >
|
||||
|
||||
system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice)
|
||||
. ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error
|
||||
system('lpr' .. (&printdevice == '' ? '' : ' -P' .. &printdevice)
|
||||
.. ' ' .. v:fname_in) .. delete(v:fname_in) + v:shell_error
|
||||
|
||||
On MS-Windows machines the default is to copy the file to the currently
|
||||
specified printdevice: >
|
||||
|
||||
system('copy' . ' ' . v:fname_in . (&printdevice == ''
|
||||
? ' LPT1:' : (' \"' . &printdevice . '\"')))
|
||||
. delete(v:fname_in)
|
||||
system('copy' .. ' ' .. v:fname_in .. (&printdevice == ''
|
||||
? ' LPT1:' : (' \"' .. &printdevice .. '\"')))
|
||||
.. delete(v:fname_in)
|
||||
|
||||
On VMS machines the default is to send the file to either the default or
|
||||
currently specified printdevice: >
|
||||
|
||||
system('print' . (&printdevice == '' ? '' : ' /queue=' .
|
||||
&printdevice) . ' ' . v:fname_in) . delete(v:fname_in)
|
||||
system('print' .. (&printdevice == '' ? '' : ' /queue=' ..
|
||||
&printdevice) .. ' ' .. v:fname_in) .. delete(v:fname_in)
|
||||
|
||||
If you change this option, using a function is an easy way to avoid having to
|
||||
escape all the spaces. Example: >
|
||||
|
||||
:set printexpr=PrintFile(v:fname_in)
|
||||
:function PrintFile(fname)
|
||||
: call system("ghostview " . a:fname)
|
||||
: call system("ghostview " .. a:fname)
|
||||
: call delete(a:fname)
|
||||
: return v:shell_error
|
||||
:endfunc
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*quickfix.txt* For Vim version 8.2. Last change: 2022 Feb 08
|
||||
*quickfix.txt* For Vim version 8.2. Last change: 2022 Feb 22
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -353,7 +353,7 @@ processing a quickfix or location list command, it will be aborted.
|
||||
cursor position will not be changed. See |:cexpr| for
|
||||
more information.
|
||||
Example: >
|
||||
:g/mypattern/caddexpr expand("%") . ":" . line(".") . ":" . getline(".")
|
||||
:g/mypattern/caddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")
|
||||
<
|
||||
*:lad* *:addd* *:laddexpr*
|
||||
:lad[dexpr] {expr} Same as ":caddexpr", except the location list for the
|
||||
@@ -654,6 +654,27 @@ quickfix window. If there already is a window for that file, it is used
|
||||
instead. If the buffer in the used window has changed, and the error is in
|
||||
another file, jumping to the error will fail. You will first have to make
|
||||
sure the window contains a buffer which can be abandoned.
|
||||
|
||||
When you select a file from the quickfix window, the following steps are used
|
||||
to find a window to edit the file:
|
||||
|
||||
1. If a window displaying the selected file is present in the current tabpage
|
||||
(starting with the window before the quickfix window), then that window is
|
||||
used.
|
||||
2. If the above step fails and if 'switchbuf' contains "usetab" and a window
|
||||
displaying the selected file is present in any one of the tabpages
|
||||
(starting with the first tabpage) then that window is used.
|
||||
3. If the above step fails then a window in the current tabpage displaying a
|
||||
buffer with 'buftype' not set (starting with the window before the quickfix
|
||||
window) is used.
|
||||
4. If the above step fails and if 'switchbuf' contains "uselast", then the
|
||||
previously accessed window is used.
|
||||
5. If the above step fails then the window before the quickfix window is used.
|
||||
If there is no previous window, then the window after the quickfix window
|
||||
is used.
|
||||
6. If the above step fails, then a new horizontally split window above the
|
||||
quickfix window is used.
|
||||
|
||||
*CTRL-W_<Enter>* *CTRL-W_<CR>*
|
||||
You can use CTRL-W <Enter> to open a new window and jump to the error there.
|
||||
|
||||
@@ -663,7 +684,7 @@ FileType event (also see |qf.vim|). Then the BufReadPost event is triggered,
|
||||
using "quickfix" for the buffer name. This can be used to perform some action
|
||||
on the listed errors. Example: >
|
||||
au BufReadPost quickfix setlocal modifiable
|
||||
\ | silent exe 'g/^/s//\=line(".")." "/'
|
||||
\ | silent exe 'g/^/s//\=line(".") .. " "/'
|
||||
\ | setlocal nomodifiable
|
||||
This prepends the line number to each line. Note the use of "\=" in the
|
||||
substitute string of the ":s" command, which is used to evaluate an
|
||||
@@ -692,13 +713,15 @@ this window, the displayed location list is used.
|
||||
When you select a file from the location list window, the following steps are
|
||||
used to find a window to edit the file:
|
||||
|
||||
1. If a window with the location list displayed in the location list window is
|
||||
present, then the file is opened in that window.
|
||||
2. If the above step fails and if the file is already opened in another
|
||||
window, then that window is used.
|
||||
3. If the above step fails then an existing window showing a buffer with
|
||||
'buftype' not set is used.
|
||||
4. If the above step fails, then the file is edited in a new window.
|
||||
1. If a non-quickfix window associated with the location list is present in
|
||||
the current tabpage, then that window is used.
|
||||
2. If the above step fails and if the file is already opened in another window
|
||||
in the current tabpage, then that window is used.
|
||||
3. If the above step fails and 'switchbuf' contains "usetab" and if the file
|
||||
is opened in a window in any one of the tabpages, then that window is used.
|
||||
4. If the above step fails then a window in the current tabpage showing a
|
||||
buffer with 'buftype' not set is used.
|
||||
5. If the above step fails, then the file is edited in a new window.
|
||||
|
||||
In all of the above cases, if the location list for the selected window is not
|
||||
yet set, then it is set to the location list displayed in the location list
|
||||
@@ -1037,7 +1060,7 @@ commands can be combined to create a NewGrep command: >
|
||||
matching is used to find matching lines. In this
|
||||
case, {pattern} is treated as a literal string
|
||||
instead of a regular expression. See
|
||||
|fuzzy-match| for more information about fuzzy
|
||||
|fuzzy-matching| for more information about fuzzy
|
||||
matching strings.
|
||||
|
||||
|QuickFixCmdPre| and |QuickFixCmdPost| are triggered.
|
||||
|
||||
@@ -101,7 +101,7 @@ precedence, otherwise the 'cursorline' highlighting.
|
||||
Here is an example that places a sign "piet", displayed with the text ">>", in
|
||||
line 23 of the current file: >
|
||||
:sign define piet text=>> texthl=Search
|
||||
:exe ":sign place 2 line=23 name=piet file=" . expand("%:p")
|
||||
:exe ":sign place 2 line=23 name=piet file=" .. expand("%:p")
|
||||
|
||||
And here is the command to delete it again: >
|
||||
:sign unplace 2
|
||||
|
||||
@@ -131,8 +131,8 @@ zuG Undo |zW| and |zG|, remove the word from the internal
|
||||
rare as this is a fairly uncommon command and all
|
||||
intuitive commands for this are already taken. If you
|
||||
want you can add mappings with e.g.: >
|
||||
nnoremap z? :exe ':spellrare ' . expand('<cWORD>')<CR>
|
||||
nnoremap z/ :exe ':spellrare! ' . expand('<cWORD>')<CR>
|
||||
nnoremap z? :exe ':spellrare ' .. expand('<cWORD>')<CR>
|
||||
nnoremap z/ :exe ':spellrare! ' .. expand('<cWORD>')<CR>
|
||||
< |:spellundo|, |zuw|, or |zuW| can be used to undo this.
|
||||
|
||||
:spellr[rare]! {word} Add {word} as a rare word to the internal word
|
||||
|
||||
@@ -1378,7 +1378,7 @@ resulting file, when executed with a ":source" command:
|
||||
After restoring the Session, the full filename of your current Session is
|
||||
available in the internal variable "v:this_session" |this_session-variable|.
|
||||
An example mapping: >
|
||||
:nmap <F2> :wa<Bar>exe "mksession! " . v:this_session<CR>:so ~/sessions/
|
||||
:nmap <F2> :wa<Bar>exe "mksession! " .. v:this_session<CR>:so ~/sessions/
|
||||
This saves the current Session, and starts off the command to load another.
|
||||
|
||||
A session includes all tab pages, unless "tabpages" was removed from
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*syntax.txt* For Vim version 8.2. Last change: 2022 Feb 06
|
||||
*syntax.txt* For Vim version 8.2. Last change: 2022 Mar 02
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -653,7 +653,7 @@ evaluate to get a unique string to append to each ID used in a given document,
|
||||
so that the full IDs will be unique even when combined with other content in a
|
||||
larger HTML document. Example, to append _ and the buffer number to each ID: >
|
||||
|
||||
:let g:html_id_expr = '"_".bufnr("%")'
|
||||
:let g:html_id_expr = '"_" .. bufnr("%")'
|
||||
<
|
||||
To append a string "_mystring" to the end of each ID: >
|
||||
|
||||
@@ -3607,8 +3607,8 @@ Do you want to draw with the mouse? Try the following: >
|
||||
:function! GetPixel()
|
||||
: let c = getline(".")[col(".") - 1]
|
||||
: echo c
|
||||
: exe "noremap <LeftMouse> <LeftMouse>r".c
|
||||
: exe "noremap <LeftDrag> <LeftMouse>r".c
|
||||
: exe "noremap <LeftMouse> <LeftMouse>r" .. c
|
||||
: exe "noremap <LeftDrag> <LeftMouse>r" .. c
|
||||
:endfunction
|
||||
:noremap <RightMouse> <LeftMouse>:call GetPixel()<CR>
|
||||
:set guicursor=n:hor20 " to see the color beneath the cursor
|
||||
@@ -4452,7 +4452,7 @@ Leading context *:syn-lc* *:syn-leading* *:syn-context*
|
||||
|
||||
Note: This is an obsolete feature, only included for backwards compatibility
|
||||
with previous Vim versions. It's now recommended to use the |/\@<=| construct
|
||||
in the pattern.
|
||||
in the pattern. You can also often use |/\zs|.
|
||||
|
||||
The "lc" offset specifies leading context -- a part of the pattern that must
|
||||
be present, but is not considered part of the match. An offset of "lc=n" will
|
||||
@@ -5567,9 +5567,9 @@ types.vim: *.[ch]
|
||||
And put these lines in your .vimrc: >
|
||||
|
||||
" load the types.vim highlighting file, if it exists
|
||||
autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') . '/types.vim'
|
||||
autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') .. '/types.vim'
|
||||
autocmd BufRead,BufNewFile *.[ch] if filereadable(fname)
|
||||
autocmd BufRead,BufNewFile *.[ch] exe 'so ' . fname
|
||||
autocmd BufRead,BufNewFile *.[ch] exe 'so ' .. fname
|
||||
autocmd BufRead,BufNewFile *.[ch] endif
|
||||
|
||||
==============================================================================
|
||||
|
||||
@@ -381,24 +381,24 @@ pages and define labels for them. Then get the label for each tab page. >
|
||||
for i in range(tabpagenr('$'))
|
||||
" select the highlighting
|
||||
if i + 1 == tabpagenr()
|
||||
let s .= '%#TabLineSel#'
|
||||
let s ..= '%#TabLineSel#'
|
||||
else
|
||||
let s .= '%#TabLine#'
|
||||
let s ..= '%#TabLine#'
|
||||
endif
|
||||
|
||||
" set the tab page number (for mouse clicks)
|
||||
let s .= '%' . (i + 1) . 'T'
|
||||
let s ..= '%' .. (i + 1) .. 'T'
|
||||
|
||||
" the label is made by MyTabLabel()
|
||||
let s .= ' %{MyTabLabel(' . (i + 1) . ')} '
|
||||
let s ..= ' %{MyTabLabel(' .. (i + 1) .. ')} '
|
||||
endfor
|
||||
|
||||
" after the last tab fill with TabLineFill and reset tab page nr
|
||||
let s .= '%#TabLineFill#%T'
|
||||
let s ..= '%#TabLineFill#%T'
|
||||
|
||||
" right-align the label to close the current tab page
|
||||
if tabpagenr('$') > 1
|
||||
let s .= '%=%#TabLine#%999Xclose'
|
||||
let s ..= '%=%#TabLine#%999Xclose'
|
||||
endif
|
||||
|
||||
return s
|
||||
@@ -461,14 +461,14 @@ windows in the tab page and a '+' if there is a modified buffer: >
|
||||
" Append the number of windows in the tab page if more than one
|
||||
let wincount = tabpagewinnr(v:lnum, '$')
|
||||
if wincount > 1
|
||||
let label .= wincount
|
||||
let label ..= wincount
|
||||
endif
|
||||
if label != ''
|
||||
let label .= ' '
|
||||
let label ..= ' '
|
||||
endif
|
||||
|
||||
" Append the buffer name
|
||||
return label . bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
|
||||
return label .. bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
|
||||
endfunction
|
||||
|
||||
set guitablabel=%{GuiTabLabel()}
|
||||
|
||||
@@ -1355,6 +1355,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
+mouse various.txt /*+mouse*
|
||||
+mouse_dec various.txt /*+mouse_dec*
|
||||
+mouse_gpm various.txt /*+mouse_gpm*
|
||||
+mouse_gpm/dyn various.txt /*+mouse_gpm\/dyn*
|
||||
+mouse_jsbterm various.txt /*+mouse_jsbterm*
|
||||
+mouse_netterm various.txt /*+mouse_netterm*
|
||||
+mouse_pterm various.txt /*+mouse_pterm*
|
||||
@@ -2112,6 +2113,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:abclear map.txt /*:abclear*
|
||||
:abo windows.txt /*:abo*
|
||||
:aboveleft windows.txt /*:aboveleft*
|
||||
:abstract vim9.txt /*:abstract*
|
||||
:addd quickfix.txt /*:addd*
|
||||
:al windows.txt /*:al*
|
||||
:all windows.txt /*:all*
|
||||
@@ -2271,6 +2273,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:chistory quickfix.txt /*:chistory*
|
||||
:cl quickfix.txt /*:cl*
|
||||
:cla quickfix.txt /*:cla*
|
||||
:class vim9.txt /*:class*
|
||||
:clast quickfix.txt /*:clast*
|
||||
:cle motion.txt /*:cle*
|
||||
:clearjumps motion.txt /*:clearjumps*
|
||||
@@ -2443,12 +2446,15 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:emenu gui.txt /*:emenu*
|
||||
:en eval.txt /*:en*
|
||||
:end eval.txt /*:end*
|
||||
:endclass vim9.txt /*:endclass*
|
||||
:enddef vim9.txt /*:enddef*
|
||||
:endenum vim9.txt /*:endenum*
|
||||
:endf eval.txt /*:endf*
|
||||
:endfo eval.txt /*:endfo*
|
||||
:endfor eval.txt /*:endfor*
|
||||
:endfunction eval.txt /*:endfunction*
|
||||
:endif eval.txt /*:endif*
|
||||
:endinterface vim9.txt /*:endinterface*
|
||||
:endt eval.txt /*:endt*
|
||||
:endtry eval.txt /*:endtry*
|
||||
:endw eval.txt /*:endw*
|
||||
@@ -2457,6 +2463,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:ene! editing.txt /*:ene!*
|
||||
:enew editing.txt /*:enew*
|
||||
:enew! editing.txt /*:enew!*
|
||||
:enum vim9.txt /*:enum*
|
||||
:eval eval.txt /*:eval*
|
||||
:ex editing.txt /*:ex*
|
||||
:exe eval.txt /*:exe*
|
||||
@@ -2583,6 +2590,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:inoreme gui.txt /*:inoreme*
|
||||
:inoremenu gui.txt /*:inoremenu*
|
||||
:insert insert.txt /*:insert*
|
||||
:interface vim9.txt /*:interface*
|
||||
:intro starting.txt /*:intro*
|
||||
:is tagsrch.txt /*:is*
|
||||
:isearch tagsrch.txt /*:isearch*
|
||||
@@ -3215,6 +3223,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:startgreplace insert.txt /*:startgreplace*
|
||||
:startinsert insert.txt /*:startinsert*
|
||||
:startreplace insert.txt /*:startreplace*
|
||||
:static vim9.txt /*:static*
|
||||
:stj tagsrch.txt /*:stj*
|
||||
:stjump tagsrch.txt /*:stjump*
|
||||
:stop starting.txt /*:stop*
|
||||
@@ -3392,6 +3401,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:tunma map.txt /*:tunma*
|
||||
:tunmap map.txt /*:tunmap*
|
||||
:tunmenu gui.txt /*:tunmenu*
|
||||
:type vim9.txt /*:type*
|
||||
:u undo.txt /*:u*
|
||||
:un undo.txt /*:un*
|
||||
:una map.txt /*:una*
|
||||
@@ -4021,6 +4031,7 @@ E1061 vim9.txt /*E1061*
|
||||
E1062 eval.txt /*E1062*
|
||||
E1063 eval.txt /*E1063*
|
||||
E1064 autocmd.txt /*E1064*
|
||||
E1065 vim9.txt /*E1065*
|
||||
E1066 vim9.txt /*E1066*
|
||||
E1067 eval.txt /*E1067*
|
||||
E1068 vim9.txt /*E1068*
|
||||
@@ -4033,6 +4044,8 @@ E1074 vim9.txt /*E1074*
|
||||
E1075 vim9.txt /*E1075*
|
||||
E1076 eval.txt /*E1076*
|
||||
E1077 vim9.txt /*E1077*
|
||||
E1078 autocmd.txt /*E1078*
|
||||
E1079 vim9.txt /*E1079*
|
||||
E108 eval.txt /*E108*
|
||||
E1080 vim9.txt /*E1080*
|
||||
E1081 eval.txt /*E1081*
|
||||
@@ -4240,6 +4253,7 @@ E1264 vim9.txt /*E1264*
|
||||
E1265 eval.txt /*E1265*
|
||||
E1266 if_pyth.txt /*E1266*
|
||||
E127 eval.txt /*E127*
|
||||
E1270 change.txt /*E1270*
|
||||
E128 eval.txt /*E128*
|
||||
E129 eval.txt /*E129*
|
||||
E13 message.txt /*E13*
|
||||
@@ -4681,7 +4695,7 @@ E534 options.txt /*E534*
|
||||
E535 options.txt /*E535*
|
||||
E536 options.txt /*E536*
|
||||
E537 options.txt /*E537*
|
||||
E538 builtin.txt /*E538*
|
||||
E538 pattern.txt /*E538*
|
||||
E539 options.txt /*E539*
|
||||
E54 pattern.txt /*E54*
|
||||
E540 options.txt /*E540*
|
||||
@@ -5004,6 +5018,7 @@ E835 options.txt /*E835*
|
||||
E836 if_pyth.txt /*E836*
|
||||
E837 if_pyth.txt /*E837*
|
||||
E838 netbeans.txt /*E838*
|
||||
E839 vim9.txt /*E839*
|
||||
E84 windows.txt /*E84*
|
||||
E840 insert.txt /*E840*
|
||||
E841 map.txt /*E841*
|
||||
@@ -5861,6 +5876,7 @@ bug-fixes-5 version5.txt /*bug-fixes-5*
|
||||
bug-fixes-6 version6.txt /*bug-fixes-6*
|
||||
bug-fixes-7 version7.txt /*bug-fixes-7*
|
||||
bug-fixes-8 version8.txt /*bug-fixes-8*
|
||||
bug-fixes-9 version9.txt /*bug-fixes-9*
|
||||
bug-reports intro.txt /*bug-reports*
|
||||
bugreport.vim intro.txt /*bugreport.vim*
|
||||
bugs intro.txt /*bugs*
|
||||
@@ -6162,6 +6178,7 @@ collate-variable eval.txt /*collate-variable*
|
||||
color-xterm syntax.txt /*color-xterm*
|
||||
coloring syntax.txt /*coloring*
|
||||
colortest.vim syntax.txt /*colortest.vim*
|
||||
command-attributes map.txt /*command-attributes*
|
||||
command-block vim9.txt /*command-block*
|
||||
command-line-functions usr_41.txt /*command-line-functions*
|
||||
command-line-window cmdline.txt /*command-line-window*
|
||||
@@ -6171,6 +6188,7 @@ compile-changes-5 version5.txt /*compile-changes-5*
|
||||
compile-changes-6 version6.txt /*compile-changes-6*
|
||||
compile-changes-7 version7.txt /*compile-changes-7*
|
||||
compile-changes-8 version8.txt /*compile-changes-8*
|
||||
compile-changes-9 version9.txt /*compile-changes-9*
|
||||
compiler-compaqada ft_ada.txt /*compiler-compaqada*
|
||||
compiler-decada ft_ada.txt /*compiler-decada*
|
||||
compiler-gcc quickfix.txt /*compiler-gcc*
|
||||
@@ -7009,7 +7027,7 @@ function-range-example eval.txt /*function-range-example*
|
||||
function-search-undo eval.txt /*function-search-undo*
|
||||
function_key intro.txt /*function_key*
|
||||
functions eval.txt /*functions*
|
||||
fuzzy-match pattern.txt /*fuzzy-match*
|
||||
fuzzy-matching pattern.txt /*fuzzy-matching*
|
||||
fvwm.vim syntax.txt /*fvwm.vim*
|
||||
fvwm2rc syntax.txt /*fvwm2rc*
|
||||
fvwmrc syntax.txt /*fvwmrc*
|
||||
@@ -7820,6 +7838,7 @@ improvements-5 version5.txt /*improvements-5*
|
||||
improvements-6 version6.txt /*improvements-6*
|
||||
improvements-7 version7.txt /*improvements-7*
|
||||
improvements-8 version8.txt /*improvements-8*
|
||||
improvements-9 version9.txt /*improvements-9*
|
||||
in_bot channel.txt /*in_bot*
|
||||
in_buf channel.txt /*in_buf*
|
||||
in_io-buffer channel.txt /*in_io-buffer*
|
||||
@@ -7835,6 +7854,7 @@ incompatible-5 version5.txt /*incompatible-5*
|
||||
incompatible-6 version6.txt /*incompatible-6*
|
||||
incompatible-7 version7.txt /*incompatible-7*
|
||||
incompatible-8 version8.txt /*incompatible-8*
|
||||
incompatible-9 version9.txt /*incompatible-9*
|
||||
indent() builtin.txt /*indent()*
|
||||
indent-expression indent.txt /*indent-expression*
|
||||
indent.txt indent.txt /*indent.txt*
|
||||
@@ -8543,6 +8563,7 @@ new-5 version5.txt /*new-5*
|
||||
new-6 version6.txt /*new-6*
|
||||
new-7 version7.txt /*new-7*
|
||||
new-8 version8.txt /*new-8*
|
||||
new-9 version9.txt /*new-9*
|
||||
new-GTK-GUI version5.txt /*new-GTK-GUI*
|
||||
new-MzScheme version7.txt /*new-MzScheme*
|
||||
new-Select-mode version5.txt /*new-Select-mode*
|
||||
@@ -8576,6 +8597,7 @@ new-indent-flex version6.txt /*new-indent-flex*
|
||||
new-items-6 version6.txt /*new-items-6*
|
||||
new-items-7 version7.txt /*new-items-7*
|
||||
new-items-8 version8.txt /*new-items-8*
|
||||
new-items-9 version9.txt /*new-items-9*
|
||||
new-line-continuation version5.txt /*new-line-continuation*
|
||||
new-location-list version7.txt /*new-location-list*
|
||||
new-lua version7.txt /*new-lua*
|
||||
@@ -8625,6 +8647,7 @@ new-utf-8 version6.txt /*new-utf-8*
|
||||
new-vertsplit version6.txt /*new-vertsplit*
|
||||
new-vim-script version7.txt /*new-vim-script*
|
||||
new-vim-script-8 version8.txt /*new-vim-script-8*
|
||||
new-vim-script-9 version9.txt /*new-vim-script-9*
|
||||
new-vim-server version6.txt /*new-vim-server*
|
||||
new-vimgrep version7.txt /*new-vimgrep*
|
||||
new-vimscript-8.2 version8.txt /*new-vimscript-8.2*
|
||||
@@ -8743,7 +8766,8 @@ pascal.vim syntax.txt /*pascal.vim*
|
||||
patches-8 version8.txt /*patches-8*
|
||||
patches-8.1 version8.txt /*patches-8.1*
|
||||
patches-8.2 version8.txt /*patches-8.2*
|
||||
patches-after-8.2 version8.txt /*patches-after-8.2*
|
||||
patches-9 version9.txt /*patches-9*
|
||||
patches-after-8.2 version9.txt /*patches-after-8.2*
|
||||
pathshorten() builtin.txt /*pathshorten()*
|
||||
pattern pattern.txt /*pattern*
|
||||
pattern-atoms pattern.txt /*pattern-atoms*
|
||||
@@ -10011,6 +10035,7 @@ terminal.txt terminal.txt /*terminal.txt*
|
||||
terminalprops() builtin.txt /*terminalprops()*
|
||||
terminfo term.txt /*terminfo*
|
||||
termresponse-variable eval.txt /*termresponse-variable*
|
||||
ternary eval.txt /*ternary*
|
||||
test-functions usr_41.txt /*test-functions*
|
||||
test-functions-details testing.txt /*test-functions-details*
|
||||
test_alloc_fail() testing.txt /*test_alloc_fail()*
|
||||
@@ -10102,7 +10127,6 @@ tooltips gui.txt /*tooltips*
|
||||
toupper() builtin.txt /*toupper()*
|
||||
tr() builtin.txt /*tr()*
|
||||
trim() builtin.txt /*trim()*
|
||||
trinary eval.txt /*trinary*
|
||||
trojan-horse starting.txt /*trojan-horse*
|
||||
true vim9.txt /*true*
|
||||
true-variable eval.txt /*true-variable*
|
||||
@@ -10457,6 +10481,7 @@ version-7.4 version7.txt /*version-7.4*
|
||||
version-8.0 version8.txt /*version-8.0*
|
||||
version-8.1 version8.txt /*version-8.1*
|
||||
version-8.2 version8.txt /*version-8.2*
|
||||
version-9.0 version9.txt /*version-9.0*
|
||||
version-variable eval.txt /*version-variable*
|
||||
version4.txt version4.txt /*version4.txt*
|
||||
version5.txt version5.txt /*version5.txt*
|
||||
@@ -10471,6 +10496,8 @@ version8.0 version8.txt /*version8.0*
|
||||
version8.1 version8.txt /*version8.1*
|
||||
version8.2 version8.txt /*version8.2*
|
||||
version8.txt version8.txt /*version8.txt*
|
||||
version9.0 version9.txt /*version9.0*
|
||||
version9.txt version9.txt /*version9.txt*
|
||||
versionlong-variable eval.txt /*versionlong-variable*
|
||||
vi intro.txt /*vi*
|
||||
vi-differences vi_diff.txt /*vi-differences*
|
||||
@@ -10486,6 +10513,8 @@ vim-7.4 version7.txt /*vim-7.4*
|
||||
vim-8 version8.txt /*vim-8*
|
||||
vim-8.1 version8.txt /*vim-8.1*
|
||||
vim-8.2 version8.txt /*vim-8.2*
|
||||
vim-9 version9.txt /*vim-9*
|
||||
vim-9.0 version9.txt /*vim-9.0*
|
||||
vim-additions vi_diff.txt /*vim-additions*
|
||||
vim-announce intro.txt /*vim-announce*
|
||||
vim-arguments starting.txt /*vim-arguments*
|
||||
|
||||
@@ -724,7 +724,7 @@ matches the pattern "^# *define" it is not considered to be a comment.
|
||||
If you want to list matches, and then select one to jump to, you could use a
|
||||
mapping to do that for you. Here is an example: >
|
||||
|
||||
:map <F4> [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR>
|
||||
:map <F4> [I:let nr = input("Which one: ")<Bar>exe "normal " .. nr .. "[\t"<CR>
|
||||
<
|
||||
*[i*
|
||||
[i Display the first line that contains the keyword
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*term.txt* For Vim version 8.2. Last change: 2021 Dec 21
|
||||
*term.txt* For Vim version 8.2. Last change: 2022 Mar 04
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -725,12 +725,12 @@ size is wrong you can use the 'lines' and 'columns' options to set the
|
||||
correct values.
|
||||
|
||||
One command can be used to set the screen size:
|
||||
|
||||
*:mod* *:mode* *E359*
|
||||
:mod[e] [mode]
|
||||
|
||||
Without argument this only detects the screen size and redraws the screen.
|
||||
[mode] was used on MS-DOS, but it doesn't work anymore.
|
||||
[mode] was used on MS-DOS, but it doesn't work anymore. In |Vim9| this
|
||||
command is not supported.
|
||||
|
||||
==============================================================================
|
||||
4. Slow and fast terminals *slow-fast-terminal*
|
||||
@@ -984,7 +984,7 @@ an #if/#else/#endif block, the selection becomes linewise.
|
||||
For MS-Windows and xterm the time for double clicking can be set with the
|
||||
'mousetime' option. For the other systems this time is defined outside of Vim.
|
||||
An example, for using a double click to jump to the tag under the cursor: >
|
||||
:map <2-LeftMouse> :exe "tag ". expand("<cword>")<CR>
|
||||
:map <2-LeftMouse> :exe "tag " .. expand("<cword>")<CR>
|
||||
|
||||
Dragging the mouse with a double click (button-down, button-up, button-down
|
||||
and then drag) will result in whole words to be selected. This continues
|
||||
|
||||
@@ -979,8 +979,8 @@ Currently supported commands:
|
||||
< Calls a function defined like this: >
|
||||
function Tapi_Impression(bufnum, arglist)
|
||||
if len(a:arglist) == 2
|
||||
echomsg "impression " . a:arglist[0]
|
||||
echomsg "count " . a:arglist[1]
|
||||
echomsg "impression " .. a:arglist[0]
|
||||
echomsg "count " .. a:arglist[1]
|
||||
endif
|
||||
endfunc
|
||||
< Output from `:echo` may be erased by a redraw, use `:echomsg`
|
||||
|
||||
@@ -101,14 +101,14 @@ What you need:
|
||||
create it with the shell command "mkid file1 file2 ..".
|
||||
|
||||
Put this in your .vimrc: >
|
||||
map _u :call ID_search()<Bar>execute "/\\<" . g:word . "\\>"<CR>
|
||||
map _n :n<Bar>execute "/\\<" . g:word . "\\>"<CR>
|
||||
map _u :call ID_search()<Bar>execute "/\\<" .. g:word .. "\\>"<CR>
|
||||
map _n :n<Bar>execute "/\\<" .. g:word .. "\\>"<CR>
|
||||
|
||||
function! ID_search()
|
||||
let g:word = expand("<cword>")
|
||||
let x = system("lid --key=none ". g:word)
|
||||
let x = system("lid --key=none " .. g:word)
|
||||
let x = substitute(x, "\n", " ", "g")
|
||||
execute "next " . x
|
||||
execute "next " .. x
|
||||
endfun
|
||||
|
||||
To use it, place the cursor on a word, type "_u" and vim will load the file
|
||||
@@ -356,13 +356,13 @@ This mapping will format any bullet list. It requires that there is an empty
|
||||
line above and below each list entry. The expression commands are used to
|
||||
be able to give comments to the parts of the mapping. >
|
||||
|
||||
:let m = ":map _f :set ai<CR>" " need 'autoindent' set
|
||||
:let m = m . "{O<Esc>" " add empty line above item
|
||||
:let m = m . "}{)^W" " move to text after bullet
|
||||
:let m = m . "i <CR> <Esc>" " add space for indent
|
||||
:let m = m . "gq}" " format text after the bullet
|
||||
:let m = m . "{dd" " remove the empty line
|
||||
:let m = m . "5lDJ" " put text after bullet
|
||||
:let m = ":map _f :set ai<CR>" " need 'autoindent' set
|
||||
:let m ..= "{O<Esc>" " add empty line above item
|
||||
:let m ..= "}{)^W" " move to text after bullet
|
||||
:let m ..= "i <CR> <Esc>" " add space for indent
|
||||
:let m ..= "gq}" " format text after the bullet
|
||||
:let m ..= "{dd" " remove the empty line
|
||||
:let m ..= "5lDJ" " put text after bullet
|
||||
:execute m |" define the mapping
|
||||
|
||||
(<> notation |<>|. Note that this is all typed literally. ^W is "^" "W", not
|
||||
@@ -514,15 +514,15 @@ A slightly more advanced version is used in the |matchparen| plugin.
|
||||
let c = '\['
|
||||
let c2 = '\]'
|
||||
endif
|
||||
let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||
let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' ..
|
||||
\ '=~? "string\\|comment"'
|
||||
execute 'if' s_skip '| let s_skip = 0 | endif'
|
||||
|
||||
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip)
|
||||
|
||||
if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$')
|
||||
exe 'match Search /\(\%' . c_lnum . 'l\%' . c_col .
|
||||
\ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
|
||||
exe 'match Search /\(\%' .. c_lnum .. 'l\%' .. c_col ..
|
||||
\ 'c\)\|\(\%' .. m_lnum .. 'l\%' .. m_col .. 'c\)/'
|
||||
let s:paren_hl_on = 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 8.2. Last change: 2022 Feb 16
|
||||
*todo.txt* For Vim version 8.2. Last change: 2022 Mar 08
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -38,10 +38,29 @@ browser use: https://github.com/vim/vim/issues/1234
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
Allow for assigning v:null to job/channel/funcref etc.
|
||||
- Check that the declared type is not lost.
|
||||
- Check: var d: dict<func> = {a: function('tr'), b: null}
|
||||
|
||||
Fix that with s being an empty string, this returns TRUE:
|
||||
echo s is null_string
|
||||
|
||||
Make sure null types work to:
|
||||
- assign to a variable
|
||||
- use as an argument
|
||||
- use as default value of optional argument
|
||||
- use as return value
|
||||
- use in a list/dict constant, type is correct
|
||||
- revert comparing with null?
|
||||
|
||||
TODO item in eval.c
|
||||
|
||||
Really drop the Athena GUI? And NeXtaw?
|
||||
|
||||
Once Vim9 is stable:
|
||||
- Use Vim9 for runtime files.
|
||||
- Check code coverage, add more tests if needed.
|
||||
vim9execute.c
|
||||
vim9execute.c line 1900
|
||||
vim9expr.c
|
||||
vim9instr.c
|
||||
vim9script.c
|
||||
@@ -209,6 +228,13 @@ Use CTRL-R to specify the register to use. (#9531)
|
||||
|
||||
Some prompts are not translated: #9495
|
||||
|
||||
Improvement in terminal configuration mess: Request the terminfo entry from
|
||||
the terminal itself. The $TERM value then is only relevant for whether this
|
||||
feature is supported or not. Replaces the xterm mechanism to request each
|
||||
entry separately. #6609
|
||||
Multiplexers (screen, tmux) can request it to the underlaying terminal, and
|
||||
pass it on with modifications.
|
||||
|
||||
Test_communicate_ipv6(): is flaky on many systems
|
||||
Fails in line 64 of Ch_communicate, no exception is thrown.
|
||||
|
||||
@@ -286,6 +312,9 @@ Probably because it's using MAXCOL. #8238
|
||||
Make "g>" and "g<" in Visual mode move the text right or left.
|
||||
Also for a block selection. #8558
|
||||
|
||||
When using dictionary insert completion with 'ignorecase', the leading capital
|
||||
in a word should be preserved.
|
||||
|
||||
Add optional argument to virtcol() that specifies "start", "cursor" or "end"
|
||||
to tell which value from getvvcol() should be used. (#7964)
|
||||
Value returned by virtcol() changes depending on how lines wrap. This is
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*uganda.txt* For Vim version 8.2. Last change: 2022 Feb 05
|
||||
*uganda.txt* For Vim version 8.2. Last change: 2022 Mar 02
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -133,11 +133,12 @@ Kibaale Children's Centre *kcc* *Kibaale* *charity*
|
||||
Kibaale Children's Centre (KCC) is located in Kibaale, a small town in the
|
||||
south of Uganda, near Tanzania, in East Africa. The area is known as Rakai
|
||||
District. The population is mostly farmers. Although people are poor, there
|
||||
is enough food. But this district is suffering from AIDS more than any other
|
||||
part of the world. Some say that it started there. Estimations are that 10
|
||||
to 30% of the Ugandans are infected with HIV. Because parents die, there are
|
||||
many orphans. In this district about 60,000 children have lost one or both
|
||||
parents, out of a population of 350,000. And this is still continuing.
|
||||
usually is enough food. But this district is suffering from AIDS more than
|
||||
any other part of the world. Some say that it started there. Estimations are
|
||||
that in the past 10 to 30% of the Ugandans are infected with HIV. Because
|
||||
parents die, there are many orphans. In this district about 60,000 children
|
||||
have lost one or both parents, out of a population of 350,000. Although AIDS
|
||||
is now mostly under control, the problems are still continuing.
|
||||
|
||||
The children need a lot of help. The KCC is working hard to provide the needy
|
||||
with food, medical care and education. Food and medical care to keep them
|
||||
|
||||
@@ -286,12 +286,12 @@ history file. E.g.: >
|
||||
au BufReadPost * call ReadUndo()
|
||||
au BufWritePost * call WriteUndo()
|
||||
func ReadUndo()
|
||||
if filereadable(expand('%:h'). '/UNDO/' . expand('%:t'))
|
||||
if filereadable(expand('%:h') .. '/UNDO/' .. expand('%:t'))
|
||||
rundo %:h/UNDO/%:t
|
||||
endif
|
||||
endfunc
|
||||
func WriteUndo()
|
||||
let dirname = expand('%:h') . '/UNDO'
|
||||
let dirname = expand('%:h') .. '/UNDO'
|
||||
if !isdirectory(dirname)
|
||||
call mkdir(dirname)
|
||||
endif
|
||||
|
||||
@@ -270,7 +270,7 @@ line break. Revert with ":iunmap <C-U>".
|
||||
Enable using the mouse if available. See 'mouse'.
|
||||
|
||||
>
|
||||
vnoremap _g y:exe "grep /" . escape(@", '\\/') . "/ *.c *.h"<CR>
|
||||
vnoremap _g y:exe "grep /" .. escape(@", '\\/') .. "/ *.c *.h"<CR>
|
||||
|
||||
This mapping yanks the visually selected text and searches for it in C files.
|
||||
You can see that a mapping can be used to do quite complicated things. Still,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*various.txt* For Vim version 8.2. Last change: 2022 Feb 03
|
||||
*various.txt* For Vim version 8.2. Last change: 2022 Mar 04
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -114,6 +114,7 @@ g8 Print the hex values of the bytes used in the
|
||||
:[range]P[rint] [count] [flags]
|
||||
Just as ":print". Was apparently added to Vi for
|
||||
people that keep the shift key pressed too long...
|
||||
This command is not supported in |Vim9| script.
|
||||
Note: A user command can overrule this command.
|
||||
See |ex-flags| for [flags].
|
||||
|
||||
@@ -267,7 +268,7 @@ g8 Print the hex values of the bytes used in the
|
||||
name does not contain a single quote: >
|
||||
:!ls '%'
|
||||
< This should always work, but it's more typing: >
|
||||
:exe "!ls " . shellescape(expand("%"))
|
||||
:exe "!ls " .. shellescape(expand("%"))
|
||||
< To get a literal "%" or "#" prepend it with a
|
||||
backslash. For example, to list all files starting
|
||||
with "%": >
|
||||
@@ -650,7 +651,7 @@ N *+X11* Unix only: can restore window title |X11|
|
||||
used. In this example |:silent| is used to avoid the
|
||||
message about reading the file and |:unsilent| to be
|
||||
able to list the first line of each file. >
|
||||
:silent argdo unsilent echo expand('%') . ": " . getline(1)
|
||||
:silent argdo unsilent echo expand('%') .. ": " .. getline(1)
|
||||
<
|
||||
|
||||
*:verb* *:verbose*
|
||||
|
||||
@@ -14965,7 +14965,7 @@ Solution: Adjust autoconf. (lilydjwg)
|
||||
Files: src/configure.in, src/auto/configure
|
||||
|
||||
Patch 7.3.806
|
||||
Problem: Compiler warnings in Perl code when building with Visual studio
|
||||
Problem: Compiler warnings in Perl code when building with Visual Studio
|
||||
2012. (skeept)
|
||||
Solution: Add type casts. (Christian Brabandt, 2013 Jan 30)
|
||||
Files: src/if_perl.xs
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
26927
runtime/doc/version9.txt
Normal file
26927
runtime/doc/version9.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2022 Feb 22
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2022 Mar 08
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -94,8 +94,20 @@ script and `:def` functions; details are below:
|
||||
def CallMe(count: number, message: string): bool
|
||||
- Call functions without `:call`: >
|
||||
writefile(['done'], 'file.txt')
|
||||
- You cannot use old Ex commands `:xit`, `:t`, `:k`, `:append`, `:change`,
|
||||
`:insert`, `:open`, and `:s` or `:d` with only flags.
|
||||
- You cannot use old Ex commands:
|
||||
`:Print`
|
||||
`:append`
|
||||
`:change`
|
||||
`:d` directly followed by 'd' or 'p'.
|
||||
`:insert`
|
||||
`:k`
|
||||
`:mode`
|
||||
`:open`
|
||||
`:s` with only flags
|
||||
`:t`
|
||||
`:xit`
|
||||
- Some commands, especially those used for flow control, cannot be shortened.
|
||||
E.g., `:throw` cannot be written as `:th`. *E839*
|
||||
- You cannot use curly-braces names.
|
||||
- A range before a command must be prefixed with a colon: >
|
||||
:%s/this/that
|
||||
@@ -229,8 +241,17 @@ script "export" needs to be used. >
|
||||
< *E1058* *E1075*
|
||||
When using `:function` or `:def` to specify a nested function inside a `:def`
|
||||
function and no namespace was given, this nested function is local to the code
|
||||
block it is defined in. It is not possible to define a script-local function.
|
||||
It is possible to define a global function by using the "g:" prefix.
|
||||
block it is defined in. It cannot be used in `function()` with a string
|
||||
argument, pass the function reference itself: >
|
||||
def Outer()
|
||||
def Inner()
|
||||
echo 'inner'
|
||||
enddef
|
||||
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.
|
||||
|
||||
When referring to a function and no "s:" or "g:" prefix is used, Vim will
|
||||
search for the function:
|
||||
@@ -296,7 +317,7 @@ function, the function does not need to be defined more than once: >
|
||||
|
||||
|
||||
Variable declarations with :var, :final and :const ~
|
||||
*vim9-declaration* *:var*
|
||||
*vim9-declaration* *:var* *E1079*
|
||||
*E1017* *E1020* *E1054* *E1087* *E1108* *E1124*
|
||||
Local variables need to be declared with `:var`. Local constants need to be
|
||||
declared with `:final` or `:const`. We refer to both as "variables" in this
|
||||
@@ -366,6 +387,9 @@ In Vim9 script `:let` cannot be used. An existing variable is assigned to
|
||||
without any command. The same for global, window, tab, buffer and Vim
|
||||
variables, because they are not really declared. Those can also be deleted
|
||||
with `:unlet`.
|
||||
*E1065*
|
||||
You cannot use `:va` to declare a variable, it must be written with the full
|
||||
name `:var`. Just to make sure it is easy to read.
|
||||
*E1178*
|
||||
`:lockvar` does not work on local variables. Use `:const` and `:final`
|
||||
instead.
|
||||
@@ -943,10 +967,37 @@ always converted to string: >
|
||||
Simple types are Number, Float, Special and Bool. For other types |string()|
|
||||
should be used.
|
||||
*false* *true* *null* *E1034*
|
||||
In Vim9 script one can use "true" for v:true, "false" for v:false and "null"
|
||||
for v:null. When converting a boolean to a string "false" and "true" are
|
||||
used, not "v:false" and "v:true" like in legacy script. "v:none" is not
|
||||
changed, it is only used in JSON and has no equivalent in other languages.
|
||||
In Vim9 script one can use the following predefined values: >
|
||||
true
|
||||
false
|
||||
null
|
||||
null_blob
|
||||
null_channel
|
||||
null_dict
|
||||
null_function
|
||||
null_job
|
||||
null_list
|
||||
null_partial
|
||||
null_string
|
||||
`true` is the same as `v:true`, `false` the same as `v:false`, `null` the same
|
||||
as `v:null`.
|
||||
|
||||
While `null` has the type "special", the other "null_" types have the type
|
||||
indicated by their name. Quite often a null value is handled the same as an
|
||||
empty value, but not always. The values can be useful to clear a script-local
|
||||
variable, since they cannot be deleted with `:unlet`. E.g.: >
|
||||
var theJob = job_start(...)
|
||||
# let the job do its work
|
||||
theJob = null_job
|
||||
|
||||
The values can also be useful as the default value for an argument: >
|
||||
def MyFunc(b: blob = null_blob)
|
||||
if b == null_blob
|
||||
# b argument was not given
|
||||
|
||||
When converting a boolean to a string `false` and `true` are used, not
|
||||
`v:false` and `v:true` like in legacy script. `v:none` has no `none`
|
||||
replacement, it has no equivalent in other languages.
|
||||
|
||||
Indexing a string with [idx] or taking a slice with [idx : idx] uses character
|
||||
indexes instead of byte indexes. Composing characters are included.
|
||||
@@ -1752,6 +1803,17 @@ threaded, connecting asynchronous operations is a natural way of allowing
|
||||
plugins to do their work without blocking the user. It's a uniform way to
|
||||
invoke callbacks and handle timeouts and errors.
|
||||
|
||||
Some commands have already been reserved:
|
||||
*:class*
|
||||
*:endclass*
|
||||
*:abstract*
|
||||
*:enum*
|
||||
*:endenum*
|
||||
*:interface*
|
||||
*:endinterface*
|
||||
*:static*
|
||||
*:type*
|
||||
|
||||
Some examples: >
|
||||
|
||||
abstract class Person
|
||||
|
||||
@@ -473,7 +473,7 @@ These commands can also be executed with ":wincmd":
|
||||
the |CursorHold| autocommand event). Or when a Normal mode
|
||||
command is inconvenient.
|
||||
The count can also be a window number. Example: >
|
||||
:exe nr . "wincmd w"
|
||||
:exe nr .. "wincmd w"
|
||||
< This goes to window "nr".
|
||||
|
||||
==============================================================================
|
||||
@@ -964,12 +964,12 @@ CTRL-W g } *CTRL-W_g}*
|
||||
cursor. This is less clever than using |:ptag|, but you don't
|
||||
need a tags file and it will also find matches in system
|
||||
include files. Example: >
|
||||
:au! CursorHold *.[ch] ++nested exe "silent! psearch " . expand("<cword>")
|
||||
:au! CursorHold *.[ch] ++nested exe "silent! psearch " .. expand("<cword>")
|
||||
< Warning: This can be slow.
|
||||
|
||||
Example *CursorHold-example* >
|
||||
|
||||
:au! CursorHold *.[ch] ++nested exe "silent! ptag " . expand("<cword>")
|
||||
:au! CursorHold *.[ch] ++nested exe "silent! ptag " .. expand("<cword>")
|
||||
|
||||
This will cause a ":ptag" to be executed for the keyword under the cursor,
|
||||
when the cursor hasn't moved for the time set with 'updatetime'. The "nested"
|
||||
@@ -992,14 +992,14 @@ is no word under the cursor, and a few other things: >
|
||||
:
|
||||
: " Delete any existing highlight before showing another tag
|
||||
: silent! wincmd P " jump to preview window
|
||||
: if &previewwindow " if we really get there...
|
||||
: if &previewwindow " if we really get there...
|
||||
: match none " delete existing highlight
|
||||
: wincmd p " back to old window
|
||||
: endif
|
||||
:
|
||||
: " Try displaying a matching tag for the word under the cursor
|
||||
: try
|
||||
: exe "ptag " . w
|
||||
: exe "ptag " .. w
|
||||
: catch
|
||||
: return
|
||||
: endtry
|
||||
@@ -1011,10 +1011,10 @@ is no word under the cursor, and a few other things: >
|
||||
: endif
|
||||
: call search("$", "b") " to end of previous line
|
||||
: let w = substitute(w, '\\', '\\\\', "")
|
||||
: call search('\<\V' . w . '\>') " position cursor on match
|
||||
: call search('\<\V' .. w .. '\>') " position cursor on match
|
||||
: " Add a match highlight to the word at this position
|
||||
: hi previewWord term=bold ctermbg=green guibg=green
|
||||
: exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"'
|
||||
: exe 'match previewWord "\%' .. line(".") .. 'l\%' .. col(".") .. 'c\k*"'
|
||||
: wincmd p " back to old window
|
||||
: endif
|
||||
: endif
|
||||
|
||||
@@ -484,6 +484,7 @@ au BufNewFile,BufRead */etc/dnsmasq.conf setf dnsmasq
|
||||
au BufNewFile,BufRead *.desc setf desc
|
||||
|
||||
" the D language or dtrace
|
||||
au BufNewFile,BufRead */dtrace/*.d setf dtrace
|
||||
au BufNewFile,BufRead *.d call dist#ft#DtraceCheck()
|
||||
|
||||
" Desktop files
|
||||
@@ -667,7 +668,7 @@ au BufNewFile,BufRead *.fs call dist#ft#FTfs()
|
||||
au BufNewFile,BufRead *.fsi,*.fsx setf fsharp
|
||||
|
||||
" GDB command files
|
||||
au BufNewFile,BufRead .gdbinit,gdbinit setf gdb
|
||||
au BufNewFile,BufRead .gdbinit,gdbinit,.gdbearlyinit,gdbearlyinit,*.gdb setf gdb
|
||||
|
||||
" GDMO
|
||||
au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: ant
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: aspvbs
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: config
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: csc
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: csh
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
" Previous Maintainer: Dan Sharp
|
||||
" Contributor: Johannes Zellner <johannes@zellner.org>
|
||||
" Last Change: 2021 Oct 15
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: dtd
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: html
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Java
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Change: 2012 Mar 11
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: jsp
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Pascal
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
" Previous Maintainer: Dan Sharp
|
||||
" Last Change: 2021 Apr 23
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: php
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: sgml
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: sh
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: svg
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: tcsh
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
" Previous Maintainer: Dan Sharp
|
||||
" Last Change: 2021 Oct 15
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: xhtml
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Maintainer: Christian Brabandt <cb@256bit.org>
|
||||
" Last Changed: Dec 07th, 2018
|
||||
" Repository: https://github.com/chrisbra/vim-xml-ftplugin
|
||||
" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
" Previous Maintainer: Dan Sharp
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: xsd
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: xslt
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
"
|
||||
" This runtime file is looking for a new maintainer.
|
||||
"
|
||||
" Former maintainer: Dan Sharp
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim indent file
|
||||
" Language: Vim script
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2021 Nov 27
|
||||
" Last Change: 2022 Mar 01
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
@@ -10,7 +10,7 @@ endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetVimIndent()
|
||||
setlocal indentkeys+==end,=},=else,=cat,=finall,=END,0\\,0=\"\\\
|
||||
setlocal indentkeys+==endif,=enddef,=endfu,=endfor,=endwh,=endtry,=},=else,=cat,=finall,=END,0\\,0=\"\\\
|
||||
setlocal indentkeys-=0#
|
||||
setlocal indentkeys-=:
|
||||
|
||||
@@ -103,8 +103,9 @@ function GetVimIndentIntern()
|
||||
" A line starting with :au does not increment/decrement indent.
|
||||
" A { may start a block or a dict. Assume that when a } follows it's a
|
||||
" terminated dict.
|
||||
" ":function" starts a block but "function(" doesn't.
|
||||
if prev_text !~ '^\s*au\%[tocmd]' && prev_text !~ '^\s*{.*}'
|
||||
let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|fu\%[nction]\|def\|el\%[seif]\)\>\)')
|
||||
let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|def\|el\%[seif]\)\>\|fu\%[nction][! ]\)')
|
||||
if i >= 0
|
||||
let ind += shiftwidth()
|
||||
if strpart(prev_text, i, 1) == '|' && has('syntax_items')
|
||||
@@ -170,10 +171,15 @@ function GetVimIndentIntern()
|
||||
let ind = ind + shiftwidth()
|
||||
endif
|
||||
|
||||
" Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry,
|
||||
" :endfun, :enddef, :else and :augroup END.
|
||||
if cur_text =~ '^\s*\(ene\@!\|cat\|finall\|el\|aug\%[roup]\s\+[eE][nN][dD]\)'
|
||||
" Subtract a 'shiftwidth' on a :endif, :endwhile, :endfor, :catch, :finally,
|
||||
" :endtry, :endfun, :enddef, :else and :augroup END.
|
||||
" Although ":en" would be enough only match short command names as in
|
||||
" 'indentkeys'.
|
||||
if cur_text =~ '^\s*\(endif\|endwh\|endfor\|endtry\|endfu\|enddef\|cat\|finall\|else\|aug\%[roup]\s\+[eE][nN][dD]\)'
|
||||
let ind = ind - shiftwidth()
|
||||
if ind < 0
|
||||
let ind = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
return ind
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
" You can also use this as a start for your own set of menus.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2022 Feb 23
|
||||
" Last Change: 2022 Mar 02
|
||||
|
||||
" Note that ":an" (short for ":anoremenu") is often used to make a menu work
|
||||
" in all modes and avoid side effects from mappings defined by the user.
|
||||
@@ -583,9 +583,9 @@ def s:XxdConv()
|
||||
:%!mc vim:xxd
|
||||
else
|
||||
s:XxdFind()
|
||||
exe '%!' .. g:xxdprogram
|
||||
exe ':%!' .. g:xxdprogram
|
||||
endif
|
||||
if getline(1) =~ "^0000000:" # only if it worked
|
||||
if getline(1) =~ "^00000000:" # only if it worked
|
||||
set ft=xxd
|
||||
endif
|
||||
&mod = mod
|
||||
@@ -597,7 +597,7 @@ def s:XxdBack()
|
||||
:%!mc vim:xxd -r
|
||||
else
|
||||
s:XxdFind()
|
||||
exe '%!' .. g:xxdprogram .. ' -r'
|
||||
exe ':%!' .. g:xxdprogram .. ' -r'
|
||||
endif
|
||||
set ft=
|
||||
doautocmd filetypedetect BufReadPost
|
||||
|
||||
@@ -34,10 +34,11 @@ Contents:
|
||||
11. Building with Ruby support
|
||||
12. Building with Tcl support
|
||||
13. Building with DirectX (DirectWrite) support
|
||||
14. Windows 3.1
|
||||
15. MS-DOS
|
||||
14. Building with libsodium support
|
||||
15. Windows 3.1
|
||||
16. MS-DOS
|
||||
|
||||
16. Installing after building from sources
|
||||
17. Installing after building from sources
|
||||
|
||||
|
||||
The currently recommended way (that means it has been verified to work) is
|
||||
@@ -247,9 +248,6 @@ MSYS2 has its own git package, and you can also install it via pacman:
|
||||
|
||||
$ pacman -S git
|
||||
|
||||
For enabling libsodium support, you also need to install the package
|
||||
|
||||
$ pacman -S mingw-w64-x86_64-libsodium
|
||||
|
||||
2.3. Keep the build environment up-to-date
|
||||
|
||||
@@ -846,20 +844,55 @@ Just set DIRECTX to yes:
|
||||
mingw32-make -f Make_ming.mak DIRECTX=yes
|
||||
|
||||
|
||||
14. Windows 3.1x
|
||||
14. Building with libsodium support
|
||||
===================================
|
||||
|
||||
For better encryption support, you can build Vim with libsodium.
|
||||
|
||||
A) Using MSVC
|
||||
|
||||
You can download the latest libsodium library from here:
|
||||
https://download.libsodium.org/libsodium/releases/
|
||||
|
||||
At this moment, libsodium-1.0.18-stable-msvc.zip is the latest package.
|
||||
Unpack it to anywhere you like, and specify the path to the SODIUM option:
|
||||
|
||||
nmake -f Make_mvc.mak SODIUM=C:/path/to/libsodium
|
||||
(libsodium.dll will be used as the libsodium DLL name.)
|
||||
|
||||
B) Using MinGW
|
||||
|
||||
If you use msys2, you can install the libsodium package by pacman (or pacboy):
|
||||
|
||||
$ pacman -S mingw-w64-x86_64-libsodium # for 64-bit Vim
|
||||
$ pacman -S mingw-w64-i686-libsodium # for 32-bit Vim
|
||||
$ pacboy -S libsodium:m # for both 32-bit and 64-bit Vim
|
||||
|
||||
Then set SODIUM to yes:
|
||||
|
||||
mingw32-make -f Make_ming.mak SODIUM=yes
|
||||
(libsodium-23.dll will be used as the libsodium DLL name.)
|
||||
|
||||
Or you can set the path to libsodium explicitly:
|
||||
|
||||
mingw32-make -f Make_ming.mak SODIUM=C:/path/to/libsodium
|
||||
(libsodium.dll will be used as the libsodium DLL name.)
|
||||
|
||||
|
||||
15. Windows 3.1x
|
||||
================
|
||||
|
||||
The Windows 3.1x support was removed in patch 7.4.1364.
|
||||
|
||||
|
||||
15. MS-DOS
|
||||
16. MS-DOS
|
||||
==========
|
||||
|
||||
The MS-DOS support was removed in patch 7.4.1399. Only very old Vim versions
|
||||
work on MS-DOS because of the limited amount of memory available.
|
||||
|
||||
|
||||
16. Installing after building from sources
|
||||
17. Installing after building from sources
|
||||
==========================================
|
||||
|
||||
[provided by Michael Soyka, updated by Ken Takata]
|
||||
|
||||
@@ -32,30 +32,31 @@
|
||||
# Set to TINY to make minimal version (few features).
|
||||
FEATURES=HUGE
|
||||
|
||||
# set to yes for a debug build
|
||||
# Set to yes for a debug build.
|
||||
DEBUG=no
|
||||
|
||||
# set to yes to create a mapfile
|
||||
# Set to yes to create a mapfile.
|
||||
#MAP=yes
|
||||
|
||||
# set to yes to measure code coverage
|
||||
# Set to yes to measure code coverage.
|
||||
COVERAGE=no
|
||||
|
||||
# better encryption support using libsodium
|
||||
# Better encryption support using libsodium.
|
||||
# Set to yes or specify the path to the libsodium directory to enable it.
|
||||
#SODIUM=yes
|
||||
|
||||
# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
|
||||
# Set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization.
|
||||
OPTIMIZE=MAXSPEED
|
||||
|
||||
# set to yes to make gvim, no for vim
|
||||
# Set to yes to make gvim, no for vim.
|
||||
GUI=yes
|
||||
|
||||
# set to yes to enable the DLL support (EXPERIMENTAL).
|
||||
# Set to yes to enable the DLL support (EXPERIMENTAL).
|
||||
# Creates vim{32,64}.dll, and stub gvim.exe and vim.exe.
|
||||
# "GUI" should be also set to "yes".
|
||||
#VIMDLL=yes
|
||||
|
||||
# set to no if you do not want to use DirectWrite (DirectX)
|
||||
# Set to no if you do not want to use DirectWrite (DirectX).
|
||||
# MinGW-w64 is needed, and ARCH should be set to i686 or x86-64.
|
||||
DIRECTX=yes
|
||||
|
||||
@@ -524,10 +525,6 @@ CXXFLAGS = -std=gnu++11
|
||||
WINDRES_FLAGS =
|
||||
EXTRA_LIBS =
|
||||
|
||||
ifdef SODIUM
|
||||
DEFINES += -DHAVE_SODIUM
|
||||
endif
|
||||
|
||||
ifdef GETTEXT
|
||||
DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
|
||||
GETTEXTINCLUDE = $(GETTEXT)/include
|
||||
@@ -671,12 +668,19 @@ DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(SODIUM),yes)
|
||||
ifdef SODIUM
|
||||
DEFINES += -DHAVE_SODIUM
|
||||
ifeq ($(SODIUM),yes)
|
||||
SODIUM_DLL = libsodium-23.dll
|
||||
else
|
||||
SODIUM_DLL = libsodium.dll
|
||||
CFLAGS += -I $(SODIUM)/include
|
||||
endif
|
||||
ifndef DYNAMIC_SODIUM
|
||||
DYNAMIC_SODIUM=yes
|
||||
endif
|
||||
ifeq ($(DYNAMIC_SODIUM),yes)
|
||||
DEFINES += -DDYNAMIC_SODIUM
|
||||
DEFINES += -DDYNAMIC_SODIUM -DDYNAMIC_SODIUM_DLL=\"$(SODIUM_DLL)\"
|
||||
else
|
||||
SODIUMLIB = -lsodium
|
||||
endif
|
||||
@@ -1229,19 +1233,19 @@ $(OUTDIR)/netbeans.o: netbeans.c $(INCL) version.h
|
||||
|
||||
$(OUTDIR)/version.o: version.c $(INCL) version.h
|
||||
|
||||
$(OUTDIR)/vim9cmds.o: vim9cmds.c $(INCL) version.h
|
||||
$(OUTDIR)/vim9cmds.o: vim9cmds.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9compile.o: vim9compile.c $(INCL) version.h
|
||||
$(OUTDIR)/vim9compile.o: vim9compile.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9execute.o: vim9execute.c $(INCL) version.h
|
||||
$(OUTDIR)/vim9execute.o: vim9execute.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9expr.o: vim9expr.c $(INCL) version.h
|
||||
$(OUTDIR)/vim9expr.o: vim9expr.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9instr.o: vim9instr.c $(INCL) version.h
|
||||
$(OUTDIR)/vim9instr.o: vim9instr.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9script.o: vim9script.c $(INCL) version.h
|
||||
$(OUTDIR)/vim9script.o: vim9script.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9type.o: vim9type.c $(INCL) version.h
|
||||
$(OUTDIR)/vim9type.o: vim9type.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/viminfo.o: viminfo.c $(INCL) version.h
|
||||
|
||||
|
||||
@@ -391,7 +391,8 @@ SODIUM = no
|
||||
!if "$(SODIUM)" != "no"
|
||||
SOD_INC = /I "$(SODIUM)\include"
|
||||
! if "$(DYNAMIC_SODIUM)" == "yes"
|
||||
SOD_DEFS = -DHAVE_SODIUM -DDYNAMIC_SODIUM
|
||||
SODIUM_DLL = libsodium.dll
|
||||
SOD_DEFS = -DHAVE_SODIUM -DDYNAMIC_SODIUM -DDYNAMIC_SODIUM_DLL=\"$(SODIUM_DLL)\"
|
||||
SOD_LIB =
|
||||
! else
|
||||
SOD_DEFS = -DHAVE_SODIUM
|
||||
@@ -1812,19 +1813,19 @@ $(OUTDIR)/userfunc.obj: $(OUTDIR) userfunc.c $(INCL)
|
||||
|
||||
$(OUTDIR)/version.obj: $(OUTDIR) version.c $(INCL) version.h
|
||||
|
||||
$(OUTDIR)/vim9cmds.obj: $(OUTDIR) vim9cmds.c $(INCL)
|
||||
$(OUTDIR)/vim9cmds.obj: $(OUTDIR) vim9cmds.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9compile.obj: $(OUTDIR) vim9compile.c $(INCL)
|
||||
$(OUTDIR)/vim9compile.obj: $(OUTDIR) vim9compile.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9execute.obj: $(OUTDIR) vim9execute.c $(INCL)
|
||||
$(OUTDIR)/vim9execute.obj: $(OUTDIR) vim9execute.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9expr.obj: $(OUTDIR) vim9expr.c $(INCL)
|
||||
$(OUTDIR)/vim9expr.obj: $(OUTDIR) vim9expr.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9instr.obj: $(OUTDIR) vim9instr.c $(INCL)
|
||||
$(OUTDIR)/vim9instr.obj: $(OUTDIR) vim9instr.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9script.obj: $(OUTDIR) vim9script.c $(INCL)
|
||||
$(OUTDIR)/vim9script.obj: $(OUTDIR) vim9script.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/vim9type.obj: $(OUTDIR) vim9type.c $(INCL)
|
||||
$(OUTDIR)/vim9type.obj: $(OUTDIR) vim9type.c $(INCL) vim9.h
|
||||
|
||||
$(OUTDIR)/viminfo.obj: $(OUTDIR) viminfo.c $(INCL) version.h
|
||||
|
||||
|
||||
77
src/Makefile
77
src/Makefile
@@ -21,8 +21,8 @@
|
||||
# the first column of a line is removed.
|
||||
# - If you want a version of Vim that is small and starts up quickly,
|
||||
# you might want to disable the GUI, X11, Perl, Python and Tcl.
|
||||
# - Uncomment the line with --disable-gui if you have Motif, GTK and/or
|
||||
# Athena but don't want to make gvim (the GUI version of Vim with nice
|
||||
# - Uncomment the line with --disable-gui if you have Motif and/or GTK
|
||||
# but don't want to make gvim (the GUI version of Vim with nice
|
||||
# menus and scrollbars, but makes Vim bigger and startup slower).
|
||||
# - Uncomment --disable-darwin if on Mac OS X but you want to compile a
|
||||
# Unix version.
|
||||
@@ -329,7 +329,7 @@ CClink = $(CC)
|
||||
|
||||
# GUI - For creating Vim with GUI (gvim) (B)
|
||||
# Uncomment this line when you don't want to get the GUI version, although you
|
||||
# have GTK, Motif and/or Athena. Also use --without-x if you don't want X11
|
||||
# have GTK and/or Motif. Also use --without-x if you don't want X11
|
||||
# at all.
|
||||
#CONF_OPT_GUI = --disable-gui
|
||||
|
||||
@@ -343,12 +343,10 @@ CClink = $(CC)
|
||||
#CONF_OPT_GUI = --enable-gnome-check
|
||||
#CONF_OPT_GUI = --disable-gtk3-check
|
||||
#CONF_OPT_GUI = --disable-motif-check
|
||||
#CONF_OPT_GUI = --disable-athena-check
|
||||
#CONF_OPT_GUI = --disable-nextaw-check
|
||||
|
||||
# Uncomment one of these lines to select a specific GUI to use.
|
||||
# When using "yes" or nothing, configure will use the first one found: GTK+,
|
||||
# Motif or Athena.
|
||||
# or Motif.
|
||||
#
|
||||
# GTK versions that are known not to work 100% are rejected.
|
||||
# Use "--disable-gtktest" to accept them anyway.
|
||||
@@ -372,8 +370,6 @@ CClink = $(CC)
|
||||
#CONF_OPT_GUI = --enable-gui=gtk3 --disable-gtktest
|
||||
#CONF_OPT_GUI = --enable-gui=motif
|
||||
#CONF_OPT_GUI = --enable-gui=motif --with-motif-lib="-static -lXm -shared"
|
||||
#CONF_OPT_GUI = --enable-gui=athena
|
||||
#CONF_OPT_GUI = --enable-gui=nextaw
|
||||
|
||||
# Uncomment this line to run an individual test with gvim.
|
||||
#GUI_TESTARG = GUI_FLAG=-g
|
||||
@@ -793,13 +789,6 @@ SANITIZER_LIBS = $(SANITIZER_CFLAGS)
|
||||
#X_LIBS_DIR = -L/usr/openwin/lib -R/usr/openwin/lib
|
||||
#CFLAGS = -O
|
||||
|
||||
### (9) Solaris 2.x with cc (SunPro), using Athena.
|
||||
### Only required for compiling gui_at_sb.c.
|
||||
### Symptom: "identifier redeclared: vim_XawScrollbarSetThumb"
|
||||
### Use one of the lines (either Full ANSI or no ANSI at all)
|
||||
#CFLAGS = $(CFLAGS) -Xc
|
||||
#CFLAGS = $(CFLAGS) -Xs
|
||||
|
||||
### Solaris 2.3 with X11 and specific cc
|
||||
#CC=/opt/SUNWspro/bin/cc -O -Xa -v -R/usr/openwin/lib
|
||||
|
||||
@@ -1261,8 +1250,8 @@ LINKIT = @echo >/dev/null
|
||||
### 'configure --enable-gui' can enable one of these for you if you did set
|
||||
### a corresponding CONF_OPT_GUI above and have X11.
|
||||
### Override configures choice by uncommenting all the following lines.
|
||||
### As they are, the GUI is disabled. Replace "NONE" with "ATHENA" or "MOTIF"
|
||||
### for enabling the Athena or Motif GUI.
|
||||
### As they are, the GUI is disabled. Replace "NONE" with "MOTIF"
|
||||
### for enabling the Motif GUI.
|
||||
#GUI_SRC = $(NONE_SRC)
|
||||
#GUI_OBJ = $(NONE_OBJ)
|
||||
#GUI_DEFS = $(NONE_DEFS)
|
||||
@@ -1313,54 +1302,6 @@ MOTIF_MAN_TARGETS = yes
|
||||
MOTIF_TESTTARGET = gui
|
||||
MOTIF_BUNDLE =
|
||||
|
||||
### Athena GUI
|
||||
### Use Xaw3d to make the menus look a little bit nicer
|
||||
#XAW_LIB = -lXaw3d
|
||||
XAW_LIB = -lXaw
|
||||
|
||||
### When using Xaw3d, uncomment/comment the following lines to also get the
|
||||
### scrollbars from Xaw3d.
|
||||
#ATHENA_SRC = gui.c gui_athena.c gui_x11.c gui_beval.c gui_at_fs.c
|
||||
#ATHENA_OBJ = objects/gui.o objects/gui_athena.o objects/gui_x11.o \
|
||||
# objects/gui_beval.o objects/gui_at_fs.o
|
||||
#ATHENA_DEFS = -DFEAT_GUI_ATHENA $(NARROW_PROTO) \
|
||||
# -Dvim_scrollbarWidgetClass=scrollbarWidgetClass \
|
||||
# -Dvim_XawScrollbarSetThumb=XawScrollbarSetThumb
|
||||
ATHENA_SRC = gui.c gui_athena.c gui_x11.c gui_beval.c \
|
||||
gui_at_sb.c gui_at_fs.c
|
||||
ATHENA_OBJ = objects/gui.o objects/gui_athena.o objects/gui_x11.o \
|
||||
objects/gui_beval.o \
|
||||
objects/gui_at_sb.o objects/gui_at_fs.o
|
||||
ATHENA_DEFS = -DFEAT_GUI_ATHENA $(NARROW_PROTO)
|
||||
|
||||
ATHENA_IPATH = $(GUI_INC_LOC)
|
||||
ATHENA_LIBS_DIR = $(GUI_LIB_LOC)
|
||||
ATHENA_LIBS1 = $(XAW_LIB)
|
||||
ATHENA_LIBS2 = -lXt
|
||||
ATHENA_INSTALL = install_normal install_gui_extra
|
||||
ATHENA_TARGETS = installglinks
|
||||
ATHENA_MAN_TARGETS = yes
|
||||
ATHENA_TESTTARGET = gui
|
||||
ATHENA_BUNDLE =
|
||||
|
||||
### neXtaw GUI
|
||||
NEXTAW_LIB = -lneXtaw
|
||||
|
||||
NEXTAW_SRC = gui.c gui_athena.c gui_x11.c gui_beval.c gui_at_fs.c
|
||||
NEXTAW_OBJ = objects/gui.o objects/gui_athena.o objects/gui_x11.o \
|
||||
objects/gui_beval.o objects/gui_at_fs.o
|
||||
NEXTAW_DEFS = -DFEAT_GUI_ATHENA -DFEAT_GUI_NEXTAW $(NARROW_PROTO)
|
||||
|
||||
NEXTAW_IPATH = $(GUI_INC_LOC)
|
||||
NEXTAW_LIBS_DIR = $(GUI_LIB_LOC)
|
||||
NEXTAW_LIBS1 = $(NEXTAW_LIB)
|
||||
NEXTAW_LIBS2 = -lXt
|
||||
NEXTAW_INSTALL = install_normal install_gui_extra
|
||||
NEXTAW_TARGETS = installglinks
|
||||
NEXTAW_MAN_TARGETS = yes
|
||||
NEXTAW_TESTTARGET = gui
|
||||
NEXTAW_BUNDLE =
|
||||
|
||||
### (J) Sun OpenWindows 3.2 (SunOS 4.1.x) or earlier that produce these ld
|
||||
# errors: ld: Undefined symbol
|
||||
# _get_wmShellWidgetClass
|
||||
@@ -2240,7 +2181,7 @@ os_vms.pro: os_vms.c
|
||||
# must use os_vms_conf.h for auto/config.h
|
||||
mv auto/config.h auto/config.h.save
|
||||
cp os_vms_conf.h auto/config.h
|
||||
$(CPROTO) -DVMS -UFEAT_GUI_ATHENA -UFEAT_GUI_NEXTAW -UFEAT_GUI_MOTIF -UFEAT_GUI_GTK $< > proto/$@
|
||||
$(CPROTO) -DVMS -UFEAT_GUI_MOTIF -UFEAT_GUI_GTK $< > proto/$@
|
||||
echo "/* vim: set ft=c : */" >> proto/$@
|
||||
rm auto/config.h
|
||||
mv auto/config.h.save auto/config.h
|
||||
@@ -2257,8 +2198,7 @@ gui_gtk_gresources.pro: auto/gui_gtk_gresources.c
|
||||
notags:
|
||||
-rm -f tags
|
||||
|
||||
# Note: tags is made for the currently configured version, can't include both
|
||||
# Motif and Athena GUI
|
||||
# Note: tags is made for the currently configured version.
|
||||
# You can ignore error messages for missing files.
|
||||
tags TAGS: notags
|
||||
$(TAGPRG) $(TAGS_FILES)
|
||||
@@ -3010,7 +2950,6 @@ shadow: runtime pixmaps
|
||||
../../testdir/sautest \
|
||||
../../testdir/samples \
|
||||
../../testdir/dumps \
|
||||
../../testdir/test83-tags? \
|
||||
../../testdir/*.ok \
|
||||
../../testdir/testluaplugin \
|
||||
.
|
||||
|
||||
49
src/alloc.h
49
src/alloc.h
@@ -8,26 +8,37 @@
|
||||
|
||||
/*
|
||||
* alloc.h: enumeration of alloc IDs.
|
||||
* Used by test_alloc_fail() to test memory allocation failures.
|
||||
* Each entry must be on exactly one line, GetAllocId() depends on that.
|
||||
*/
|
||||
typedef enum {
|
||||
aid_none = 0,
|
||||
aid_qf_dirname_start,
|
||||
aid_qf_dirname_now,
|
||||
aid_qf_namebuf,
|
||||
aid_qf_module,
|
||||
aid_qf_errmsg,
|
||||
aid_qf_pattern,
|
||||
aid_tagstack_items,
|
||||
aid_tagstack_from,
|
||||
aid_tagstack_details,
|
||||
aid_sign_getdefined,
|
||||
aid_sign_getplaced,
|
||||
aid_sign_define_by_name,
|
||||
aid_sign_getlist,
|
||||
aid_sign_getplaced_dict,
|
||||
aid_sign_getplaced_list,
|
||||
aid_insert_sign,
|
||||
aid_sign_getinfo,
|
||||
aid_last
|
||||
aid_none = 0,
|
||||
aid_qf_dirname_start,
|
||||
aid_qf_dirname_now,
|
||||
aid_qf_namebuf,
|
||||
aid_qf_module,
|
||||
aid_qf_errmsg,
|
||||
aid_qf_pattern,
|
||||
aid_qf_efm_fmtstr,
|
||||
aid_qf_efm_fmtpart,
|
||||
aid_qf_title,
|
||||
aid_qf_mef_name,
|
||||
aid_qf_qfline,
|
||||
aid_qf_qfinfo,
|
||||
aid_qf_dirstack,
|
||||
aid_qf_multiline_pfx,
|
||||
aid_qf_makecmd,
|
||||
aid_qf_linebuf,
|
||||
aid_tagstack_items,
|
||||
aid_tagstack_from,
|
||||
aid_tagstack_details,
|
||||
aid_sign_getdefined,
|
||||
aid_sign_getplaced,
|
||||
aid_sign_define_by_name,
|
||||
aid_sign_getlist,
|
||||
aid_sign_getplaced_dict,
|
||||
aid_sign_getplaced_list,
|
||||
aid_insert_sign,
|
||||
aid_sign_getinfo,
|
||||
aid_last
|
||||
} alloc_id_T;
|
||||
|
||||
158
src/auto/configure
vendored
158
src/auto/configure
vendored
@@ -834,8 +834,6 @@ enable_gtk2_check
|
||||
enable_gnome_check
|
||||
enable_gtk3_check
|
||||
enable_motif_check
|
||||
enable_athena_check
|
||||
enable_nextaw_check
|
||||
enable_gtktest
|
||||
with_gnome_includes
|
||||
with_gnome_libs
|
||||
@@ -1509,13 +1507,11 @@ Optional Features:
|
||||
--disable-farsi Deprecated.
|
||||
--enable-xim Include XIM input support.
|
||||
--enable-fontset Include X fontset output support.
|
||||
--enable-gui=OPTS X11 GUI. default=auto OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/haiku/photon/carbon
|
||||
--enable-gui=OPTS X11 GUI. default=auto OPTS=auto/no/gtk2/gnome2/gtk3/motif/haiku/photon/carbon
|
||||
--enable-gtk2-check If auto-select GUI, check for GTK+ 2 default=yes
|
||||
--enable-gnome-check If GTK GUI, check for GNOME default=no
|
||||
--enable-gtk3-check If auto-select GUI, check for GTK+ 3 default=yes
|
||||
--enable-motif-check If auto-select GUI, check for Motif default=yes
|
||||
--enable-athena-check If auto-select GUI, check for Athena default=yes
|
||||
--enable-nextaw-check If auto-select GUI, check for neXtaw default=yes
|
||||
--disable-gtktest Do not try to compile and run a test GTK program
|
||||
--disable-icon-cache-update update disabled
|
||||
--disable-desktop-database-update update disabled
|
||||
@@ -1523,7 +1519,7 @@ Optional Features:
|
||||
--disable-canberra Do not use libcanberra.
|
||||
--disable-libsodium Do not use libsodium.
|
||||
--disable-acl No check for ACL support.
|
||||
--disable-gpm Don't use gpm (Linux mouse daemon).
|
||||
--enable-gpm=OPTS Use gpm (Linux mouse daemon). default=yes OPTS=yes/no/dynamic
|
||||
--disable-sysmouse Don't use sysmouse (mouse in *BSD console).
|
||||
--disable-nls Don't support NLS (gettext()).
|
||||
|
||||
@@ -4787,7 +4783,7 @@ rm -f core conftest.err conftest.$ac_objext \
|
||||
OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
|
||||
CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
|
||||
|
||||
if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
|
||||
if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
|
||||
with_x=no
|
||||
fi
|
||||
fi
|
||||
@@ -9274,8 +9270,6 @@ SKIP_GTK2=YES
|
||||
SKIP_GTK3=YES
|
||||
SKIP_GNOME=YES
|
||||
SKIP_MOTIF=YES
|
||||
SKIP_ATHENA=YES
|
||||
SKIP_NEXTAW=YES
|
||||
SKIP_PHOTON=YES
|
||||
SKIP_HAIKU=YES
|
||||
GUITYPE=NONE
|
||||
@@ -9335,9 +9329,7 @@ $as_echo "yes/auto - automatic GUI support" >&6; }
|
||||
SKIP_GTK2=
|
||||
SKIP_GTK3=
|
||||
SKIP_GNOME=
|
||||
SKIP_MOTIF=
|
||||
SKIP_ATHENA=
|
||||
SKIP_NEXTAW=;;
|
||||
SKIP_MOTIF=;;
|
||||
gtk2) { $as_echo "$as_me:${as_lineno-$LINENO}: result: GTK+ 2.x GUI support" >&5
|
||||
$as_echo "GTK+ 2.x GUI support" >&6; }
|
||||
SKIP_GTK2=;;
|
||||
@@ -9351,12 +9343,6 @@ $as_echo "GTK+ 3.x GUI support" >&6; }
|
||||
motif) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Motif GUI support" >&5
|
||||
$as_echo "Motif GUI support" >&6; }
|
||||
SKIP_MOTIF=;;
|
||||
athena) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Athena GUI support" >&5
|
||||
$as_echo "Athena GUI support" >&6; }
|
||||
SKIP_ATHENA=;;
|
||||
nextaw) { $as_echo "$as_me:${as_lineno-$LINENO}: result: neXtaw GUI support" >&5
|
||||
$as_echo "neXtaw GUI support" >&6; }
|
||||
SKIP_NEXTAW=;;
|
||||
*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Sorry, $enable_gui GUI is not supported" >&5
|
||||
$as_echo "Sorry, $enable_gui GUI is not supported" >&6; } ;;
|
||||
esac
|
||||
@@ -9433,40 +9419,6 @@ $as_echo "$enable_motif_check" >&6; }
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether or not to look for Athena" >&5
|
||||
$as_echo_n "checking whether or not to look for Athena... " >&6; }
|
||||
# Check whether --enable-athena-check was given.
|
||||
if test "${enable_athena_check+set}" = set; then :
|
||||
enableval=$enable_athena_check;
|
||||
else
|
||||
enable_athena_check="yes"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_athena_check" >&5
|
||||
$as_echo "$enable_athena_check" >&6; }
|
||||
if test "x$enable_athena_check" = "xno"; then
|
||||
SKIP_ATHENA=YES
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether or not to look for neXtaw" >&5
|
||||
$as_echo_n "checking whether or not to look for neXtaw... " >&6; }
|
||||
# Check whether --enable-nextaw-check was given.
|
||||
if test "${enable_nextaw_check+set}" = set; then :
|
||||
enableval=$enable_nextaw_check;
|
||||
else
|
||||
enable_nextaw_check="yes"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_nextaw_check" >&5
|
||||
$as_echo "$enable_nextaw_check" >&6; };
|
||||
if test "x$enable_nextaw_check" = "xno"; then
|
||||
SKIP_NEXTAW=YES
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9735,8 +9687,6 @@ $as_echo "no" >&6; }
|
||||
|
||||
if test "x$GTK_CFLAGS" != "x"; then
|
||||
SKIP_GTK3=YES
|
||||
SKIP_ATHENA=YES
|
||||
SKIP_NEXTAW=YES
|
||||
SKIP_MOTIF=YES
|
||||
GUITYPE=GTK
|
||||
|
||||
@@ -9995,8 +9945,6 @@ $as_echo "no" >&6; }
|
||||
if test "x$GTK_CFLAGS" != "x"; then
|
||||
SKIP_GTK2=YES
|
||||
SKIP_GNOME=YES
|
||||
SKIP_ATHENA=YES
|
||||
SKIP_NEXTAW=YES
|
||||
SKIP_MOTIF=YES
|
||||
GUITYPE=GTK
|
||||
|
||||
@@ -10302,82 +10250,11 @@ $as_echo "<not found>" >&6; }
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_MOTIF"; then
|
||||
SKIP_ATHENA=YES
|
||||
SKIP_NEXTAW=YES
|
||||
GUITYPE=MOTIF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
GUI_X_LIBS=
|
||||
|
||||
if test -z "$SKIP_ATHENA"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if Athena header files can be found" >&5
|
||||
$as_echo_n "checking if Athena header files can be found... " >&6; }
|
||||
cflags_save=$CFLAGS
|
||||
CFLAGS="$CFLAGS $X_CFLAGS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/Xaw/Paned.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }; SKIP_ATHENA=YES
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS=$cflags_save
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_ATHENA"; then
|
||||
GUITYPE=ATHENA
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_NEXTAW"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if neXtaw header files can be found" >&5
|
||||
$as_echo_n "checking if neXtaw header files can be found... " >&6; }
|
||||
cflags_save=$CFLAGS
|
||||
CFLAGS="$CFLAGS $X_CFLAGS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/neXtaw/Paned.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }; SKIP_NEXTAW=YES
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS=$cflags_save
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_NEXTAW"; then
|
||||
GUITYPE=NEXTAW
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
|
||||
if test -z "$SKIP_MOTIF"; then
|
||||
if test -n "$GUI_INC_LOC"; then
|
||||
GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
|
||||
fi
|
||||
@@ -10636,7 +10513,7 @@ done
|
||||
fi
|
||||
|
||||
|
||||
if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
|
||||
if test -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
|
||||
cppflags_save=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
||||
for ac_header in X11/xpm.h X11/Sunkeysym.h
|
||||
@@ -10680,7 +10557,7 @@ $as_echo "X GUI selected; xim has been enabled" >&6; }
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
|
||||
if test -z "$SKIP_MOTIF"; then
|
||||
cppflags_save=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X11/Xmu/Editres.h" >&5
|
||||
@@ -13845,8 +13722,8 @@ rm -f core conftest.err conftest.$ac_objext \
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-gpm argument" >&5
|
||||
$as_echo_n "checking --disable-gpm argument... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-gpm argument" >&5
|
||||
$as_echo_n "checking --enable-gpm argument... " >&6; }
|
||||
# Check whether --enable-gpm was given.
|
||||
if test "${enable_gpm+set}" = set; then :
|
||||
enableval=$enable_gpm;
|
||||
@@ -13855,9 +13732,9 @@ else
|
||||
fi
|
||||
|
||||
|
||||
if test "$enable_gpm" = "yes"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
if test "$enable_gpm" = "yes" -o "$enable_gpm" = "dynamic"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_gpm" >&5
|
||||
$as_echo "$enable_gpm" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gpm" >&5
|
||||
$as_echo_n "checking for gpm... " >&6; }
|
||||
if ${vi_cv_have_gpm+:} false; then :
|
||||
@@ -13889,13 +13766,18 @@ fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_have_gpm" >&5
|
||||
$as_echo "$vi_cv_have_gpm" >&6; }
|
||||
if test $vi_cv_have_gpm = yes; then
|
||||
LIBS="$LIBS -lgpm"
|
||||
if test "$enable_gpm" = "yes"; then
|
||||
LIBS="$LIBS -lgpm"
|
||||
else
|
||||
$as_echo "#define DYNAMIC_GPM 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
$as_echo "#define HAVE_GPM 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-sysmouse argument" >&5
|
||||
|
||||
@@ -921,16 +921,30 @@ do_autocmd(exarg_T *eap, char_u *arg_in, int forceit)
|
||||
if ((STRNCMP(cmd, "++nested", 8) == 0 && VIM_ISWHITE(cmd[8])))
|
||||
{
|
||||
if (nested)
|
||||
{
|
||||
semsg(_(e_duplicate_argument_str), "++nested");
|
||||
return;
|
||||
}
|
||||
nested = TRUE;
|
||||
cmd = skipwhite(cmd + 8);
|
||||
}
|
||||
|
||||
// Check for the old "nested" flag.
|
||||
// Check for the old "nested" flag in legacy script.
|
||||
if (STRNCMP(cmd, "nested", 6) == 0 && VIM_ISWHITE(cmd[6]))
|
||||
{
|
||||
if (in_vim9script())
|
||||
{
|
||||
// If there ever is a :nested command this error should
|
||||
// be removed and "nested" accepted as the start of the
|
||||
// command.
|
||||
emsg(_(e_invalid_command_nested_did_you_mean_plusplus_nested));
|
||||
return;
|
||||
}
|
||||
if (nested)
|
||||
{
|
||||
semsg(_(e_duplicate_argument_str), "nested");
|
||||
return;
|
||||
}
|
||||
nested = TRUE;
|
||||
cmd = skipwhite(cmd + 6);
|
||||
}
|
||||
|
||||
194
src/buffer.c
194
src/buffer.c
@@ -2728,10 +2728,12 @@ ExpandBufnames(
|
||||
int round;
|
||||
char_u *p;
|
||||
int attempt;
|
||||
char_u *patc;
|
||||
char_u *patc = NULL;
|
||||
#ifdef FEAT_VIMINFO
|
||||
bufmatch_T *matches = NULL;
|
||||
#endif
|
||||
int fuzzy;
|
||||
fuzmatch_str_T *fuzmatch = NULL;
|
||||
|
||||
*num_file = 0; // return values in case of FAIL
|
||||
*file = NULL;
|
||||
@@ -2741,32 +2743,42 @@ ExpandBufnames(
|
||||
return FAIL;
|
||||
#endif
|
||||
|
||||
// Make a copy of "pat" and change "^" to "\(^\|[\/]\)".
|
||||
if (*pat == '^')
|
||||
fuzzy = cmdline_fuzzy_complete(pat);
|
||||
|
||||
// Make a copy of "pat" and change "^" to "\(^\|[\/]\)" (if doing regular
|
||||
// expression matching)
|
||||
if (!fuzzy)
|
||||
{
|
||||
patc = alloc(STRLEN(pat) + 11);
|
||||
if (patc == NULL)
|
||||
return FAIL;
|
||||
STRCPY(patc, "\\(^\\|[\\/]\\)");
|
||||
STRCPY(patc + 11, pat + 1);
|
||||
if (*pat == '^')
|
||||
{
|
||||
patc = alloc(STRLEN(pat) + 11);
|
||||
if (patc == NULL)
|
||||
return FAIL;
|
||||
STRCPY(patc, "\\(^\\|[\\/]\\)");
|
||||
STRCPY(patc + 11, pat + 1);
|
||||
}
|
||||
else
|
||||
patc = pat;
|
||||
}
|
||||
else
|
||||
patc = pat;
|
||||
|
||||
// attempt == 0: try match with '\<', match at start of word
|
||||
// attempt == 1: try match without '\<', match anywhere
|
||||
for (attempt = 0; attempt <= 1; ++attempt)
|
||||
for (attempt = 0; attempt <= (fuzzy ? 0 : 1); ++attempt)
|
||||
{
|
||||
regmatch_T regmatch;
|
||||
int score = 0;
|
||||
|
||||
if (attempt > 0 && patc == pat)
|
||||
break; // there was no anchor, no need to try again
|
||||
regmatch.regprog = vim_regcomp(patc + attempt * 11, RE_MAGIC);
|
||||
if (regmatch.regprog == NULL)
|
||||
if (!fuzzy)
|
||||
{
|
||||
if (patc != pat)
|
||||
vim_free(patc);
|
||||
return FAIL;
|
||||
if (attempt > 0 && patc == pat)
|
||||
break; // there was no anchor, no need to try again
|
||||
regmatch.regprog = vim_regcomp(patc + attempt * 11, RE_MAGIC);
|
||||
if (regmatch.regprog == NULL)
|
||||
{
|
||||
if (patc != pat)
|
||||
vim_free(patc);
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
// round == 1: Count the matches.
|
||||
@@ -2786,75 +2798,127 @@ ExpandBufnames(
|
||||
continue;
|
||||
#endif
|
||||
|
||||
p = buflist_match(®match, buf, p_wic);
|
||||
if (p != NULL)
|
||||
if (!fuzzy)
|
||||
p = buflist_match(®match, buf, p_wic);
|
||||
else
|
||||
{
|
||||
if (round == 1)
|
||||
++count;
|
||||
else
|
||||
p = NULL;
|
||||
// first try matching with the short file name
|
||||
if ((score = fuzzy_match_str(buf->b_sfname, pat)) != 0)
|
||||
p = buf->b_sfname;
|
||||
if (p == NULL)
|
||||
{
|
||||
if (options & WILD_HOME_REPLACE)
|
||||
p = home_replace_save(buf, p);
|
||||
else
|
||||
p = vim_strsave(p);
|
||||
#ifdef FEAT_VIMINFO
|
||||
if (matches != NULL)
|
||||
{
|
||||
matches[count].buf = buf;
|
||||
matches[count].match = p;
|
||||
count++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
(*file)[count++] = p;
|
||||
// next try matching with the full path file name
|
||||
if ((score = fuzzy_match_str(buf->b_ffname, pat)) != 0)
|
||||
p = buf->b_ffname;
|
||||
}
|
||||
}
|
||||
|
||||
if (p == NULL)
|
||||
continue;
|
||||
|
||||
if (round == 1)
|
||||
{
|
||||
++count;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (options & WILD_HOME_REPLACE)
|
||||
p = home_replace_save(buf, p);
|
||||
else
|
||||
p = vim_strsave(p);
|
||||
|
||||
if (!fuzzy)
|
||||
{
|
||||
#ifdef FEAT_VIMINFO
|
||||
if (matches != NULL)
|
||||
{
|
||||
matches[count].buf = buf;
|
||||
matches[count].match = p;
|
||||
count++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
(*file)[count++] = p;
|
||||
}
|
||||
else
|
||||
{
|
||||
fuzmatch[count].idx = count;
|
||||
fuzmatch[count].str = p;
|
||||
fuzmatch[count].score = score;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count == 0) // no match found, break here
|
||||
break;
|
||||
if (round == 1)
|
||||
{
|
||||
*file = ALLOC_MULT(char_u *, count);
|
||||
if (*file == NULL)
|
||||
if (!fuzzy)
|
||||
{
|
||||
vim_regfree(regmatch.regprog);
|
||||
if (patc != pat)
|
||||
vim_free(patc);
|
||||
return FAIL;
|
||||
}
|
||||
*file = ALLOC_MULT(char_u *, count);
|
||||
if (*file == NULL)
|
||||
{
|
||||
vim_regfree(regmatch.regprog);
|
||||
if (patc != pat)
|
||||
vim_free(patc);
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef FEAT_VIMINFO
|
||||
if (options & WILD_BUFLASTUSED)
|
||||
matches = ALLOC_MULT(bufmatch_T, count);
|
||||
if (options & WILD_BUFLASTUSED)
|
||||
matches = ALLOC_MULT(bufmatch_T, count);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
fuzmatch = ALLOC_MULT(fuzmatch_str_T, count);
|
||||
if (fuzmatch == NULL)
|
||||
{
|
||||
*num_file = 0;
|
||||
*file = NULL;
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vim_regfree(regmatch.regprog);
|
||||
if (count) // match(es) found, break here
|
||||
break;
|
||||
|
||||
if (!fuzzy)
|
||||
{
|
||||
vim_regfree(regmatch.regprog);
|
||||
if (count) // match(es) found, break here
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (patc != pat)
|
||||
if (!fuzzy && patc != pat)
|
||||
vim_free(patc);
|
||||
|
||||
#ifdef FEAT_VIMINFO
|
||||
if (matches != NULL)
|
||||
if (!fuzzy)
|
||||
{
|
||||
int i;
|
||||
if (count > 1)
|
||||
qsort(matches, count, sizeof(bufmatch_T), buf_compare);
|
||||
// if the current buffer is first in the list, place it at the end
|
||||
if (matches[0].buf == curbuf)
|
||||
if (matches != NULL)
|
||||
{
|
||||
for (i = 1; i < count; i++)
|
||||
(*file)[i-1] = matches[i].match;
|
||||
(*file)[count-1] = matches[0].match;
|
||||
int i;
|
||||
if (count > 1)
|
||||
qsort(matches, count, sizeof(bufmatch_T), buf_compare);
|
||||
// if the current buffer is first in the list, place it at the end
|
||||
if (matches[0].buf == curbuf)
|
||||
{
|
||||
for (i = 1; i < count; i++)
|
||||
(*file)[i-1] = matches[i].match;
|
||||
(*file)[count-1] = matches[0].match;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < count; i++)
|
||||
(*file)[i] = matches[i].match;
|
||||
}
|
||||
vim_free(matches);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < count; i++)
|
||||
(*file)[i] = matches[i].match;
|
||||
}
|
||||
vim_free(matches);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fuzzymatches_to_strmatches(fuzmatch, file, count, FALSE) == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -558,7 +558,7 @@ transchar_nonprint(buf_T *buf, char_u *charbuf, int c)
|
||||
charbuf[1] = c ^ 0x40; // DEL displayed as ^?
|
||||
charbuf[2] = NUL;
|
||||
}
|
||||
else if (enc_utf8 && c >= 0x80)
|
||||
else if (enc_utf8)
|
||||
{
|
||||
transchar_hex(charbuf, c);
|
||||
}
|
||||
@@ -1037,9 +1037,10 @@ win_lbr_chartabsize(
|
||||
* May have to add something for 'breakindent' and/or 'showbreak'
|
||||
* string at start of line.
|
||||
* Set *headp to the size of what we add.
|
||||
* Do not use 'showbreak' at the NUL after the text.
|
||||
*/
|
||||
added = 0;
|
||||
sbr = get_showbreak_value(wp);
|
||||
sbr = c == NUL ? empty_option : get_showbreak_value(wp);
|
||||
if ((*sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && col != 0)
|
||||
{
|
||||
colnr_T sbrlen = 0;
|
||||
|
||||
529
src/cmdexpand.c
529
src/cmdexpand.c
@@ -16,14 +16,14 @@
|
||||
static int cmd_showtail; // Only show path tail in lists ?
|
||||
|
||||
static void set_expand_context(expand_T *xp);
|
||||
static int ExpandGeneric(expand_T *xp, regmatch_T *regmatch,
|
||||
static int ExpandGeneric(char_u *pat, expand_T *xp, regmatch_T *regmatch,
|
||||
char_u ***matches, int *numMatches,
|
||||
char_u *((*func)(expand_T *, int)), int escaped);
|
||||
static int ExpandFromContext(expand_T *xp, char_u *, char_u ***, int *, int);
|
||||
static int expand_showtail(expand_T *xp);
|
||||
static int expand_shellcmd(char_u *filepat, char_u ***matches, int *numMatches, int flagsarg);
|
||||
#if defined(FEAT_EVAL)
|
||||
static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, char_u ***matches, int *numMatches);
|
||||
static int ExpandUserDefined(char_u *pat, expand_T *xp, regmatch_T *regmatch, char_u ***matches, int *numMatches);
|
||||
static int ExpandUserList(expand_T *xp, char_u ***matches, int *numMatches);
|
||||
#endif
|
||||
|
||||
@@ -39,6 +39,42 @@ static int compl_selected;
|
||||
|
||||
#define SHOW_FILE_TEXT(m) (showtail ? sm_gettail(matches[m]) : matches[m])
|
||||
|
||||
/*
|
||||
* Returns TRUE if fuzzy completion is supported for a given cmdline completion
|
||||
* context.
|
||||
*/
|
||||
static int
|
||||
cmdline_fuzzy_completion_supported(expand_T *xp)
|
||||
{
|
||||
return (vim_strchr(p_wop, WOP_FUZZY) != NULL
|
||||
&& xp->xp_context != EXPAND_BOOL_SETTINGS
|
||||
&& xp->xp_context != EXPAND_COLORS
|
||||
&& xp->xp_context != EXPAND_COMPILER
|
||||
&& xp->xp_context != EXPAND_DIRECTORIES
|
||||
&& xp->xp_context != EXPAND_FILES
|
||||
&& xp->xp_context != EXPAND_FILES_IN_PATH
|
||||
&& xp->xp_context != EXPAND_FILETYPE
|
||||
&& xp->xp_context != EXPAND_HELP
|
||||
&& xp->xp_context != EXPAND_OLD_SETTING
|
||||
&& xp->xp_context != EXPAND_OWNSYNTAX
|
||||
&& xp->xp_context != EXPAND_PACKADD
|
||||
&& xp->xp_context != EXPAND_SHELLCMD
|
||||
&& xp->xp_context != EXPAND_TAGS
|
||||
&& xp->xp_context != EXPAND_TAGS_LISTFILES
|
||||
&& xp->xp_context != EXPAND_USER_LIST);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns TRUE if fuzzy completion for cmdline completion is enabled and
|
||||
* 'fuzzystr' is not empty. If search pattern is empty, then don't use fuzzy
|
||||
* matching.
|
||||
*/
|
||||
int
|
||||
cmdline_fuzzy_complete(char_u *fuzzystr)
|
||||
{
|
||||
return vim_strchr(p_wop, WOP_FUZZY) != NULL && *fuzzystr != NUL;
|
||||
}
|
||||
|
||||
/*
|
||||
* sort function for the completion matches.
|
||||
* <SNR> functions should be sorted to the end.
|
||||
@@ -188,16 +224,22 @@ nextwild(
|
||||
i = (int)(xp->xp_pattern - ccline->cmdbuff);
|
||||
xp->xp_pattern_len = ccline->cmdpos - i;
|
||||
|
||||
if (type == WILD_NEXT || type == WILD_PREV)
|
||||
if (type == WILD_NEXT || type == WILD_PREV
|
||||
|| type == WILD_PAGEUP || type == WILD_PAGEDOWN)
|
||||
{
|
||||
// Get next/previous match for a previous expanded pattern.
|
||||
p2 = ExpandOne(xp, NULL, NULL, 0, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cmdline_fuzzy_completion_supported(xp))
|
||||
// If fuzzy matching, don't modify the search string
|
||||
p1 = vim_strsave(xp->xp_pattern);
|
||||
else
|
||||
p1 = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
|
||||
|
||||
// Translate string into pattern and expand it.
|
||||
if ((p1 = addstar(xp->xp_pattern, xp->xp_pattern_len,
|
||||
xp->xp_context)) == NULL)
|
||||
if (p1 == NULL)
|
||||
p2 = NULL;
|
||||
else
|
||||
{
|
||||
@@ -335,9 +377,13 @@ int cmdline_pum_active(void)
|
||||
*/
|
||||
void cmdline_pum_remove(void)
|
||||
{
|
||||
int save_p_lz = p_lz;
|
||||
|
||||
pum_undisplay();
|
||||
VIM_CLEAR(compl_match_array);
|
||||
p_lz = FALSE; // avoid the popup menu hanging around
|
||||
update_screen(0);
|
||||
p_lz = save_p_lz;
|
||||
redrawcmd();
|
||||
}
|
||||
|
||||
@@ -359,7 +405,7 @@ int cmdline_compl_startcol(void)
|
||||
|
||||
/*
|
||||
* Get the next or prev cmdline completion match. The index of the match is set
|
||||
* in 'p_findex'
|
||||
* in "p_findex"
|
||||
*/
|
||||
static char_u *
|
||||
get_next_or_prev_match(
|
||||
@@ -369,6 +415,7 @@ get_next_or_prev_match(
|
||||
char_u *orig_save)
|
||||
{
|
||||
int findex = *p_findex;
|
||||
int ht;
|
||||
|
||||
if (xp->xp_numfiles <= 0)
|
||||
return NULL;
|
||||
@@ -379,11 +426,50 @@ get_next_or_prev_match(
|
||||
findex = xp->xp_numfiles;
|
||||
--findex;
|
||||
}
|
||||
else // mode == WILD_NEXT
|
||||
else if (mode == WILD_NEXT)
|
||||
++findex;
|
||||
else if (mode == WILD_PAGEUP)
|
||||
{
|
||||
if (findex == 0)
|
||||
// at the first entry, don't select any entries
|
||||
findex = -1;
|
||||
else if (findex == -1)
|
||||
// no entry is selected. select the last entry
|
||||
findex = xp->xp_numfiles - 1;
|
||||
else
|
||||
{
|
||||
// go up by the pum height
|
||||
ht = pum_get_height();
|
||||
if (ht > 3)
|
||||
ht -= 2;
|
||||
findex -= ht;
|
||||
if (findex < 0)
|
||||
// few entries left, select the first entry
|
||||
findex = 0;
|
||||
}
|
||||
}
|
||||
else // mode == WILD_PAGEDOWN
|
||||
{
|
||||
if (findex == xp->xp_numfiles - 1)
|
||||
// at the last entry, don't select any entries
|
||||
findex = -1;
|
||||
else if (findex == -1)
|
||||
// no entry is selected. select the first entry
|
||||
findex = 0;
|
||||
else
|
||||
{
|
||||
// go down by the pum height
|
||||
ht = pum_get_height();
|
||||
if (ht > 3)
|
||||
ht -= 2;
|
||||
findex += ht;
|
||||
if (findex >= xp->xp_numfiles)
|
||||
// few entries left, select the last entry
|
||||
findex = xp->xp_numfiles - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// When wrapping around, return the original string, set findex to
|
||||
// -1.
|
||||
// When wrapping around, return the original string, set findex to -1.
|
||||
if (findex < 0)
|
||||
{
|
||||
if (orig_save == NULL)
|
||||
@@ -540,7 +626,7 @@ find_longest_match(expand_T *xp, int options)
|
||||
}
|
||||
|
||||
/*
|
||||
* Do wildcard expansion on the string 'str'.
|
||||
* Do wildcard expansion on the string "str".
|
||||
* Chars that should not be expanded must be preceded with a backslash.
|
||||
* Return a pointer to allocated memory containing the new string.
|
||||
* Return NULL for failure.
|
||||
@@ -594,7 +680,8 @@ ExpandOne(
|
||||
long_u len;
|
||||
|
||||
// first handle the case of using an old match
|
||||
if (mode == WILD_NEXT || mode == WILD_PREV)
|
||||
if (mode == WILD_NEXT || mode == WILD_PREV
|
||||
|| mode == WILD_PAGEUP || mode == WILD_PAGEDOWN)
|
||||
return get_next_or_prev_match(mode, xp, &findex, orig_save);
|
||||
|
||||
if (mode == WILD_CANCEL)
|
||||
@@ -1169,13 +1256,16 @@ set_cmd_index(char_u *cmd, exarg_T *eap, expand_T *xp, int *complp)
|
||||
{
|
||||
char_u *p = NULL;
|
||||
int len = 0;
|
||||
int fuzzy = cmdline_fuzzy_complete(cmd);
|
||||
|
||||
// Isolate the command and search for it in the command table.
|
||||
// Exceptions:
|
||||
// - the 'k' command can directly be followed by any character, but
|
||||
// do accept "keepmarks", "keepalt" and "keepjumps".
|
||||
// - the 'k' command can directly be followed by any character, but do
|
||||
// accept "keepmarks", "keepalt" and "keepjumps". As fuzzy matching can
|
||||
// find matches anywhere in the command name, do this only for command
|
||||
// expansion based on regular expression and not for fuzzy matching.
|
||||
// - the 's' command can be followed directly by 'c', 'g', 'i', 'I' or 'r'
|
||||
if (*cmd == 'k' && cmd[1] != 'e')
|
||||
if (!fuzzy && (*cmd == 'k' && cmd[1] != 'e'))
|
||||
{
|
||||
eap->cmdidx = CMD_k;
|
||||
p = cmd + 1;
|
||||
@@ -1210,7 +1300,9 @@ set_cmd_index(char_u *cmd, exarg_T *eap, expand_T *xp, int *complp)
|
||||
|
||||
eap->cmdidx = excmd_get_cmdidx(cmd, len);
|
||||
|
||||
if (cmd[0] >= 'A' && cmd[0] <= 'Z')
|
||||
// User defined commands support alphanumeric characters.
|
||||
// Also when doing fuzzy expansion, support alphanumeric characters.
|
||||
if ((cmd[0] >= 'A' && cmd[0] <= 'Z') || (fuzzy && *p != NUL))
|
||||
while (ASCII_ISALNUM(*p) || *p == '*') // Allow * wild card
|
||||
++p;
|
||||
}
|
||||
@@ -1552,6 +1644,73 @@ set_context_in_lang_cmd(expand_T *xp, char_u *arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
static enum
|
||||
{
|
||||
EXP_BREAKPT_ADD, // expand ":breakadd" sub-commands
|
||||
EXP_BREAKPT_DEL, // expand ":breakdel" sub-commands
|
||||
EXP_PROFDEL // expand ":profdel" sub-commands
|
||||
} breakpt_expand_what;
|
||||
|
||||
/*
|
||||
* Set the completion context for the :breakadd command. Always returns NULL.
|
||||
*/
|
||||
static char_u *
|
||||
set_context_in_breakadd_cmd(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
|
||||
{
|
||||
char_u *p;
|
||||
char_u *subcmd_start;
|
||||
|
||||
xp->xp_context = EXPAND_BREAKPOINT;
|
||||
xp->xp_pattern = arg;
|
||||
|
||||
if (cmdidx == CMD_breakadd)
|
||||
breakpt_expand_what = EXP_BREAKPT_ADD;
|
||||
else if (cmdidx == CMD_breakdel)
|
||||
breakpt_expand_what = EXP_BREAKPT_DEL;
|
||||
else
|
||||
breakpt_expand_what = EXP_PROFDEL;
|
||||
|
||||
p = skipwhite(arg);
|
||||
if (*p == NUL)
|
||||
return NULL;
|
||||
subcmd_start = p;
|
||||
|
||||
if (STRNCMP("file ", p, 5) == 0 || STRNCMP("func ", p, 5) == 0)
|
||||
{
|
||||
// :breakadd file [lnum] <filename>
|
||||
// :breakadd func [lnum] <funcname>
|
||||
p += 4;
|
||||
p = skipwhite(p);
|
||||
|
||||
// skip line number (if specified)
|
||||
if (VIM_ISDIGIT(*p))
|
||||
{
|
||||
p = skipdigits(p);
|
||||
if (*p != ' ')
|
||||
{
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
return NULL;
|
||||
}
|
||||
p = skipwhite(p);
|
||||
}
|
||||
if (STRNCMP("file", subcmd_start, 4) == 0)
|
||||
xp->xp_context = EXPAND_FILES;
|
||||
else
|
||||
xp->xp_context = EXPAND_USER_FUNC;
|
||||
xp->xp_pattern = p;
|
||||
}
|
||||
else if (STRNCMP("expr ", p, 5) == 0)
|
||||
{
|
||||
// :breakadd expr <expression>
|
||||
xp->xp_context = EXPAND_EXPRESSION;
|
||||
xp->xp_pattern = skipwhite(p + 5);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set the completion context in 'xp' for command 'cmd' with index 'cmdidx'.
|
||||
* The argument to the command is 'arg' and the argument flags is 'argt'.
|
||||
@@ -1908,6 +2067,13 @@ set_context_by_cmdname(
|
||||
xp->xp_pattern = arg;
|
||||
break;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
case CMD_breakadd:
|
||||
case CMD_profdel:
|
||||
case CMD_breakdel:
|
||||
return set_context_in_breakadd_cmd(xp, arg, cmdidx);
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2188,9 +2354,15 @@ expand_cmdline(
|
||||
|
||||
// add star to file name, or convert to regexp if not exp. files.
|
||||
xp->xp_pattern_len = (int)(str + col - xp->xp_pattern);
|
||||
file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
|
||||
if (file_str == NULL)
|
||||
return EXPAND_UNSUCCESSFUL;
|
||||
if (cmdline_fuzzy_completion_supported(xp))
|
||||
// If fuzzy matching, don't modify the search string
|
||||
file_str = vim_strsave(xp->xp_pattern);
|
||||
else
|
||||
{
|
||||
file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
|
||||
if (file_str == NULL)
|
||||
return EXPAND_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
if (p_wic)
|
||||
options += WILD_ICASE;
|
||||
@@ -2292,6 +2464,39 @@ get_behave_arg(expand_T *xp UNUSED, int idx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
# ifdef FEAT_EVAL
|
||||
/*
|
||||
* Function given to ExpandGeneric() to obtain the possible arguments of the
|
||||
* ":breakadd {expr, file, func, here}" command.
|
||||
* ":breakdel {func, file, here}" command.
|
||||
*/
|
||||
static char_u *
|
||||
get_breakadd_arg(expand_T *xp UNUSED, int idx)
|
||||
{
|
||||
char *opts[] = {"expr", "file", "func", "here"};
|
||||
|
||||
if (idx >=0 && idx <= 3)
|
||||
{
|
||||
// breakadd {expr, file, func, here}
|
||||
if (breakpt_expand_what == EXP_BREAKPT_ADD)
|
||||
return (char_u *)opts[idx];
|
||||
else if (breakpt_expand_what == EXP_BREAKPT_DEL)
|
||||
{
|
||||
// breakdel {func, file, here}
|
||||
if (idx <= 2)
|
||||
return (char_u *)opts[idx + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
// profdel {func, file}
|
||||
if (idx <= 1)
|
||||
return (char_u *)opts[idx + 1];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function given to ExpandGeneric() to obtain the possible arguments of the
|
||||
* ":messages {clear}" command.
|
||||
@@ -2317,7 +2522,8 @@ get_mapclear_arg(expand_T *xp UNUSED, int idx)
|
||||
*/
|
||||
static int
|
||||
ExpandOther(
|
||||
expand_T *xp,
|
||||
char_u *pat,
|
||||
expand_T *xp,
|
||||
regmatch_T *rmp,
|
||||
char_u ***matches,
|
||||
int *numMatches)
|
||||
@@ -2340,42 +2546,45 @@ ExpandOther(
|
||||
{EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE},
|
||||
{EXPAND_USER_NARGS, get_user_cmd_nargs, FALSE, TRUE},
|
||||
{EXPAND_USER_COMPLETE, get_user_cmd_complete, FALSE, TRUE},
|
||||
# ifdef FEAT_EVAL
|
||||
#ifdef FEAT_EVAL
|
||||
{EXPAND_USER_VARS, get_user_var_name, FALSE, TRUE},
|
||||
{EXPAND_FUNCTIONS, get_function_name, FALSE, TRUE},
|
||||
{EXPAND_USER_FUNC, get_user_func_name, FALSE, TRUE},
|
||||
{EXPAND_DISASSEMBLE, get_disassemble_argument, FALSE, TRUE},
|
||||
{EXPAND_EXPRESSION, get_expr_name, FALSE, TRUE},
|
||||
# endif
|
||||
# ifdef FEAT_MENU
|
||||
#endif
|
||||
#ifdef FEAT_MENU
|
||||
{EXPAND_MENUS, get_menu_name, FALSE, TRUE},
|
||||
{EXPAND_MENUNAMES, get_menu_names, FALSE, TRUE},
|
||||
# endif
|
||||
# ifdef FEAT_SYN_HL
|
||||
#endif
|
||||
#ifdef FEAT_SYN_HL
|
||||
{EXPAND_SYNTAX, get_syntax_name, TRUE, TRUE},
|
||||
# endif
|
||||
# ifdef FEAT_PROFILE
|
||||
#endif
|
||||
#ifdef FEAT_PROFILE
|
||||
{EXPAND_SYNTIME, get_syntime_arg, TRUE, TRUE},
|
||||
# endif
|
||||
#endif
|
||||
{EXPAND_HIGHLIGHT, get_highlight_name, TRUE, TRUE},
|
||||
{EXPAND_EVENTS, get_event_name, TRUE, FALSE},
|
||||
{EXPAND_AUGROUP, get_augroup_name, TRUE, FALSE},
|
||||
# ifdef FEAT_CSCOPE
|
||||
#ifdef FEAT_CSCOPE
|
||||
{EXPAND_CSCOPE, get_cscope_name, TRUE, TRUE},
|
||||
# endif
|
||||
# ifdef FEAT_SIGNS
|
||||
#endif
|
||||
#ifdef FEAT_SIGNS
|
||||
{EXPAND_SIGN, get_sign_name, TRUE, TRUE},
|
||||
# endif
|
||||
# ifdef FEAT_PROFILE
|
||||
#endif
|
||||
#ifdef FEAT_PROFILE
|
||||
{EXPAND_PROFILE, get_profile_name, TRUE, TRUE},
|
||||
# endif
|
||||
# if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
|
||||
#endif
|
||||
#if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
|
||||
{EXPAND_LANGUAGE, get_lang_arg, TRUE, FALSE},
|
||||
{EXPAND_LOCALES, get_locales, TRUE, FALSE},
|
||||
# endif
|
||||
#endif
|
||||
{EXPAND_ENV_VARS, get_env_name, TRUE, TRUE},
|
||||
{EXPAND_USER, get_users, TRUE, FALSE},
|
||||
{EXPAND_ARGLIST, get_arglist_name, TRUE, FALSE},
|
||||
#ifdef FEAT_EVAL
|
||||
{EXPAND_BREAKPOINT, get_breakadd_arg, TRUE, TRUE},
|
||||
#endif
|
||||
};
|
||||
int i;
|
||||
int ret = FAIL;
|
||||
@@ -2388,7 +2597,7 @@ ExpandOther(
|
||||
{
|
||||
if (tab[i].ic)
|
||||
rmp->rm_ic = TRUE;
|
||||
ret = ExpandGeneric(xp, rmp, matches, numMatches,
|
||||
ret = ExpandGeneric(pat, xp, rmp, matches, numMatches,
|
||||
tab[i].func, tab[i].escaped);
|
||||
break;
|
||||
}
|
||||
@@ -2437,6 +2646,8 @@ ExpandFromContext(
|
||||
int ret;
|
||||
int flags;
|
||||
char_u *tofree = NULL;
|
||||
int fuzzy = cmdline_fuzzy_complete(pat)
|
||||
&& cmdline_fuzzy_completion_supported(xp);
|
||||
|
||||
flags = map_wildopts_to_ewflags(options);
|
||||
|
||||
@@ -2521,26 +2732,30 @@ ExpandFromContext(
|
||||
pat = tofree;
|
||||
}
|
||||
|
||||
regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
|
||||
if (regmatch.regprog == NULL)
|
||||
return FAIL;
|
||||
if (!fuzzy)
|
||||
{
|
||||
regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
|
||||
if (regmatch.regprog == NULL)
|
||||
return FAIL;
|
||||
|
||||
// set ignore-case according to p_ic, p_scs and pat
|
||||
regmatch.rm_ic = ignorecase(pat);
|
||||
// set ignore-case according to p_ic, p_scs and pat
|
||||
regmatch.rm_ic = ignorecase(pat);
|
||||
}
|
||||
|
||||
if (xp->xp_context == EXPAND_SETTINGS
|
||||
|| xp->xp_context == EXPAND_BOOL_SETTINGS)
|
||||
ret = ExpandSettings(xp, ®match, numMatches, matches);
|
||||
ret = ExpandSettings(xp, ®match, pat, numMatches, matches);
|
||||
else if (xp->xp_context == EXPAND_MAPPINGS)
|
||||
ret = ExpandMappings(®match, numMatches, matches);
|
||||
ret = ExpandMappings(pat, ®match, numMatches, matches);
|
||||
# if defined(FEAT_EVAL)
|
||||
else if (xp->xp_context == EXPAND_USER_DEFINED)
|
||||
ret = ExpandUserDefined(xp, ®match, matches, numMatches);
|
||||
ret = ExpandUserDefined(pat, xp, ®match, matches, numMatches);
|
||||
# endif
|
||||
else
|
||||
ret = ExpandOther(xp, ®match, matches, numMatches);
|
||||
ret = ExpandOther(pat, xp, ®match, matches, numMatches);
|
||||
|
||||
vim_regfree(regmatch.regprog);
|
||||
if (!fuzzy)
|
||||
vim_regfree(regmatch.regprog);
|
||||
vim_free(tofree);
|
||||
|
||||
return ret;
|
||||
@@ -2553,10 +2768,14 @@ ExpandFromContext(
|
||||
* obtain strings, one by one. The strings are matched against a regexp
|
||||
* program. Matching strings are copied into an array, which is returned.
|
||||
*
|
||||
* If 'fuzzy' is TRUE, then fuzzy matching is used. Otherwise, regex matching
|
||||
* is used.
|
||||
*
|
||||
* Returns OK when no problems encountered, FAIL for error (out of memory).
|
||||
*/
|
||||
static int
|
||||
ExpandGeneric(
|
||||
char_u *pat,
|
||||
expand_T *xp,
|
||||
regmatch_T *regmatch,
|
||||
char_u ***matches,
|
||||
@@ -2566,80 +2785,134 @@ ExpandGeneric(
|
||||
int escaped)
|
||||
{
|
||||
int i;
|
||||
int count = 0;
|
||||
int round;
|
||||
garray_T ga;
|
||||
char_u *str;
|
||||
fuzmatch_str_T *fuzmatch = NULL;
|
||||
int score = 0;
|
||||
int fuzzy;
|
||||
int match;
|
||||
|
||||
// do this loop twice:
|
||||
// round == 0: count the number of matching names
|
||||
// round == 1: copy the matching names into allocated memory
|
||||
for (round = 0; round <= 1; ++round)
|
||||
fuzzy = cmdline_fuzzy_complete(pat);
|
||||
*matches = NULL;
|
||||
*numMatches = 0;
|
||||
|
||||
if (!fuzzy)
|
||||
ga_init2(&ga, sizeof(char *), 30);
|
||||
else
|
||||
ga_init2(&ga, sizeof(fuzmatch_str_T), 30);
|
||||
|
||||
for (i = 0; ; ++i)
|
||||
{
|
||||
for (i = 0; ; ++i)
|
||||
{
|
||||
str = (*func)(xp, i);
|
||||
if (str == NULL) // end of list
|
||||
break;
|
||||
if (*str == NUL) // skip empty strings
|
||||
continue;
|
||||
str = (*func)(xp, i);
|
||||
if (str == NULL) // end of list
|
||||
break;
|
||||
if (*str == NUL) // skip empty strings
|
||||
continue;
|
||||
|
||||
if (vim_regexec(regmatch, str, (colnr_T)0))
|
||||
if (xp->xp_pattern[0] != NUL)
|
||||
{
|
||||
if (!fuzzy)
|
||||
match = vim_regexec(regmatch, str, (colnr_T)0);
|
||||
else
|
||||
{
|
||||
if (round)
|
||||
{
|
||||
if (escaped)
|
||||
str = vim_strsave_escaped(str, (char_u *)" \t\\.");
|
||||
else
|
||||
str = vim_strsave(str);
|
||||
if (str == NULL)
|
||||
{
|
||||
FreeWild(count, *matches);
|
||||
*numMatches = 0;
|
||||
*matches = NULL;
|
||||
return FAIL;
|
||||
}
|
||||
(*matches)[count] = str;
|
||||
# ifdef FEAT_MENU
|
||||
if (func == get_menu_names && str != NULL)
|
||||
{
|
||||
// test for separator added by get_menu_names()
|
||||
str += STRLEN(str) - 1;
|
||||
if (*str == '\001')
|
||||
*str = '.';
|
||||
}
|
||||
# endif
|
||||
}
|
||||
++count;
|
||||
score = fuzzy_match_str(str, pat);
|
||||
match = (score != 0);
|
||||
}
|
||||
}
|
||||
if (round == 0)
|
||||
else
|
||||
match = TRUE;
|
||||
|
||||
if (!match)
|
||||
continue;
|
||||
|
||||
if (escaped)
|
||||
str = vim_strsave_escaped(str, (char_u *)" \t\\.");
|
||||
else
|
||||
str = vim_strsave(str);
|
||||
if (str == NULL)
|
||||
{
|
||||
if (count == 0)
|
||||
return OK;
|
||||
*matches = ALLOC_MULT(char_u *, count);
|
||||
if (*matches == NULL)
|
||||
if (!fuzzy)
|
||||
{
|
||||
*numMatches = 0;
|
||||
*matches = NULL;
|
||||
ga_clear_strings(&ga);
|
||||
return FAIL;
|
||||
}
|
||||
*numMatches = count;
|
||||
count = 0;
|
||||
|
||||
for (i = 0; i < ga.ga_len; ++i)
|
||||
{
|
||||
fuzmatch = &((fuzmatch_str_T *)ga.ga_data)[i];
|
||||
vim_free(fuzmatch->str);
|
||||
}
|
||||
ga_clear(&ga);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (ga_grow(&ga, 1) == FAIL)
|
||||
{
|
||||
vim_free(str);
|
||||
break;
|
||||
}
|
||||
|
||||
if (fuzzy)
|
||||
{
|
||||
fuzmatch = &((fuzmatch_str_T *)ga.ga_data)[ga.ga_len];
|
||||
fuzmatch->idx = ga.ga_len;
|
||||
fuzmatch->str = str;
|
||||
fuzmatch->score = score;
|
||||
}
|
||||
else
|
||||
((char_u **)ga.ga_data)[ga.ga_len] = str;
|
||||
|
||||
# ifdef FEAT_MENU
|
||||
if (func == get_menu_names)
|
||||
{
|
||||
// test for separator added by get_menu_names()
|
||||
str += STRLEN(str) - 1;
|
||||
if (*str == '\001')
|
||||
*str = '.';
|
||||
}
|
||||
# endif
|
||||
|
||||
++ga.ga_len;
|
||||
}
|
||||
|
||||
if (ga.ga_len == 0)
|
||||
return OK;
|
||||
|
||||
// Sort the results. Keep menu's in the specified order.
|
||||
if (xp->xp_context != EXPAND_MENUNAMES && xp->xp_context != EXPAND_MENUS)
|
||||
if (!fuzzy && xp->xp_context != EXPAND_MENUNAMES
|
||||
&& xp->xp_context != EXPAND_MENUS)
|
||||
{
|
||||
if (xp->xp_context == EXPAND_EXPRESSION
|
||||
|| xp->xp_context == EXPAND_FUNCTIONS
|
||||
|| xp->xp_context == EXPAND_USER_FUNC
|
||||
|| xp->xp_context == EXPAND_DISASSEMBLE)
|
||||
// <SNR> functions should be sorted to the end.
|
||||
qsort((void *)*matches, (size_t)*numMatches, sizeof(char_u *),
|
||||
qsort((void *)ga.ga_data, (size_t)ga.ga_len, sizeof(char_u *),
|
||||
sort_func_compare);
|
||||
else
|
||||
sort_strings(*matches, *numMatches);
|
||||
sort_strings((char_u **)ga.ga_data, ga.ga_len);
|
||||
}
|
||||
|
||||
if (!fuzzy)
|
||||
{
|
||||
*matches = ga.ga_data;
|
||||
*numMatches = ga.ga_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
int funcsort = FALSE;
|
||||
|
||||
if (xp->xp_context == EXPAND_EXPRESSION
|
||||
|| xp->xp_context == EXPAND_FUNCTIONS
|
||||
|| xp->xp_context == EXPAND_USER_FUNC
|
||||
|| xp->xp_context == EXPAND_DISASSEMBLE)
|
||||
// <SNR> functions should be sorted to the end.
|
||||
funcsort = TRUE;
|
||||
|
||||
if (fuzzymatches_to_strmatches(ga.ga_data, matches, ga.ga_len,
|
||||
funcsort) == FAIL)
|
||||
return FAIL;
|
||||
*numMatches = ga.ga_len;
|
||||
}
|
||||
|
||||
#if defined(FEAT_SYN_HL)
|
||||
@@ -2647,6 +2920,7 @@ ExpandGeneric(
|
||||
// they don't show up when getting normal highlight names by ID.
|
||||
reset_expand_highlight();
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -2863,10 +3137,12 @@ call_user_expand_func(
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand names with a function defined by the user.
|
||||
* Expand names with a function defined by the user (EXPAND_USER_DEFINED and
|
||||
* EXPAND_USER_LIST).
|
||||
*/
|
||||
static int
|
||||
ExpandUserDefined(
|
||||
char_u *pat,
|
||||
expand_T *xp,
|
||||
regmatch_T *regmatch,
|
||||
char_u ***matches,
|
||||
@@ -2877,15 +3153,23 @@ ExpandUserDefined(
|
||||
char_u *e;
|
||||
int keep;
|
||||
garray_T ga;
|
||||
int skip;
|
||||
int fuzzy;
|
||||
int match;
|
||||
int score = 0;
|
||||
|
||||
fuzzy = cmdline_fuzzy_complete(pat);
|
||||
*matches = NULL;
|
||||
*numMatches = 0;
|
||||
|
||||
retstr = call_user_expand_func(call_func_retstr, xp);
|
||||
if (retstr == NULL)
|
||||
return FAIL;
|
||||
|
||||
ga_init2(&ga, sizeof(char *), 3);
|
||||
if (!fuzzy)
|
||||
ga_init2(&ga, sizeof(char *), 3);
|
||||
else
|
||||
ga_init2(&ga, sizeof(fuzmatch_str_T), 3);
|
||||
|
||||
for (s = retstr; *s != NUL; s = e)
|
||||
{
|
||||
e = vim_strchr(s, '\n');
|
||||
@@ -2894,14 +3178,35 @@ ExpandUserDefined(
|
||||
keep = *e;
|
||||
*e = NUL;
|
||||
|
||||
skip = xp->xp_pattern[0] && vim_regexec(regmatch, s, (colnr_T)0) == 0;
|
||||
if (xp->xp_pattern[0] != NUL)
|
||||
{
|
||||
if (!fuzzy)
|
||||
match = vim_regexec(regmatch, s, (colnr_T)0);
|
||||
else
|
||||
{
|
||||
score = fuzzy_match_str(s, pat);
|
||||
match = (score != 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
match = TRUE; // match everything
|
||||
|
||||
*e = keep;
|
||||
|
||||
if (!skip)
|
||||
if (match)
|
||||
{
|
||||
if (ga_grow(&ga, 1) == FAIL)
|
||||
break;
|
||||
((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, e - s);
|
||||
if (!fuzzy)
|
||||
((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, e - s);
|
||||
else
|
||||
{
|
||||
fuzmatch_str_T *fuzmatch =
|
||||
&((fuzmatch_str_T *)ga.ga_data)[ga.ga_len];
|
||||
fuzmatch->idx = ga.ga_len;
|
||||
fuzmatch->str = vim_strnsave(s, e - s);
|
||||
fuzmatch->score = score;
|
||||
}
|
||||
++ga.ga_len;
|
||||
}
|
||||
|
||||
@@ -2909,8 +3214,22 @@ ExpandUserDefined(
|
||||
++e;
|
||||
}
|
||||
vim_free(retstr);
|
||||
*matches = ga.ga_data;
|
||||
*numMatches = ga.ga_len;
|
||||
|
||||
if (ga.ga_len == 0)
|
||||
return OK;
|
||||
|
||||
if (!fuzzy)
|
||||
{
|
||||
*matches = ga.ga_data;
|
||||
*numMatches = ga.ga_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fuzzymatches_to_strmatches(ga.ga_data, matches, ga.ga_len,
|
||||
FALSE) == FAIL)
|
||||
return FAIL;
|
||||
*numMatches = ga.ga_len;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -291,8 +291,8 @@ if test "$vim_cv_uname_output" = Darwin; then
|
||||
CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
|
||||
|
||||
dnl Assume we don't want X11 unless it was specifically asked for
|
||||
dnl (--with-x) or Motif, Athena or GTK GUI is used.
|
||||
if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
|
||||
dnl (--with-x) or Motif or GTK GUI is used.
|
||||
if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
|
||||
with_x=no
|
||||
fi
|
||||
fi
|
||||
@@ -2443,7 +2443,7 @@ test "x$with_x" = xno -a "x$HAIKU" != "xyes" -a "x$MACOS_X" != "xyes" -a "x$QNX"
|
||||
|
||||
AC_MSG_CHECKING(--enable-gui argument)
|
||||
AC_ARG_ENABLE(gui,
|
||||
[ --enable-gui[=OPTS] X11 GUI. [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/haiku/photon/carbon]], , enable_gui="auto")
|
||||
[ --enable-gui[=OPTS] X11 GUI. [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/haiku/photon/carbon]], , enable_gui="auto")
|
||||
|
||||
dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
|
||||
dnl Do not use character classes for portability with old tools.
|
||||
@@ -2455,8 +2455,6 @@ SKIP_GTK2=YES
|
||||
SKIP_GTK3=YES
|
||||
SKIP_GNOME=YES
|
||||
SKIP_MOTIF=YES
|
||||
SKIP_ATHENA=YES
|
||||
SKIP_NEXTAW=YES
|
||||
SKIP_PHOTON=YES
|
||||
SKIP_HAIKU=YES
|
||||
GUITYPE=NONE
|
||||
@@ -2501,9 +2499,7 @@ else
|
||||
SKIP_GTK2=
|
||||
SKIP_GTK3=
|
||||
SKIP_GNOME=
|
||||
SKIP_MOTIF=
|
||||
SKIP_ATHENA=
|
||||
SKIP_NEXTAW=;;
|
||||
SKIP_MOTIF=;;
|
||||
gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
|
||||
SKIP_GTK2=;;
|
||||
gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
|
||||
@@ -2513,10 +2509,6 @@ else
|
||||
SKIP_GTK3=;;
|
||||
motif) AC_MSG_RESULT(Motif GUI support)
|
||||
SKIP_MOTIF=;;
|
||||
athena) AC_MSG_RESULT(Athena GUI support)
|
||||
SKIP_ATHENA=;;
|
||||
nextaw) AC_MSG_RESULT(neXtaw GUI support)
|
||||
SKIP_NEXTAW=;;
|
||||
*) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
|
||||
esac
|
||||
|
||||
@@ -2568,28 +2560,6 @@ if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
|
||||
AC_MSG_CHECKING(whether or not to look for Athena)
|
||||
AC_ARG_ENABLE(athena-check,
|
||||
[ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
|
||||
, enable_athena_check="yes")
|
||||
AC_MSG_RESULT($enable_athena_check)
|
||||
if test "x$enable_athena_check" = "xno"; then
|
||||
SKIP_ATHENA=YES
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
|
||||
AC_MSG_CHECKING(whether or not to look for neXtaw)
|
||||
AC_ARG_ENABLE(nextaw-check,
|
||||
[ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
|
||||
, enable_nextaw_check="yes")
|
||||
AC_MSG_RESULT($enable_nextaw_check);
|
||||
if test "x$enable_nextaw_check" = "xno"; then
|
||||
SKIP_NEXTAW=YES
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl define an autoconf function to check for a specified version of GTK, and
|
||||
dnl try to compile/link a GTK program.
|
||||
dnl
|
||||
@@ -2821,8 +2791,6 @@ if test -z "$SKIP_GTK2"; then
|
||||
GUI_INC_LOC="$GTK_CFLAGS"], )
|
||||
if test "x$GTK_CFLAGS" != "x"; then
|
||||
SKIP_GTK3=YES
|
||||
SKIP_ATHENA=YES
|
||||
SKIP_NEXTAW=YES
|
||||
SKIP_MOTIF=YES
|
||||
GUITYPE=GTK
|
||||
AC_SUBST(GTK_LIBNAME)
|
||||
@@ -2872,8 +2840,6 @@ if test -z "$SKIP_GTK3"; then
|
||||
if test "x$GTK_CFLAGS" != "x"; then
|
||||
SKIP_GTK2=YES
|
||||
SKIP_GNOME=YES
|
||||
SKIP_ATHENA=YES
|
||||
SKIP_NEXTAW=YES
|
||||
SKIP_MOTIF=YES
|
||||
GUITYPE=GTK
|
||||
AC_SUBST(GTK_LIBNAME)
|
||||
@@ -3034,49 +3000,11 @@ if test -z "$SKIP_MOTIF"; then
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_MOTIF"; then
|
||||
SKIP_ATHENA=YES
|
||||
SKIP_NEXTAW=YES
|
||||
GUITYPE=MOTIF
|
||||
AC_SUBST(MOTIF_LIBNAME)
|
||||
fi
|
||||
|
||||
dnl Check if the Athena files can be found
|
||||
|
||||
GUI_X_LIBS=
|
||||
|
||||
if test -z "$SKIP_ATHENA"; then
|
||||
AC_MSG_CHECKING(if Athena header files can be found)
|
||||
cflags_save=$CFLAGS
|
||||
CFLAGS="$CFLAGS $X_CFLAGS"
|
||||
AC_TRY_COMPILE([
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/Xaw/Paned.h>], ,
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no); SKIP_ATHENA=YES )
|
||||
CFLAGS=$cflags_save
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_ATHENA"; then
|
||||
GUITYPE=ATHENA
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_NEXTAW"; then
|
||||
AC_MSG_CHECKING(if neXtaw header files can be found)
|
||||
cflags_save=$CFLAGS
|
||||
CFLAGS="$CFLAGS $X_CFLAGS"
|
||||
AC_TRY_COMPILE([
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/neXtaw/Paned.h>], ,
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
|
||||
CFLAGS=$cflags_save
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_NEXTAW"; then
|
||||
GUITYPE=NEXTAW
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
|
||||
if test -z "$SKIP_MOTIF"; then
|
||||
dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
|
||||
dnl Avoid adding it when it twice
|
||||
if test -n "$GUI_INC_LOC"; then
|
||||
@@ -3138,7 +3066,7 @@ if test "$enable_xsmp" = "yes"; then
|
||||
fi
|
||||
|
||||
|
||||
if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
|
||||
if test -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
|
||||
dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
|
||||
cppflags_save=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
||||
@@ -3160,7 +3088,7 @@ if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
|
||||
if test -z "$SKIP_MOTIF"; then
|
||||
cppflags_save=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
||||
dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
|
||||
@@ -3175,7 +3103,7 @@ dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
|
||||
CPPFLAGS=$cppflags_save
|
||||
fi
|
||||
|
||||
dnl Only use the Xm directory when compiling Motif, don't use it for Athena
|
||||
dnl Only use the Xm directory when compiling Motif.
|
||||
if test -z "$SKIP_MOTIF"; then
|
||||
cppflags_save=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
||||
|
||||
@@ -251,7 +251,7 @@ static struct {
|
||||
sodium_runtime_link_init(int verbose)
|
||||
{
|
||||
static HINSTANCE hsodium = NULL;
|
||||
const char *libname = "libsodium.dll";
|
||||
const char *libname = DYNAMIC_SODIUM_DLL;
|
||||
int i;
|
||||
|
||||
if (hsodium != NULL)
|
||||
@@ -270,7 +270,7 @@ sodium_runtime_link_init(int verbose)
|
||||
if ((*sodium_funcname_table[i].ptr = symbol_from_dll(hsodium,
|
||||
sodium_funcname_table[i].name)) == NULL)
|
||||
{
|
||||
FreeLibrary(hsodium);
|
||||
close_dll(hsodium);
|
||||
hsodium = NULL;
|
||||
if (verbose)
|
||||
semsg(_(e_could_not_load_library_function_str), sodium_funcname_table[i].name);
|
||||
|
||||
@@ -989,7 +989,12 @@ debuggy_find(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (typval_compare(tv, bp->dbg_val, EXPR_IS, FALSE) == OK
|
||||
// Use "==" instead of "is" for strings, that is what we
|
||||
// always have done.
|
||||
exprtype_T type = tv->v_type == VAR_STRING
|
||||
? EXPR_EQUAL : EXPR_IS;
|
||||
|
||||
if (typval_compare(tv, bp->dbg_val, type, FALSE) == OK
|
||||
&& tv->vval.v_number == FALSE)
|
||||
{
|
||||
typval_T *v;
|
||||
|
||||
@@ -2495,7 +2495,7 @@ command_line_setup_choices(int argc, char **argv)
|
||||
int vimfiles_dir_choice = (int)vimfiles_dir_none;
|
||||
|
||||
init_directories_choice();
|
||||
if (argv[i + 1][0] != '-')
|
||||
if (i + 1 < argc && argv[i + 1][0] != '-')
|
||||
{
|
||||
i++;
|
||||
if (strcmp(argv[i], "vim") == 0)
|
||||
|
||||
@@ -330,7 +330,7 @@ win_line(
|
||||
#endif
|
||||
#ifdef FEAT_SPELL
|
||||
int has_spell = FALSE; // this buffer has spell checking
|
||||
int can_spell;
|
||||
int can_spell = FALSE;
|
||||
# define SPWORDLEN 150
|
||||
char_u nextline[SPWORDLEN * 2];// text with start of the next line
|
||||
int nextlinecol = 0; // column where nextline[] starts
|
||||
@@ -354,6 +354,8 @@ win_line(
|
||||
#if defined(FEAT_DIFF) || defined(FEAT_SIGNS)
|
||||
int filler_lines = 0; // nr of filler lines to be drawn
|
||||
int filler_todo = 0; // nr of filler lines still to do + 1
|
||||
#else
|
||||
# define filler_lines 0
|
||||
#endif
|
||||
#ifdef FEAT_DIFF
|
||||
hlf_T diff_hlf = (hlf_T)0; // type of diff highlighting
|
||||
@@ -1107,10 +1109,7 @@ win_line(
|
||||
// Display the absolute or relative line number. After the
|
||||
// first fill with blanks when the 'n' flag isn't in 'cpo'
|
||||
if ((wp->w_p_nu || wp->w_p_rnu)
|
||||
&& (row == startrow
|
||||
#ifdef FEAT_DIFF
|
||||
+ filler_lines
|
||||
#endif
|
||||
&& (row == startrow + filler_lines
|
||||
|| vim_strchr(p_cpo, CPO_NUMCOL) == NULL))
|
||||
{
|
||||
#ifdef FEAT_SIGNS
|
||||
@@ -1127,11 +1126,7 @@ win_line(
|
||||
#endif
|
||||
{
|
||||
// Draw the line number (empty space after wrapping).
|
||||
if (row == startrow
|
||||
#ifdef FEAT_DIFF
|
||||
+ filler_lines
|
||||
#endif
|
||||
)
|
||||
if (row == startrow + filler_lines)
|
||||
{
|
||||
long num;
|
||||
char *fmt = "%*ld ";
|
||||
@@ -1187,15 +1182,16 @@ win_line(
|
||||
#ifdef FEAT_SYN_HL
|
||||
// When 'cursorline' is set highlight the line number of
|
||||
// the current line differently.
|
||||
// When 'cursorlineopt' has "screenline" only highlight
|
||||
// the line number itself.
|
||||
// When 'cursorlineopt' does not have "line" only
|
||||
// highlight the line number itself.
|
||||
// TODO: Can we use CursorLine instead of CursorLineNr
|
||||
// when CursorLineNr isn't set?
|
||||
if (wp->w_p_cul
|
||||
&& lnum == wp->w_cursor.lnum
|
||||
&& (wp->w_p_culopt_flags & CULOPT_NBR)
|
||||
&& (row == startrow
|
||||
|| wp->w_p_culopt_flags & CULOPT_LINE))
|
||||
&& (row == startrow + filler_lines
|
||||
|| (row > startrow + filler_lines
|
||||
&& (wp->w_p_culopt_flags & CULOPT_LINE))))
|
||||
char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN));
|
||||
#endif
|
||||
if (wp->w_p_rnu && lnum < wp->w_cursor.lnum
|
||||
|
||||
@@ -1463,11 +1463,14 @@ win_update(win_T *wp)
|
||||
#ifdef FEAT_SYN_HL
|
||||
// remember what happened to the previous line, to know if
|
||||
// check_visual_highlight() can be used
|
||||
#define DID_NONE 1 // didn't update a line
|
||||
#define DID_LINE 2 // updated a normal line
|
||||
#define DID_FOLD 3 // updated a folded line
|
||||
# define DID_NONE 1 // didn't update a line
|
||||
# define DID_LINE 2 // updated a normal line
|
||||
# define DID_FOLD 3 // updated a folded line
|
||||
int did_update = DID_NONE;
|
||||
linenr_T syntax_last_parsed = 0; // last parsed text line
|
||||
// remember the current w_last_cursorline, it changes when drawing the new
|
||||
// cursor line
|
||||
linenr_T last_cursorline = wp->w_last_cursorline;
|
||||
#endif
|
||||
linenr_T mod_top = 0;
|
||||
linenr_T mod_bot = 0;
|
||||
@@ -2244,7 +2247,7 @@ win_update(win_T *wp)
|
||||
))))
|
||||
#ifdef FEAT_SYN_HL
|
||||
|| (wp->w_p_cul && (lnum == wp->w_cursor.lnum
|
||||
|| lnum == wp->w_last_cursorline))
|
||||
|| lnum == last_cursorline))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@@ -3027,6 +3030,23 @@ redraw_asap(int type)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_SYN_HL) || defined(PROTO)
|
||||
/*
|
||||
* Check if the cursor moved and 'cursorline' is set. Mark for a VALID redraw
|
||||
* if needed.
|
||||
*/
|
||||
void
|
||||
check_redraw_cursorline(void)
|
||||
{
|
||||
// When 'cursorlineopt' is "screenline" need to redraw always.
|
||||
if (curwin->w_p_cul
|
||||
&& (curwin->w_last_cursorline != curwin->w_cursor.lnum
|
||||
|| (curwin->w_p_culopt_flags & CULOPT_SCRLINE))
|
||||
&& !char_avail())
|
||||
redraw_later(VALID);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Invoked after an asynchronous callback is called.
|
||||
* If an echo command was used the cursor needs to be put back where
|
||||
@@ -3071,6 +3091,10 @@ redraw_after_callback(int call_update_screen, int do_message)
|
||||
}
|
||||
else if (State & (NORMAL | INSERT | TERMINAL))
|
||||
{
|
||||
#ifdef FEAT_SYN_HL
|
||||
// might need to update for 'cursorline'
|
||||
check_redraw_cursorline();
|
||||
#endif
|
||||
// keep the command line if possible
|
||||
update_screen(VALID_NO_UPDATE);
|
||||
setcursor();
|
||||
|
||||
29
src/errors.h
29
src/errors.h
@@ -1346,7 +1346,8 @@ EXTERN char e_comma_required[]
|
||||
EXTERN char e_commentstring_must_be_empty_or_contain_str[]
|
||||
INIT(= N_("E537: 'commentstring' must be empty or contain %s"));
|
||||
#endif
|
||||
// E538 unused
|
||||
EXTERN char e_pattern_found_in_every_line_str[]
|
||||
INIT(= N_("E538: Pattern found in every line: %s"));
|
||||
EXTERN char e_illegal_character_str[]
|
||||
INIT(= N_("E539: Illegal character <%s>"));
|
||||
#ifdef FEAT_STL_OPT
|
||||
@@ -2760,8 +2761,9 @@ EXTERN char e_type_mismatch_for_v_variable[]
|
||||
#endif
|
||||
EXTERN char e_yank_register_changed_while_using_it[]
|
||||
INIT(= N_("E1064: Yank register changed while using it"));
|
||||
EXTERN char e_command_cannot_be_shortened_str[]
|
||||
INIT(= N_("E1065: Command cannot be shortened: %s"));
|
||||
#ifdef FEAT_EVAL
|
||||
// E1065 unused
|
||||
EXTERN char e_cannot_declare_a_register_str[]
|
||||
INIT(= N_("E1066: Cannot declare a register: %s"));
|
||||
EXTERN char e_separator_mismatch_str[]
|
||||
@@ -2780,14 +2782,18 @@ EXTERN char e_no_white_space_allowed_after_dot[]
|
||||
INIT(= N_("E1074: No white space allowed after dot"));
|
||||
EXTERN char e_namespace_not_supported_str[]
|
||||
INIT(= N_("E1075: Namespace not supported: %s"));
|
||||
#ifndef FEAT_FLOAT
|
||||
# ifndef FEAT_FLOAT
|
||||
EXTERN char e_this_vim_is_not_compiled_with_float_support[]
|
||||
INIT(= N_("E1076: This Vim is not compiled with float support"));
|
||||
#endif
|
||||
# endif
|
||||
EXTERN char e_missing_argument_type_for_str[]
|
||||
INIT(= N_("E1077: Missing argument type for %s"));
|
||||
// E1078 unused
|
||||
// E1079 unused
|
||||
#endif
|
||||
EXTERN char e_invalid_command_nested_did_you_mean_plusplus_nested[]
|
||||
INIT(= N_("E1078: Invalid command \"nested\", did you mean \"++nested\"?"));
|
||||
#ifdef FEAT_EVAL
|
||||
EXTERN char e_cannot_declare_variable_on_command_line[]
|
||||
INIT(= N_("E1079: Cannot declare a variable on the command line"));
|
||||
EXTERN char e_invalid_assignment[]
|
||||
INIT(= N_("E1080: Invalid assignment"));
|
||||
EXTERN char e_cannot_unlet_str[]
|
||||
@@ -3010,7 +3016,8 @@ EXTERN char e_variable_arguments_type_must_be_list_str[]
|
||||
INIT(= N_("E1180: Variable arguments type must be a list: %s"));
|
||||
EXTERN char e_cannot_use_underscore_here[]
|
||||
INIT(= N_("E1181: Cannot use an underscore here"));
|
||||
// E1182 unused
|
||||
EXTERN char e_cannot_define_dict_func_in_vim9_script_str[]
|
||||
INIT(= N_("E1182: Cannot define a dict function in Vim9 script: %s"));
|
||||
EXTERN char e_cannot_use_range_with_assignment_operator_str[]
|
||||
INIT(= N_("E1183: Cannot use a range with an assignment operator: %s"));
|
||||
#endif
|
||||
@@ -3240,3 +3247,11 @@ EXTERN char e_cannot_use_s_colon_in_vim9_script_str[]
|
||||
EXTERN char e_cannot_create_vim9_script_variable_in_function_str[]
|
||||
INIT(= N_("E1269: Cannot create a Vim9 script variable in a function: %s"));
|
||||
#endif
|
||||
EXTERN char e_cannot_use_s_backslash_in_vim9_script[]
|
||||
INIT(= N_("E1270: Cannot use :s\\/sub/ in Vim9 script"));
|
||||
#ifdef FEAT_EVAL
|
||||
EXTERN char e_compiling_closure_without_context_str[]
|
||||
INIT(= N_("E1271: compiling closure without context: %s"));
|
||||
EXTERN char e_using_type_not_in_script_context_str[]
|
||||
INIT(= N_("E1272: Using type not in a script context: %s"));
|
||||
#endif
|
||||
|
||||
169
src/eval.c
169
src/eval.c
@@ -695,6 +695,7 @@ call_vim_function(
|
||||
char_u *arg;
|
||||
char_u *name;
|
||||
char_u *tofree = NULL;
|
||||
int ignore_errors;
|
||||
|
||||
rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this
|
||||
CLEAR_FIELD(funcexe);
|
||||
@@ -702,11 +703,17 @@ call_vim_function(
|
||||
funcexe.fe_lastline = curwin->w_cursor.lnum;
|
||||
funcexe.fe_evaluate = TRUE;
|
||||
|
||||
// The name might be "import.Func" or "Funcref".
|
||||
// The name might be "import.Func" or "Funcref". We don't know, we need to
|
||||
// ignore errors for an undefined name. But we do want errors when an
|
||||
// autoload script has errors. Guess that when there is a dot in the name
|
||||
// showing errors is the right choice.
|
||||
ignore_errors = vim_strchr(func, '.') == NULL;
|
||||
arg = func;
|
||||
++emsg_off;
|
||||
if (ignore_errors)
|
||||
++emsg_off;
|
||||
name = deref_function_name(&arg, &tofree, &EVALARG_EVALUATE, FALSE);
|
||||
--emsg_off;
|
||||
if (ignore_errors)
|
||||
--emsg_off;
|
||||
if (name == NULL)
|
||||
name = func;
|
||||
|
||||
@@ -922,15 +929,14 @@ get_lval(
|
||||
if (vim9script)
|
||||
{
|
||||
// "a: type" is declaring variable "a" with a type, not "a:".
|
||||
if (p == name + 2 && p[-1] == ':')
|
||||
// However, "g:[key]" is indexing a dictionary.
|
||||
if (p == name + 2 && p[-1] == ':' && *p != '[')
|
||||
{
|
||||
--p;
|
||||
lp->ll_name_end = p;
|
||||
}
|
||||
if (*p == ':')
|
||||
{
|
||||
garray_T tmp_type_list;
|
||||
garray_T *type_list;
|
||||
char_u *tp = skipwhite(p + 1);
|
||||
|
||||
if (tp == p + 1 && !quiet)
|
||||
@@ -939,26 +945,19 @@ get_lval(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (SCRIPT_ID_VALID(current_sctx.sc_sid))
|
||||
type_list = &SCRIPT_ITEM(current_sctx.sc_sid)->sn_type_list;
|
||||
else
|
||||
if (!SCRIPT_ID_VALID(current_sctx.sc_sid))
|
||||
{
|
||||
type_list = &tmp_type_list;
|
||||
ga_init2(type_list, sizeof(type_T), 10);
|
||||
semsg(_(e_using_type_not_in_script_context_str), p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// parse the type after the name
|
||||
lp->ll_type = parse_type(&tp, type_list, !quiet);
|
||||
lp->ll_type = parse_type(&tp,
|
||||
&SCRIPT_ITEM(current_sctx.sc_sid)->sn_type_list,
|
||||
!quiet);
|
||||
if (lp->ll_type == NULL && !quiet)
|
||||
return NULL;
|
||||
lp->ll_name_end = tp;
|
||||
|
||||
// drop the type when not in a script
|
||||
if (type_list == &tmp_type_list)
|
||||
{
|
||||
lp->ll_type = NULL;
|
||||
clear_type_list(type_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2848,6 +2847,7 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
||||
int vim9script = in_vim9script();
|
||||
int evaluate = evalarg == NULL
|
||||
? 0 : (evalarg->eval_flags & EVAL_EVALUATE);
|
||||
long comp_lnum = SOURCING_LNUM;
|
||||
|
||||
if (getnext)
|
||||
{
|
||||
@@ -2903,6 +2903,8 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
// use the line of the comparison for messages
|
||||
SOURCING_LNUM = comp_lnum;
|
||||
if (vim9script && check_compare_types(type, rettv, &var2) == FAIL)
|
||||
{
|
||||
ret = FAIL;
|
||||
@@ -3482,6 +3484,106 @@ eval_leader(char_u **arg, int vim9)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for a predefined value "true", "false" and "null.*".
|
||||
* Return OK when recognized.
|
||||
*/
|
||||
int
|
||||
handle_predefined(char_u *s, int len, typval_T *rettv)
|
||||
{
|
||||
switch (len)
|
||||
{
|
||||
case 4: if (STRNCMP(s, "true", 4) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_BOOL;
|
||||
rettv->vval.v_number = VVAL_TRUE;
|
||||
return OK;
|
||||
}
|
||||
if (STRNCMP(s, "null", 4) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_SPECIAL;
|
||||
rettv->vval.v_number = VVAL_NULL;
|
||||
return OK;
|
||||
}
|
||||
break;
|
||||
case 5: if (STRNCMP(s, "false", 5) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_BOOL;
|
||||
rettv->vval.v_number = VVAL_FALSE;
|
||||
return OK;
|
||||
}
|
||||
break;
|
||||
case 8: if (STRNCMP(s, "null_job", 8) == 0)
|
||||
{
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
rettv->v_type = VAR_JOB;
|
||||
rettv->vval.v_job = NULL;
|
||||
#else
|
||||
rettv->v_type = VAR_SPECIAL;
|
||||
rettv->vval.v_number = VVAL_NULL;
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (STRNCMP(s, "null_", 5) != 0)
|
||||
break;
|
||||
if (STRNCMP(s + 5, "list", 4) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_LIST;
|
||||
rettv->vval.v_list = NULL;
|
||||
return OK;
|
||||
}
|
||||
if (STRNCMP(s + 5, "dict", 4) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_DICT;
|
||||
rettv->vval.v_dict = NULL;
|
||||
return OK;
|
||||
}
|
||||
if (STRNCMP(s + 5, "blob", 4) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_BLOB;
|
||||
rettv->vval.v_blob = NULL;
|
||||
return OK;
|
||||
}
|
||||
break;
|
||||
case 11: if (STRNCMP(s, "null_string", 11) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
return OK;
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
if (STRNCMP(s, "null_channel", 12) == 0)
|
||||
{
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
rettv->v_type = VAR_CHANNEL;
|
||||
rettv->vval.v_channel = NULL;
|
||||
#else
|
||||
rettv->v_type = VAR_SPECIAL;
|
||||
rettv->vval.v_number = VVAL_NULL;
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
if (STRNCMP(s, "null_partial", 12) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_PARTIAL;
|
||||
rettv->vval.v_partial = NULL;
|
||||
return OK;
|
||||
}
|
||||
break;
|
||||
case 13: if (STRNCMP(s, "null_function", 13) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_FUNC;
|
||||
rettv->vval.v_string = NULL;
|
||||
return OK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle sixth level expression:
|
||||
* number number constant
|
||||
@@ -3690,8 +3792,8 @@ eval7(
|
||||
// This is recognized in compile_return().
|
||||
if (ufunc->uf_ret_type->tt_type == VAR_VOID)
|
||||
ufunc->uf_ret_type = &t_unknown;
|
||||
if (compile_def_function(ufunc,
|
||||
FALSE, COMPILE_TYPE(ufunc), NULL) == FAIL)
|
||||
if (compile_def_function(ufunc, FALSE,
|
||||
get_compile_type(ufunc), NULL) == FAIL)
|
||||
{
|
||||
clear_tv(rettv);
|
||||
ret = FAIL;
|
||||
@@ -3757,26 +3859,11 @@ eval7(
|
||||
ret = FAIL;
|
||||
else if (evaluate)
|
||||
{
|
||||
// get the value of "true", "false" or a variable
|
||||
if (len == 4 && vim9script && STRNCMP(s, "true", 4) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_BOOL;
|
||||
rettv->vval.v_number = VVAL_TRUE;
|
||||
ret = OK;
|
||||
}
|
||||
else if (len == 5 && vim9script && STRNCMP(s, "false", 5) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_BOOL;
|
||||
rettv->vval.v_number = VVAL_FALSE;
|
||||
ret = OK;
|
||||
}
|
||||
else if (len == 4 && vim9script && STRNCMP(s, "null", 4) == 0)
|
||||
{
|
||||
rettv->v_type = VAR_SPECIAL;
|
||||
rettv->vval.v_number = VVAL_NULL;
|
||||
ret = OK;
|
||||
}
|
||||
else
|
||||
// get the value of "true", "false", etc. or a variable
|
||||
ret = FAIL;
|
||||
if (vim9script)
|
||||
ret = handle_predefined(s, len, rettv);
|
||||
if (ret == FAIL)
|
||||
{
|
||||
name_start = s;
|
||||
ret = eval_variable(s, len, 0, rettv, NULL,
|
||||
|
||||
@@ -624,6 +624,8 @@ arg_sort_how(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
|
||||
where_T where = WHERE_INIT;
|
||||
|
||||
args[1] = args[0];
|
||||
if (type->tt_argcount == -1)
|
||||
t_func_exp.tt_argcount = -1;
|
||||
where.wt_index = 2;
|
||||
return check_type(&t_func_exp, type, TRUE, where);
|
||||
}
|
||||
@@ -4380,7 +4382,8 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
|
||||
|
||||
if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s))
|
||||
|| (is_funcref && trans_name == NULL))
|
||||
semsg(_(e_invalid_argument_str), use_string ? tv_get_string(&argvars[0]) : s);
|
||||
semsg(_(e_invalid_argument_str),
|
||||
use_string ? tv_get_string(&argvars[0]) : s);
|
||||
// Don't check an autoload name for existence here.
|
||||
else if (trans_name != NULL && (is_funcref
|
||||
? find_func(trans_name, is_global) == NULL
|
||||
@@ -6099,13 +6102,7 @@ f_has(typval_T *argvars, typval_T *rettv)
|
||||
0
|
||||
#endif
|
||||
},
|
||||
{"tag_binary",
|
||||
#ifdef FEAT_TAG_BINS
|
||||
1
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
},
|
||||
{"tag_binary", 1}, // graduated feature
|
||||
{"tcl",
|
||||
#if defined(FEAT_TCL) && !defined(DYNAMIC_TCL)
|
||||
1
|
||||
|
||||
@@ -754,11 +754,20 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
|
||||
void
|
||||
ex_var(exarg_T *eap)
|
||||
{
|
||||
char_u *p = eap->cmd;
|
||||
int has_var;
|
||||
|
||||
if (!in_vim9script())
|
||||
{
|
||||
semsg(_(e_str_cannot_be_used_in_legacy_vim_script), ":var");
|
||||
return;
|
||||
}
|
||||
has_var = checkforcmd_noparen(&p, "var", 3);
|
||||
if (current_sctx.sc_sid == 0 && has_var)
|
||||
{
|
||||
emsg(_(e_cannot_declare_variable_on_command_line));
|
||||
return;
|
||||
}
|
||||
ex_let(eap);
|
||||
}
|
||||
|
||||
@@ -990,6 +999,11 @@ ex_let_vars(
|
||||
listitem_T *item;
|
||||
typval_T ltv;
|
||||
|
||||
if (tv->v_type == VAR_VOID)
|
||||
{
|
||||
emsg(_(e_cannot_use_void_value));
|
||||
return FAIL;
|
||||
}
|
||||
if (*arg != '[')
|
||||
{
|
||||
// ":let var = expr" or ":for var in list"
|
||||
@@ -1518,8 +1532,11 @@ ex_let_option(
|
||||
{
|
||||
if (opt_type != gov_string || s != NULL)
|
||||
{
|
||||
set_option_value(arg, n, s, scope);
|
||||
char *err = set_option_value(arg, n, s, scope);
|
||||
|
||||
arg_end = p;
|
||||
if (err != NULL)
|
||||
emsg(_(err));
|
||||
}
|
||||
else
|
||||
emsg(_(e_string_required));
|
||||
@@ -2816,29 +2833,33 @@ eval_variable(
|
||||
}
|
||||
|
||||
// If a list or dict variable wasn't initialized, do it now.
|
||||
if (tv->v_type == VAR_DICT && tv->vval.v_dict == NULL)
|
||||
// Not for global variables, they are not declared.
|
||||
if (ht != &globvarht)
|
||||
{
|
||||
tv->vval.v_dict = dict_alloc();
|
||||
if (tv->vval.v_dict != NULL)
|
||||
if (tv->v_type == VAR_DICT && tv->vval.v_dict == NULL)
|
||||
{
|
||||
++tv->vval.v_dict->dv_refcount;
|
||||
tv->vval.v_dict->dv_type = alloc_type(type);
|
||||
tv->vval.v_dict = dict_alloc();
|
||||
if (tv->vval.v_dict != NULL)
|
||||
{
|
||||
++tv->vval.v_dict->dv_refcount;
|
||||
tv->vval.v_dict->dv_type = alloc_type(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tv->v_type == VAR_LIST && tv->vval.v_list == NULL)
|
||||
{
|
||||
tv->vval.v_list = list_alloc();
|
||||
if (tv->vval.v_list != NULL)
|
||||
else if (tv->v_type == VAR_LIST && tv->vval.v_list == NULL)
|
||||
{
|
||||
++tv->vval.v_list->lv_refcount;
|
||||
tv->vval.v_list->lv_type = alloc_type(type);
|
||||
tv->vval.v_list = list_alloc();
|
||||
if (tv->vval.v_list != NULL)
|
||||
{
|
||||
++tv->vval.v_list->lv_refcount;
|
||||
tv->vval.v_list->lv_type = alloc_type(type);
|
||||
}
|
||||
}
|
||||
else if (tv->v_type == VAR_BLOB && tv->vval.v_blob == NULL)
|
||||
{
|
||||
tv->vval.v_blob = blob_alloc();
|
||||
if (tv->vval.v_blob != NULL)
|
||||
++tv->vval.v_blob->bv_refcount;
|
||||
}
|
||||
}
|
||||
else if (tv->v_type == VAR_BLOB && tv->vval.v_blob == NULL)
|
||||
{
|
||||
tv->vval.v_blob = blob_alloc();
|
||||
if (tv->vval.v_blob != NULL)
|
||||
++tv->vval.v_blob->bv_refcount;
|
||||
}
|
||||
copy_tv(tv, rettv);
|
||||
}
|
||||
@@ -3433,7 +3454,7 @@ set_var_const(
|
||||
if (in_vim9script() && is_export
|
||||
&& SCRIPT_ID_VALID(current_sctx.sc_sid)
|
||||
&& (si = SCRIPT_ITEM(current_sctx.sc_sid))
|
||||
->sn_autoload_prefix != NULL)
|
||||
->sn_autoload_prefix != NULL)
|
||||
{
|
||||
// In a vim9 autoload script an exported variable is put in the
|
||||
// global namespace with the autoload prefix.
|
||||
|
||||
@@ -3737,6 +3737,11 @@ ex_substitute(exarg_T *eap)
|
||||
*/
|
||||
if (*cmd == '\\')
|
||||
{
|
||||
if (in_vim9script())
|
||||
{
|
||||
emsg(_(e_cannot_use_s_backslash_in_vim9_script));
|
||||
return;
|
||||
}
|
||||
++cmd;
|
||||
if (vim_strchr((char_u *)"/?&", *cmd) == NULL)
|
||||
{
|
||||
@@ -5001,9 +5006,19 @@ ex_global(exarg_T *eap)
|
||||
else if (ndone == 0)
|
||||
{
|
||||
if (type == 'v')
|
||||
smsg(_("Pattern found in every line: %s"), pat);
|
||||
{
|
||||
if (in_vim9script())
|
||||
semsg(_(e_pattern_found_in_every_line_str), pat);
|
||||
else
|
||||
smsg(_("Pattern found in every line: %s"), pat);
|
||||
}
|
||||
else
|
||||
smsg(_("Pattern not found: %s"), pat);
|
||||
{
|
||||
if (in_vim9script())
|
||||
semsg(_(e_pattern_not_found_str), pat);
|
||||
else
|
||||
smsg(_("Pattern not found: %s"), pat);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#define EX_NONWHITE_OK 0x2000000 // command can be followed by non-white
|
||||
#define EX_KEEPSCRIPT 0x4000000 // keep sctx of where command was invoked
|
||||
#define EX_EXPR_ARG 0x8000000 // argument is an expression
|
||||
#define EX_WHOLE 0x10000000 // command name cannot be shortened in Vim9
|
||||
|
||||
#define EX_FILES (EX_XFILE | EX_EXTRA) // multiple extra files allowed
|
||||
#define EX_FILE1 (EX_FILES | EX_NOSPC) // 1 file, defaults to current file
|
||||
@@ -221,7 +222,7 @@ EXCMD(CMD_brewind, "brewind", ex_brewind,
|
||||
EX_BANG|EX_RANGE|EX_CMDARG|EX_TRLBAR,
|
||||
ADDR_OTHER),
|
||||
EXCMD(CMD_break, "break", ex_break,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_breakadd, "breakadd", ex_breakadd,
|
||||
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
@@ -281,7 +282,7 @@ EXCMD(CMD_call, "call", ex_call,
|
||||
EX_RANGE|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_catch, "catch", ex_catch,
|
||||
EX_EXTRA|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_EXTRA|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_cbuffer, "cbuffer", ex_cbuffer,
|
||||
EX_BANG|EX_RANGE|EX_WORD1|EX_TRLBAR,
|
||||
@@ -407,13 +408,13 @@ EXCMD(CMD_compiler, "compiler", ex_compiler,
|
||||
EX_BANG|EX_TRLBAR|EX_WORD1|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_continue, "continue", ex_continue,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_confirm, "confirm", ex_wrongmodifier,
|
||||
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_const, "const", ex_let,
|
||||
EX_EXTRA|EX_BANG|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_EXTRA|EX_BANG|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_copen, "copen", ex_copen,
|
||||
EX_RANGE|EX_COUNT|EX_TRLBAR,
|
||||
@@ -548,16 +549,16 @@ EXCMD(CMD_echon, "echon", ex_echo,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_else, "else", ex_else,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_elseif, "elseif", ex_else,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_emenu, "emenu", ex_emenu,
|
||||
EX_NEEDARG|EX_EXTRA|EX_TRLBAR|EX_NOTRLCOM|EX_RANGE|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_OTHER),
|
||||
EXCMD(CMD_endif, "endif", ex_endif,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_endinterface, "endinterface", ex_ni,
|
||||
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
@@ -566,7 +567,7 @@ EXCMD(CMD_endclass, "endclass", ex_ni,
|
||||
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_enddef, "enddef", ex_endfunction,
|
||||
EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_endenum, "endenum", ex_ni,
|
||||
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
@@ -575,13 +576,13 @@ EXCMD(CMD_endfunction, "endfunction", ex_endfunction,
|
||||
EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_endfor, "endfor", ex_endwhile,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_endtry, "endtry", ex_endtry,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_endwhile, "endwhile", ex_endwhile,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_enew, "enew", ex_edit,
|
||||
EX_BANG|EX_TRLBAR,
|
||||
@@ -602,7 +603,7 @@ EXCMD(CMD_exit, "exit", ex_exit,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_BANG|EX_FILE1|EX_ARGOPT|EX_DFLALL|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_export, "export", ex_export,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_exusage, "exusage", ex_exusage,
|
||||
EX_TRLBAR,
|
||||
@@ -623,13 +624,13 @@ EXCMD(CMD_find, "find", ex_find,
|
||||
EX_RANGE|EX_BANG|EX_FILE1|EX_CMDARG|EX_ARGOPT|EX_TRLBAR|EX_NEEDARG,
|
||||
ADDR_OTHER),
|
||||
EXCMD(CMD_final, "final", ex_let,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_finally, "finally", ex_finally,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_finish, "finish", ex_finish,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_first, "first", ex_rewind,
|
||||
EX_EXTRA|EX_BANG|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
|
||||
@@ -731,7 +732,7 @@ EXCMD(CMD_imenu, "imenu", ex_menu,
|
||||
EX_RANGE|EX_ZEROR|EX_EXTRA|EX_TRLBAR|EX_NOTRLCOM|EX_CTRLV|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_OTHER),
|
||||
EXCMD(CMD_import, "import", ex_import,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_inoremap, "inoremap", ex_map,
|
||||
EX_EXTRA|EX_TRLBAR|EX_NOTRLCOM|EX_CTRLV|EX_CMDWIN|EX_LOCK_OK,
|
||||
@@ -1280,7 +1281,7 @@ EXCMD(CMD_retab, "retab", ex_retab,
|
||||
EX_TRLBAR|EX_RANGE|EX_WHOLEFOLD|EX_DFLALL|EX_BANG|EX_WORD1|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_return, "return", ex_return,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_rewind, "rewind", ex_rewind,
|
||||
EX_EXTRA|EX_BANG|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
|
||||
@@ -1601,7 +1602,7 @@ EXCMD(CMD_tfirst, "tfirst", ex_tag,
|
||||
EX_RANGE|EX_BANG|EX_TRLBAR|EX_ZEROR,
|
||||
ADDR_OTHER),
|
||||
EXCMD(CMD_throw, "throw", ex_throw,
|
||||
EX_EXTRA|EX_NEEDARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_EXTRA|EX_NEEDARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_tjump, "tjump", ex_tag,
|
||||
EX_BANG|EX_TRLBAR|EX_WORD1,
|
||||
@@ -1694,7 +1695,7 @@ EXCMD(CMD_vglobal, "vglobal", ex_global,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_DFLALL|EX_CMDWIN|EX_LOCK_OK|EX_NONWHITE_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_var, "var", ex_var,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_version, "version", ex_version,
|
||||
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
@@ -1763,7 +1764,7 @@ EXCMD(CMD_wall, "wall", do_wqall,
|
||||
EX_BANG|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_while, "while", ex_while,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_winsize, "winsize", ex_winsize,
|
||||
EX_EXTRA|EX_NEEDARG|EX_TRLBAR,
|
||||
|
||||
@@ -3523,12 +3523,14 @@ find_ex_command(
|
||||
return eap->cmd;
|
||||
}
|
||||
|
||||
if (p != eap->cmd && (
|
||||
if ((p != eap->cmd && (
|
||||
// "varname[]" is an expression.
|
||||
*p == '['
|
||||
// "varname.key" is an expression.
|
||||
|| (*p == '.' && (ASCII_ISALPHA(p[1])
|
||||
|| p[1] == '_'))))
|
||||
|| (*p == '.'
|
||||
&& (ASCII_ISALPHA(p[1]) || p[1] == '_'))))
|
||||
// g:[key] is an expression
|
||||
|| STRNCMP(eap->cmd, "g:[", 3) == 0)
|
||||
{
|
||||
char_u *after = eap->cmd;
|
||||
|
||||
@@ -3745,13 +3747,26 @@ find_ex_command(
|
||||
(size_t)len) == 0)
|
||||
{
|
||||
#ifdef FEAT_EVAL
|
||||
if (full != NULL
|
||||
&& cmdnames[(int)eap->cmdidx].cmd_name[len] == NUL)
|
||||
if (full != NULL && cmdnames[eap->cmdidx].cmd_name[len] == NUL)
|
||||
*full = TRUE;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
// :Print and :mode are not supported in Vim9 script.
|
||||
// Some commands cannot be shortened in Vim9 script.
|
||||
if (vim9 && eap->cmdidx != CMD_SIZE)
|
||||
{
|
||||
if (eap->cmdidx == CMD_mode || eap->cmdidx == CMD_Print)
|
||||
eap->cmdidx = CMD_SIZE;
|
||||
else if ((cmdnames[eap->cmdidx].cmd_argt & EX_WHOLE)
|
||||
&& len < (int)STRLEN(cmdnames[eap->cmdidx].cmd_name))
|
||||
{
|
||||
semsg(_(e_command_cannot_be_shortened_str), eap->cmd);
|
||||
eap->cmdidx = CMD_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not recognize ":*" as the star command unless '*' is in
|
||||
// 'cpoptions'.
|
||||
if (eap->cmdidx == CMD_star && vim_strchr(p_cpo, CPO_STAR) == NULL)
|
||||
@@ -3771,8 +3786,8 @@ find_ex_command(
|
||||
eap->cmdidx = CMD_SIZE;
|
||||
}
|
||||
|
||||
// ":fina" means ":finally" for backwards compatibility.
|
||||
if (eap->cmdidx == CMD_final && p - eap->cmd == 4)
|
||||
// ":fina" means ":finally" in legacy script, for backwards compatibility.
|
||||
if (eap->cmdidx == CMD_final && p - eap->cmd == 4 && !vim9)
|
||||
eap->cmdidx = CMD_finally;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user