How do I escape the %-character in a vimrc-file?
How could I escape the %
in this example?
func! my_func()
exec "!pri开发者_如何学编程ntf '=%.0s' {1..100}"
endfunc
Use shellescape
for any string that is a single argument (not a list of space-separated arguments) and may contains special characters (including space itself):
let suspicious_string='=%.0s'
exec "!printf ".shellescape(suspicious_string, 1)." {1..100}"
精彩评论