0

When I first created my .inputrc (it didn't exist by default), I set vi-ins-mode-string to "+" and vi-cmd-mode-string to ":" to differentiate between modes. I didn't have "(cmd)" or "(ins)" prepended to my prompt by default, but later decided I did want those to show up instead, so I changed those options in my .inputrc. However, the "+" and ":" continue to be prepended to my bash prompt and I don't know why. I've tried sourcing .inputrc with source and bind, I've exited all instances of my terminal, but nothing works. Is there something I'm doing wrong here? My .inputrc is currently:

set show-mode-in-prompt on
set vi-ins-mode-string "(ins)"
set vi-cmd-mode-string "(cmd)"

Edit: when starting python's interactive cli from inside a virtual environment (created with conda, if that's important), the (ins) and (cmd) get appended appropriately. It's only on my regular bash commandline that the "+" and ":" continue to show up.

  • I had the exact same problem. Maybe you are not running bash 4.4 with readline 7.0. bash --version returned version 4.4 for me, however my start up shell (/etc/passwd) pointed to /bin/bash (4.3) instead of /usr/local/bin/bash (4.4). (typing 'bash' into the command line might show the string, given the bash version in your path is 4.4). BASH_VERSION holds the actualy current version of the bash shell currently running. If so, changing the start up shell in /etc/passwd to a bash binary version 4.4 might fix it. – Bennix Deprîx Sep 4 '18 at 14:24
  • I just ran bash --version and got back 4.3.48 (and some extra notation), so maybe that's it. – alyms108 Sep 5 '18 at 21:58
0
  1. Add those lines to your ~/.inputrc file.
  2. Restart the shell (open a new terminal session).
  3. Make sure that your bash shell is in vi command line mode with set -o vi.

Alternatively:

  1. Add those lines to your ~/.inputrc file.
  2. Make bash reread the file using Ctrl+XCtrl+R (you will have to switch to emacs mode temporarily for this first, with set -o emacs).
  3. Make sure that your bash shell is in vi command line mode with set -o vi.

If you have an INPUTRC environment variable, then this will point to the file that is actually used. Remove the variable from your shell's startup files (and restart the shell), or make sure that it has the default value of $HOME/.inputrc (and restart the shell).

  • I tried all of the above, but the prompt still doesn't change. – alyms108 Jun 20 '18 at 6:56
  • @alyms108 Do you have a colorized prompt? It's conceivable that the control characters in the PS1 variable may interfere. Also confirm that you are in fact running bash (and not e.g. zsh), and that you have no INPUTRC variable set. – Kusalananda Jun 20 '18 at 7:02
  • I am running bash and INPUTRC isn't set, meaning it might be the control characters for my colorized prompt. I have no idea how that would interfere/why it would keep changes to the prompt string from being noticed. – alyms108 Jun 21 '18 at 1:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.