Slackware This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
05-20-2014, 04:31 PM
|
#1
|
Senior Member
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442
Rep:
|
v key in less starts vi.
Slackware 14.0
less 451
Hi:
Code:
semoi@server:~$ echo $LESSEDIT
semoi@server:~$ echo $VISUAL
/usr/bin/vim
semoi@server:~$ v /usr/bin/vim
-rwxr-xr-x 1 root root 2006812 2012-08-29 18:49:57 /usr/bin/vim*
semoi@server:~$
However, when in less, if I press 'v', then the vi, and not the vim editor starts. How can this be?
|
|
|
05-20-2014, 04:47 PM
|
#2
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
less starts the editor specified in $EDITOR, not $VISUAL.
|
|
|
05-20-2014, 05:01 PM
|
#3
|
LQ Veteran
Registered: May 2008
Posts: 7,010
|
From the man-page:
Quote:
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.
|
If it's not working then my guess would be that VISUAL is set but not exported and thus not available to less.
|
|
|
05-20-2014, 05:52 PM
|
#4
|
Senior Member
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442
Original Poster
Rep:
|
echo $VISUAL from the prompt echoes '/usr/bin/vim'. Does it not mean $VISUAL is available to less?
|
|
|
05-20-2014, 06:54 PM
|
#5
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
My fault, I don't have $VISUAL defined on my machines and setting $EDITOR to nano worked, so I assumed that less looks for $EDITOR instead.
|
|
|
05-20-2014, 07:00 PM
|
#6
|
Senior Member
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442
Original Poster
Rep:
|
ok, but I do 'echo $VISUAL' and get '/usr/bin/vim'. Does it not mean $VISUAL is available to less?
|
|
|
05-20-2014, 07:10 PM
|
#7
|
Senior Member
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,860
|
Are you running the "echo $VISUAL" command in the same shell where you are invoking less?
|
|
|
05-20-2014, 07:47 PM
|
#8
|
Senior Member
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442
Original Poster
Rep:
|
Yes, I am.
|
|
|
05-20-2014, 07:54 PM
|
#9
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
Have you tried to run it directly with
Code:
VISUAL=/usr/bin/vim less textfile
Works for me in a Slackware 14.1 chroot with less 451 and on Gentoo with less 457.
|
|
|
05-20-2014, 11:16 PM
|
#10
|
Member
Registered: May 2007
Distribution: Slackware
Posts: 288
Rep:
|
If there is no output from running "printenv | grep VISUAL" then you need to "export VISUAL". (echo expands both shell parameters and environment variables; printenv will print only the environment variables).
|
|
2 members found this post helpful.
|
05-21-2014, 06:27 AM
|
#11
|
Member
Registered: Jul 2007
Location: Nottingham, UK
Distribution: Slackware64-current
Posts: 93
Rep:
|
I have neither $VISUAL nor $EDITOR set on my system, but when I press "v" in less I get vim editor. In the /usr/bin directory I have changed the link so that vi points at vim not elvis.
|
|
|
05-21-2014, 07:22 AM
|
#12
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,729
|
there is an additional environment variable, LESSEDIT to check.
|
|
|
05-21-2014, 09:18 AM
|
#13
|
Senior Member
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442
Original Poster
Rep:
|
I always had this in /etc/profile:
Code:
##### MODIFICO
alias x="d -1|grep -v \~"
alias m0="mount -tiso9660 /dev/sr0 /mnt/cd0"
VIM="/usr/share/vim"
VISUAL="/usr/bin/vim"
alias r="fc -s"
alias date="date +\"%a %F %T\""
# ( sudo setsid /almacen/soft/z80/cpu/c_progs/kbd_monitor/kbd_monitor_2 /dev/input/event5 </dev/null &>/tmp/input.log & )
alias diff2="diff --minimal --context=1 --ignore-all-space"
This is from the backup copy of /etc/profile I keep among my personal data. That is why I was reluctant to add an 'export' in the line for VISUAL. But is is clear to me now that at some point after installation I
add the export token.
What is not clear is why vim does not have any problem with the VIM variable. vim obediently uses the vimrc I have in /usr/share/vim despite the fact that I do not export VIM. Anyways, the problem is now solved and the whys I'll leave them for a later time.
|
|
|
All times are GMT -5. The time now is 07:21 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|