aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-29 21:57:46 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-29 23:35:37 -0400
commitf5d1f0bf0372ac57c8b1f814bb5b18f13b3b53de (patch)
treeac3ecc8d51aceea2c4d5b9557c5596bb1ce09a23 /runtime/doc
parent1e03e76dafb5d166bb3d9ed262695f306de6ac4d (diff)
downloadrneovim-f5d1f0bf0372ac57c8b1f814bb5b18f13b3b53de.tar.gz
rneovim-f5d1f0bf0372ac57c8b1f814bb5b18f13b3b53de.tar.bz2
rneovim-f5d1f0bf0372ac57c8b1f814bb5b18f13b3b53de.zip
vim-patch:1c6737b20a5c
Update runtime files. https://github.com/vim/vim/commit/1c6737b20a5cf71751b180461cea22fc76d8870c
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/eval.txt12
-rw-r--r--runtime/doc/map.txt65
-rw-r--r--runtime/doc/message.txt2
-rw-r--r--runtime/doc/options.txt2
-rw-r--r--runtime/doc/pattern.txt22
-rw-r--r--runtime/doc/usr_03.txt17
-rw-r--r--runtime/doc/usr_41.txt48
7 files changed, 90 insertions, 78 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index ba2b3d567c..0c5bf0b2d8 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -75,8 +75,9 @@ base, use |str2nr()|.
*TRUE* *FALSE* *Boolean*
For boolean operators Numbers are used. Zero is FALSE, non-zero is TRUE.
-You can also use |v:false| and |v:true|. When TRUE is returned from a
-function it is the Number one, FALSE is the number zero.
+You can also use |v:false| and |v:true|.
+When TRUE is returned from a function it is the Number one, FALSE is the
+number zero.
Note that in the command: >
:if "foo"
@@ -2818,7 +2819,7 @@ bufnr([{expr} [, {create}]])
the ":ls" command. For the use of {expr}, see |bufname()|
above.
If the buffer doesn't exist, -1 is returned. Or, if the
- {create} argument is present and not zero, a new, unlisted,
+ {create} argument is present and TRUE, a new, unlisted,
buffer is created and its number is returned.
bufnr("$") is the last buffer: >
:let last_buffer = bufnr("$")
@@ -8161,7 +8162,7 @@ str2list({expr} [, {utf8}]) *str2list()*
< |list2str()| does the opposite.
When {utf8} is omitted or zero, the current 'encoding' is used.
- With {utf8} set to 1, always treat the String as utf-8
+ With {utf8} set to TRUE, always treat the String as utf-8
characters. With utf-8 composing characters are handled
properly: >
str2list("á") returns [97, 769]
@@ -9136,7 +9137,8 @@ win_screenpos({nr}) *win_screenpos()*
Return the screen position of window {nr} as a list with two
numbers: [row, col]. The first window always has position
[1, 1], unless there is a tabline, then it is [2, 1].
- {nr} can be the window number or the |window-ID|.
+ {nr} can be the window number or the |window-ID|. Use zero
+ for the current window.
Return [0, 0] if the window cannot be found in the current
tabpage.
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 82c54925fd..9c72412179 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -180,7 +180,7 @@ Note that this works when the <nowait> mapping fully matches and is found
before any partial matches. This works when:
- There is only one matching buffer-local mapping, since these are always
found before global mappings.
-- There is another buffer-local mapping that partly matches, but it is was
+- There is another buffer-local mapping that partly matches, but it is
defined earlier (last defined mapping is found first).
*:map-<silent>* *:map-silent*
@@ -283,15 +283,8 @@ Here is an example that inserts a list number that increases: >
CTRL-L inserts the next number, CTRL-R resets the count. CTRL-R returns an
empty string, so that nothing is inserted.
-Note that there are some tricks to make special keys work and escape CSI bytes
-in the text. The |:map| command also does this, thus you must avoid that it
-is done twice. This does not work: >
- :imap <expr> <F3> "<Char-0x611B>"
-Because the <Char- sequence is escaped for being a |:imap| argument and then
-again for using <expr>. This does work: >
- :imap <expr> <F3> "\u611B"
-Using 0x80 as a single byte before other text does not work, it will be seen
-as a special key.
+Note that using 0x80 as a single byte before other text does not work, it will
+be seen as a special key.
*<Cmd>* *:map-cmd*
The <Cmd> pseudokey begins a "command mapping", which executes the command
@@ -814,35 +807,47 @@ g@{motion} Call the function set by the 'operatorfunc' option.
Here is an example that counts the number of spaces with <F4>: >
- nmap <silent> <F4> :set opfunc=CountSpaces<CR>g@
- vmap <silent> <F4> :<C-U>call CountSpaces(visualmode(), 1)<CR>
+ nnoremap <expr> <F4> CountSpaces()
+ xnoremap <expr> <F4> CountSpaces()
+ " doubling <F4> works on a line
+ nnoremap <expr> <F4><F4> CountSpaces() .. '_'
- function! CountSpaces(type, ...)
- let sel_save = &selection
- let &selection = "inclusive"
- let reg_save = @@
-
- if a:0 " Invoked from Visual mode, use gv command.
- silent exe "normal! gvy"
- elseif a:type == 'line'
- silent exe "normal! '[V']y"
- else
- silent exe "normal! `[v`]y"
+ function CountSpaces(type = '') abort
+ if a:type == ''
+ set opfunc=CountSpaces
+ return 'g@'
endif
- echomsg strlen(substitute(@@, '[^ ]', '', 'g'))
-
- let &selection = sel_save
- let @@ = reg_save
+ let sel_save = &selection
+ let reg_save = getreginfo('"')
+ let cb_save = &clipboard
+ let visual_marks_save = [getpos("'<"), getpos("'>")]
+
+ try
+ set clipboard= selection=inclusive
+ let commands = #{line: "'[V']y", char: "`[v`]y", block: "`[\<c-v>`]y"}
+ silent exe 'noautocmd keepjumps normal! ' .. get(commands, a:type, '')
+ echom getreg('"')->count(' ')
+ finally
+ call setreg('"', reg_save)
+ call setpos("'<", visual_marks_save[0])
+ call setpos("'>", visual_marks_save[1])
+ let &clipboard = cb_save
+ let &selection = sel_save
+ endtry
endfunction
+An <expr> mapping is used to be able to fetch any prefixed count and register.
+This also avoids using a command line, which would trigger CmdlineEnter and
+CmdlineLeave autocommands.
+
Note that the 'selection' option is temporarily set to "inclusive" to be able
to yank exactly the right text by using Visual mode from the '[ to the ']
mark.
-Also note that there is a separate mapping for Visual mode. It removes the
-"'<,'>" range that ":" inserts in Visual mode and invokes the function with
-visualmode() and an extra argument.
+Also note that the 'clipboard' option is temporarily emptied to avoid
+clobbering the `"*` or `"+` registers, if its value contains the item `unnamed`
+or `unnamedplus`.
==============================================================================
2. Abbreviations *abbreviations* *Abbreviations*
diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt
index 85e11634fc..4df53a561e 100644
--- a/runtime/doc/message.txt
+++ b/runtime/doc/message.txt
@@ -68,7 +68,7 @@ Or view a list of recent messages with: >
See `:messages` above.
LIST OF MESSAGES
- *E222* *E228* *E232* *E256* *E293* *E298* *E304* *E317*
+ *E222* *E228* *E232* *E293* *E298* *E304* *E317*
*E318* *E356* *E438* *E439* *E440* *E316* *E320* *E322*
*E323* *E341* *E473* *E570* *E685* *E292* >
Add to read buffer
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 79dcea510c..a7ad94db6d 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -5256,7 +5256,7 @@ A jump table for the options with a short description can be found at |Q_op|.
of this option).
For MS-Windows the default is ">%s 2>&1". The output is directly
saved in a file and not echoed to the screen.
- For Unix the default it "| tee". The stdout of the compiler is saved
+ For Unix the default is "| tee". The stdout of the compiler is saved
in a file and echoed to the screen. If the 'shell' option is "csh" or
"tcsh" after initializations, the default becomes "|& tee". If the
'shell' option is "sh", "ksh", "mksh", "pdksh", "zsh", "zsh-beta",
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 92147ecbce..406068982e 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -787,11 +787,12 @@ An ordinary atom can be:
^beep( the start of the C function "beep" (probably).
*/\^*
-\^ Matches literal '^'. Can be used at any position in the pattern.
+\^ Matches literal '^'. Can be used at any position in the pattern, but
+ not inside [].
*/\_^*
\_^ Matches start-of-line. |/zero-width| Can be used at any position in
- the pattern.
+ the pattern, but not inside [].
Example matches ~
\_s*\_^foo white space and blank lines and then "foo" at
start-of-line
@@ -802,12 +803,13 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
|/zero-width|
*/\$*
-\$ Matches literal '$'. Can be used at any position in the pattern.
+\$ Matches literal '$'. Can be used at any position in the pattern, but
+ not inside [].
*/\_$*
\_$ Matches end-of-line. |/zero-width| Can be used at any position in the
- pattern. Note that "a\_$b" never matches, since "b" cannot match an
- end-of-line. Use "a\nb" instead |/\n|.
+ pattern, but not inside []. Note that "a\_$b" never matches, since
+ "b" cannot match an end-of-line. Use "a\nb" instead |/\n|.
Example matches ~
foo\_$\_s* "foo" at end-of-line and following white space and
blank lines
@@ -830,8 +832,9 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
|/zero-width|
*/\zs*
-\zs Matches at any position, and sets the start of the match there: The
- next char is the first char of the whole match. |/zero-width|
+\zs Matches at any position, but not inside [], and sets the start of the
+ match there: The next char is the first char of the whole match.
+ |/zero-width|
Example: >
/^\s*\zsif
< matches an "if" at the start of a line, ignoring white space.
@@ -842,8 +845,9 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
This cannot be followed by a multi. *E888*
*/\ze*
-\ze Matches at any position, and sets the end of the match there: The
- previous char is the last char of the whole match. |/zero-width|
+\ze Matches at any position, but not inside [], and sets the end of the
+ match there: The previous char is the last char of the whole match.
+ |/zero-width|
Can be used multiple times, the last one encountered in a matching
branch is used.
Example: "end\ze\(if\|for\)" matches the "end" in "endif" and
diff --git a/runtime/doc/usr_03.txt b/runtime/doc/usr_03.txt
index b1b04f95c7..d42701b698 100644
--- a/runtime/doc/usr_03.txt
+++ b/runtime/doc/usr_03.txt
@@ -30,10 +30,11 @@ Table of contents: |usr_toc.txt|
To move the cursor forward one word, use the "w" command. Like most Vim
commands, you can use a numeric prefix to move past multiple words. For
-example, "3w" moves three words. This figure shows how it works:
+example, "3w" moves three words. This figure shows how it works (starting at
+the position marked with "x"):
This is a line with example text ~
- --->-->->----------------->
+ x-->-->->----------------->
w w w 3w
Notice that "w" moves to the start of the next word if it already is at the
@@ -41,15 +42,15 @@ start of a word.
The "b" command moves backward to the start of the previous word:
This is a line with example text ~
- <----<--<-<---------<---
+ <----<--<-<---------<--x
b b b 2b b
There is also the "e" command that moves to the next end of a word and "ge",
which moves to the previous end of a word:
This is a line with example text ~
- <- <--- -----> ---->
- ge ge e e
+ <----<----x---->------------>
+ 2ge ge e we
If you are at the last word of a line, the "w" command will take you to the
first word in the next line. Thus you can use this to move through a
@@ -82,12 +83,12 @@ an <End> key it will do the same thing.
The "^" command moves to the first non-blank character of the line. The "0"
command (zero) moves to the very first character of the line, and the <Home>
-key does the same thing. In a picture:
+key does the same thing. In a picture ("." indicates a space):
^
- <------------
+ <-----------x
.....This is a line with example text ~
- <----------------- --------------->
+ <----------------x x-------------->
0 $
(the "....." indicates blanks here)
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 80c0592c7c..9505ac7909 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -327,9 +327,9 @@ Grouping is done with parentheses. No surprises here. Example: >
:echo (10 + 5) * 2
< 30 ~
-Strings can be concatenated with ".". Example: >
+Strings can be concatenated with ".." (see |expr6|). Example: >
- :echo "foo" . "bar"
+ :echo "foo" .. "bar"
< foobar ~
When the ":echo" command gets multiple arguments, it separates them with a
@@ -496,9 +496,9 @@ So far the commands in the script were executed by Vim directly. The
very powerful way to build commands and execute them.
An example is to jump to a tag, which is contained in a variable: >
- :execute "tag " . tag_name
+ :execute "tag " .. tag_name
-The "." is used to concatenate the string "tag " with the value of variable
+The ".." is used to concatenate the string "tag " with the value of variable
"tag_name". Suppose "tag_name" has the value "get_cmd", then the command that
will be executed is: >
@@ -514,7 +514,7 @@ This jumps to the first line and formats all lines with the "=" operator.
To make ":normal" work with an expression, combine ":execute" with it.
Example: >
- :execute "normal " . normal_commands
+ :execute "normal " .. normal_commands
The variable "normal_commands" must contain the Normal mode commands.
Make sure that the argument for ":normal" is a complete command. Otherwise
@@ -531,12 +531,12 @@ If you don't want to execute a string but evaluate it to get its expression
value, you can use the eval() function: >
:let optname = "path"
- :let optval = eval('&' . optname)
+ :let optval = eval('&' .. optname)
A "&" character is prepended to "path", thus the argument to eval() is
"&path". The result will then be the value of the 'path' option.
The same thing can be done with: >
- :exe 'let optval = &' . optname
+ :exe 'let optval = &' .. optname
==============================================================================
*41.6* Using functions
@@ -1136,7 +1136,7 @@ Example: >
: let n = n + len(split(getline(lnum)))
: let lnum = lnum + 1
: endwhile
- : echo "found " . n . " words"
+ : echo "found " .. n .. " words"
:endfunction
You can call this function with: >
@@ -1149,7 +1149,7 @@ It will be executed once and echo the number of words.
range, with the cursor in that line. Example: >
:function Number()
- : echo "line " . line(".") . " contains: " . getline(".")
+ : echo "line " .. line(".") .. " contains: " .. getline(".")
:endfunction
If you call this function with: >
@@ -1173,11 +1173,11 @@ so on. The variable "a:0" contains the number of extra arguments.
:function Show(start, ...)
: echohl Title
- : echo "start is " . a:start
+ : echo "start is " .. a:start
: echohl None
: let index = 1
: while index <= a:0
- : echo " Arg " . index . " is " . a:{index}
+ : echo " Arg " .. index .. " is " .. a:{index}
: let index = index + 1
: endwhile
: echo ""
@@ -1585,10 +1585,10 @@ Another useful mechanism is the ":finally" command: >
:let tmp = tempname()
:try
- : exe ".,$write " . tmp
- : exe "!filter " . tmp
+ : exe ".,$write " .. tmp
+ : exe "!filter " .. tmp
: .,$delete
- : exe "$read " . tmp
+ : exe "$read " .. tmp
:finally
: call delete(tmp)
:endtry
@@ -1939,8 +1939,8 @@ prepending it with "s:".
We will define a function that adds a new typing correction: >
30 function s:Add(from, correct)
- 31 let to = input("type the correction for " . a:from . ": ")
- 32 exe ":iabbrev " . a:from . " " . to
+ 31 let to = input("type the correction for " .. a:from .. ": ")
+ 32 exe ":iabbrev " .. a:from .. " " .. to
..
36 endfunction
@@ -2045,7 +2045,7 @@ a few lines to count the number of corrections: >
30 function s:Add(from, correct)
..
34 let s:count = s:count + 1
- 35 echo s:count . " corrections now"
+ 35 echo s:count .. " corrections now"
36 endfunction
First s:count is initialized to 4 in the script itself. When later the
@@ -2088,11 +2088,11 @@ Here is the resulting complete example: >
28 noremap <SID>Add :call <SID>Add(expand("<cword>"), 1)<CR>
29
30 function s:Add(from, correct)
- 31 let to = input("type the correction for " . a:from . ": ")
- 32 exe ":iabbrev " . a:from . " " . to
+ 31 let to = input("type the correction for " .. a:from .. ": ")
+ 32 exe ":iabbrev " .. a:from .. " " .. to
33 if a:correct | exe "normal viws\<C-R>\" \b\e" | endif
34 let s:count = s:count + 1
- 35 echo s:count . " corrections now"
+ 35 echo s:count .. " corrections now"
36 endfunction
37
38 if !exists(":Correct")
@@ -2340,7 +2340,7 @@ should be undone. Set the b:undo_ftplugin variable to the commands that will
undo the settings in your filetype plugin. Example: >
let b:undo_ftplugin = "setlocal fo< com< tw< commentstring<"
- \ . "| unlet b:match_ignorecase b:match_words b:match_skip"
+ \ .. "| unlet b:match_ignorecase b:match_words b:match_skip"
Using ":setlocal" with "<" after the option name resets the option to its
global value. That is mostly the best way to reset the option value.
@@ -2461,17 +2461,17 @@ The following example shows how it's done: >
map <F19> :call BufNetWrite('something')<CR>
let s:did_load = 1
- exe 'au FuncUndefined BufNet* source ' . expand('<sfile>')
+ exe 'au FuncUndefined BufNet* source ' .. expand('<sfile>')
finish
endif
function BufNetRead(...)
- echo 'BufNetRead(' . string(a:000) . ')'
+ echo 'BufNetRead(' .. string(a:000) .. ')'
" read functionality here
endfunction
function BufNetWrite(...)
- echo 'BufNetWrite(' . string(a:000) . ')'
+ echo 'BufNetWrite(' .. string(a:000) .. ')'
" write functionality here
endfunction