From 9701cbf036aecf18e7d88681040c07d61c314ca6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 15 Oct 2024 08:16:56 +0800 Subject: [PATCH 1/2] vim-patch:7b5e52d: runtime(doc): add preview flag to statusline example Problem: The standard statusline example is missing the preview flag "%w" Solution: Add the preview flag "%w" closes: vim/vim#15874 https://github.com/vim/vim/commit/7b5e52d16fb457c90cc44340a6190712aab7e03b Co-authored-by: saher --- runtime/doc/options.txt | 2 +- runtime/lua/vim/_meta/options.lua | 2 +- src/nvim/options.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 9a6072a23b..739452ab00 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -6275,7 +6275,7 @@ A jump table for the options with a short description can be found at |Q_op|. Examples: Emulate standard status line with 'ruler' set >vim - set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P + set statusline=%<%f\ %h%w%m%r%=%-14.(%l,%c%V%)\ %P < Similar, but add ASCII value of char under the cursor (like "ga") >vim set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P < Display byte count and byte value, modified flag in red. >vim diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index ce3ff4f861..1270ad2519 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -6695,7 +6695,7 @@ vim.wo.stc = vim.wo.statuscolumn --- Emulate standard status line with 'ruler' set --- --- ```vim ---- set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P +--- set statusline=%<%f\ %h%w%m%r%=%-14.(%l,%c%V%)\ %P --- ``` --- Similar, but add ASCII value of char under the cursor (like "ga") --- diff --git a/src/nvim/options.lua b/src/nvim/options.lua index f20933d172..8c6d7bd9cf 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -8356,7 +8356,7 @@ return { Examples: Emulate standard status line with 'ruler' set >vim - set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P + set statusline=%<%f\ %h%w%m%r%=%-14.(%l,%c%V%)\ %P < Similar, but add ASCII value of char under the cursor (like "ga") >vim set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P < Display byte count and byte value, modified flag in red. >vim From dbd172e7e953bdab7132bd635532295a4dc64af9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 15 Oct 2024 08:20:09 +0800 Subject: [PATCH 2/2] vim-patch:5bcfb5a: runtime(doc): add some docs for file-watcher programs fixes: vim/vim#15733 https://github.com/vim/vim/commit/5bcfb5a30cfd8e8574061bdd82a192f47aae09b5 Co-authored-by: Christian Brabandt --- runtime/doc/editing.txt | 9 +++++++++ runtime/doc/options.txt | 5 +++-- runtime/lua/vim/_meta/options.lua | 5 +++-- src/nvim/options.lua | 5 +++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 91c9554d63..4224709a39 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -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 diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 739452ab00..3a6f93ae01 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -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 diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 1270ad2519..36c0f583c7 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -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 diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 8c6d7bd9cf..3c3eaaf5a1 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -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