Tony Mechelynck wrote:
> 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
OK:
Only works when editing the command line, thus requires use of
|c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping.
--
Life would be so much easier if we could just look at the source code.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
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