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 :v # now one is editing the file # verify that one is using vim now :version VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 28 2019 13:59:32) # write and quit, switch back to less :wq # now one is back in less # quit less q
temporarily vs permanently set default editor (nano vim vi)
# temporarily set default editor
export VISUAL=vim
export EDITOR="$VISUAL"
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
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!