8

我想做类似的事情

map <C-k> :e#<CR>

在我的.vimrc.

但是,我最近发现它<C-k>用于有向图。

如何在 vim 中获取未映射的控制键列表?

4

3 回答 3

2

Vim has many commands, so it can be a challenge to find a (memorable and short) key sequence for mappings.

My approach is to use the recommended <Leader> prefix for things I do not use frequently, but for essential stuff a mapping with Ctrl is useful, indeed.

Learn how the commands are represented in the help (e.g. CTRL-O in normal mode, i_CTRL-X_CTRL-N for insert mode), think of a good mapping candidate, then try to look it up via :help CTRL-...) If there are no matches, you can make sure that the mapping is free via :nmap C-...; if there is a match (the nice thing is that this also covers plugins that supply documentation), you can read the description, have at least discovered a new Vim command, and can then decide whether you need it (then retry with a different mapping candidate), or whether you override the command.

(Note that you can also :noremap built-in commands to other keys, but be aware that this makes you increasingly helpless in vanilla Vim installations or other application's vi-emulation modes.)

于 2012-11-22T10:09:49.540 回答
2

I just akc'd the documentation directory for vim 7.4 debian/ubuntu package to find used control keys.

the command I used was

ack ctrl- | perl -ne 'm/(CTRL-.?)/g; print $1."\n";' | sort| uniq

The output is below

CTRL-^
CTRL-<
CTRL-_
CTRL--
CTRL-;
CTRL-?
CTRL-(
CTRL-[
CTRL-]
CTRL-{
CTRL-@
CTRL-\
CTRL-6
CTRL-a
CTRL-A
CTRL-B
CTRL-C
CTRL-D
CTRL-E
CTRL-F
CTRL-G
CTRL-H
CTRL-I
CTRL-J
CTRL-K
CTRL-L
CTRL-M
CTRL-N
CTRL-O
CTRL-P
CTRL-Q
CTRL-R
CTRL-s
CTRL-S
CTRL-T
CTRL-U
CTRL-V
CTRL-W
CTRL-x
CTRL-X
CTRL-Y
CTRL-Z

Basically no free ctrl keys . . . Yay! :)

于 2015-10-08T18:32:52.270 回答
1
于 2012-11-22T10:04:19.113 回答