On 2021-07-13, Bram Moolenaar wrote: > Gary Johnson wrote: > > > Would there be a problem with making 'virtualedit' global-local > > instead of just global, as it is now? > > > > The problem I'm having is that I set virtualedit=all automatically > > whenever I'm diffing two or more buffers so that I can move the > > cursor vertically through either buffer and not have the windows > > scroll to the left whenever the cursor moves to an empty line. When > > I open a new buffer, it also has virtualedit=all and editing behaves > > oddly, causing me to make mistakes and to take extra steps to work > > around those oddities. > > > > The most common situation is committing a file to a git repo using > > Fugitive. I use :Gdiffsplit to see the changes, which sets > > virtualedit=all, then ":Git add %" and "Git commit" to commit them. > > ":Git commit" opens a new buffer containing the usual Git commit > > template and the cursor positioned at line 1, column 1. Typing 'a' > > to begin adding text, as I would in any buffer, moves the cursor to > > the right to column 2, leaving a virtual space in column 1. I can't > > backspace over it because there is no space character there. There > > are several ways to begin my commit comment in column 1, but all > > involve doing something I wouldn't have to do if 'virtualedit' was > > not set. > > Yes, this sounds like a good idea. > > I wonder if it should be buffer-local or window-local? Thus is it > related to the contents of the buffer, or to how it's displayed? > When buffer-local you would keep the setting when editing the same > buffer again in another window, but you can't have two windows on the > same buffer with different 'virtualedit' values. > > I suppose buffer-local makes most sense.
Now that I've used this a while longer, I think it would work better if it was window-local rather than buffer-local. The state of 'virtualedit' is more a property of the editing task than it is of the file type or buffer contents. I noticed this while using Fugitive and diffing a file in a pair of windows while having the same file open for editing in another window. The latter window suddenly had virtualedit=all even though I only wanted it set in those windows where 'diff' was set. I don't think the feature has been released for long enough for changing it to be a problem, if that's what we decide to do. I don't know if there are any other difficulties with making this window-local. What do you think? Regards, Gary -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20210729183622.GB16854%40phoenix.
