Quantcast

Look up key binding for command

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Look up key binding for command

Michael Ludwig-3
Let's say I'm exploring some feature, like ":help quickfix".
I then see :cnext (also :cn) in the documentation, and I'm
wondering whether it's bound to some key mapping. What's the
best way to find out? I did the following, but there might
be a better way:

  :redir hhh.txt
  :map
  :redir end
  :e hhh.txt
  /cnext

(By the way, :cnext isn't bound to any command in my setup.)

Michael

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Look up key binding for command

Marcin Szamotulski
On 14:36 Sat 14 Apr     , Michael Ludwig wrote:

> Let's say I'm exploring some feature, like ":help quickfix".
> I then see :cnext (also :cn) in the documentation, and I'm
> wondering whether it's bound to some key mapping. What's the
> best way to find out? I did the following, but there might
> be a better way:
>
>   :redir hhh.txt
>   :map
>   :redir end
>   :e hhh.txt
>   /cnext
>
> (By the way, :cnext isn't bound to any command in my setup.)
>
> Michael
>
> --
> 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

Note vim normal commands are done internally by vim and not by a :map command.
So for example you will not find CTRL-W_CTRL-N (:help CTRL-W_CTRL-N) in any
map though it behaves like :new command. Usually, the help file is written in
such a way that ex-command is written together with the corresponding normal
command, like in: ":help :new" and ":help CTRL-W_CTRL-N".

However, there are many maps defined by plugins and that's why all the :map commands
are useful (knowing the key, e.g. :map <F10>). I wrote a plugin to search in
right or left side of a map:
    http://www.vim.org/scripts/script.php?script_id=3767

You can also use :helpgrep command to grep in the docs (consult ":help :helpgrep")

Best regards,
Marcin Szamotulski

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Look up key binding for command

Michael Ludwig-3
Marcin Szamotulski schrieb am 14.04.2012 um 13:56 (+0100):

> Note vim normal commands are done internally by vim and not by
> a :map command. So for example you will not find CTRL-W_CTRL-N
> (:help CTRL-W_CTRL-N) in any map though it behaves like :new
> command.

I see.

> Usually, the help file is written in such a way that ex-command
> is written together with the corresponding normal command, like
> in: ":help :new" and ":help CTRL-W_CTRL-N".

I see.

> However, there are many maps defined by plugins and that's why
> all the :map commands are useful (knowing the key, e.g. :map
> <F10>). I wrote a plugin to search in right or left side of a
> map:
>     http://www.vim.org/scripts/script.php?script_id=3767

Works fine. I can see that you're also using :redir and :map and
its brethren to get the mapping. As far as I can see, the current
release only searches the right-hand side of the mapping, though.

One observation:

    if len(found_maps) > 0
        echo join(found_maps, "\n")
    else
        echohl WarningMsg
        echo "No such map"
        echohl Normal
    endif

Maybe "No matches found" would be a more suitable message here.

> You can also use :helpgrep command to grep in the docs (consult
> ":help :helpgrep")

Thanks. All very helpful.

Michael

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Look up key binding for command

Marcin Szamotulski
On 15:36 Sat 14 Apr     , Michael Ludwig wrote:
> Works fine. I can see that you're also using :redir and :map and
> its brethren to get the mapping. As far as I can see, the current
> release only searches the right-hand side of the mapping, though.
with :Map! you the pattern matches against the whole output of :map command
(except the mode in the first column).

>
> One observation:
>
>     if len(found_maps) > 0
>         echo join(found_maps, "\n")
>     else
>         echohl WarningMsg
>         echo "No such map"
>         echohl Normal
>     endif
>
> Maybe "No matches found" would be a more suitable message here.
You're right.

Best regards,
Marcin Szamotulski

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Look up key binding for command

Michael Ludwig-3
Marcin Szamotulski schrieb am 14.04.2012 um 14:49 (+0100):
> On 15:36 Sat 14 Apr     , Michael Ludwig wrote:
> > As far as I can see, the current release only searches the
> > right-hand side of the mapping, though.
> with :Map! you the pattern matches against the whole output of :map
> command (except the mode in the first column).

Indeed - works fine. Thanks.

Michael

--
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
Loading...