Tags: #tags: vim, compile
FROM golang:1.8
RUN apt-get update -y
RUN apt-get install -y wget git ncurses-dev
WORKDIR /tmp
RUN git clone https://github.com/vim/vim.git
RUN cd vim && make && make install
The key ingredient for getting compilation of vim to work is to tell the compilation script which Python3 version you want to use, but that telling it what to use by itself won’t work if it’s trying to use ‘cached’ layers (kinda like Docker caches operations in layers to make future runs quicker).
So now whenever I’m compiling Vim I’m cleaning out the cache (see the first line in the below script)…
make clean distclean
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-python3interp=yes \
--with-python3-command=/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/bin/python3.7 \
--with-python3-config-dir=/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin/ \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 \
--enable-cscope \
--prefix=/usr/local
make && make install
The key flags are…
--enable-python3interp=yes
: tell the compilation you want Python3 support--with-python3-command
: give it a path to a Python3 interpreter/binary (†)--with-python3-config-dir
: a configuration directory used by the version of Python3 you want to use.† e.g. if I run that full path in my terminal shell it’ll actually run the Python3 REPL so I know it’s a valid path to provide.
# The build-dep command means to install all dependencies for Vim, so that we can build it
sudo apt-get build-dep vim
# Download Vim source code
sudo apt-get install mercurial
hg clone https://vim.googlecode.com/hg/ vim
# Compile vim
cd vim/src
./configure \
--enable-perlinterp=dynamic \
--enable-pythoninterp=dynamic \
--enable-rubyinterp=dynamic \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-gnome-check \
--with-features=huge \
--with-x \
--with-python-config-dir=/usr/lib/python2.7/config*
make && sudo make install
# Set vim as system-wide default
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 1
sudo update-alternatives --config editor
# `view` is Vim but read-only mode (similar to `vim -R`)
sudo update-alternatives --install /usr/bin/view view /usr/local/bin/view 1
sudo update-alternatives --config view
cd ../../
# Cleanup
rm -r vim
# ENABLED FEATURES:
# +arabic
# +file_in_path
# +mouse_sgr
# +tag_binary
# +autocmd
# +find_in_path
# -mouse_sysmouse
# +tag_old_static
# +balloon_eval
# +float
# +mouse_urxvt
# -tag_any_white
# +browse
# +folding
# +mouse_xterm
# -tcl
# ++builtin_terms
# -footer
# +multi_byte
# +terminfo
# +byte_offset
# +fork()
# +multi_lang
# +termresponse
# +cindent
# +gettext
# -mzscheme
# +textobjects
# +clientserver
# -hangul_input
# +netbeans_intg
# +title
# +clipboard
# +iconv
# +path_extra
# +toolbar
# +cmdline_compl
# +insert_expand
# +perl/dyn
# +user_commands
# +cmdline_hist
# +jumplist
# +persistent_undo
# +vertsplit
# +cmdline_info
# +keymap
# +postscript
# +virtualedit
# +comments
# +langmap
# +printer
# +visual
# +conceal
# +libcall
# +profile
# +visualextra
# +cryptv
# +linebreak
# +python/dyn
# +viminfo
# +cscope
# +lispindent
# -python3
# +vreplace
# +cursorbind
# +listcmds
# +quickfix
# +wildignore
# +cursorshape
# +localmap
# +reltime
# +wildmenu
# +dialog_con_gui
# -lua
# +rightleft
# +windows
# +diff
# +menu
# +ruby/dyn
# +writebackup
# +digraphs
# +mksession
# +scrollbind
# +X11
# +dnd
# +modify_fname
# +signs
# -xfontset
# -ebcdic
# +mouse
# +smartindent
# +xim
# +emacs_tags
# +mouseshape
# -sniff
# +xsmp_interact
# +eval
# +mouse_dec
# +startuptime
# +xterm_clipboard
# +ex_extra
# +mouse_gpm
# +statusline
# -xterm_save
# +extra_search
# -mouse_jsbterm
# -sun_workshop
# +farsi
# +mouse_netterm
# +syntax