1

My vim does most everything what I want with :retab! one thing I would like it to do in addition is remove all trailing whitespace like this,

:%s/\s\+$//

Is there a way to redefine :retab! such that the above command runs after it. If not, can I define another function (:fixws!) that calls :retab! and the above regex?

1
  • 1
    @Quasímodo how can I create my own then, like :fixws! May 2, 2022 at 1:26

1 Answer 1

2

I would propose:

function! Fixws()
  retab!
  %s/\s\+$//
endfunction

command! Fixws :call Fixws()

The command is :Fixws because the custom command starts with an uppercase.

Your Answer

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

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