8

I occasionally find that while working in iTerm the default Readline key bindings are replaced with the vi keybindings.

For example, I will try to go to the beginning of the line with ctrl-a, and instead it will print the character ^A, and then I won't be able to insert any text until I enter insert mode. I know this can be configured by setting the editing-mode in my inputrc file, but I don’t have that set in mine. Is there a way that I could be dynamically entering vi mode?

1
  • 1
    Could you have accidentally pressed Ctr+Alt+J ? (This keycombo toggles between emacs-mode and vi-mode in many readline-compatible applications)
    – miono
    Feb 22, 2017 at 9:57

1 Answer 1

0

I believe this issue is related to the way the Mac OS X terminal handles terminal emulation and even color coding—which is related to control sequences—as explained in this blog post:

After upgrading to Lion I noticed that the Homebrew theme that I’ve been using since Snow Leopard doesn’t display colors correctly(using different colors for directories, different types of files etc.) any more when working on remote hosts via ssh (local dir colors still work though) and switching to other themes doesn’t help. After messing around with the Terminal settings I finally found the cause and a solution. It seems Lion changed the terminal type to xterm-color256 during the upgrade (don’t remember what the setting was in SL though). The solution is simple enough, just change the emulation type for terminal from xterm-color256 to xterm-color (see screenshot below).

Fair warning, some of the advice in that comment thread is out of date since there no longer is a xterm-color in the terminal as of Mac OS X 10.8 (Mountain Lion). But I believe adjusting items in the “Advanced” tab (pictured) might help:

enter image description here

1
  • That's for the system-supplied Terminal, not iTerm. xterm-256color or xterm-color would be settings to use; I don't know of anything using the string xterm-color256. None of these color settings should have anything to do with changing the shell's editing mode (which doesn't necessarily mean that they don't). Nov 14, 2014 at 19:10

You must log in to answer this question.

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