[vim/vim] Change 'virtualedit' local option from buffer-local to window-local (#8685)

10 views
Skip to first unread message

Gary Johnson

unread,
Aug 1, 2021, 5:00:35 PM8/1/21
to vim/vim, Subscribed

Patch 8.2.3227 allowed 'virtualedit' to be local to buffer as well as global. After using the buffer-local settings for a while, it became apparent that they would be more useful if they were window-local instead. That change is made here. Patch 8.2.3227 hasn't been released very long, so making this change should not inconvenience users.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/8685

Commit Summary

  • Make the 'virtualedit' option global-local
  • Merge branch 'master' into gj_ve_global_local
  • Add "none" to 'virtualedit' values
  • Add "NONE" as alternative spelling of "none"
  • Change 'virtualedit' from local to buffer to local to window
  • Merge branch 'master' into gj_ve_window_local
  • Delete 'virtualedit' buffer variables

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Gabriel Dupras

unread,
Aug 1, 2021, 5:06:34 PM8/1/21
to vim/vim, Subscribed

it became apparent that they would be more useful if they were window-local instead.

Can you explain why?

Nick Jensen

unread,
Aug 1, 2021, 5:13:41 PM8/1/21
to vim/vim, Subscribed

Can you explain why?

It was discussed on the mailing list, see the discussion here: https://groups.google.com/g/vim_dev/c/7kwC0ysjM9s/m/1mjEhN0fCwAJ

Gary Johnson

unread,
Aug 1, 2021, 5:51:20 PM8/1/21
to reply+ACY5DGA7NFQXNNRSIU...@reply.github.com, vim...@googlegroups.com
On 2021-08-01, Gabriel Dupras wrote:
> it became apparent that they would be more useful if they were window-local
> instead.
>
> Can you explain why?

In short, the choice of 'virtualedit' setting depends on the editing
task more than on the file type or buffer contents.

Sometimes, when I'm viewing diffs in relatively narrow
vertically-split windows, the differences are near the ends of
lines, so I scroll the windows to see those differences. Without
virtualedit=all, moving the cursor up or down to a shorter line can
cause the windows to scroll back to the left, which is really
annoying. So I created a set of autocommands to fix that problem by
setting virtualedit=all whenever 'diff' is set. When 'virtualedit'
was global, that would set it in all my windows, whether they were
viewing a diff or not.

When I proposed making 'virtualedit' global-local, it wasn't clear
to either Bram or me whether it would be better to make it
buffer-local or window-local. I was more familiar with buffer-local
settings, so I went that route. I changed my autocommands to set
virtualedit=all only in those buffers involved in a diff.

However, after using it a lot recently with Fugitive, I discovered
some cases where I had a buffer open both in a regular window and in
a window where it was being diffed against another version of the
file. The automatic virtualedit=all setting was also being applied
to the same buffer in the regular window, which is not what
I wanted.

So there I had an example of a case where window-local was better,
and I couldn't think of a case where buffer-local would be better,
so I changed it from buffer-local to window-local.

Regards,
Gary

vim-dev ML

unread,
Aug 1, 2021, 5:51:38 PM8/1/21
to vim/vim, vim-dev ML, Your activity

On 2021-08-01, Gabriel Dupras wrote:
> it became apparent that they would be more useful if they were window-local
> instead.
>

codecov[bot]

unread,
Aug 2, 2021, 1:21:12 PM8/2/21
to vim/vim, vim-dev ML, Comment

Codecov Report

Merging #8685 (bbfa5e4) into master (0d4d9ee) will decrease coverage by 87.64%.
The diff coverage is 6.89%.

Current head bbfa5e4 differs from pull request most recent head 47ef3bb. Consider uploading reports for the commit 47ef3bb to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@

##           master    #8685       +/-   ##

===========================================

- Coverage   90.11%    2.46%   -87.65%     

===========================================

  Files         150      148        -2     

  Lines      170265   165053     -5212     

===========================================

- Hits       153436     4072   -149364     

- Misses      16829   160981   +144152     
Flag Coverage Δ
huge-clang-none ?
huge-gcc-none ?
huge-gcc-testgui ?
huge-gcc-unittests 2.46% <6.89%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/buffer.c 3.46% <ø> (-88.99%) ⬇️
src/drawscreen.c 1.63% <0.00%> (-84.75%) ⬇️
src/ex_docmd.c 0.00% <ø> (-95.90%) ⬇️
src/ops.c 0.00% <0.00%> (-96.00%) ⬇️
src/optionstr.c 21.41% <0.00%> (-73.77%) ⬇️
src/textprop.c 0.00% <0.00%> (-96.82%) ⬇️
src/usercmd.c 0.00% <0.00%> (-94.74%) ⬇️
src/userfunc.c 0.18% <0.00%> (-95.08%) ⬇️
src/version.c 0.86% <ø> (-91.48%) ⬇️
src/vim9compile.c 0.00% <0.00%> (-93.89%) ⬇️
... and 147 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0d4d9ee...47ef3bb. Read the comment docs.


You are receiving this because you commented.

Bram Moolenaar

unread,
Aug 3, 2021, 12:33:37 PM8/3/21
to vim/vim, vim-dev ML, Comment

Closed #8685 via 51ad850.


You are receiving this because you commented.


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.

Reply all
Reply to author
Forward
0 new messages