On 13/01/09 18:49, Sitaram Chamarty wrote:
> On 2009-01-13, Tony Mechelynck<[email protected]>  wrote:
>
>> On 13/01/09 07:28, John Beckett wrote:
>>> Sitaram Chamarty wrote:
>>>>> :cnoremap<expr>   <CR>   ((getcmdtype == '/'<Bar><Bar>
>>>>> getcmdtype == '?')?"<Bslash>CR>:set fdm=expr":'')
>>>> Can someone explain this a bit more slowly for me please?
>>> The 'getcmdtype' should be 'getcmdtype()'. I can't offer more help at
> [...]
>>      :cnoremap<expr>  <CR>  ((getcmdtype() == '/'<Bar><Bar>  getcmdtype() ==
>> '?')? "<Bslash>r:set fdm=expr<Bslash>r" : "<Bslash>r")
>>
>> Now here are the explanations:
>>
>> <Bslash>  in a mapping is replaced by \ in the result, and<Bar>  by |
>> So the expression to exaluate is (still all on one line)
>>
>> ((getcmdtype() == '/' || getcmdtype() == '?')? "\r:set fdm=expr\r" : "\r")
>>
>> IOW, if getcmdtype() is a slash or a question mark, the Enter key maps
>> to "\r:set fdm=expr\r" and since this is a double-quoted string, \r in
>> it means a carriage-return (the Enter key). Otherwise, the Enter key
>> maps to itself.
>
> Cool!  Thanks.  If I understand correctly, this mapping is
> invoked every time you hit enter on a command line, to
> change the "foldmethod" setting if it was a search command,
> right?
>
> Thanks again and best regards,
>
> Sitaram

Right.


Best regards,
Tony.
-- 
"It's easier said than done."

... and if you don't believe it, try proving that it's easier done than
said, and you'll see that "it's easier said that `it's easier done than
said' than it is done", which really proves that "it's easier said than
done".

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to