
BashusaLinha de leitura GNU. Readline fornece uma coleção de atalhos de teclado. No entanto, existem alguns atalhos que funcionam no basheque não estão documentados no Readlinereferência. Alguns exemplos são:
C-h
- O mesmo que BackspaceC-m
- O mesmo que Enter (CR, eu acho)
Então, por que esses atalhos funcionam? Eu acho que isso pode ter algo a ver comASCIImas não tenho certeza de qual componente fornece interpretação dessas sequências de controle como o comportamento que indiquei.
É a biblioteca Readline? Ou é o próprio bash? É meu emulador de terminal? É o kernel? Etc...
Qual componente faz com que essas sequências de controle se comportem dessa maneira?
Editar: Meu .inputrc
arquivo:
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any warranty.
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software.
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
# base-files version 4.2-4
# ~/.inputrc: readline initialization file.
# The latest version as installed by the Cygwin Setup program can
# always be found at /etc/defaults/etc/skel/.inputrc
# Modifying /etc/skel/.inputrc directly will prevent
# setup from updating it.
# The copy in your home directory (~/.inputrc) is yours, please
# feel free to customise it to create a shell
# environment to your liking. If you feel a change
# would be benifitial to all, please feel free to send
# a patch to the cygwin mailing list.
# the following line is actually
# equivalent to "\C-?": delete-char
"\e[3~": delete-char
# VT
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# kvt
"\e[H": beginning-of-line
"\e[F": end-of-line
# rxvt and konsole (i.e. the KDE-app...)
"\e[7~": beginning-of-line
"\e[8~": end-of-line
# VT220
"\eOH": beginning-of-line
"\eOF": end-of-line
# Allow 8-bit input/output
#set meta-flag on
#set convert-meta off
#set input-meta on
#set output-meta on
#$if Bash
# Don't ring bell on completion
#set bell-style none
# or, don't beep at me - show me
#set bell-style visible
# Filename completion/expansion
#set completion-ignore-case on
#set show-all-if-ambiguous on
# Expand homedir name
#set expand-tilde on
# Append "/" to all dirnames
#set mark-directories on
#set mark-symlinked-directories on
# Match all files
#set match-hidden-files on
# 'Magic Space'
# Insert a space character then performs
# a history expansion in the line
#Space: magic-space
#$endif
Responder1
As ligações (quer apareçam no manual ou não) aparecem quando você digita
bind -p
Por exemplo (listagem parcial):
"\C-g": abort
"\C-x\C-g": abort
"\e\C-g": abort
"\C-j": accept-line
"\C-m": accept-line
# alias-expand-line (not bound)
# arrow-key-prefix (not bound)
# backward-byte (not bound)
"\C-b": backward-char
# backward-byte (not bound)
"\C-b": backward-char
"\eOD": backward-char
"\e[D": backward-char
"\C-h": backward-delete-char
"\e[3;5~": backward-delete-char
"\C-?": backward-delete-char
"\C-x\C-?": backward-kill-line
"\e\C-h": backward-kill-word
"\e\C-?": backward-kill-word
"\eb": backward-word
"\e<": beginning-of-history
O manual documenta a -p
opção:
O
bind -p
exibições de comandoLeia a linhanomes de funções e ligações em um formato que pode ser colocado diretamente em um arquivo de inicialização. VerBash integrados.
As ligações (leitura do código-fonte) dependem do mapa de teclado. Os que citei são domapa de teclado emacs, que é inicializado a partir de uma tabela integrada antes da aplicação dos scripts. Existe um arquivo correspondente com tabelas para ovi mapa de teclado.
Tudo isso faz parteLeia a linha(que vem junto com bash
). Ao bash
iniciar, ele define as ligações usando essas tabelas. Dependendo dos outros arquivos dos quais ele lê /etc/inputrc
, ~/.inputrc
ele pode adicionar, modificar ou remover algumas dessas ligações integradas.
Responder2
Como é apontado na seção "1.3 Arquivo de inicialização Readline" do manual ao qual você se refere, a biblioteca readline é configurável. As combinações de teclas podem ser definidas em /etc/inputrc
, ou em seu local ~/.inputrc
.