I want to remove # from line 79 to 91
Asked
Active
Viewed 45 times
-1
-
1Please don't post images of text – D. Ben Knoble Mar 08 '22 at 14:52
3 Answers
0
You can use the Visual-Block mode:
- Enter in Visual-Block mode with Ctrlv,
- select the first column and
- Hit d.
But you have also plugins like nerdcommenter (preservim/nerdcommenter) to help you with that.
Vivian De Smedt
- 16,336
- 3
- 18
- 37
0
There's different ways to do this.
A solution:
:79,91g/^#/normal x
g applies a command on the given range. In this case we just delete the first character.
^# filters line to keep only those starting with a #.
You could also select your lines visually then hit :g.... This will automatically limit the command to your selection.
Biggybi
- 2,740
- 9
- 29
0
:79,91 s/^.//
would be my natural answer.
although you did say 'selected' code, which suggests that
:s/^.// would work, although it will show up as
:'<,'>s/^.//
This deletes the first character regardless of if it's a #, which is fine here, but might not be what you want in general.
Joe
- 287
- 1
- 9
