vim-patch:5bcfb5a: runtime(doc): add some docs for file-watcher programs

fixes: vim/vim#15733

5bcfb5a30c

Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-10-15 08:20:09 +08:00
parent 9701cbf036
commit dbd172e7e9
4 changed files with 18 additions and 6 deletions

View File

@ -1032,6 +1032,15 @@ explanation of when the copy is made and when the file is renamed.
If the creation of a backup file fails, the write is not done. If you want
to write anyway add a '!' to the command.
*file-watcher*
When you notice issues with programs, that act upon when a buffer is written
(like inotify, entr or fswatch) or when external applications execute Vim to
edit the file (like git) and those programs do not seem to notice that the
original file has been changed, you may want to consider switching the
'backupcopy' option value to "yes". This makes sure, Vim writes to the same
file, that those watcher programs expect, without creating a new file (which
prevents them from detecting that the file has changed). See also |crontab|
*write-permissions*
When writing a new file the permissions are read-write. For unix the mask is
0o666 with additionally umask applied. When writing a file that was read Vim

View File

@ -897,12 +897,13 @@ A jump table for the options with a short description can be found at |Q_op|.
useful for example in source trees where all the files are symbolic or
hard links and any changes should stay in the local source tree, not
be propagated back to the original source.
*crontab*
*crontab*
One situation where "no" and "auto" will cause problems: A program
that opens a file, invokes Vim to edit that file, and then tests if
the open file was changed (through the file descriptor) will check the
backup file instead of the newly created file. "crontab -e" is an
example.
example, as are several |file-watcher| daemons like inotify. In that
case you probably want to switch this option.
When a copy is made, the original file is truncated and then filled
with the new text. This means that protection bits, owner and

View File

@ -289,12 +289,13 @@ vim.go.bk = vim.go.backup
--- useful for example in source trees where all the files are symbolic or
--- hard links and any changes should stay in the local source tree, not
--- be propagated back to the original source.
--- *crontab*
--- *crontab*
--- One situation where "no" and "auto" will cause problems: A program
--- that opens a file, invokes Vim to edit that file, and then tests if
--- the open file was changed (through the file descriptor) will check the
--- backup file instead of the newly created file. "crontab -e" is an
--- example.
--- example, as are several `file-watcher` daemons like inotify. In that
--- case you probably want to switch this option.
---
--- When a copy is made, the original file is truncated and then filled
--- with the new text. This means that protection bits, owner and

View File

@ -435,12 +435,13 @@ return {
useful for example in source trees where all the files are symbolic or
hard links and any changes should stay in the local source tree, not
be propagated back to the original source.
*crontab*
*crontab*
One situation where "no" and "auto" will cause problems: A program
that opens a file, invokes Vim to edit that file, and then tests if
the open file was changed (through the file descriptor) will check the
backup file instead of the newly created file. "crontab -e" is an
example.
example, as are several |file-watcher| daemons like inotify. In that
case you probably want to switch this option.
When a copy is made, the original file is truncated and then filled
with the new text. This means that protection bits, owner and