是否可以在插入模式下映射 Alt-hjkl? [英] is it possible to mapping Alt-hjkl in Insert mode?

查看:26
本文介绍了是否可以在插入模式下映射 Alt-hjkl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在描述我的问题之前,我会列出环境.应用程序在这里:

before describing my problem, I'd list the env. applications here:

OS:linux 2.6.37-ARCH  (archlinux i686)
vim: 7.2.436
Terminal emulator: urxvt (with 256colors patch)

kent$ echo $TERM
rxvt-256color

screen: Screen version 4.00.03 (FAU) 23-Oct-06

我在终端运行 vim.我想在 INSERT 模式下按 ALT-hjkl 移动光标,光标移动后,保持 INSERT 模式,以便我可以继续输入单词.

I run vim in terminal. I want to move cursor in INSERT mode by pressing ALT-hjkl, after the cursor moved, stay in INSERT mode, so that I could continue typing words.

我找到的文章:

http://vim.wikia.com/wiki/Mapping_fast_keycodes_in_terminal_Vim

http://vim.wikia.com/wiki/Get_Alt_key_to_work_in_terminal

我尝试了什么:

在 .vimrc 中使用 ttimeoutlen=50 进行 keyCode 映射,如下所示:(仅粘贴 alt-j 映射作为示例):

in .vimrc do a keyCode mapping with ttimeoutlen=50 like this: ( only alt-j mapping was pasted as example):

set timeout ttimeoutlen=50
set <F13>=^[j  "ctrl-v alt-j
imap <F13> <down>

有了这个配置,在插入模式下移动光标就可以了.如果我按 和 j.Vim 带我回到插入模式.我不知道为什么 ttimeoutlen=50 不起作用.

with this conf, moving cursor in INSERT mode was ok. If I press <ESC> and j. Vim brings me back to insert Mode. I don't know why the ttimeoutlen=50 didn't work.

也尝试过:

set timeout ttimeoutlen=50
set <M-j>=^[j

使用此设置,当我按下 ALT-j 时,会输入带有重音符号的e".

With this setting, when I pressed ALT-j, a "e" with an accent mark was typed.

你们能给我任何提示,我应该如何在终端中映射 ALT-hjkl 吗?

Can you guys give me any hints how should I map the ALT-hjkl in terminal ?

提前致谢

肯特

推荐答案

映射组合键的作用更容易.Alt+something 通常产生一个字符,不同于 Ctrl+something.

It's easier to map what your key combination does. Alt+something generally results in a character, differently from Ctrl+something.

例如,在我的 Mac 上,Alt 加上 hjkl 生成 ˙Δ˚¬.所以:

For example, on my Mac Alt plus hjkl generates ˙∆˚¬. So:

imap ˙ <Left>
imap ∆ <Down>
imap ˚ <Up>
imap ¬ <Right>

愿意.

这篇关于是否可以在插入模式下映射 Alt-hjkl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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