ใช่คุณสามารถใช้คำสั่ง bind
bind '"\ey"':"\"less \C-m\""
แมป Alt-e กับคำสั่งที่น้อยกว่าและดำเนินการ (ด้วย \ Cm aka Ctrl-m)
อาจเป็นไปได้สำหรับ คุณต้องหลบหนี
bind '"\ey"':"\"\|less \C-m\""
หากคุณต้องการต่อท้ายบรรทัดคำสั่งให้ลบ * \ Cm \ ""
ระวังเนื่องจากมีการผูกไว้แล้ว:
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + L Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H Same as backspace
Ctrl + R Let’s you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
Ctrl + Z Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W Delete the word before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + T Swap the last two characters before the cursor
Esc + T Swap the last two words before the cursor
Alt + F Move cursor forward one word on the current line
Alt + B Move cursor backward one word on the current line
Tab Auto-complete files and folder names
ปุ่มควบคุมดังที่คุณเห็นด้านบนทำด้วย Cm ดังนั้นคุณสามารถเริ่มต้นคำสั่งน้อยด้วย Ctrl-g ดังต่อไปนี้:
ผูก '"\ Cg"': "\" \ | less * \ Cm \ ""
ในการรับรหัสคีย์สำหรับ Alt (สำหรับ ALT เท่านั้น) คุณสามารถใช้คำสั่ง read จากเชลล์:
@~$ read
^[y
^ [y เท่ากับ \ ey
สำหรับข้อมูลเพิ่มเติมคำถามนี้ได้รับคำตอบใน stackoverflow ด้วย:
/programming/4119991/bash-call-script-with-customized-keyboard-shortcuts