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.
> If making 'virtualedit' global-local seems OK, I can take a stab at
> making that change, but I don't have much free time these days, so
> it may be a while.
It's not complicated, you can use another option as an example.
--
There are three kinds of persons: Those who can count and those who can't.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///