diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2023-10-04 06:31:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-04 06:31:25 -0700 |
commit | 29fe883aa9166bdbcae3f935523c75a8aa56fe45 (patch) | |
tree | 40c1179d6d854acec5d044a94cc6111dc54883c7 /runtime/doc/eval.txt | |
parent | 1e7e9ee91f73c62b8c5ba9dbdabba3a3b6dc0130 (diff) | |
download | rneovim-29fe883aa9166bdbcae3f935523c75a8aa56fe45.tar.gz rneovim-29fe883aa9166bdbcae3f935523c75a8aa56fe45.tar.bz2 rneovim-29fe883aa9166bdbcae3f935523c75a8aa56fe45.zip |
feat: ignore swapfile for running Nvim processes #25336
Problem:
The swapfile "E325: ATTENTION" dialog is displayed when editing a file
already open in another (running) Nvim. Usually this behavior is
annoying and irrelevant:
- "Recover" and the other options ("Open readonly", "Quit", "Abort") are
almost never wanted.
- swapfiles are less relevant for "multi-Nvim" since 'autoread' is
enabled by default.
- Even less relevant if user enables 'autowrite'.
Solution:
Define a default SwapExists handler which does the following:
1. If the swapfile is owned by a running Nvim process, automatically
chooses "(E)dit anyway" (caveat: this creates a new, extra swapfile,
which is mostly harmless and ignored except by `:recover` or `nvim -r`.
2. Shows a 1-line "ignoring swapfile..." message.
3. Users can disable the default SwapExists handler via `autocmd! nvim_swapfile`.
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r-- | runtime/doc/eval.txt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 3cd5ea13f6..c41237b862 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2276,12 +2276,13 @@ v:stderr |channel-id| corresponding to stderr. The value is always 2; :call chansend(v:stderr, "error: toaster empty\n") < *v:swapname* *swapname-variable* -v:swapname Only valid when executing |SwapExists| autocommands: Name of - the swap file found. Read-only. +v:swapname Name of the swapfile found. + Only valid during |SwapExists| event. + Read-only. *v:swapchoice* *swapchoice-variable* v:swapchoice |SwapExists| autocommands can set this to the selected choice - for handling an existing swap file: + for handling an existing swapfile: 'o' Open read-only 'e' Edit anyway 'r' Recover |