Is there a way to configure bash
to automatically insert text at the beginning of each input line? For example, to automatically insert the string 'git '
at the beginning of each input line, to save the user from having to repeatedly type git
. This would allow me to create a very minimal git
shell, with autocompletion.
1 Answer
Your Enter probably sends Ctrl+m (confirm with Ctrl+v and then Enter, you should see ^M
), but Ctrl+j works like Enter as well.
This allows us to solve your problem with one shell command:
bind '"\C-m": "\C-jgit "'
Note: with Backspace or Ctrl+c you can still delete the git
string and type any command.
g
togit
. You save two key-strokes.