3

For example: if my cursor is on c in abcde and I do gUw then the result is abCDE with the cursor on C, while gUb results in ABcde with the cursor on A. Is this the expected behaviour? It seems that these two should behave analogously, but they don't.

Edit: I should add that I'm using

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 10 2018 11:27:58)
macOS version
5

See :h operator:

After applying the operator the cursor is mostly left at the start of the text that was operated upon. For example, "yfe" doesn't move the cursor, but "yFe" moves the cursor leftwards to the "e" where the yank started.

You are experiencing the expected behavior: your cursor is put at the beginning of the text described by your motion.

  • Thanks for your answer! That definitely explains it. If my goal is to type a word, go into normal mode, capitalize it, and then continue inserting, is the best way to do abcde <ESC> gUbw? The reason I ask is that I'm trying to avoid use of the shift key because the repeated stretching irritates my hand, and i have caps lock rebound to ctrl. – ira Jan 11 '18 at 19:34
  • @ira I would say that if you absolutely want to capitalize your word while you are writing that is you best bet. But I think you would be more productive if you wrote your sentence (or line of code) and then go to insert mode to change the capitalization: this way you create repeatable changes which are meaningful and make the dot command . more powerful :) – statox Jan 11 '18 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.