~ / .inputrc приводит к тому, что клавиши CTRL + не работают

798
nickh

Когда ~/.inputrcже не существует, ударяя Ctrl+ Left Arrowи Ctrl+ Right Arrowна команды Bash строка перемещает курсор назад и вперед, одним словом, соответственно.

Однако, если ~/.inputrcсуществует (независимо от того, является ли он пуст), эти два ключевых комбо в результате ;5Dи ;5Cпечатается, где находится курсор вместо перемещения курсора.

Как я могу это исправить?

4

2 ответа на вопрос

5
numeric illustration

Its because if the file exists, bash uses your local settings for the readline settings instead of the default one.

From http://www.gnu.org/software/bash/manual/html_node/Readline-Init-File.html

"When a program which uses the Readline library starts up, the init file is read, and the key bindings are set."

The recommendation in the sample file at gnu.org is to source the default in your local one with a line like this:

$include /etc/inputrc 

and then modify from there.

0
Aaron Miller

set -o emacs in your ~/.profile should do it.

Я поместил `set -o emacs` в` ~ / .profile` и запустил `touch ~ / .inputrc`. К сожалению, клавиши CTRL + LARROW и CTRL + RARROW по-прежнему вызывали печать `; 5D` и`; 5C` вместо перемещения курсора. nickh 11 лет назад 0