What's the quickest way to change a specific number of characters? I want to edit the next N number of characters without using replace mode.
-
4Can you clarify your question further more, please? By specifying some sample input and expected outcome? – kenorb May 15 '15 at 11:34
-
@kenorb It was just a Q&A thing that I wanted to post, I just thought to myself that really there are several ways to accomplish something very simple and wanted to share them here (since Vi is now off-topic on SuperUser and SO). I'll edit the question a bit better to reflect that. And I wanted to narrow it down a bit further to avoid the replace-mode way. – Nobilis May 15 '15 at 13:20
-
It's ok to post, but the thing is that you don't give enough details/explanation within the question, so people won't understand what's the answer about if they don't understand what was the problem in the first place, in other words you're not allowing other users to post alternative solutions, because the problem isn't clarified enough. E.g. 'a specific number of characters' and 'through the INSERT mode' is ambiguous. Just giving some sample text example (in and out) would be great. – kenorb May 15 '15 at 15:43
-
@kenorb I understand, not sure how to edit it better, I just wanted to post a Q&A about ways to change characters that don't include replace mode (as I believe that's already covered). – Nobilis May 15 '15 at 15:47
Several straightforward ways, where the number of characters is, say, 5:
5s
c5Space
5xi
Space can be substituted with l or →.
All of those will remove the desired number of characters first (in this case 5) and then put you in INSERT
mode.
To avoid entering INSERT
mode, refer to this question.
-
2The question asks: 'through the INSERT mode', but when you type
5s
then you type it literally. If you don't mean in INSERT mode, then you've to press Escape first to exit this mode, unless you was thinking about COMMAND mode. That's why isn't clear for me. – kenorb May 15 '15 at 15:45