0

I'm working on RHEL environment, and using xterm.

My question is that how to make the xterm command line works like vim instead of emacs (eg, selection, copy, paste, keyboard shortcuts)

Thanks!

Edward Wang
  • 345
  • 1
  • 3
  • 13
  • 4
    `xterm` has nothing to do with this. You're looking for a feature of your shell, which means you should tell us which shell you're using (likely bash). – Keith Thompson Sep 23 '13 at 02:11

3 Answers3

3

The bash command to turn on vim-style editing is

set -o vi
Jim Garrison
  • 85,615
  • 20
  • 155
  • 190
1

As it was already mentioned, this has nothing to do with the terminal(emulator) you're using. In case you use zsh, you can enable vi-like bindings with:

bindkey -v
saep
  • 56
  • 3
0

The Emacs-style keybindings to which you are referring are actually a feature of the Readline utility.

While adding, set -o vi to the end of your ~/.bash_profile should suffice (if you're a bash user), this utility can also be controlled through the use of an ~/.inputrc file.

Create an ~/.inputrc if it doesn't already exist and append this:

set editing-mode vi
set keymap vi-command

The benefit of this approach over set -o vi is that this is read wherever readline is used include the MySQL command line interface and Ruby's IRB.

See this post for more Vim-related readline tips: http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal

thcipriani
  • 1,479
  • 1
  • 10
  • 6