Mercurial > vim
comparison runtime/doc/repeat.txt @ 28158:e1d1fa6ba1ed v8.2.4603
patch 8.2.4603: sourcing buffer lines is too complicated
Commit: https://github.com/vim/vim/commit/85b43c6cb7d56919e245622f4e42db6d8bee4194
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Mon Mar 21 19:45:17 2022 +0000
patch 8.2.4603: sourcing buffer lines is too complicated
Problem: Sourcing buffer lines is too complicated.
Solution: Simplify the code. Make it possible to source Vim9 script lines.
(Yegappan Lakshmanan, closes #9974)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 21 Mar 2022 21:00:04 +0100 |
parents | f34afadbef47 |
children | b0b712d48225 |
comparison
equal
deleted
inserted
replaced
28157:81034dff92a4 | 28158:e1d1fa6ba1ed |
---|---|
199 Triggers the |SourcePre| autocommand. | 199 Triggers the |SourcePre| autocommand. |
200 | 200 |
201 :[range]so[urce] Read Ex commands from the [range] of lines in the | 201 :[range]so[urce] Read Ex commands from the [range] of lines in the |
202 current buffer. When sourcing commands from the | 202 current buffer. When sourcing commands from the |
203 current buffer, the same script-ID |<SID>| is used | 203 current buffer, the same script-ID |<SID>| is used |
204 even if the buffer is sourced multiple times. | 204 even if the buffer is sourced multiple times. If a |
205 buffer is sourced more than once, then the functions | |
206 in the buffer are redefined again. | |
207 Sourcing a buffer with a Vim9 script more than once | |
208 works like |vim9-reload|. | |
209 To source a script in the Vim9 context, the |:vim9cmd| | |
210 modifier can be used. | |
205 | 211 |
206 *:source!* | 212 *:source!* |
207 :so[urce]! {file} Read Vim commands from {file}. These are commands | 213 :so[urce]! {file} Read Vim commands from {file}. These are commands |
208 that are executed from Normal mode, like you type | 214 that are executed from Normal mode, like you type |
209 them. | 215 them. |
423 | 429 |
424 An alternative is to put the commands in a file, and execute them with the | 430 An alternative is to put the commands in a file, and execute them with the |
425 ':source!' command. Useful for long command sequences. Can be combined with | 431 ':source!' command. Useful for long command sequences. Can be combined with |
426 the ':map' command to put complicated commands under a function key. | 432 the ':map' command to put complicated commands under a function key. |
427 | 433 |
428 The ':source' command reads Ex commands from a file line by line. You will | 434 The ':source' command reads Ex commands from a file or a buffer line by line. |
429 have to type any needed keyboard input. The ':source!' command reads from a | 435 You will have to type any needed keyboard input. The ':source!' command reads |
430 script file character by character, interpreting each character as if you | 436 from a script file character by character, interpreting each character as if |
431 typed it. | 437 you typed it. |
432 | 438 |
433 Example: When you give the ":!ls" command you get the |hit-enter| prompt. If | 439 Example: When you give the ":!ls" command you get the |hit-enter| prompt. If |
434 you ':source' a file with the line "!ls" in it, you will have to type the | 440 you ':source' a file with the line "!ls" in it, you will have to type the |
435 <Enter> yourself. But if you ':source!' a file with the line ":!ls" in it, | 441 <Enter> yourself. But if you ':source!' a file with the line ":!ls" in it, |
436 the next characters from that file are read until a <CR> is found. You will | 442 the next characters from that file are read until a <CR> is found. You will |