2

I would like to run a shell command on the current file - ie, I saved an empty file and would like to delete it. I've found % represents the current filename, but when there are spaces in the filepath it ends up attempting to remove multiple files, split on the spaces. How can I safely quote the filename?

1 Answer 1

1

Konfekt answers at https://github.com/vim/vim/issues/5907#issuecomment-612667235

If the filename does not contain double quotation marks, then "%" will work. Or, if the Vim version is at least 7.4, then %:S escapes for use with a shell command, see :help %:S.

0

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.