Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use ssh -X user@IP to connect to an Ubuntu Server which has had gnome-terminal installed on it.

When inside gnome-terminal, occasionally I accidentally hit a key combination and the terminal behaves differently. I think I have entered "vi mode". As an example, after I have hit this mysterious combination, I can press - and the font size of the terminal gets smaller.

I have to press ESC to get back into the normal mode.

Can anyone tell me what key combination I may have hit, and provide links or useful hints for the things I might be able to do with "vi mode"?

I have tried searching Google but haven't found anything particularly good - most pages refer to "vi mode" inside vi.

For information, I am using a French AZERTY keyboard, and the key combination I think I hit is AltGr+- (on AZERTY keyboards the number keys provide punctuation unless Shift is pressed - the key I am pressing has the 6 on it), so that I can get the | character.

share|improve this question
    
"vi mode" is not mode of the terminal window itself, but the shell which is running inside it. I think it's not the case though, it's maybe you've activated somehow the 'font size' option of the terminal itself, maybe because of your other keyboard layout, but I am only guessing now. I can't check it out since the kbd combo you've mentioned is used by another purpose in my config. –  LGB Mar 9 '11 at 17:21
    
In my gnome-terminal, I hit Crtl and - to make fonts smaller, and Ctrl-Shift and + to make them larger. I wonder if you've gotten the keymap so that it is emulating Ctrl with a different key combo? loadkeys defkeymap worked on some older systems, but I can't get it to find a default keymap on my system. –  belacqua Mar 9 '11 at 17:27

1 Answer 1

up vote 3 down vote accepted

Usually vi mode is set in bash with set -o vi .
By default, and contrary to the editor itself, you will be in insert mode. You can hit ESC and i to move between insert and command mode.

When you enter a line in vi mode, you are already placed in `insertion' mode, as if you had typed an "i". Pressing ESC switches you into "command" mode, where you can edit the text of the line with the standard vi movement keys, move to previous history lines with "k" and subsequent lines with "j" and so forth.

(from linuxselfhelp )

To go to the default mode, use set -o emacs .

According to this question , you can toggle out of emacs mode (and back) with Meta+Ctrl+J . But I can't get that to work on my keyboard (perhaps because I'm not sure what Meta is mapped to).

Here's a link with some editing commands : hyperex.org : vi mode .

Here's another link to a cheat-sheet type reference : catonmat.net .

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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