下载源文件
$ git clone https://github.com/vim/vim.git $ cd vim/src $ vi Makefile
编辑Makefile
- 选择编译器
# COMPILER - Name of the compiler {{{1 # The default from configure will mostly be fine, no need to change this, just # an example. If a compiler is defined here, configure will use it rather than # probing for one. It is dangerous to change this after configure was run. # Make will use your choice then -- but beware: Many things may change with # another compiler. It is wise to run 'make reconfig' to start all over # again. #CC = cc # For some reason, gcc does not install itself as /usr/bin/gcc CC = gcc-9 #CC = clang
if gcc is not installed, installing it by running
$ sudo apt update $ sudo apt install build-essential
- 关闭图形
# GUI - For creating Vim with GUI (gvim) (B) # Uncomment this line when you don't want to get the GUI version, although you # have GTK, Motif and/or Athena. Also use --without-x if you don't want X11 # at all. CONF_OPT_GUI = --disable-gui # X WINDOWS DISABLE - For creating a plain Vim without any X11 related fancies # (otherwise Vim configure will try to include xterm titlebar access) # Also disable the GUI above, otherwise it will be included anyway. # When both GUI and X11 have been disabled this may save about 15% of the # code and make Vim startup quicker. CONF_OPT_X = --without-x
- 支持 Python3
安装 Python3 库文件
$ sudo apt install python3.8 python3.8-dev python3-distutils
静态链接 Python 解释器。
# PYTHON # Uncomment lines here when you want to include the Python interface. # This requires at least "normal" features, "tiny" and "small" don't work. # NOTE: This may cause threading to be enabled, which has side effects (such # as using different libraries and debugging becomes more difficult). # For Python3 support make a symbolic link in /usr/local/bin: # ln -s python3 python3.1 # If both python2.x and python3.x are enabled then the linking will be via # dlopen(), dlsym(), dlclose(), i.e. pythonX.Y.so must be available # However, this may still cause problems, such as "import termios" failing. # Build two separate versions of Vim in that case. #CONF_OPT_PYTHON = --enable-pythoninterp #CONF_OPT_PYTHON = --enable-pythoninterp --with-python-command=python2.7 #CONF_OPT_PYTHON = --enable-pythoninterp=dynamic #CONF_OPT_PYTHON3 = --enable-python3interp #CONF_OPT_PYTHON3 = --enable-python3interp --with-python3-command=python3.8 #CONF_OPT_PYTHON3 = --enable-python3interp=dynamic CONF_OPT_PYTHON3 = --enable-python3interp --with-python3-command=python3.8 --with-python3-config-dir=/usr/lib/python3.8/config-3.8-x86_64-linux-gnu
编译和安装
$ make $ sudo make install
清理一切,从头开始
$ make distclean