Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim常用键位说明 #146

Open
itgoyo opened this issue Apr 10, 2019 · 0 comments
Open

Vim常用键位说明 #146

itgoyo opened this issue Apr 10, 2019 · 0 comments

Comments

@itgoyo
Copy link
Owner

itgoyo commented Apr 10, 2019

前缀键

前缀键。各类 vim 插件帮助文档中经常出现 ,即,前缀键。vim 自带有很多快捷键,再加上各类插件的快捷键,大量快捷键出现在单层空间中难免引起冲突,为缓解该问题,引入了前缀键 ,这样,键 r 可以配置成 r、r、r 等等多个快捷键。前缀键是 vim 使用率较高的一个键(最高的当属 Esc),选一个最方便输入的键作为前缀键,将有助于提高编辑效率。找个无须眼睛查找、无须移动手指的键 —— 分号键,挺方便的,就在你右手小指处:
" 定义快捷键的前缀,即<Leader>let mapleader=";"

举例

  • 使用set命令:
    set pastetoggle=<F9>
  • 使用imap命令:
    用Esc退出插入模式很麻烦,可以将另外的键映射到这个键上,比如将Ctrl-i映射为Esc:imap <C-I> <Esc>
  • "配置F4为Ack快捷键:
    :map <F4> :Ack -i
  • 在插入模式,设置ctrl+\为退出文件 :
    :map! <C-\> <ESC>:q<CR>
<Esc>代表Escape键:<CR>代表Enter键;<D>代表Command键。
Alt键可以使用<M-key>或<A-key>来表示。<C>代表Ctrl.
对于组合键,可以用<C-Esc>代表Ctrl-Esc;使用<S-F1>表示Shift-F1.


使用下表中不同形式的map命令,可以针对特定的模式设置键盘映射:

Command命令 常规模式 可视化模式 运算符模式 插入模式 命令行模式
:map
:nmap
:vmap
:omap
:map!
:imap
:cmap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant