У Pulseaudio есть модуль, отправленный по умолчанию, который предназначен для достижения именно этого:
http://pulseaudio.org/wiki/Modules#module-device-restore
Вы можете перечислить все ярлыки в вашей текущей оболочке bash, вызвав bash builtin bind с опцией -P.
например.
bind -P | grep clear
clear-screen can be found on "\C-l".
Чтобы изменить их, вы можете сделать что-то вроде
bind '\C-p:clear-screen'
и поместить его в файл инициализации, чтобы сделать его постоянным (обратите внимание, что вы можете использовать только комбинацию клавиш к одной вещи за раз, поэтому она потеряет привязку, которая была ранее).
Следующая команда дает хороший вывод столбца, показывающий использование и ярлыки.
bind -P | grep "can be found" | sort | awk '{printf "%-40s", $1} {for(i=6;i<=NF;i++){printf "%s ", $i}{printf"\n"}}'
Это дает результат, который выглядит как
abort "\C-g", "\C-x\C-g", "\e\C-g".
accept-line "\C-j", "\C-m".
backward-char "\C-b", "\eOD", "\e[D".
backward-delete-char "\C-h", "\C-?".
backward-kill-line "\C-x\C-?".
backward-kill-word "\e\C-h", "\e\C-?".
backward-word "\e\e[D", "\e[1;5D", "\e[5D", "\eb".
beginning-of-history "\e<".
beginning-of-line "\C-a", "\eOH", "\e[1~", "\e[H".
call-last-kbd-macro "\C-xe".
capitalize-word "\ec".
character-search-backward "\e\C-]".
character-search "\C-]".
clear-screen "\C-l".
complete "\C-i", "\e\e".
...
. Получите этот вывод в текстовый файл, используя следующую команду
bind -P|grep "can be found"|sort | awk '{printf "%-40s", $1} {for(i=6;i<=NF;i++){printf "%s ", $i}{printf"\n"}}' > ~/shortcuts
Файл создается в вашем каталоге $ HOME.
bind -P
удаляет все не назначенные ярлыки grep "can be found"
сортирует вывод sort
печатает первый столбец (т. е. функция) и выравнивает текст awk '{printf "%-40s", $1}
. Это часть предыдущей команды. Он печатает столбцы 6+ (т. Е. Ярлыки). {for(i=6;i<=NF;i++){printf "%s ", $i}{printf"\n"}}'
Выводит вывод в хороший текстовый файл в домашнем каталоге с именами ярлыков > shortcuts
. Вы можете понять, как работает команда, выполнив следующие команды.
bind -P
bind -P | grep "can be found"
bind -P | grep "can be found" | sort
Хорошо, у меня есть способ получить список ярлыков, фильтруя руководство bash. Он также даст описание того, что именно делает каждый ярлык. Спасибо Спархоку, который просветил меня, чтобы найти решение. Мне нужно было изучить использование регулярных выражений, хотя я все еще не очень хорош в этом:)
Итак, вот одна строка:man bash | grep "(.-.*)$" -A1
Итак, вот одна строка:
beginning-of-line (C-a)
Move to the start of the current line.
end-of-line (C-e)
Move to the end of the line.
forward-char (C-f)
Move forward a character.
backward-char (C-b)
Move back a character.
forward-word (M-f)
Move forward to the end of the next word. Words are composed of alphanumeric characters (letters and digits).
backward-word (M-b)
Move back to the start of the current or previous word. Words are composed of alphanumeric characters (letters and digits).
clear-screen (C-l)
Clear the screen leaving the current line at the top of the screen. With an argument, refresh the current line without clearing the
previous-history (C-p)
Fetch the previous command from the history list, moving back in the list.
next-history (C-n)
Fetch the next command from the history list, moving forward in the list.
beginning-of-history (M-<)
Move to the first line in the history.
end-of-history (M->)
Move to the end of the input history, i.e., the line currently being entered.
reverse-search-history (C-r)
Search backward starting at the current line and moving `up' through the history as necessary. This is an incremental search.
forward-search-history (C-s)
Search forward starting at the current line and moving `down' through the history as necessary. This is an incremental search.
Итак, вот одна строка: man bash | grep "(.-.*)$" -A1 > bash_shortcuts
небольшое извлечение выхода:
Это все, что мне нужно. Я просто хотел узнать клавиши быстрого доступа, назначенные для bash, и я не переконфигурировал какие-либо ключи, поскольку Sparhawk спросил меня.
Еще раз спасибо всем за их вклад. [!d15 ]
инструкция bash :
До тех пор, пока руководство bash не будет изменено таким образом, чтобы сделать эту команду ненадлежащей (что очень мало), следующая команда покажет все ярлыки по умолчанию для bash.
man bash | grep -A294 'Commands for Moving'
[d1 ] Это дает результат, который выглядит следующим образом: Commands for Moving
beginning-of-line (C-a)
Move to the start of the current line.
end-of-line (C-e)
Move to the end of the line.
forward-char (C-f)
Move forward a character.
backward-char (C-b)
Move back a character.
forward-word (M-f)
Move forward to the end of the next word. Words are composed of alphanumeric characters (letters and digits).
backward-word (M-b)
Move back to the start of the current or previous word. Words are composed of alphanumeric characters (letters and
digits).
shell-forward-word
Move forward to the end of the next word. Words are delimited by non-quoted shell metacharacters.
shell-backward-word
Move back to the start of the current or previous word. Words are delimited by non-quoted shell metacharacters.
clear-screen (C-l)
Clear the screen leaving the current line at the top of the screen. With an argument, refresh the current line
without clearing the screen.
redraw-current-line
Refresh the current line.
Commands for Manipulating the History
accept-line (Newline, Return)
Accept the line regardless of where the cursor is. If this line is non-empty, add it to the history list according
to the state of the HISTCONTROL variable. If the line is a modified history line, then restore the history line to
its original state.
previous-history (C-p)
Fetch the previous command from the history list, moving back in the list.
next-history (C-n)
...
Если инструкция bash изменена, эта команда легко может быть изменена в соответствии с потребностями.