On Sun, 21 May 2006, Eric Arnold wrote:
I've been trying to map "cd" if it's the first two characters on the :ex line. I've tried all the combinations I can think of. On several of them, I seem to be getting errors as if <expr> is run in the sandbox (that dog won't hunt). The only one that works at all is the first simple mapping, but that gets painful, of course, when you want to use "cd" in a search, etc.
"cnoremap <silent> <expr> cd ( getcmdpos() == 1 ? Cd_plus() : 'cd' )
This one ought to work. Remove "<silent>". cnoremap <expr> cd ( getcmdpos() == 1 ? Cd_plus() : 'cd' ) HTH. -- Gerald