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 --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
