Compile & install vim on a shared host
Many developers just can’t live without a CLI based editor, that being vi, nano or perhaps even pico.
And I myself, is no exception. However today I found myself in the need of vim, mostly because it’s way easier to configure contrary to vi.
For those not enlightened yet, vim stands for vimproved.
Some day you might find yourself in a similar situation, you tunnel through a ssh connection to you hosting provider type the vim command.. and instantly you’re faced with this message:
vim: command not found.
So, without further ado, here’s the commands you need to run in order to get a working copy of vim installed.
Replace the version number, or head to the official vim public ftp to grab the link for download.
# Download the latest version of vim.
$ wget ftp://ftp.vim.org/pub/vim/
# Extract the downloaded archive
$ tar -jxf vim-7.4.tar.bz2
# No need for the archive file, once extracted
$ rm vim-7.4.tar.bz2
# Change directory to vim source files
$ cd vim74/src
# Ovveride configuration location by specifying a prefix
$ ./configure --prefix=/home/<USERNAME>/bin/vim
Also this path is required to be absolute.
--prefixoverrides all of them, so you need to override config location after specifying the prefix. This course of actions usually works for every automake-based project.
configure --helpand see what other options are available.
At this point we’re only left with compiling the binaries needed.
# Build the vim binaries
$ make && make install
# No need for the source files, once compiled
$ rm -r vim74/
bin/vim/within the current working directory.
# Edit your bash profile
$ vi ~/.bashrc
Add this line:
# Finally source your profile, to make changes effective immediately$ source ~/.bashrc
For extra sugar you could create
.vimrc file in your home directory, and add
syntax on to it, to enable syntax highligthing when using vim.
$ git commitwon’t be able to use vim, if configured so, to workaround this you’ll have to add the vim binary directory to you environment variables, by changing your PATH variable.
PATH=~$PATH:$HOME<PATH TO VIM BINARIES>