New answers tagged

2

If the task is to move 15 characters after the leading SAC/ to immediately before the .SAC at the end of the line I would use a substitute command: :%s/^\(SAC\/\)\(.*\{15\}\)\(.*\)\(\.SAC\)$/\1\3\2\4/ The search pattern captures the leading SAC/, 15 random characters, the following characters up to the trailing .SAC, and the trailing .SAC, each in its own ...


1

Vim has quite a few commands to repeat actions. For your particular situation, I'd recommend using :normal with a range, which will perform a sequence of Normal mode commands for every line in the range. First you need to come up with the sequence of Normal mode commands that will implement your operation. For example, if you want to always delete 15 ...


2

There is also the unimpaired plugin that give mappings in normal mode for putting in blank lines (among other [ and ] base mappings). I never would have thought I'd use them, but I do constantly - these in particular are burned into my fingers: There are linewise mappings. [<Space> and ]<Space> add newlines before and after the cursor line. [e ...


5

Vim golf? :) How about Y2pD It's perhaps a little contrived to create two new hello lines only to delete one but trying to avoid Insert mode is also a bit contrived when you're actually, you know, inserting new text (the blank line). ;)


Top 50 recent answers are included