Using the correct version of vim - vim

I installed vim with:
brew install vim --override-system-vi
I also installed macvim using:
brew install macvim
However, terminal vim uses 7.4.52 and macvim uses 7.4.22. Any way around this?
I've uninstalled and reinstalled many times, but I must be doing it wrong...
which vim returns /usr/local/bin/vim
which mvim returns /usr/local/bin/mvim
Any help would be greatly appreciated.
Thnx!

You only need to install macvim: it runs both as a GUI and in the terminal.
I don't know where the confusion comes from but neither gvim nor macvim are frontends for a separate vim. They are vim.

you can rename your system vim, then vim will be the mac vim

You've installed two different pieces of software..but you only want to use one? If so, then just alias your macvim in your shell; for example:
alias vim="/Applications/MacVim.app/Contents/MacOS/Vim"

Related

How to make Brew install Vim with +clipboard?

I'm trying to figure out how to copy-and-paste between a file edited with Vim and the macOS Clipboard. Most instructions say to start by installing Vim using Homebrew as it will be installed with the clipboard option enabled (vim --version will display "+clipboard"). However, when I installed Vim using brew, the clipboard option was still set to "-clipboard". Can I force brew to reinstall Vim and turn this option on in the process? I'm using Homebrew 1.1.2 which installed VIM 7.4.
Because Homebrew no longer takes package specific options on the command line you need to edit the formula to add support for the clipboard back and then tell brew to install from source and not from a bottle.
brew uninstall vim
brew edit vim
# Add `"--enable-clipboard",` after the `./configure` in the list of other options.
brew install -s vim
Summarized from this solution:
https://coderwall.com/p/avmotq/gain-clipboard-support-for-vim-on-os-x
Expanding on Andy Ray's comment…
MacVim is a GUI program but it also comes with a TUI executable that can be run in a terminal emulator. Because that TUI executable has all the features of the GUI program, installing MacVim is by far the easiest and safest way to have a full-featured and well optimized Vim on Mac OS X:
Download the latest release.
Mount the disk image.
Drag and drop MacVim.app to /Applications/ or ~/Applications.
Put the mvim scriptsomewhere in your$PATH`.
[OPTIONAL] Add alias vim='mvim -v' to your shell's init script.
From your shell, you can do:
$ mvim foo.txt
to edit foo.txt in the MacVim GUI,
$ mvim -v bar.txt
to edit bar.txt in the MacVim TUI. Or, if you added the alias:
$ vim bar.txt
Now, to address your comment…
If you connect to your Mac from your Linux box, iTerm.app doesn't come into play and you can use whatever TUI program is installed on the Mac, including the Macvim TUI.
If you connect to your Linux box from your Mac, whether it is via iTerm.app or Terminal.app, the vim you are going to run will be the vim on your Linux machine so… what programs you install on your Mac doesn't matter at all as you won't have access to them anyway.

How to add python support for vim without destroying up all the plugins?

I started using vim earlier this summer and have recently started to add plugins. Todays challenge is to install YouCompleteMe.
Problem: During the installation process I noticed that my vim version (7.4) doesn't have support for python/python3.
Question: How can I fix this without messing up all my plugins/.vimrc file?
Will a clean install even affect my plugins/.vimrc?
I read some where that I should install 'vim-nox'.. Should I?
My setup: Ubuntu 16.04. Vim 7.4. Plugins are installed via Pathogen.
Thanks in advance for your replies!
Kind regards, Edvin
As long as your plugins are installed in $HOME/.vim (or MsWindows equivalent), and not into /etc/vim or /usr/share/vim, there should be no problem: you can upgrade your vim version without impacting what you have already installed.
See :h 'rtp' and :h startup.
Plugins and vimrc are just files. They can't be executed stand alone. Further, they come into power, only when vim is running.
So, your uninstallation/installation of vim doesn't change/affect plugins or vimrc. However, if the plugin or vimrc has code related to specific environment (like OS, terminal, etc,.) or needs specific features of vim and if your new version doesnt support them, you may have problems. Plugins in default folder(where vim is installed) will get deleted when you uninstall. The plugins in HOME directory aren't affected anyway.

GVim does not launch after installing plugins (Windows)

I installed Vim 7.4 in a Windows 8 machine and it was working fine. After installing all plugins in my .vimrc, GVIM crashed and it wouldn't open again. I could manage to use VIM from cmd but not without some errors. My first try was to reeinstall GVIM completely. After reinstalling, it worked fine but if I also reinstall my plugins it would crash and not open again. What should I do?
I removed all plugins and installed one by one until I got the error, which was with the Ultisnips plugin. I happen to know that this plugin requires VIM with Python support, which my VIM probably wouldn't have. To test this, run vim --version and look for a +python (or run echo has("python") from inside GVIM and look for a output of 1). In my case, it was -python, which was confusing, since I have Python installed. According to this answer, you need to install Python after installing VIM, so I did it and it worked.

brew installed Vim in Terminal with RVM (Ruby 1.9.3), MacVim and Command-T

I'm using RVM (1.17.7) and Ruby 1.9.3p362. In the long run I want to move over to Vim in the Terminal with Tmux. I'm trying to learn how to install and run with my choices for plugins instead of defaulting to Janus, just trying to learn it all and not be a cargo cult programmer.
I did a brew install of Vim git clone of Command-T (I'm using Pathogen) while the Ruby was set to 1.9.3... and everything is good in Terminal using Vim and Command-T. When I run :ruby puts RUBY_VERSION in Terminal Vim, it gives 1.9.3 back. The Command-T works fine too.
When I try and use the same Command-T in MacVim it crashes and the Terminal says:
Vim: Caught deadly signal SEGV
Vim: Finished.
I did a brew install macvim while in 1.9.3, but when I launch mvim from Terminal and run :ruby puts RUBY_VERSION I get back 1.8.7. I know Wincent recommends the system version of Ruby for installing Command-T and I've read you have to match up the Ruby version either way. I've managed to get it working for both when I had the system ruby, but can't get it for both on the RVM version with 1.9.3...
Is it possible? Should I just forget about MacVim and stick with Vim in the Terminal?
Other things I thought I could do would be to have a disabled folder and just move the different Command-T installations in and out of it. Or maybe do an if for 'gui_running' and target the different installs. Any advice to set me straight would be great.
I've installed Tim Pope's rvm.vim and can set the Ruby version, but that doesn't seem to stop the crash in the MacVim when I call :CommandT.
I'm guessing that you installed the macvim package before you installed installed all the rest of that, and then installed the vim package afterwards. That'd explain why it works in terminal mode. These are two different packages, and they have their own build options.
Run:
vim --version
And compare the output to:
mvim --version
In particular, check out the last line (starts with Linking:). You'll probably see ruby-1.8 linked in for mvim, and ruby-1.9.1 linked in for vim (note that 1.9.3 reports 1.9.1; it's the C API version, not the Ruby version).
If all this is true, fix it by doing:
brew uninstall macvim
brew install macvim
It should build against your 1.9.3 config. Make sure rvm current reports 1.9.3 before you do that.

macports vim with +keymap option

I've got a Mac OS X Lion. And there's a vim, that is installed from macports. Unfortunately, it lacks a +keymap option. Is there a way I can install vim from macports with this additional option?
As far as I know, ports fetch vim sources and compile them. If so, there might be a way how to hold on ports installation process to introduce one small change to makefile. Do you know one?
Thanks a lot
Vim provides several feature sets, which can be selected by variants in MacPorts. The normal build does not include this keymap feature, you would need +big or even +huge.
For a new install:
sudo port install vim +big
Or, to add the +big variant to an existing installation:
sudo port -n upgrade --enforce-variants vim +big
Another option would be to just use CLI executable found in the latest MacVim build. I think it comes with this option.

Resources