~/.inputrc file not sourcing correctly

I have this ~/.inputrc file that I created for certain key bindings.

# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"e[1;5C":forward-word
"e[1;5D":backward-word
"e[5C":forward-word
"e[5D":backward-word
"ee[C":forward-word
"ee[D":backward-word

whenever I try to run source ~/.inputrc, it gives me the following error:

e[1;5C:forward-word: Command not found.
e[1;5D:backward-word: Command not found.
e[5C:forward-word: Command not found.
e[5D:backward-word: Command not found.
ee[C:forward-word: Command not found.
ee[D:backward-word: Command not found.

It also doesn’t work when I open a new terminal, I don’t get the error but my ctrl key combinations are not working in new terminal as well. I created this file myself since I do not have root access to change /etc/inputrc. Can anybody help me out? Thanks.

EDIT: I’ve tried the file with space after the colon (:) sign as well. It doesn’t work. I also tried my making it executable (chmod +x ~/.inputrc), didn’t work.

EDIT: I realized that this procedure is only for ‘bash’ and I am running ‘tcsh’. For ‘csh’, use .bindings file instead of .inputrc file and use bindkey syntax.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

For bash, this will reload now the currently defined mappings

bind -f  ~/.inputrc

Method 2

The .inputrc file is not a file to be sourced. It should be taken into account automatically by bash or other software using the readline library. If this doesn’t work, add a space after the colon, e.g.

"e[1;5C": forward-word

(I’ve always seen a space in this config file).

Method 3

The key bindings and ~/.inputrc file posted in question is for bash. For csh (or tcsh) use a file ~/.bindings and use following syntax.

bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word

Realized this after some googling.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x