it is actually possible to open a text file in less, then switch over to vim (without exiting less) and when done with editing, switch back to less.

less /open/this/file/for/viewing
# switch over to vim
# now one is editing the file
# verify that one is using vim now
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 28 2019 13:59:32)

# write and quit, switch back to less

# now one is back in less
# quit less

temporarily vs permanently set default editor (nano vim vi)

# temporarily set default editor
export VISUAL=vim

make it permanent:

# add it to shell’s configuration file ~/.bashrc or ~/.bash_profile
# or global /etc/bash.bashrc (Debian) /etc/bashrc
# should also set $VISUAL, as some programs (correctly) use that instead of $EDITOR
echo "export VISUAL=vim" >> ~/.bashrc
echo "export EDITOR=\"\$VISUAL\"" >> ~/.bashrc

hover mouse over stars then click to rate this article:

average rating 0 / 5. based on ratings 0

not rated yet