1

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.

3

1 Answer 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .