how do I cut text in vim and automatically remove the remaining lines. For example, when I cut the following text using d:

enter image description here

The lines remain there:

enter image description here

But I want to remove those lines with the cut. Thank you!

  • 1
    Welcome to Vim :-) I suppose we need a bit more context to help you. I don't see the <style> tags in the first screen shot. I suppose they are before and after the section you have selected. How did you select the code? Using Ctrl- v, using Shift-v or using v? Commented Jul 5, 2022 at 7:18
  • Yeah the style tags are there, I just didn't screenshot properly haha. I used B-Visual mode (Ctrl-V) to highlight the text. Thanks for the welcome :)! And now I am seeing that using SHIFT-V to cut removes the remaining spaces. So thanks for answering my question indirectly! Altho kinda curious as to why it doesn't with B-Visual?
    – LeonardALQ
    Commented Jul 5, 2022 at 10:30
  • Please don't post images of text.
    – D. Ben Knoble
    Commented Jul 5, 2022 at 15:22

1 Answer 1


If you want the lines to be deleted when you run the d command I suggest you to select the lines in visual mode (that you start with v) or in visual line mode (that you start with Shiftv).

If you select `visual block' mode (that you start with Ctrlv) the lines will not be deleted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.