vim Mac OS X install with gui-support - macos

I have Mac Pro, with OS X 10.9.4 (can't upgrade to Yosemite yet), and I'm trying to build vim7.4 with gui-support, or get any kind of gui-support. My current vim is version 7.3, I'm guessing, that's the default vim that ships with macs. I have the Terminal.app and iTerm2.app, my vim rc has the default
set term=xterm-256colors
or what have you.
What I have so far:
macvim
The colors look great, basically it's the same setup I had on my ubuntu system, but it's really annoying that it opens a new window. Is there a way to get it to open within my terminal? (not launch it from the terminal, open inside of it)
As I've said I have the regular vim7.3
And while I can use color-schemes, they look like garbage compared to my ubuntu system. I suppose this must be due to gui-support option? I tried, CSApprox but that gives me a weird error.
So I decided to simply build vim 7.4 and enable gui support, but I get random errors.
My basic config make looks like:
./configure --enable-gui=yes
make
At which point it complains about missing header file etc. , I figured this should not be that hard.
Any tips?
The basics of what I'm trying to do is:
Have a vim version installed with gui-support, or a work-around where my colors are all screwed up.
Thanks!

Building Vim on Mac OS X is a waste of time.
Step 1: Download the appropriate MacVim build from here.
Step 2: Put MacVim.app into the /Applications/ directory.
Step 3: Put the bundled mvim script somewhere in your PATH.
Done.
To run MacVim in your shell:
$ mvim -v filename
To run MacVim from your shell:
$ mvim filename

Building Vim with GUI on macOS using Homebrew:
brew edit vim.
Add a new line with option for GUI:
option "enable-gui", "Enable GUI mode"
Change from no to yes in the following line:
opts << "--enable-gui=no"
Install or re-install vim:
brew reinstall vim --enable-gui
Troubleshooting:
If you've errors related to Python 3, see: vim's GH-2754.
Checkout new Homebrew PR at GH-25785 with above patch.

Related

Mac can't open system vim in terminal

I tried to upgrade my system Vim from 7.3 to a high version so I used macport to do that. This newer version is located in /opt/local/bin/. Later I decided to uninstall it due to some reason.
Now I can't open my system Vim in the terminal, the error message is -bash: /opt/local/bin/vim: No such file or directory. Somehow the machine still thinks the vim is located in /opt/local/bin/.
Then weird thing happens, when I type which vim, it shows my vim located at /usr/local/bin, and there is indeed a vim folder in that directory, but I can't open it by typing vim in the terminal.
So here is the situation: I have two working versions of Vim in my machine, a 7.3 version in /usr/bin and a 7.4 version in /usr/local/bin(I don't know how I got this one). Both working (I have to type the whole directory /urs/bin/vim or /urs/local/bin/vim), but can't be opened in the terminal by simply typing vim.
Updates:
now I can use vi or vim, but the problem is, the former opens 7.3 whereas the latter opens 7.4
At the current command window, type:
$ hash -r
then try running vim again. Or create a new window and try in that.
Bash remembered where vim was found, and expects to find it there again. When you removed vim, it got upset and complained (rather than try to find it again before complaining). Using hash -r vim forgets all previously hashed commands and then finds vim explicitly. Run hash with no options to see what it knows.
See the Bash manual on hash for more information.
The default Vim is /usr/bin/vim. There is absolutely no reason whatsoever to change it.
If you want a more up-to-date Vim, install MacVim and use the bundled mvim script instead of vim.

MacVim on OSX / Yosemite: no editor windows visible at all

Installed MacVim on my Yosemite 10.10.2 Macbook Pro today from http://www.macupdate.com/app/mac/25988/macvim
The problem is that no editor window(s) are visible. If I open a file using the menu, there's simply no effect: no editor window appears. It's not hidden behind other windows, it's not listed in the Windows menu, it's just entirely undisplayed.
Strangely, the file will appear in the MRU list, though. So this renders the entire editor completely useless. Should I just build gvim myself? Is this app actually being maintained by anyone?
I'd read some answers which suggest running:
brew install macvim
... does the trick.
You might want to try that first.
What worked for me...
However, this didn't work for me because although it updated my macvim, the one being linked to in the /Applications folder was not the version being updated by brew.
So, here are the steps I had to take.
Quit MacVim if open.
Delete the MacVim file in /Applications.
In the terminal, run:
brew install macvim --override-system-vim
Run (this will add the link to your Applications file):
brew linkapps macvim
I can't be sure every step above is required, or that the --override-system-vim flag is required, but I can tell you that doing the above steps worked for me.
Hope this helps.
It looks like MacVim development has been moved to a new repository (and maybe a different group of developers?):
https://github.com/macvim-dev/macvim
This repo has had changes applied to fix MacVim's graphical problems under Yosemite. (This is the same location that brew's macvim formula currently pulls its source from, which is why MacVim works on Yosemite when installed via brew.)
They also have a set of precompiled binary releases:
https://github.com/macvim-dev/macvim/releases
The latest ("snapshot 76") has worked fine for me in Yosemite so far. You just need to download the .tbz archive, double-click it to unpack to a folder, then drag the MacVim.app icon to Applications -- much easier and less invasive than installing a whole package management system and build environment! :)
Note: I had to execute a command given in another StackOverflow answer to correct a rendering glitch seen in full screen mode for snapshot 76:
$ defaults write org.vim.MacVim MMNativeFullScreen 0
I got the same problem today.
The solution:
mv ~/.vimrc ~/.vimrc_bak
It looks like there is something wrong with my .vimrc file.
I was having the same issue, and one of the answers in here helped me, but not for the reason explained so I thought this might be useful for others.
Some plugins might depend on the version of vim, and may work in version 7 but not in version 8, when you install MacVim this could be version 8, and the terminal vim version might be 7, both will use the same .vim folder and .vimrc to load the plugins and configuration, when you open the vim from terminal it might still work because the plugins were depending on vim version 7, but when you try to execute MacVim it will try to load the plugins using version 8 and then it will crash, the reason some of the answers worked it's because they are replacing the system vim, therefore MacVim and vim will be in the same major version, if you have upgraded from the previous version the best you can do it's to clear up the plugins folder and then load MacVim or vim and check that everything is working, then start applying the plugins one by one checking that they are not breaking vim. At least with this method I found that one of the plugins was not working as expected and removing it solved the "MacVim" issue.
In summary:
- move your .vim as .vim_bak
- move your .vimrc as .vimrc_bak (suggested by #hai feng kao)
And test if this solves the issue, if that's the case then a plugin is breaking your installation and you will need to activate some and figure out which is the one that causes the issue.
Hope this helps to others, I've followed a lot of these recommendations without success until I decided to upgrade vim (terminal) and this started to break as well, that pointed me in the right direction.
Again hope this saves some hours for some.
I had the same symptom with MacVim launching with no window and command-N doesn't start any a new one. brew re-install didn't help.
It turned out there was another instance of macvim installed on my system somehow, in the Downloads folder. I found out by clicking "MacVim" --> "About MacVim" and it was a version from 2014. I found the instance and deleted it.
I created an alias for the newly installed version and copied that into Applications folder so spotlight search can find the new one. That solved my problem.
I had this problem upon updating from MacOS 10.12.5 to 10.12.6.
I uninstalled MacVim by moving it to the trashcan and downloading it again.
I would guess that the new version fixed whatever issue it had with the new operating system.

How to open a window from mac terminal

this is the first time I ask on stackoverflow because I can't find the answer anywhere. I use emacs to write all my code and I just switched from ubuntu to mac os. One problem has been bothering me: How could you open emacs window from mac terminal just like you would open firefox window from terminal on Linux system? I know the way it works for Linux system is that, whenever you type a command from terminal, the terminal search for the binary in you PATH and execute it. Is it the case for Mac that you can only open applicaiton in window form under "/Application" directory and all binaries opened from terminal are in non-window form? Big thanks!!
The pre-installed Emacs that comes with OS X is built without the GUI. Hence
$ emacs # in the shell/terminal
will NOT open a graphical window, and instead will open up the text/terminal version instead. Note that this version (installed at /usr/bin/emacs) is also old, and is at 22.1.1 in Mountain Lion.
To get the behavior you desire (and also get the latest version of Emacs as a bonus), you can download the latest Emacs build. This is available at various places, including http://emacsforosx.com/.
Most of these pre-built Emacs are installed under /Applications, and in order to invoke from the terminal, you will need to specify the full path to the binary, which usually is:
/Applications/Emacs.app/Contents/MacOS/Emacs
You can create a simple alias to this binary in your .bashrc as:
alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs
and then invoke emacs in its full glory from the command line.
I just tried
/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal &
and it did open a new window just fine.
OS X 10.7.4 here.
EDIT: Indeed if I try:
open /Applications/Utilities/Terminal.app
No new terminal window is opened
But,
open --new /Applications/Utilities/Terminal.app
works also, and is probably better than my first option because the job is not tied to the terminal you started the new terminal with.
First, download a Mac OS/X emacs build from here: http://emacsformacosx.com/
Second, once it's installed, you can:
Open it from the command line with open -a emacs
Set it to run server mode in your .emacs init, and then at the
command line type emacsclient foo for file foo.
I'd recommend either getting emacs via fink, or going to here: http://emacsformacosx.com/
This will allow you to install a local version of emacs that runs through the X server, and thus has the full GUI interface.
not sure if u're looking for something like this
open /path/to/some.app

How to install vim on Cygwin

First, I saw that you can install vim normally in the setup.exe, but I realized that I wanted to install vim with Ruby support. I downloaded the vim 7.3, untared it and ran
./config --enable-ruby-interp
and everything configured fine. Then I ran
$ make && make install
and everything installed ok, but it put a vim.exe in /usr/local/bin. I don't want a vim.exe, I want a vim, which I can run by typing
$ vim
in my Cygwin shell.
Is there a way to tell vim during the installation to install it like it would if I was on Linux? Meaning, to ignore the fact that I'm on Windows?
Now, when I type vim into the shell, it just does nothing. So it found it, but it doesn't do anything with it.
You can drop a Windows build of Vim that has Ruby support (like this one) into your PATH (add vim's folder to PATH before everything else) and then when you run vim from inside cygwin it will run that (the first vim.exe in PATH. should also work in cygwin's MinTTY)
Remember to close and re-open your shell after changing PATH from windows settings.
reinstall the cygwin, or re-install git-bash. (which also included the cygwin environment)

How can I upgrade the *console* version of vim on OS X?

I'm sure this is a newbie question, but every time I've compiled/dl'ed a new version of vim for os x, running vim on the command-line opens up the gvim app. I just want to upgrade the console version (so I can, for example, have python compiled in to use omnicomplete).
If I understsood the question correcty, here is another solution: check out http://www.andrewvos.com/2011/07/23/upgrading-vim-on-os-x-with-homebrew/
Really simple, fast, painless. It uses homebrew-alt and you also need to have mercurial installed (it will prompt you if not).
You can also use MacPorts to handle the installation for you. Once you've installed it, run the /opt/local/bin/vim binary. I place this in my PATH before the system binary dirs (although be aware that this may cause problems for cmdline tools that rely on the versions of tools shipped with OS X).
This may sound stupid, but are you copying the vim binary to /usr/bin? by default, the "vim" path is /usr/bin/vim. If you compile from source, you'll likely need to either copy the vim binary to /usr/bin/vim (thus overwriting the original vim), or launch the compiled version via absolute path (eg. ~/vim-checkout/build/vim).
that's just a guess, however. I can't see it being anything more than that.
With Homebrew:
brew install macvim
ln -s /usr/local/bin/mvim /usr/local/bin/vim
Can also symlink your new binary to /usr/local/bin/

Resources