LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-20-2014, 04:31 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
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?
 
Old 05-20-2014, 04:47 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
less starts the editor specified in $EDITOR, not $VISUAL.
 
Old 05-20-2014, 05:01 PM   #3
GazL
LQ Veteran
 
Registered: May 2008
Posts: 7,010

Rep: Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142
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.
 
Old 05-20-2014, 05:52 PM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
echo $VISUAL from the prompt echoes '/usr/bin/vim'. Does it not mean $VISUAL is available to less?
 
Old 05-20-2014, 06:54 PM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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.
 
Old 05-20-2014, 07:00 PM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
ok, but I do 'echo $VISUAL' and get '/usr/bin/vim'. Does it not mean $VISUAL is available to less?
 
Old 05-20-2014, 07:10 PM   #7
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,860

Rep: Reputation: 2228Reputation: 2228Reputation: 2228Reputation: 2228Reputation: 2228Reputation: 2228Reputation: 2228Reputation: 2228Reputation: 2228Reputation: 2228Reputation: 2228
Are you running the "echo $VISUAL" command in the same shell where you are invoking less?
 
Old 05-20-2014, 07:47 PM   #8
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Yes, I am.
 
Old 05-20-2014, 07:54 PM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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.
 
Old 05-20-2014, 11:16 PM   #10
saulgoode
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 288

Rep: Reputation: 155Reputation: 155
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.
Old 05-21-2014, 06:27 AM   #11
phi11ip
Member
 
Registered: Jul 2007
Location: Nottingham, UK
Distribution: Slackware64-current
Posts: 93

Rep: Reputation: 23
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.
 
Old 05-21-2014, 07:22 AM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,729

Rep: Reputation: 7555Reputation: 7555Reputation: 7555Reputation: 7555Reputation: 7555Reputation: 7555Reputation: 7555Reputation: 7555Reputation: 7555Reputation: 7555Reputation: 7555
there is an additional environment variable, LESSEDIT to check.
 
Old 05-21-2014, 09:18 AM   #13
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mandriva 2009 starts installation and then monitor starts rolling showing color lines HubertHickey Linux - Newbie 6 12-18-2008 12:24 AM
Enable NUM LOCK key while os starts deostroll Ubuntu 3 01-08-2008 01:48 AM
Two Fluxbox Versions - Root starts newest,User starts oldest fortezza Linux - Software 1 05-21-2006 01:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration