Skip to content
Home » Shell Script » How to Set Default Editor to Vi in KSH

How to Set Default Editor to Vi in KSH

You might find out your shell does not respond to your esc + k which can reuse the historical commands in KSH just like in bash. This is because the default EDITOR in your shell has not been set.

There're several ways to solve this:
  1. For session-scope only:
  2. $ set -o vi
  3. For single user:
  4. $ vi ~/.profile
    ...
    EDITOR=vi; export EDITOR

  5. For all users:
  6. $ vi /etc/profile
    ...
    EDITOR=vi; export EDITOR

Leave a Reply

Your email address will not be published. Required fields are marked *