As Thomas explained, you can add bindings to /etc/inputrc
.
Another alternative, so it loads every time you log in, puts them in ~/.bashrc
as follows:
#use ctl keys to move forward and back in words bind '"\eOC":forward-word' bind '"\eOD":backward-word'
I found out that you can use cat > /dev/null
to view the characters your keyboard sends, for example, CTRL + right arrow shows:
^[OC
where ^[
matches \e
, so where is the code from the bind
command.
You can also search for bindings as follows:
bind -p | grep forward-word
All of this is pretty damn cool, and I'm glad I recognized the even greater power of bash.
Bryan Ruiz Feb 17 2018-11-17T00: 00Z
source share