45619RE: Calling a function from a :s command (weird results)
- Nov 30, 2003On Sun, 30 Nov 2003, David Fishburn wrote:
>>> I get this kind of thing once in a while; and if I remember correctly,Second try..
>>> it's a quoting issue. From your results, it looks as if the \= isn't
>>> being taken for its intended meaning. Without remembering what really
>>> fixes this, I'd say go ahead and throw an extra backslash in there.
>> Just a guess.. Flag 'C' in 'cpo'?
" Courtesy of Antony Scriven
" This will invert/reverse a string
" This will work on arbitrary length strings, too. The /.*/ should
" quick, which might make it up for using a regex rather than using
" numerous commands in a :while loop.
" This can be used in a substitute command as follows:
let inverted = substitute(a:str, '.\(.*\)\@=',
\ '\=a:str[strlen(submatch(1))]', 'g')
- << Previous post in topic Next post in topic >>