Open ghost opened 7 years ago
The code above doesn't work (non-recursive).
A map with rhs like this is a problem: :call <SID>hello('world')
.
'world'
should be escaped.
<SID>
will receive hardtime script id, resulting in a unknow function.
Something like this will fix it:
let mapping["rhs"] = substitute(mapping["rhs"], "'", "''", "g")
let mapping["rhs"] = substitute(mapping["rhs"], "<SID>", "<SNR>" . mapping["sid"] . "_", "g")
Adding "w" to the keys and trying to use vim-wordmotion results in:
E109: ':' missing after '?'
The problem seems to be with the arguments, so:
let mapping["rhs"] = substitute(mapping["rhs"], "'", "''", "g")
But know I getE117: Unknown function
.This works for me, but I don't know if it is equivalent (there's a reason to execute rhs and not the key itself?):