runtime(doc): clarify the use of change marks when writing a buffer

related: #17008

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2025-04-03 12:33:02 +02:00
parent a359c9c25e
commit df68419ba0
4 changed files with 18 additions and 16 deletions

View File

@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 9.1. Last change: 2025 Mar 12
*autocmd.txt* For Vim version 9.1. Last change: 2025 Apr 03
VIM REFERENCE MANUAL by Bram Moolenaar
@ -593,7 +593,8 @@ BufWriteCmd Before writing the whole buffer to a file.
The buffer contents should not be changed.
When the command resets 'modified' the undo
information is adjusted to mark older undo
states as 'modified', like |:write| does.
states as 'modified', like |:write| does. Use
the |'[| and |']| marks for the range of lines.
|Cmd-event|
*BufWritePost*
BufWritePost After writing the whole buffer to a file
@ -886,14 +887,14 @@ FileType When the 'filetype' option has been set. The
FileWriteCmd Before writing to a file, when not writing the
whole buffer. Should do the writing to the
file. Should not change the buffer. Use the
'[ and '] marks for the range of lines.
|'[| and |']| marks for the range of lines.
|Cmd-event|
*FileWritePost*
FileWritePost After writing to a file, when not writing the
whole buffer.
*FileWritePre*
FileWritePre Before writing to a file, when not writing the
whole buffer. Use the '[ and '] marks for the
whole buffer. Use the |'[| and |']| marks for the
range of lines.
*FilterReadPost*
FilterReadPost After reading a file from a filter command.

View File

@ -1,4 +1,4 @@
*change.txt* For Vim version 9.1. Last change: 2025 Mar 18
*change.txt* For Vim version 9.1. Last change: 2025 Apr 03
VIM REFERENCE MANUAL by Bram Moolenaar
@ -156,8 +156,8 @@ only after a '.').
The 'B' and 'M' flags in 'formatoptions' change the behavior for inserting
spaces before and after a multibyte character |fo-table|.
The '[ mark is set at the end of the first line that was joined, '] at the end
of the resulting line.
The |'[| mark is set at the end of the first line that was joined, |']| at the
end of the resulting line.
==============================================================================
@ -1188,8 +1188,8 @@ the ":put" command, Vim always inserts the text in the next line. You can
exchange two characters with the command sequence "xp". You can exchange two
lines with the command sequence "ddp". You can exchange two words with the
command sequence "deep" (start with the cursor in the blank space before the
first word). You can use the "']" or "`]" command after the put command to
move the cursor to the end of the inserted text, or use "'[" or "`[" to move
first word). You can use the |']| or |`]| command after the put command to
move the cursor to the end of the inserted text, or use |'[| or |`[| to move
the cursor to the start.
*put-Visual-mode* *v_p* *v_P*

View File

@ -1,4 +1,4 @@
*editing.txt* For Vim version 9.1. Last change: 2024 Oct 14
*editing.txt* For Vim version 9.1. Last change: 2025 Apr 03
VIM REFERENCE MANUAL by Bram Moolenaar
@ -974,8 +974,9 @@ Note: When the 'write' option is off, you are not able to write any file.
executed like with ":!{cmd}", any '!' is replaced with
the previous command |:!|.
The default [range] for the ":w" command is the whole buffer (1,$). If you
write the whole buffer, it is no longer considered changed. When you
The default [range] for the ":w" command is the whole buffer (1,$). The |'[|
and |']| marks will be set to the [range] being used for the write command.
If you write the whole buffer, it is no longer considered changed. When you
write it to a different file with ":w somefile" it depends on the "+" flag in
'cpoptions'. When included, the write command will reset the 'modified' flag,
even though the buffer itself may still be different from its file.

View File

@ -1,4 +1,4 @@
*motion.txt* For Vim version 9.1. Last change: 2024 Dec 17
*motion.txt* For Vim version 9.1. Last change: 2025 Apr 03
VIM REFERENCE MANUAL by Bram Moolenaar
@ -895,12 +895,12 @@ Numbered mark should be stored. See |viminfo-file-marks|.
*'[* *`[*
'[ `[ To the first character of the previously changed
or yanked text.
'[ `[ To the first character of the previously changed,
or yanked text. Also set when writing the buffer.
*']* *`]*
'] `] To the last character of the previously changed or
yanked text.
yanked text. Also set when writing the buffer.
After executing an operator the Cursor is put at the beginning of the text
that was operated upon. After a put command ("p" or "P") the cursor is