2

How to delete wrapped lines?

I imagined something like gdd and gD but they did not work as expected, in a similar fashion to gj and gk to move through wrapped lines.

It would be really useful to have a way to delete multi-lined wraps.

Ctrl+U in Insert Mode, doesn't help with that as well.

1 Answer 1

2

AFAIK there's no default mapping for this. You could make one for yourself though. I would be careful about mapping gdd or gD because gd and gD already have functions that are really useful. I'm going to use Alt+d just as a suggestion.

nnoremap <A-d> g^dg$g^
5
  • Thats right, I already mapped it myself :P but it was a workaround and it doesn't accept input numbers for range. Alts never work for me, and what are the pre-existing functions of gdd and gD though? :)
    – user10767
    Mar 24, 2017 at 17:46
  • 1
    I linked the documentation for you. :P But they find the local definition of the word under the cursor.
    – Tumbler41
    Mar 24, 2017 at 17:47
  • Btw I did noremap gD g^dg$g^ (and gdd too). I think d$ would delete until the end of the whole line.
    – user10767
    Mar 24, 2017 at 17:52
  • 1
    Good point, added.
    – Tumbler41
    Mar 24, 2017 at 17:55
  • 1
    I think you should replace the last 0 with g^ too though, for the sake of wraps :P
    – user10767
    Mar 24, 2017 at 17:59

Your Answer

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