LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Tip for non-Power Users: Moving from "less" directly into an editor (https://www.linuxquestions.org/questions/linux-general-1/tip-for-non-power-users-moving-from-less-directly-into-an-editor-491178/)

rickh 10-10-2006 01:54 PM

Tip for non-Power Users: Moving from "less" directly into an editor
 
Real power users and gurus already know this, but I just ran across it yesterday, and thought it was worth sharing. To scan thru a medium to large size file most people use "less" rather than "more" because you can move backwards as well as forward. The "v" key used in "less" automatically opens the file in the editor of your choice. Make changes, and exit the editor, and you are returned to "less."

This action is dependent on the environment variables EDITOR, or VISUAL. Some distros come with those variables loaded (usually with vi or vim), and in others, such as Debian, you have to load them yourself. Try
Code:

debian64:~$ echo $EDITOR
vim
debian64:~$

or
Code:

debian64:~$ echo $VISUAL
vim
debian64:~$

If you come up blank there,
Code:

$ EDITOR=vim
$ VISUAL=vim
$ export EDITOR VISUAL

If you like it, add those lines to your /etc/profile file.

You could, of course, choose to use nano, pico, emacs, or any other editor.

blackhole54 10-11-2006 10:16 AM

Thanks for the tip. I knew it could be done but had forgotten how and have been too lazy to go looking for istructions.


All times are GMT -5. The time now is 08:59 PM.