I want to launch
vim instead of the default
vi editor when I hit v in
Are there any settings I can modify to allow me to do this?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
v Invokes an editor to edit the current file being viewed. The editor is taken from the environment variable VISUAL if defined, or EDITOR if VISUAL is not defined, or defaults to "vi" if nei‐ ther VISUAL nor EDITOR is defined. See also the discussion of LESSEDIT under the section on PROMPTS below.
Simply set standard
EDITOR environment variable according to your wishes, e.g.
export EDITOR=vim in
~/.bashrc or something like that.
I found an answer here https://www.howtogeek.com/howto/ubuntu/change-the-default-editor-from-nano-on-ubuntu-linux/ that shows how to change the default editor without having to change any environment variables. This will only work in Debian based distros though.
In short, type the command below into your cli:
sudo update-alternatives --config editor
which will give you a menu with your different editor options, like so:
$ sudo update-alternatives –config editor There are 5 alternatives which provide `editor’. Selection Alternative ———————————————– 1 /usr/bin/vim 2 /bin/ed *+ 3 /bin/nano 4 /usr/bin/vim.basic 5 /usr/bin/vim.tiny Press enter to keep the default[*], or type selection number:
Just enter the number of the editor you wish to set to default.