SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi: To change from an O.S to a new version of it can be upsetting. Example: When in slackware 12.0, when seeing text files with less, I sometimes made a little correction. I pressed 'v' and in this way entered vi. The tiny correction done, I returned to less. Now I have 14.0. If I press the 'v' key, again vi is invoked. But now vi comes with different default settings and, as a result, it's impossible for me to make the most elementary change to the edited file. I have two options: either make vi behave as before, by changieng its settings or make vim, whose default settings have not been changed, the less editor. Unfortunately it's not an easy thing to do either of these. I thought instructing less to use vim instead of vi would be an easy thing. After studying its man page for some hours, I had to give up. This of course is not slackware but plain linux. If you do not know how to do it, do not blame but your own ignorance, I mean.
Set $VISUAL or $EDITOR in your environment to whatever editor you prefer, less will use $VISUAL first, if not set, it uses $EDITOR. It's actually very simple...
From the less manpage:
Code:
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 neither VISUAL nor EDITOR is defined.
See also the discussion of LESSEDIT under the section on PROMPTS below.
Set $VISUAL or $EDITOR in your environment to whatever editor you prefer, less will use $VISUAL first, if not set, it uses $EDITOR. It's actually very simple...
Well, I don't know then. In my system that only happens if VISUAL or EDITOR aren't defined. Maybe you could try exporting the variables or changing the vi symlink as astrogeek suggests.
OK. But I am studying vi/elvis looking forward to use it as an editor. I would rather prefer operating at the less level. I wrote the assignment
VISUAL="/usr/bin/vim"
in /etc/profile. And I booted the machine. But still less invokes vi and not vim. There must be something odd in the settings of my O.S. (slackware 14.0). Maybe I'd rather post a thread in the linuxquestions>slackware forum.
If I put it in /home/my_directory/.bashrc then I will have to put in /root/.bashrc too and in my girl friend's directory as well. Using /etc/profile, I'm making the setting system wide.
But why is it necessary to export the variable. If I don't export it, after boot I can see it anyway (echo $VISUAL), THOUGH it's obvious that less does not.
But why is it necessary to export the variable. If I don't export it, after boot I can see it anyway (echo $VISUAL), THOUGH it's obvious that less does not.
It's necessary to export the variables so subprocesses can use them. When you declare a variable as VAR=value, that's a shell variable. When the export keyword is used, the variable becomes an environment variable, and is available to subprocesses, 'less' in this case. More info here.
Are not the variables output by the set command without arguments all of them environment variables? You mean that if, in /etc/profile, I don't prefix the variable name with 'export' then 'set' wont display it?
Are not the variables output by the set command without arguments all of them environment variables? You mean that if, in /etc/profile, I don't prefix the variable name with 'export' then 'set' wont display it?
No and no.
I didn't mention "set" nor /etc/profile. I don't "mean" anything. I only answered your previous question about why 'less' wasn't seeing a shell variable. RTFM.
I've read the F manual, as you say, 13467 times and still can't make any sense of it. On the other hand, I don't have to read any manual if I want to ask a question. Are you some busy developer that answers questions as an act of charity? Besides, I did not ask you to answer any question. If you want to respond, that's your business.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.