How do I define a function so that I can call it from command-line mode without :call in front of it?
Right now, I have to do this: :call TrimWhitespace()
I want to define it so that I can do this: :TrimWhitespace
This won't be a function, you should create a command instead. Check the documentation for commands (:help user-commands
in Vim).
The simplest case is of a command to call a function:
command! TrimWhitespace call TrimWhitespace()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With