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?
Add a comment
|
1 Answer
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.