In eval.txt, under getcmdpos() and getcmdtype(), IMHO it should be mentioned that they also work in the {rhs} of a :cmap or :cabbrev (and friends) with the <expr> modifier (which is only available in Vim 7 and later).

Example (which works for me, I have it in my vimrc; it assumes 'nocompatible'):

" open help window at bottom if :help was shortened to :h
if version < 700
        cnoreabbrev h bot h
else
        cnoreabbrev <expr> h
        \ ((getcmdtype() == ':' && getcmdpos() <= 2)? 'bot h' : 'h')
endif



Best regards,
Tony.
--
ZOOT:  I'm afraid our life must seem very dull and quiet compared to yours.
       We are but eightscore young blondes, all between sixteen and
nineteen-and-a-half, cut off in this castle, with no one to protect us. Oooh. It is a lonely life ... bathing ... dressing ... undressing ...
       making exciting underwear....
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui