问题
I sometimes open vim with screen linux command but since ctrl-a is considered as control key I cannot increment numbers using the same combination inside the editor.
I don't want to remap entirly ctrl-a but is there a way to disable it so I can use it in vim ?
回答1:
In screen
, you can pass on the prefix key via Ctrl-A
followed by a
(cp. here). In tmux
, this would be Ctrl-b
Ctrl-b
. Either can be adapted in the tool's configuration file.
Alternatively, you could remap the increment inside Vim, e.g. by putting the following into your ~/.vimrc
:
noremap <C-q> <C-a>
回答2:
You can remap screen to use a different escape if you want. I use Ctrlt.
In .screenrc
:
escape ^Tt
This will map the screen metacharacter to Ctrlt. And it also maps the literal sequence of Ctrlt + t to send a Ctrl-t
through to the application running inside screen.
This would free Ctrla so screen will not be using it, and it will be passed through to Vim.
来源:https://stackoverflow.com/questions/42136436/screen-command-disable-the-control-key-ctrl-a-to-use-it-in-vim