KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Say I have this vimscript as "/tmp/example.vim": let g:input = "START; % END" exec("! clear && echo " . shellescape(g:input)) If I open that file and run it with :so % , the output will be START; /tmp/example.vim END because the "%" is expanded to the buffer name. I want the output to be START; % END I can use the generic escape() method to escape percent signs in particular. This works: let g:input = "START; % END" exec("! clear && echo " . escape(shellescape(g:input), "%")) But is that really the best way? I'm sure there're more characters I should escape. Is there a specific escape function for this purpose? Or a better way to shell out?
Tags (comma-separated)
Save Edits
Cancel