Personalizza bash tramite un .inputrc
file nel tuo /home/username
, puoi copiare il valore predefinito
cp /etc/inputrc.default ~/.inputrc
ecco il mio (i commenti iniziano con #)
# Key-bindings for the command-line editor.
# Ask before displaying >50 items
# Since $WINDIR $PATH var can be in $PATH, this could list
# all window exectables in C:\WINDOWS
set completion-query-items 50
# Ignore case for the command-line-completion functionality
# on: default to a Windows style console
# off: default to a *nix style console
set completion-ignore-case on
# none, visible or audible
set bell-style audible
# disable/enable 8bit input
set meta-flag on
set input-meta on
set output-meta off
set convert-meta on
# visible-stats
# Append a mark according to the file type in a listing
set visible-stats off
set mark-directories on
# Show all instead of beeping first
set show-all-if-ambiguous off
# MSYSTEM is emacs based
$if mode=emacs
# Common to Console & RXVT
"\C-?": backward-kill-line # Ctrl-BackSpace
"\e[2~": paste-from-clipboard # "Ins. Key"
"\e[5~": beginning-of-history # Page up
"\e[6~": end-of-history # Page down
$if term=msys # RXVT
"\e[7~": beginning-of-line # Home Key
"\e[8~": end-of-line # End Key
"\e[11~": display-shell-version # F1
"\e[15~": re-read-init-file # F5
#$endif
#$if term=cygwin # Console
$else
"\e[1~": beginning-of-line # Home Key
"\e[4~": end-of-line # End Key
"\e[3~": delete-char # Delete Key
#~ "\e\e[D": backward-word # Alt-LeftArrow
#~ "\e\e[C": forward-word # Alt-RightArrow
"\M-\e[D": backward-word # Alt-LeftArrow
"\M-\e[C": forward-word # Alt-RightArrow
`#~` "\C-\E[D": backward-word # Ctrl-LeftArrow, nowork, can't be made to work
#~`enter preformatted text here` "\C-\E[C": forward-word # Ctrl-RightArrow, nowork, can't be made to work
#~ to see current bindings use bind -q backward-kill-line
"\e\e": kill-whole-line # double/triple escape works :) Esc/Escape to delete current line like cmd.exe
$endif
$endif
per scoprire di cosa hai bisogno per digitare il tuo inputrc sul lato sinistro (il codice di escape, in quanto può variare tra laptop / desktop ...), al prompt digitare echo '
quindi Ctrl-V
seguito dal tasto, come Home
, quindi digitare '
esempio
$ echo ' home key ^[[1~ '
home key
~
$ echo ' end key ^[[4~ '
end key
~
$ echo ' pg up page up ^[[5~ '
pg up page up
~
$ echo ' pg dn page down ^[[6~ '
pg dn page down
~
quindi sostituire ogni ^[
con \e
aggiuntivo \M-
per Alt
teoricamente usereste \C-
per Ctrl
ma attualmente non funziona (finestre limitazione)
i comandi disponibili (come backward-kill-line
) sono elencati in http://www.gnu.org/software/bash/manual/bashref.html#index-backward_002dkill_002dline-_0028C_002dx-Rubout_0029
puoi visualizzare le scorciatoie da tastiera / i collegamenti esistenti con bind -p
o
$ bind -q backward-kill-word
backward-kill-word can be invoked via "\M-\C-h", "\M-\C-?".
~
$ bind -q backward-word
backward-word can be invoked via "\M-\M-[D", "\M-b", "\C-\E[[D".
~
$ bind -q beginning-of-line
beginning-of-line can be invoked via "\C-a", "\M-OH", "\M-[1~", "\M-[H".
~
non scherzare con TERMCAP