Skip to content

Commit 5bcfb5a

Browse files
committed
runtime(doc): add some docs for file-watcher programs
fixes: #15733 Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 793c315 commit 5bcfb5a

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

runtime/doc/editing.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*editing.txt* For Vim version 9.1. Last change: 2024 Oct 13
1+
*editing.txt* For Vim version 9.1. Last change: 2024 Oct 14
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1058,6 +1058,15 @@ explanation of when the copy is made and when the file is renamed.
10581058
If the creation of a backup file fails, the write is not done. If you want
10591059
to write anyway add a '!' to the command.
10601060

1061+
*file-watcher*
1062+
When you notice issues with programs, that act upon when a buffer is written
1063+
(like inotify, entr or fswatch) or when external applications execute Vim to
1064+
edit the file (like git) and those programs do not seem to notice that the
1065+
original file has been changed, you may want to consider switching the
1066+
'backupcopy' option value to "yes". This makes sure, Vim writes to the same
1067+
file, that those watcher programs expect, without creating a new file (which
1068+
prevents them from detecting that the file has changed). See also |crontab|
1069+
10611070
*write-permissions*
10621071
When writing a new file the permissions are read-write. For unix the mask is
10631072
0o666 with additionally umask applied. When writing a file that was read Vim

runtime/doc/options.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,12 +1151,13 @@ A jump table for the options with a short description can be found at |Q_op|.
11511151
useful for example in source trees where all the files are symbolic or
11521152
hard links and any changes should stay in the local source tree, not
11531153
be propagated back to the original source.
1154-
*crontab*
1154+
*crontab*
11551155
One situation where "no" and "auto" will cause problems: A program
11561156
that opens a file, invokes Vim to edit that file, and then tests if
11571157
the open file was changed (through the file descriptor) will check the
11581158
backup file instead of the newly created file. "crontab -e" is an
1159-
example.
1159+
example, as are several |file-watcher| daemons like inotify. In that
1160+
case you probably want to switch this option.
11601161

11611162
When a copy is made, the original file is truncated and then filled
11621163
with the new text. This means that protection bits, owner and

runtime/doc/tags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7114,6 +7114,7 @@ file-read insert.txt /*file-read*
71147114
file-searching editing.txt /*file-searching*
71157115
file-type filetype.txt /*file-type*
71167116
file-types filetype.txt /*file-types*
7117+
file-watcher editing.txt /*file-watcher*
71177118
file_readable() builtin.txt /*file_readable()*
71187119
filecopy() builtin.txt /*filecopy()*
71197120
fileencoding-changed version6.txt /*fileencoding-changed*

0 commit comments

Comments
 (0)