If I press CtrlC, jjj(select all lines) , Shifti, \, only first line changed.
Notice: Don't want to use :s substitute command.
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
The short answer is: In Visual Block mode select lines to their ends (
$) and use
A to append some text at the end of each line.
The longer answer:
ggto go the beginning of the first line.
CTRL-V(or the proper alternative
CTRL-Qin e.g. gVim) to start blockwise visual selection.
jjj$select all four lines down (
jjj) and to the right until their individual ends (
Astart appending some text ('
\' in your case).
In fact this is not exactly your desired result, but functually equal and achievable with a minimum effort and time:
short line \ very long line \ very very long line \ short line \
This is a nice technique. Thanks Maxim Kim.
This description may be helpful. All codes are literal key entries except:
To insert (spaces that end with char: #) on a vertical line, with cursor anywhere on the first line:
:set ve=all . enable full screen block cursor access $ . cursor to top right position for vertical line start C-v . enable select (vertical line) mode 8j . move cursor down 8 lines (selects a vertical line) s#ESC . substitute # char in highlighted area, actuate by escape key :set ve= . restore default mode (mine is unset, could be: block)
notes: can also append a char or word using an uppercase key append: A, or use insert: I