Monday, August 28, 2017

Re: Evoking the option for :help in a mapping

On Mon, Aug 28, 2017 at 7:02 PM, Graham Lawrence <gl00637@gmail.com> wrote:
> I have the customary mappings for :help,
>
> nmap <F1> :exec "help " . expand("<cword>")<CR>
> nmap <S-F1> :exec "help " . expand("<cWORD>")<CR>
>
> and have been trying to develop similar do the <Tab> option on the cursor
> word, something like
>
> nmap \\ yiw:h ^R"^[
>
> but to no avail. Although the mapping does not terminate with a <CR>, vim
> treats the ^[ as if it were <CR> rather than <Tab> and goes straight to the
> specific help for the cursor-word.
>
> Is it possible to have vim act on the <Tab> as it does in the command line?
>
> --
> Graham Lawrence

See :help 'wildcharm'

For instance:

if has('wildmenu')
set wildmenu wildmode=longest:full,full wildcharm=<C-Z>
map <F1> <expr> ':help ' . expand('cword') . "\<C-Z>"
map <S-F1> <expr> ':help ' . expand('cWORD') . "\<C-Z>"
endif

See also
:help map-<expr>
:help expr-quote

Best regards,
Tony.

--
--
You received this message from the "vim_use" 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment