> Gerald Lai sent on Thu, 27 Apr 2006 17:44:05 -0700 (PDT):
>> On Thu, 27 Apr 2006, Suresh Govindachar wrote:
>>
>> Hello,
>>
>> Why does the following _single_ line map
>> generate the E10 error?:
>>
>> nmap <space> :let
@a=substitute(getline('.'),'\(^.*|\s*\)\|\(\s\s*$\)','','g')
Note that error E10 concerns viml line continuation
but the preceding is all one line -- does not have viml
line continuation.
>> How would it be fixed?
>
> What do you intend to do with the mapping?
The line would have several '|' characters in it; I want @a to
contain the the stuff after the very last '|' but without any
leading or trailing white space in the captured stuff:
So, for example, if the line was:
stuff | more stuff | want this gold
then @a should contain "want this gold" (without quotes)
Also, put the cursor on the above example line, and issue
the command
echo substitute(getline('.'),'\(^.*|\s*\)\|\(\s\s*$\)','','g')
> First, replace all "|" with "<Bar>":
Well, putting the cursor on the example line and issuing
the following command gives the wrong answer:
echo substitute(getline('.'),'\(^.*<bar>\s*\)\<bar>\(\s\s*$\)','','g')
[...]
Here's my present work-around:
let @b="'\\(^.*|\\s*\\)\\|\\(\\s\\s*$\\)','','g'"
nmap <space> :exec "let @a=substitute(getline('.'),"[EMAIL PROTECTED]")
--Suresh