January 2, 2018
Recently, something broke in Homebrew's version of Vim. Several things seemed weird, but what first caught my eye was that misspelled words were no longer highlighted in Markdown files. This is a feature that I have previously configured and I use it often when writing blog posts and such.
Initially, I assumed I had a problem with my Vim settings. After much troubleshooting and no joy, I finally uninstalled Homebrew's version of Vim which caused my system to fall back to the default version of Vim that ships with macOS. Suddenly the highlighting worked fine.
After doing some further research, I decided I would try to compile and install Vim myself. After some googling and patching together a few different articles, this is what worked for me.
-
Clone the Vim repo from GitHub.
$ git clone https://github.com/vim/vim.git
-
Check out the latest tag.
$ cd vim $ git tag --list $ git checkout v8.0.1427
-
Configure options. (See
./configure --help
for a complete list of options.)$ ./configure --with-features=huge --enable-multibyte --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-python3interp=yes --enable-perlinterp=yes --enable-luainterp=yes --enable-cscope --prefix=/usr/local
-
Build with custom runtime directory.
$ make VIMRUNTIMEDIR=/usr/local/share/vim/vim80
-
Install.
$ sudo make install
After compiling and installing Vim from source, everything is working nicely. In future, I'll probably try to go back to Homebrew's Vim. They have a great system that's usually very reliable and I'm sure this little wrinkle will get ironed out. Meanwhile, I got a nice refresher on building Unix software. And best of all, my spellcheck highlighting shows up again!
$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 2 2018 14:25:57)
macOS version
Included patches: 1-1427
Compiled by joshukraine@joshuas-imac
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_sgr -tag_any_white
+arabic +file_in_path -mouse_sysmouse -tcl
+autocmd +find_in_path +mouse_urxvt +termguicolors
-autoservername +float +mouse_xterm +terminal
-balloon_eval +folding +multi_byte +terminfo
+balloon_eval_term -footer +multi_lang +termresponse
-browse +fork() -mzscheme +textobjects
++builtin_terms -gettext +netbeans_intg +timers
+byte_offset -hangul_input +num64 +title
+channel +iconv +packages -toolbar
+cindent +insert_expand +path_extra +user_commands
-clientserver +job +perl +vertsplit
+clipboard +jumplist +persistent_undo +virtualedit
+cmdline_compl +keymap +postscript +visual
+cmdline_hist +lambda +printer +visualextra
+cmdline_info +langmap +profile +viminfo
+comments +libcall +python/dyn +vreplace
+conceal +linebreak +python3/dyn +wildignore
+cryptv +lispindent +quickfix +wildmenu
+cscope +listcmds +reltime +windows
+cursorbind +localmap +rightleft +writebackup
+cursorshape -lua +ruby -X11
+dialog_con +menu +scrollbind -xfontset
+diff +mksession +signs -xim
+digraphs +modify_fname +smartindent -xpm
-dnd +mouse +startuptime -xsmp
-ebcdic -mouseshape +statusline -xterm_clipboard
+emacs_tags +mouse_dec -sun_workshop -xterm_save
+eval -mouse_gpm +syntax
+ex_extra -mouse_jsbterm +tag_binary
+extra_search +mouse_netterm +tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
f-b for $VIMRUNTIME: "/usr/local/share/vim/vim80"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -L/usr/local/lib -o vim -lncurses -liconv -framework AppKit -mmacosx-version-min=10.13 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.26.1/lib/perl5/5.26.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -lruby-static -framework CoreFoundation -lgmp -lobjc -L/Users/joshukraine/.asdf/installs/ruby/2.4.3/lib
In addition to selecting a standard feature set (Huge, Normal, etc.), there are a plethora of configuration flags that can be passed prior to compiling Vim. Some are fairly self-explanatory, some are less so. Somewhere there must be a list, right? And so there is! I've found two so far.
- In the root of Vim's source code repository, run
./configure --help
. OR... - View the appropriate help document within Vim itself:
:help feature-list
Option 2 is especially nice since there are links to the various options which provide more detail.
- http://vim.wikia.com/wiki/Building_Vim
- https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source
- https://wikimatze.de/compiling-vim-from-source-for-ubuntu-and-mac-with-rbenv/
- https://robots.thoughtbot.com/the-magic-behind-configure-make-make-install
- https://stackoverflow.com/questions/32561979/how-to-install-vim-with-all-options-features-vim
- http://vim.wikia.com/wiki/Understanding_VIMRUNTIME