zhaogaolong / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Inconsistency with virtualedit=onemore $ and g$ in NORMAL vs VISUAL. #344

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
With set virtualedit=onemore, $ takes me to the last character in NORMAL, not 
past it, but in VISUAL $ takes me past the last char just like g$ does.

Basically, $ and g$ work as expected in NORMAL, but in VISUAL $ behaves like g$.

Also, when I set virtualedit="", $ and g$ both take me to the last character 
and it's not possible to move past the last char, but in VISUAL $ and g$ still 
go past the last char.

The intuitively expected behavior would be for VISUAL $ and g$ to act just like 
NORMAL in either form of virtualedit.

Original issue reported on code.google.com by TruSktr on 20 Mar 2015 at 3:50

GoogleCodeExporter commented 9 years ago
This is working as intended.  It's a compromise that keeps backwards 
compatibility while allowing different behavior if 'virtualedit' is set.

Original comment by brammool...@gmail.com on 20 Mar 2015 at 11:27

GoogleCodeExporter commented 9 years ago
Backwards compatibility with Vi? I'm completely willing to be incompatible with 
it. Those people can go use Vi. And that's why the nocompatible setting was 
introduced, so I'd say make the best use of it.

Original comment by TruSktr on 20 Mar 2015 at 4:46

GoogleCodeExporter commented 9 years ago
By they way, Google Code is shutting down, you should consider moving to 
GitHub! ;)

Original comment by TruSktr on 20 Mar 2015 at 4:47

GoogleCodeExporter commented 9 years ago
First, changing the way it behaves currently to the way you wish will make it 
backword incompatible for the people used to the current behaviour. I hope you 
don't want all of them to move to vi ;)

Second, we are aware of this and will move, see the other issues like 
#340,#341,#343

Original comment by chrisbr...@googlemail.com on 20 Mar 2015 at 4:51

GoogleCodeExporter commented 9 years ago
I'm willing to bet high amounts of money that only a very very tiny fraction of 
people actually rely on selecting the newline char in VISUAL mode (and if the 
selection spans multiple lines, the selection of the newline chars between 
those lines is implied), and those people can simply use g$, or map $ to g$ in 
VISUAL, so there would be no need for them to go back to Vi. That would the 
proper design, IMO. I'm also willing to bet millions of dollars that only a 
very very tiny fraction of people care about backwards compatibility with Vi.

But anyway, I love my expensive shiny new proper mapping:
xnoremap $ g$h

Original comment by TruSktr on 20 Mar 2015 at 9:48