VIM:禁用光标/箭头键,但仅用于导航 [英] VIM: disabling the cursor/arrow keys, but only for navigation

查看:37
本文介绍了VIM:禁用光标/箭头键,但仅用于导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

inoremap  <Up>     <NOP>
inoremap  <Down>   <NOP>
inoremap  <Left>   <NOP>
inoremap  <Right>  <NOP>
noremap   <Up>     <NOP>
noremap   <Down>   <NOP>
noremap   <Left>   <NOP>
noremap   <Right>  <NOP>

这是我用来禁用光标导航的方法,以帮助我坚持使用 hjkl :)

This is what I use to disable cursor navigation, to help me stick to hjkl :)

但它也会禁用命令栏上的光标...通常箭头键可让您循环浏览历史

But it also disables the cursor on the command bar... normally the arrow keys let you cycle through the history

是否可以禁用光标键仅用于导航,而不用于历史记录?

Is it possible to disable the cursor keys ONLY for navigation, and not for the history?

推荐答案

.vimrc 文件中添加以下内容:

Add the following in your .vimrc file:

" Disable Arrow keys in Normal mode
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>

" Disable Arrow keys in Insert mode
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>

这篇关于VIM:禁用光标/箭头键,但仅用于导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆