Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
It's probably a good idea to leave the stock vim alone, because OS X updates may want to overwrite it with the official Apple release.

instead, make a /usr/local/bin or similar, prepend that to your path, and put your custom copy there.

You can get a reasonably up-to-date vim from http://macvim.org/OSX

Make a symlink or copy of the included gvim script to vim if you want it to work inside Terminal, see the script and the readme for other things you can do.
 
Thanks.

I compiled the latest source of VIM, moved it to the Applications folder and added gvim to the local path.

However when i type gvim in the terminal it opens VIM instead of running in the terminal. :(
 
Thanks.

I compiled the latest source of VIM, moved it to the Applications folder and added gvim to the local path.

However when i type gvim in the terminal it opens VIM instead of running in the terminal. :(
I'm not quite sure what you want here. gvim won't run in the Terminal. It always opens a separate window (gvim is gui vim). vim is the non-gui terminal version.
 
I'm not quite sure what you want here. gvim won't run in the Terminal. It always opens a separate window (gvim is gui vim). vim is the non-gui terminal version.

I just want the vim command to use an updated version of vim.
 
I just want the vim command to use an updated version of vim.
Ok, so you type vim in Terminal, exactly what happens?

You type gvim in Terminal, exactly what happens?

What are the version strings displayed in each case?

What's displayed when you type "which vim"?

What's displayed when you type "which gvim"?

Have you updated or replaced the gvim script to point to the new Vim.app?
 
However when i type gvim in the terminal it opens VIM instead of running in the terminal. :(
that's expected. The gvim script included with the MacVIM (that's the one you're using, right?) does different things depending on what name you give it on the command line.

So, you can copy or rename the gvim script to vim, or if you prefer, make a symlink named vim pointing to the gvim script, to get it to run inside the terminal.

Also, make sure that the location of "your" vim shows up earlier in your path than the stock Apple build.
 
Plidem:
vim is on the glogal path.
/usr/bin/vim
gvim is on the local path.
/usr/local/bin/gvim

iMeowbot:
I renamed the file and still no cookie :( i guess the global path takes priority over the local path...

BTW: as you all guessed im an IDE noob.
 
I renamed the file and still no cookie :( i guess the global path takes priority over the local path...

No, the one that comes first in the PATH takes precedence - there's no such thing as "global" or "local" path. What's the result of typing in Terminal:
Code:
echo $PATH

But I still don't know if you want to use vim (ie. it loads in the Terminal you're currently using) or gvim (ie. it opens in a separate window). Which one do you want?

Also, it doesn't really matter where the files are, as long as it loads the new Vim.app. So, please, when you type "gvim" in Terminal, what's the version? And when you type "vim" what's the version?

"gvim" is a script that does some application lookups to find which vim to load. If you view /usr/local/bin/gvim, you should see a line like:
Code:
# First, check "All the Usual Suspects" for the location of the Vim.app
# bundle.  You can short-circuit this by setting the VIM_APP_DIR environment
# variable or by un-commenting and editing the following line:
# VIM_APP_DIR=/Applications

If you uncomment that last line, the gvim script will look inside /Applications for Vim.app so you'll get the latest version. But this loads gvim in a separate window. Which I don't know if you want.

By the way, when I type vim in Terminal, I get version 6.2, but if I type gvim, I get version 7.0. I always use gvim so I didn't bother trying to set up vim.
 
Thanks.

I want to load Vim 7.1.2 in the terminal

gvim points to the app folder where i have version 7.1.2 (but opens it on a new window) and vim goes to vim 6.2.
 
I just aliased vim to /Applications/Vim.app/Contents/MacOS/Vim, which I compiled and installed from source. Because argv[0] is vim, it knows to run in the terminal instead of as a separate application.
 
I just aliased vim to /Applications/Vim.app/Contents/MacOS/Vim, which I compiled and installed from source. Because argv[0] is vim, it knows to run in the terminal instead of as a separate application.

That means u replaced vim in the usr/bin folder?

I tried to add an alias with a nome other than vim pointing to /Applications/Vim.app/Contents/MacOS/Vim but when i run the command terminal shows permission dennied.
 
Thanks.

I compiled the latest source of VIM, moved it to the Applications folder and added gvim to the local path.

However when i type gvim in the terminal it opens VIM instead of running in the terminal. :(

Make an alias in your profile that points at the vim you want to use. ;)

Ooops, you already did that.

Make sure it's executable?
 
Make an alias in your profile that points at the vim you want to use. ;)

Ooops, you already did that.

Make sure it's executable?

It is executable.

If this is relevant: i created th alias with the finder.

Im currently using iTerm bookmarks to open vim. But of course i can't open files from the terminal that way.
 
If this is relevant: i created th alias with the finder.

Yeah, that is relevant. While symbolic links look just like aliases when viewed in the Finder, aliases created through the Finder are not symlinks.

To get what you need, delete that alias, then (from Terminal):

Code:
cd /wherever/the/gvim/script/lives
ln -s gvim vim

(may need sudo for that, depending on where you put stuff)
 
That means u replaced vim in the usr/bin folder?

I tried to add an alias with a nome other than vim pointing to /Applications/Vim.app/Contents/MacOS/Vim but when i run the command terminal shows permission dennied.

No, I created a shell alias. I guess I wasn't specific enough. So in my .tcshrc files, there's a command "alias vim /Applications/Vim.app/Contents/MacOS/Vim". I'm not sure what the equivalent command would be in bash.
 
No, I created a shell alias. I guess I wasn't specific enough. So in my .tcshrc files, there's a command "alias vim /Applications/Vim.app/Contents/MacOS/Vim". I'm not sure what the equivalent command would be in bash.

Yes, that's the alias I was referring to as well. THough I finally extricatred myself from tcsh last month. My office Mac was the final bastion! :)
 
Yeah, that is relevant. While symbolic links look just like aliases when viewed in the Finder, aliases created through the Finder are not symlinks.

To get what you need, delete that alias, then (from Terminal):

Code:
cd /wherever/the/gvim/script/lives
ln -s gvim vim

(may need sudo for that, depending on where you put stuff)

I made the symlink placed it on usr/local/bin but the terminal still uses the original vim.
 
What does your PATH environment variable look like? Type the command "printenv PATH"

/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/teTeX/bin/powerpc-apple-darwin-current:/usr/X11R6/bin
 
/usr/bin is ahead of /usr/local/bin, so it's finding the 6.3 version of vim before it finds your local one. you need to put /usr/local/bin ahead of /usr/bin. Or you can do the alias thing.
 
/usr/bin is ahead of /usr/local/bin, so it's finding the 6.3 version of vim before it finds your local one. you need to put /usr/local/bin ahead of /usr/bin. Or you can do the alias thing.

How do i do that?
 
Where is your PATH getting set? Do you have any files like .bashrc, .bash_profile or .profile in your home directory?

By default, the file /etc/profile gets read and that sets up an initial path, but it looks like you have more than that in your path. The /sw stuff comes from fink, I think.

Anyways you could create a simple .bash_profile in your home directory. It'd look like this:

PATH="/sw/bin:/sw/sbin:/bin:/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/powerpc-apple-darwin-current:/usr/X11R6/bin"
export PATH
 
MacPorts has it. It also has Vim.app (which is GVim). Both work really well. I highly recommend MacPorts. It's also great for other Unix utilities such as irssi, other versions of GCC, updated Ruby, etc, etc. It puts all the new binaries in /opt/local/bin so you just put that path in front of your standard one and it will use the new utilities.

edit:
And if you install the .app with ports, it will run the gui version with the command gvim from the terminal.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.