Saturday, September 30, 2023

Re: E325 ATTENTION message wrapping/formatting problem

On 2023-09-29, 'Trey Blancher' via vim_use <vim_use@googlegroups.com> wrote:
> I have a problem with the E325 ATTENTION message, informing me of an
> existing swap file. It appears that every line in the message is
> inordinately long,
> [...]
> This has been going on for quite some time, I don't know exactly when it
> started. Is there any way to fix this?

I don't know, but you may mitigate the problem with `SwapExists` to call
a function that uses a less intrusive prompt.

For example, vimrc includes:

vim9script
import autoload "my/libvimrc.vim" as lib
set cmdheight=2
autocmd SwapExists * lib.SwapExists()

Then, in libvimrc.vim, I define:

export def SwapExists()
echohl WarningMsg
echon $'A swap file exists: {fnamemodify(v:swapname, ":t")}'
echohl None
echon "\n" .. 'read-(o)nly (e)dit (r)ecover (d)elete (q)uit (a)bort (ENTER for details) '
v:swapchoice = nr2char(getchar())
echo "\r"
enddef

The same can be done in legacy Vim script, of course.

Hope this helps,
Life.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ufa2i1%24usi%241%40ciao.gmane.io.

No comments:

Post a Comment