diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-03-22 12:13:54 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-22 12:13:54 +0000 |
commit | 35dc17634dd6da5b90bd1b0160c4ed9e394f4b87 (patch) | |
tree | 3d63468febb80de476c931d79bf814d105d6d654 /runtime/doc/repeat.txt | |
parent | e18acb02bb58b2e07f3a52ce619752ba39c05ea2 (diff) |
patch 8.2.4607: sourcing buffer lines may lead to errors for conflictsv8.2.4607
Problem: Sourcing buffer lines may lead to errors for conflicts.
Solution: Add the ++clear argument. (Yegappan Lakshmanan, closes #9991)
Diffstat (limited to 'runtime/doc/repeat.txt')
-rw-r--r-- | runtime/doc/repeat.txt | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index f7756c1c06..1ee547ce04 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -198,16 +198,35 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. start with a ":". Triggers the |SourcePre| autocommand. -:[range]so[urce] Read Ex commands from the [range] of lines in the - current buffer. When sourcing commands from the - current buffer, the same script-ID |<SID>| is used - even if the buffer is sourced multiple times. If a - buffer is sourced more than once, then the functions - in the buffer are redefined again. - Sourcing a buffer with a Vim9 script more than once - works like |vim9-reload|. - To source a script in the Vim9 context, the |:vim9cmd| - modifier can be used. +:[range]so[urce] [++clear] + Read Ex commands from the [range] of lines in the + current buffer. + + When sourcing commands from the current buffer, the + same script-ID |<SID>| is used even if the buffer is + sourced multiple times. If a buffer is sourced more + than once, then the functions in the buffer are + defined again. + + To source a range of lines that doesn't start with the + |:vim9script| command in Vim9 script context, the + |:vim9cmd| modifier can be used. + + When a range of lines in a buffer is sourced in the + Vim9 script context, the previously defined + script-local variables and functions are not cleared. + This works like the range started with the + ":vim9script noclear" command. The "++clear" argument + can be used to clear the script-local variables and + functions before sourcing the script. This works like + the range started with the |:vimscript| command + without the "noclear" argument. See |vim9-reload| for + more information. + Examples: > + + :4,5source + :vim9cmd :'<,'>source + :10,18source ++clear *:source!* :so[urce]! {file} Read Vim commands from {file}. These are commands |