0

I am trying to launch vim. I probably created a bad symlink to vim. I used which and alias commands to find out what is happening. Why doesn't it run vim properly?

MacBook-Air:~ miszo97$ which vim
/usr/bin/vim
MacBook-Air:~ miszo97$ vim
-bash: /usr/local/bin/vim: No such file or directory
MacBook-Air:~ miszo97$ alias vim
-bash: alias: vim: not found
4
  • "I probably created bad symlink to vim"? Read your shell history and see exactly what you did do. Commented Dec 2, 2017 at 1:39
  • 1
    Are you sure that /usr/local/bin/vim is not just a hashed path? compare the output of type vim with that of which vim and execute hash -d vim if necessary. Commented Dec 2, 2017 at 2:02
  • 4
    also try running /usr/bin/vim, at least then we can be sure you actually have it properly installed. Then try ls -l /usr/bin/vim, if the first letter is l, you have overwritten your vim with a symlink somehow. Then show us what echo $PATH outputs and I guess double-checking if there is something fishy in /usr/local/bin/ won't hurt with ls -l /usr/local/bin/vim Commented Dec 2, 2017 at 2:15
  • I don't have Mac, but brew install vim to reinstall vim should capable fix automatically. Commented Dec 2, 2017 at 10:11

1 Answer 1

1
command -v vim

shows you how the shell currently handles the command vim.

In your case it is not an alias. It may be a shell function or it has been located at /usr/local/bin/vim earlier but you deleted the file or symlink.

If vim is somewhere else in your $PATH then you must make your shell realize the new location:

hash -d vim

If vim is not in your path then you have to either copy / move or link it there (and run hash -d vim if it is a different location) or create an alias, a shell function or a hash entry for it:

alias vim="/foo/bar/vim"
vim () { /foo/bar/vim ; }
hash -p /foo/bar/vim vim

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.