diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-03-21 19:45:17 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-21 19:45:17 +0000 |
commit | 85b43c6cb7d56919e245622f4e42db6d8bee4194 (patch) | |
tree | 96162d04de08fc6d8a9ae1aa02347f12d6206642 /runtime/doc | |
parent | 397a87ac1c9857eb0d5ec3add69e3b9ab6b0c77c (diff) | |
download | vim-git-85b43c6cb7d56919e245622f4e42db6d8bee4194.tar.gz |
patch 8.2.4603: sourcing buffer lines is too complicatedv8.2.4603
Problem: Sourcing buffer lines is too complicated.
Solution: Simplify the code. Make it possible to source Vim9 script lines.
(Yegappan Lakshmanan, closes #9974)
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/repeat.txt | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index a775af03a..f7756c1c0 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -201,7 +201,13 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. :[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. + 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. *:source!* :so[urce]! {file} Read Vim commands from {file}. These are commands @@ -425,10 +431,10 @@ An alternative is to put the commands in a file, and execute them with the ':source!' command. Useful for long command sequences. Can be combined with the ':map' command to put complicated commands under a function key. -The ':source' command reads Ex commands from a file line by line. You will -have to type any needed keyboard input. The ':source!' command reads from a -script file character by character, interpreting each character as if you -typed it. +The ':source' command reads Ex commands from a file or a buffer line by line. +You will have to type any needed keyboard input. The ':source!' command reads +from a script file character by character, interpreting each character as if +you typed it. Example: When you give the ":!ls" command you get the |hit-enter| prompt. If you ':source' a file with the line "!ls" in it, you will have to type the |