1

Is there something similar to A and I for "smaller ranges" like w and e, i.e. I don't want to have to press i to insert, after navigating to the end of the word with e?

2
  • Does this answer your question? How to delete a WORD in insert mode?
    – Matt
    Feb 24 at 10:34
  • 4
    It could be useful that you edit your question to explain a little more in depth what is your workflow and what makes you feel inefficient. With the few details you gave it sounds like you are using vim modes in a "wrong" way, if you describe what you're trying to improve maybe someone here will give you an idea of how to change your workflow to be more efficient while avoiding to create workarounds like automatically starting insert mode after a motion.
    – statox
    Feb 24 at 10:39
2

There isn't, but it is possible to create a mapping to do this. For example, if you want <leader>e to do the equivalent of e then i:

nnoremap <leader>e ei

Edit: as statox notes in the comments to the original question, whilst this is possible it may be symptomatic of non-idiomatic vim usage.

6
  • While this is a working solution it has two main drawbacks: As you pointed out that overrides E but that also creates a behavior which is not consistent with other built-in features and I think that in the long run that will not scale (how many other mapping will OP have to create to get consistent behaviors? Which keys to bind to avoid overriding a lot of useful features, etc...). I think to address the first problem a better idea is to map <leader>e instead of E but the second problem would be better addressed by understanding OP's actual pain point.
    – statox
    Feb 24 at 10:43
  • 1
    Both valid points: I have edited to change the mapping to <leader>e Feb 24 at 10:49
  • 1
    1. This should probably be ea, not ei. 2. I wonder if there could be any sense in mapping two keys into other two keys?
    – Matt
    Feb 24 at 11:20
  • Matt: the original answer overwrote E, and I agree that ea would make more sense than ei but was not the question asked. All in all, whilst this answer shows what is technically feasible as per OP's request, I think on reflection I am inclined to delete it because it leads down a non-idiomatic path that may be better tackled at the source. Is deleting an answer appropriate in this instance? Feb 24 at 11:27
  • @AndrewHo-Lee you're free to do as you prefer (it's your answer :) ) however I would be favorable to keep the answer up at least until OP gives more details about their issue. Your answer shows a technically accurate solution to a probably ill-defined problem while discussing the issues it can create. I think it's sane for a new comer to read it with the warnings we added in comments.
    – statox
    Feb 24 at 11:29

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.