LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   slackware 13.1 doesnt not recognize vim (https://www.linuxquestions.org/questions/slackware-14/slackware-13-1-doesnt-not-recognize-vim-849785/)

molossus 12-12-2010 03:05 PM

slackware 13.1 doesnt not recognize vim
 
here is my /etc/profile file:

Code:

# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.

# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"
export EDITOR="/usr/bin/vim"
# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
  export INPUTRC=/etc/inputrc
fi

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"

# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH.  Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
  echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
  if [ ! $? = 0 ]; then
    PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
  fi
fi

# I had problems with the backspace key using 'eval tset' instead of 'TERM=',
# but you might want to try it anyway instead of the section below it.  I
# think with the right /etc/termcap it would work.
# eval `tset -sQ "$TERM"`

# Set TERM to linux for unknown type or unset variable:
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
 TERM=linux
fi

# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
  VISUAL=emacs
#  VISUAL=gmacs
#  VISUAL=vim
fi


# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
 PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
 PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
 PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
 PS1='$ '
else
 PS1='\u@\h:\w\$ '
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2

# Default umask.  A umask of 022 prevents new files from being created group
# and world writable.
umask 022

# Notify user of incoming mail.  This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
 biff y 2> /dev/null
fi

# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
  if [ -x $profile_script ]; then
    . $profile_script
  fi
done
unset profile_script

# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
 PATH="$PATH:."
fi
export EDITOR="/usr/bin/vim"

i inserted export EDITOR="/usr/bin/vim" a the beginning of the file and at the end, the first time at the beginning didnt work , my .bashrc also has :
export EDITOR="/usr/bin/vim" , nothing, everytime i invoke vim , i just get vi which sucks really hard.
the only time i am able to call the real vim,is by:
Code:

$ /usr/bin/vim
whe i do :
$ echo $EDITOR
i get:
/usr/bin/vim

so why doesnt slackware calls vim???
it just defaults to the really wacky vi.

Note: i downloaded the tar.gz package vim, and did :configure, make , make install, all went well.
what else can i do ?

T3slider 12-12-2010 03:10 PM

Post the output of
Code:

$ which vim
$ alias vim
$ echo $PATH
$ ls -l /usr/bin/vim

$EDITOR only controls the default application used for editing something (for example, the default editor when you issue `crontab -e`). If you call vim explicitly it doesn't matter what $EDITOR is set to -- it should open vim (unless you have an alias or a path problem).

molossus 12-12-2010 03:15 PM

Quote:

Originally Posted by T3slider (Post 4189004)
Post the output of
Code:

$ which vim
$ alias vim
$ echo $PATH
$ ls -l /usr/bin/vim

$EDITOR only controls the default application used for editing something (for example, the default editor when you issue `crontab -e`). If you call vim explicitly it doesn't matter what $EDITOR is set to -- it should open vim (unless you have an alias or a path problem).

Code:

$ which vim
/usr/local/bin/vim

Code:

$ alias vim                                                                     
bash: alias: vim: not found

Code:

$ echo $PATH                                                                     
/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/lib/java/bin:/usr/lib/kde4/libexec:/usr/lib/qt/bin:/usr/share/texmf/bin:.

Code:

$ ls -l /usr/bin/vim                                                             
-rwxr-xr-x 1 root root 4280520 2010-05-12 02:38 /usr/bin/vim*

when i put alias vim ="/usr/bin/vim" in .bashrc it works only for my user
not when i editing a system file like fstab
su-c 'vim /etc/fstab' does not calls vim, just vi

jmccue 12-12-2010 03:16 PM

Hi

<snip>

> so why doesnt slackware calls vim???
what does this mean ? Is there a specific
application you are talking about ?
Some apps use $VISUAL instead of $EDITOR

<snip>

regards,
John

molossus 12-12-2010 03:26 PM

Quote:

Originally Posted by jmccue (Post 4189009)
Hi

<snip>

> so why doesnt slackware calls vim???
what does this mean ? Is there a specific
application you are talking about ?
Some apps use $VISUAL instead of $EDITOR

<snip>

regards,
John

i just want to be able to edit files by using vim , not vi
for example su -c 'vim /etc/fstab'
does not calls vim, just vi, eventhough with what i have in profile and .bashrc

T3slider 12-12-2010 03:29 PM

You have a copy of vim (which may just be vi) in /usr/local/bin, which is run instead of vim in /usr/bin (according to your PATH). Why do you have a duplicate copy of vim installed in /usr/local?

molossus 12-12-2010 03:46 PM

Quote:

Originally Posted by T3slider (Post 4189023)
You have a copy of vim (which may just be vi) in /usr/local/bin, which is run instead of vim in /usr/bin (according to your PATH). Why do you have a duplicate copy of vim installed in /usr/local?

i dont know, i am confused, i downloaded vim from the vim official site. is that vi?
that can't be vi because vi doesnt have colored syntax, and it doesnt even show "INSERT" at the bottom.
i have VIM on /usr/bin/vim

/usr/local/bin/vim is vi
/usr/bin/vim is VIM

i just tested it

molossus 12-12-2010 04:32 PM

problem solved found in another LQ question forum.
what i just did was
Code:

rm /usr/local/bin/vim
then
Code:

ln -s /usr/bin/vim /usr/local/bin/vim
/usr/local/bin/vim was the wacky vi
/usr/bin/vim is vim

what would another solution for this problem be other than deleting the vi link and then making a soft link to where vim is ?

T3slider 12-12-2010 04:45 PM

You shouldn't need the symlink at all...it should look in /usr/bin if vim is not found in /usr/local/bin. In a default Slackware install vim is already included, and there is no vim in /usr/local/bin. If you downloaded vim from its official site and installed it, it placed another copy of vim (with different configure options) in /usr/local/bin. The 'solution' was not to install vim into /usr/local in the first place (ie stick to Slackware's vim instead of downloading and installing vim separately), but removing all traces of vim from /usr/local/bin should be enough to solve your problem. I don't know how you installed vim (`./configure; make; make install`?), but uninstalling it (aside from just deleting everything vim-related in /usr/local) would depend on how you installed it (`make uninstall` in the source directory, perhaps?).

molossus 12-12-2010 05:00 PM

Quote:

Originally Posted by T3slider (Post 4189090)
You shouldn't need the symlink at all...it should look in /usr/bin if vim is not found in /usr/local/bin. In a default Slackware install vim is already included, and there is no vim in /usr/local/bin. If you downloaded vim from its official site and installed it, it placed another copy of vim (with different configure options) in /usr/local/bin. The 'solution' was not to install vim into /usr/local in the first place (ie stick to Slackware's vim instead of downloading and installing vim separately), but removing all traces of vim from /usr/local/bin should be enough to solve your problem. I don't know how you installed vim (`./configure; make; make install`?), but uninstalling it (aside from just deleting everything vim-related in /usr/local) would depend on how you installed it (`make uninstall` in the source directory, perhaps?).

i dont quite understand " In a default Slackware install vim is already included"
in my install of slackware 13.1 ( about 5GB) when i called vim , it called vi , i mean for example i called vim .bashrc it created the file but no colors, no indication below that i was in INSERT mode or command mode, also when i try to go up or down instead it printed weird letters ^A , B ... etc.

that is why i downloaded vim from the official site and configured , make, make install, but still it called vi.
when i called vim from /usr/bin/vim , then i was able to see INSERT, and i didnt print weird characters when i pressed the up key or down key. that is vim , not vi.
so i dont think slackware ships with vim, even though gvim is installed by default, which makes it even more confusing.

note: i deleted /usr/local/bin/vim ,and this is what is get :
Code:

bash: /usr/local/bin/vim: No such file or directory
so , no , slackware didn't look in /usr/bin/vim

T3slider 12-12-2010 05:25 PM

Quote:

Originally Posted by molossus (Post 4189100)
i dont quite understand " In a default Slackware install vim is already included"
in my install of slackware 13.1 ( about 5GB) when i called vim , it called vi , i mean for example i called vim .bashrc it created the file but no colors, no indication below that i was in INSERT mode or command mode, also when i try to go up or down instead it printed weird letters ^A , B ... etc.

that is why i downloaded vim from the official site and configured , make, make install, but still it called vi.
when i called vim from /usr/bin/vim , then i was able to see INSERT, and i didnt print weird characters when i pressed the up key or down key. that is vim , not vi.
so i dont think slackware ships with vim, even though gvim is installed by default, which makes it even more confusing.

On Slackware64-13.1:
Code:

/var/log/packages/vim-7.2.416-x86_64-1
/var/log/packages/vim-gvim-7.2.416-x86_64-1

Issuing `vim` gets the coloured vim as expected. Issuing `vi` or `elvis` gets the uncoloured vi. I don't know what was wrong with your Slackware installation or what (if anything) you were doing incorrectly, but vim is included with a full Slackware installation and works as expected. vi (in the form of elvis) is a required package in Slackware, but in a full installation vim is included as well. There are no aliases to vi by default, so issuing `vim` should get the expected behaviour. I have two 13.1 upgrades (both 32-bit and 64-bit) as well as a fresh 13.1 server (without X), and vim works as expected in all of them without installing an unofficial package. See here for 32-bit vim (in the ap/ series of Slackware) and here for the 64-bit package.
Quote:

Originally Posted by molossus (Post 4189100)
note: i deleted /usr/local/bin/vim ,and this is what is get :
Code:

bash: /usr/local/bin/vim: No such file or directory
so , no , slackware didn't look in /usr/bin/vim

What command did you issue to get that error? Without the symlink in place, what is the output of
Code:

$ which vim
$ file /usr/bin/vim

Your PATH above indicates that it should search in /usr/local/bin first, and then /usr/bin if it doesn't find it. If there is no vim in /usr/local/bin then it should find the one in /usr/bin whenever you issue `vim`.

[edit] Just as a thought, bash's hash table could be remembering /usr/local/bin/vim. Try issuing
Code:

hash -d vim
I'm not sure if the hash table is regenerated when bash is restarted, but you could try logging out and logging back in as well.
[/edit]

molossus 12-12-2010 05:42 PM

after deleting /usr/local/bin/vim and invoking vim again i got:
Code:

bash: /usr/local/bin/vim: No such file or directory
making the ln -s link to /usr/bin/vim , makes vim work and vi is gone.


the ouput of
$ which vim
Code:

/usr/local/bin/vim
$ file /usr/bin/vim
Code:

/usr/bin/vim: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
 dynamically linked (uses shared libs), stripped

hash -d vim
Code:

bash: hash: vim: not found
i installed the the vim .tgz from the link you provided , and now vim is called even when i call vi, nice.
still hash -d vim shows nothing and then if i execute again , it shows hash:vim not found
anyways i learned a lot of new things today. :)

markush 12-12-2010 06:00 PM

Hi molossus,

in a default Slackwareinstallation you'll only have to
Code:

cp /usr/share/vim/vim73/vimrc_example.vim ~/.vimrc
in order to get colord vim.
Explanation: the colors are devined in the .vimrc in your homedirectory. The default vimrc is found as vimrc_example.vim in the /usr/share/vim/vim73 directory.

Markus


All times are GMT -5. The time now is 04:22 PM.