LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-29-2009, 11:58 PM   #1
xtheunknown0
LQ Newbie
 
Registered: Aug 2009
Distribution: Damn Small Linux
Posts: 6

Rep: Reputation: 0
'Shortcut' for running vim63


In Windows you can enter in the Run dialog box or in Command prompt stuff like notepad and explorer because they're in system32; how do I add the bin directory of vim63 to some sort of script file so that I can run 'vim' quickly?
 
Old 08-30-2009, 12:16 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Hi xtheunknown0,

You just need to add the directory to your PATH variable,

eg. if you use bash, edit ~/.bash_profile

Change this:
PATH=$PATH:$HOME/bin

to:
PATH=$PATH:$HOME/bin:/path/to/vim63/bin


cheers,

kbp
 
Old 08-30-2009, 01:50 AM   #3
xtheunknown0
LQ Newbie
 
Registered: Aug 2009
Distribution: Damn Small Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Hi xtheunknown0,

You just need to add the directory to your PATH variable,

eg. if you use bash, edit ~/.bash_profile

Change this:
PATH=$PATH:$HOME/bin

to:
PATH=$PATH:$HOME/bin:/path/to/vim63/bin


cheers,

kbp
It seems that I can only run vim by typing:

./vim

while inside the bin directory. Doesn't this mean that 'vim' is not 'registered' as a command? How do I make vim a command?
 
Old 08-30-2009, 04:02 AM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Did you modify your path as I suggested ? .. once you have, you will be able to run vim from anywhere. BTW.. are you running Linux or Windows ?
 
Old 08-30-2009, 06:10 AM   #5
xtheunknown0
LQ Newbie
 
Registered: Aug 2009
Distribution: Damn Small Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Did you modify your path as I suggested ?
Yes

Quote:
Originally Posted by kbp View Post
BTW.. are you running Linux or Windows ?
Linux
 
Old 08-30-2009, 06:13 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Please, post the output from each of the following commands, so we can see where the problem is:
Code:
echo $PATH
which vim
ls -F /path/to/vim63/directory
of course you have to change /path/to/vim63/directory with the actual directory.
 
Old 08-30-2009, 06:53 AM   #7
xtheunknown0
LQ Newbie
 
Registered: Aug 2009
Distribution: Damn Small Linux
Posts: 6

Original Poster
Rep: Reputation: 0
[QUOTE=colucix;3662681]Please, post the output from each of the following commands, so we can see where the problem is:
Code:
# echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games:/opt/bin:.:.

Code:
# which vim
Code:
# ls -F /opt/vim63/bin
eview@ gview@    rgview@ rvim@ vimdiff@
evim@  gvim@     rgvim@  view@ vimtutor*
ex@    gvimdiff@ rview@  vim*  xxd*
 
Old 08-30-2009, 07:56 AM   #8
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
As you can see the directory /opt/vim63/bin is not in your PATH environment variable. Just do
Code:
export PATH=/opt/vim63/bin:$PATH
and the trick is done. Just an aside note: take in mind that the shell look for commands through the directory in $PATH in the exact order they appear. This means that if you have two executable with the same name but in different directories, it will be executed that one coming first in $PATH. This is the reason why I prefer to add my own bin directories at the beginning of my PATH.

Another aside note: in your PATH appear . (dot) that is the current working directory, whatever it be. This is not a good thing, due to security reasons. I would advice to remove it from your PATH.
 
Old 08-30-2009, 05:36 PM   #9
xtheunknown0
LQ Newbie
 
Registered: Aug 2009
Distribution: Damn Small Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
You just need to add the directory to your PATH variable,

eg. if you use bash, edit ~/.bash_profile

Change this:
PATH=$PATH:$HOME/bin

to:
PATH=$PATH:$HOME/bin:/path/to/vim63/bin
My .bash_profile file doesn't have PATH in it:

#!/bin/bash
export IRCNICK=DSL
SSH=`env | grep SSH_CONNECTION`
RUNLEVEL=`runlevel|cut -f2 -d' '`
if [ -z "$SSH" ]; then
if [ $RUNLEVEL -eq 5 ]; then
startx
fi
fi

Quote:
Originally Posted by colucix View Post
Just do
Code:
export PATH=/opt/vim63/bin:$PATH
It works but if I enter that as root it only works when I'm still in root, if I enter that as a normal user it only works when I'm still a normal user. In addition, when I close the xterm that line entered and open another xterm I have to retype it.

Quote:
Originally Posted by colucix View Post
Another aside note: in your PATH appear . (dot) that is the current working directory, whatever it be. This is not a good thing, due to security reasons. I would advice to remove it from your PATH.
How do I remove directories from the PATH variable?

Last edited by xtheunknown0; 08-30-2009 at 05:39 PM.
 
Old 08-30-2009, 06:09 PM   #10
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by xtheunknown0 View Post
It works but if I enter that as root it only works when I'm still in root, if I enter that as a normal user it only works when I'm still a normal user. In addition, when I close the xterm that line entered and open another xterm I have to retype it.
Yes, that's the normal behaviour. To make the changes permanent you have to put the export command in some initialization file, like ~/.bashrc (this on a per-user basis).

If you want to apply the change for all users, one of my preferred methods is to add an entry in the /etc/profile.d directory (if your OS supports it). Create a file called /etc/profile.d/vim63.sh containing the statement above:
Code:
export PATH=/opt/vim63/bin:$PATH
and the trick is done: at login every .sh file in /etc/profile.d will be sourced by /etc/profile.

A more simple way is to create a soft link in /usr/local/bin, since this location is usually in the default PATH for both users and root:
Code:
ln -s /opt/vim63/bin/vim /usr/local/bin/vim
Quote:
How do I remove directories from the PATH variable?
Well... you have to find out who (that is which script) adds them and modify the "offending" statement accordingly.
 
Old 08-31-2009, 05:40 PM   #11
xtheunknown0
LQ Newbie
 
Registered: Aug 2009
Distribution: Damn Small Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Problem solved

[quote=colucix;3663213]A more simple way is to create a soft link in /usr/local/bin, since this location is usually in the default PATH for both users and root:
Code:
ln -s /opt/vim63/bin/vim /usr/local/bin/vim
This method works and I like it - I'll try to make sure that that's in my re-remaster.
 
  


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
[KDE]Shortcut Icons smaller, Shortcut And Tray icons on 2 lines xeross Linux - Newbie 2 04-10-2008 11:20 AM
Running console app from desktop shortcut Bedanc Linux - Newbie 1 03-11-2007 09:25 AM
Problem running console app in X with no terminal (as a desktop shortcut) kornerr Linux - General 1 02-04-2005 01:08 AM
Desktop shortcut for running programs saurya_s Linux - Software 6 03-19-2004 06:48 PM
Possible Shortcut? AliasE Linux - Software 1 01-15-2004 08:06 PM


All times are GMT -5. The time now is 02:25 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration