When I paste into vim I often get a #
character at the start of each line I've pasted.
Is there an easy way I can remove the first char on N lines (without regex)?
Thanks!
When I paste into vim I often get a #
character at the start of each line I've pasted.
Is there an easy way I can remove the first char on N lines (without regex)?
Thanks!
Go to the first occurrence of #
in the pasted text.
Enter blockwise visual mode.
ctrl-V
Select first character in each line pasted.
<count>j
where count = N - 1
Delete the selected text.
x
Btw, your concern should have been to avoid getting #
altogether when you paste. The solution to which is :set paste
Method 1:
Select these N lines and press :
, the command line will look like this
:'<,'>
complete the command as :'<,'>normal x
and press Enter
Method 2:
Say the the number of first line and last line you pasted in are startNumber and endNumber, just use command line:
:startNumber,endNumber normal x