开发者

How do I escape the %-character in a vimrc-file?

开发者 https://www.devze.com 2023-02-18 19:52 出处:网络
How could I escape the % in this example? func! my_func() exec \"!pri开发者_如何学编程ntf \'=%.0s\' {1..100}\"

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}"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号