Patch Vim with the breakindent patch on OS X with Homebrew - macos

I'm on OS X 10.7 with Vim 7.3.
I'd like to install the breakindent patch.
Here's a way to do it on Linux with apt-get:
Compiling VIM with breakindent patch.
How do I do this? I suppose it will involve building Vim via Homebrew (which is OK with me).

Use Mercurial to get the latest Vim source code:
$ hg clone https://vim.googlecode.com/hg/ vim
$ cd vim
Grab the patch.
Apply the patch as indicated in the linked thread:
$ patch -p1 < /path/to/breakindent.patch
Configure Vim with the options you need (python/ruby support, custom location, etc.):
$ ./configure --with-features=huge <other options>
Build and install:
$ sudo make && make install

I just modified the Homebrew formula for MacVim to optionally add that patch. If you want to try it out, you can download the formula at https://gist.github.com/4108848 and plunk it in /usr/local/Library/Formula; then install using brew install --with-breakindent-patch macvim.
(EDIT: I used to have a link to my GitHub fork of Homebrew here, but I've decided to delete that fork unless I actually submit anything to Homebrew. The old formula could optionally add a patch that's been added to the main Vim since then.)

As of June 25th 2014, VIM includes the breakindent patch by default – finally :-)
For more info, see https://retracile.net/blog/2014/07/18/18.00

If you're installing from Homebrew, use:
brew install macvim --with-features=huge --override-system-vim --HEAD

Related

How to revert to system vim after using installing vim with homebrew?

I wanted to upgrade to vim 7.4+ but the macOS system version was 7.3. I used the command brew install vim --override-system-vim however I don't think overriding system defaults is ever a good idea. How can I revert the changes back to the system defaults?
Just remove /usr/local/bin/vi (which is a symbolic link to brew's vi).
Run brew rm vim && brew install vim.
Making the symbolic link is all what --override-system-vim do.
Brew actually doesn't do anything with system vi.

how to install libX11 on OSx 10.9?

I am trying to install ROOT (cern.root.ch). When I run ./configure , I get a message that libX11 is missing and must be installed.
I did some research and found that I need to install
) XQuartz (I already have the latest version.)
) Command line tools in Xcode.
I tried installing Command Line Tools from apple's developer website. The installation goes through smoothly but how do I know whether it has been installed? I still get libX11 missing error with root's configure command.
I also tried xcode-select --install and it once went through smoothly and then later again gives error saying this package is no longer maintained - or something of that sort.
I understand I may have multiple installations... But I am still facing the problem of not having libX11 and not being able to install ROOT.
Thanks,
Hershal.
This link and the one referenced in it suggests you use homebrew (brew) to install it
$ ruby <(curl -fsS https://raw.github.com/mxcl/homebrew/go)
$ brew doctor
Remember to add the Homebrew directory to your PATH by adding the directory (found with brew --prefix) to your .bashrc, .zshrc or whatever shell file you’re using (.bashrc is the OS X default). We’ll also add the XQuartz binaries to the PATH in case anything needs them in the future.
export PATH=/usr/local/bin:/opt/X11/bin:$PATH
Start a new Terminal session to pick up the changes.
Now that Homebrew is installed, we can use it to install the required dependencies. Each may take some time as Homebrew generally compiles from source.
$ brew install gfortran # Fortran compiler
$ brew install python # Python interpreter
$ brew install pcre # Regular Expressions library
$ brew install fftw # Fast Fourier Transforms
$ brew install cmake # Cross-platform make
install root
$ brew tap homebrew/science
$ brew install --with-cocoa root
You don't say whether you have installed XCode as well as the commandline tools but I think you will need it

How do I uninstall subversion on OS X

I did svn --version on command line and it says it is 1.17.10.
I want to uninstall it completely, so I can re-install 1.16.12
How do I do that in OS X?
Thanks
As said Mike Christensen, in order to uninstall it, you just need to delete the binary. Run which svn to know where your binary is installed.
In order to install subversion, you need to:
Download it.
Uncompress it (tar xzf subversion-1.x.y.tar.gz).
Compile it (./configure && make).
Install it (sudo make install).
I’m pretty sure this will install it in /usr/local/bin. So if you want svn to call the subversion you just installed (instead of the one built in XCode), you need to edit your $PATH so that /usr/local/bin is before /usr/bin. On Mac OS X, editing the path is done by editing the file /etc/paths.
Note that steps 3 and 4 requires a compiler and make. The easiest way to get those on Mac OS X is to install XCode.
If you get any error in following Etienne Miret solution so the following
after setp 3
brew install apr
brew install apr-util
/configure --with-apr=/usr/local/Cellar/apr/1.5.2_3/ --with-apr-util=/usr/local/Cellar/apr-util/1.5.4_4 && make
sudo make install
After completion, you can see the new SVN installed here
/usr/local/bin/svn --version

Installing vim with ruby support (+ruby)

I'm trying to get command-t installed for vim but my current version of vim doesn't have the (+ruby) flag. The command "which ruby" shows that ruby is installed.
What do I need to do in order to activate the +ruby flag in vim?
Also, what does the +ruby flag technically mean?
Some package provides vim-ruby on Ubuntu, for example vim-nox.
simply:
sudo apt-get install vim-nox;
will get you vim with ruby, as well as compiled in "support for scripting with Perl, Python, Ruby, and TCL but no GUI."
sudo apt-get install vim-rails
will install a "selection of vimscripts that make editing Ruby on Rails applications extremely easy." but as it depends on vim-full and vim-addon-manager, it will also install the vim-gnome version of the GUI, that is "a version of vim compiled with a GNOME2 GUI and support for scripting with Perl, Python, Ruby, and TCL."
I think "Compiling Vim With Ruby Integration On Snow Leopard" might actually help. I'm on exactly same boat at the moment.
Ok... got it to work. Took me like half hour or so.
This should help (I got Ubuntu):
sudo apt-get install mercurial
hg clone https://vim.googlecode.com/hg/ vim
cd vim
./configure --enable-rubyinterp
make
sudo make install
To test if things look fancy:
vim --version | grep ruby
Should return something like:
-python3 +quickfix +reltime -rightleft +ruby +scrollbind +signs +smartindent
Ruby should have plus now. Another trick to test it - enter vim and hit :ruby 1. Should not fail.
On mac os x, assuming you have Homebrew installed:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/vim.rb
This version of vim has ruby support enabled
Source: http://blog.jerodsanto.net/2011/08/brew-install-vim/
EDIT: edited the url, thanks #david-xia for mentioning the change
UPDATE: Apparently, homebrew vim now comes with ruby support enabled by default so you just need to do brew install vim (see comment below)
If there isn't a Ruby enabled Vim available for your operating system, you'll have to recompile. This is very easy and there are some instructions on the Vim website I believe. If you're on Linux, you use configure to choose what you want. Have a look at the output of:
./configure --help
in the Vim source directory. Read it carefully, there are a lot of options in there. The main one you want is --enable-rubyinterp, but you may also want to add --with-features=HUGE among others. As I said, read the help provided.
when you run ./configure you need to add the folowing --enable-rubyinterp
./configure --enable-rubyinterp
On Mac OS X, I find that the easiest is to install MacVim with brew install macvim which includes +ruby. And then symlink /usr/local/bin/vim to /usr/local/bin/mvim. That way to get a recent Vim version, with the huge feature set, +ruby, both GUI and command line vim just using the standard HomeBrew repository. No need for external repository like in Pierre answer
To avoid issues it's better to use the use the system ruby during installation so:
rvm use system
brew install macvim
ln -s /usr/local/bin/mvim /usr/local/bin/vim
Flag +ruby means that vim is compiled with ruby support and linked against ruby interpreter library. You cannot get this flag without recompiling vim or installing another version which is compiled with this flag.
Pulling the vim source using Mercurial and changing into the directory will give you the ability to configure your vim install before you compile it.
hg clone https://vim.googlecode.com/hg/ vim
cd vim
./configure --enable-rubyinterp
The --enable-xxinterp option can be used for Python, Perl, or any other language that Vim will support. Just type it in where the xx is and it will work.
Running the help option with the configure command will allow you to see all of the configuration options.
./configure --help
Under Windows you can install Vim from here:
http://sourceforge.net/projects/cream/files/Vim/
Version 7.3.3 seems to be compiled with Ruby support (see release notes file). The newest 7.3.x currently is not.
Installing vim-rails will add Ruby (+ruby) support. I just tried and verified that it works and Command-T runs fine now.
sudo apt-get install vim-rails
If you are using MacPorts in OSX, you may try
sudo port install vim +ruby
To specify a different ruby version, you may try
sudo port install vim +ruby18
or
sudo port install vim +ruby19
It looks like you need to have ruby installed before install vim-nox.
This works for me on Ubuntu 18.10
sudo apt-get install ruby rubygems vim-nox
Source: https://junegunn.kr/2013/09/installing-vim-with-ruby-support
If you are lazzy and don't want to recompile you can try to find a package with a vim version including ruby. On debian it's vim-ruby so something like
apt-get install vim-ruby
might work. (I can't try it, I m on mac. On mac , MacVim come with ruby enabled)

Installing meld on OS X

After I got MacPorts installed and did a 'sudo port -v selfupdate', I try to install meld.
The installation just starts to Fetching all kinds of stuff
gnome-comoon
perl5.8
perl5
pkgconfig
.....
this goes on and on.
Is that normal?
You may want to install it via HomeBrew (already mentioned before):
brew install homebrew/gui/meld
Though you may face stability issues (as I did). So I'd rather recommend to use "Meld for OSX":
Go to https://yousseb.github.io/meld/
Download DMG file you prefer (e.g. "Download latest DMG" https://github.com/yousseb/meld/releases/download/osx-6/meldmerge.dmg)
Install it to your Applications folder
We are basically done, but it is not accessible via command line.
Solution:
Write a small wrapper to run from Terminal:
echo -e '#!/bin/sh
params="$#"
open -W -a Meld --args $params' | sudo tee /usr/local/bin/meld
sudo chmod +x /usr/local/bin/meld
Try (you must use absolute paths though):
meld /home/a.txt /home/b.txt
Or just run Meld from menu.
meld is now available in homebrew. The formula can be found here.
See this answer by cmedeiros on SuperUser for more information on installing and getting it to work. This is much easier than using MacPorts.
Current command with updated formula to install meld with homebrew is:
brew install caskroom/cask/meld
Yes, it is normal to pull in dependencies but it shouldn't take too long. For comparison, installing Meld with Homebrew took about 15 minutes for me.
For reference, my installation of Meld on OS X Mavericks:
Install Xcode from the app store
Install XQuartz from package (Meld will complain if you don't have it)
command line: 'brew install meld'
If you are prompted to install the Xcode command line tools at some point, do so.
Hope this helps.
Unfortunately, the is very normal with MacPorts, and is the reason that people many have switched to homebrew http://github.com/mxcl/homebrew
However, I found this post because homebrew doesn't include Meld. Sigh.
Consider downloading macOS meld version dmg https://github.com/yousseb/meld/releases/
Brew now works brew install --cask meld.
See https://formulae.brew.sh/cask/meld#default
UPDATE Jul-23-2020
Just do :
brew install homebrew/gui/meld
using the updated brew link: brew install caskroom/cask/meld
even after this its not working when I install backup and restore tool by google. I guess its messing up with the python version.

Resources