Vim

Vim, which stands for Vi IMproved, is an open source, multiplatform text editor extended from vi.

Custom Installation
For those of us who'd like to take advantage of VIM 7's latest features, in consideration of DreamHost's older 6.3 version, the information below will get you started.

Please keep in mind this article was designed for ADVANCED USERS who already have some *nix shell experience. Custom VIM installations will NOT be supported by DH Staff.

Create and run the shell install script in your home directory:

vim73_install.sh
This is the latest version of VIM.

Older versions of the script will be preserved on the discussion page for now.

set -e
 * 1) !/bin/sh


 * 1) Version 1.3, 2011-03-02
 * 2) - Updated 2011-03-02 by Michael Bunsen (notbot@gmail.com)
 * 3)   - Updated VIM to version 7.3.
 * 4)   - Enable Python support
 * 5)   - Don't ignore errors while creating BINDIR
 * 6) Version 1.2c, 2007-10-05
 * 7) - Updated 2007-05-30 by Chris Shymanik (chris@chipsncheese.com)
 * 8)   - Minor revision 1.2b on 2007-09-19 to fix an end-of-install bug.
 * 9)   - Updated VIM to version 7.1.
 * 10)   - Added some error checking and an option to clean DISTDIR.
 * 1)   - Minor revision 1.2b on 2007-09-19 to fix an end-of-install bug.
 * 2)   - Updated VIM to version 7.1.
 * 3)   - Added some error checking and an option to clean DISTDIR.


 * 1) USER CONFIGURATION OPTIONS

SRCDIR=${HOME}/source INSTALLDIR=${HOME}/share/vim DISTDIR=${HOME}/dist DISTDEL="Yes" BINDIR=${HOME}/bin NICE=19 VIM="vim-7.3"
 * 1) Where do you want all this stuff built?
 * 2) ***Don't pick a directory that already exists!***
 * 3) We clean up after ourselves at the end!
 * 1) And where should it be installed?
 * 1) Set DISTDIR to somewhere persistent.
 * 1) Delete contents of DISTDIR after installation? (Default: Yes)
 * 1) Set BINDIR to wherever you keep your binaries.
 * 2) The default is, ~/bin (/home/username/bin).
 * 1) Set whatever nice value you wish here.
 * 2) Higher values indicate lower priority,
 * 3) Lower values indicate higher priority.
 * 4) Range: -20 to 20
 * 1) Name of the VIM install package
 * 2) (without any extension, ie: .tar.bz2)

VIMFEATURES="--prefix=${HOME} \ --enable-perlinterp \ --enable-rubyinterp \ --enable-pythoninterp \ --enable-multibyte \ --disable-netbeans \ --with-features=big \ --disable-gui \ --without-x"
 * 1) What features of VIM do you wish to enable or disable?
 * 2) ***Probably best not to change anything here!***

sleep 1s
 * 1) DO NOT MODIFY BELOW ##########

export PATH=${INSTALLDIR}/bin:$PATH
 * 1) Push the install dir's bin directory into the path.

if [ -d ${SRCDIR} ]; then echo "Source directory already exists! Cleaning it..." rm -rf ${SRCDIR}/* else echo "Creating source directory..." mkdir -p ${SRCDIR} fi
 * 1) Pre-download clean-up and checking.
 * 2) Clear and/or create the source directory.

if [ -d ${INSTALLDIR} ]; then echo "Install directory exists! Removing contents..." rm -rf ${INSTALLDIR}/* else echo "Creating installation directory..." mkdir -p ${INSTALLDIR} fi if [ -d ${BINDIR} ]; then echo "Deleting vim binary if it exists..." rm ${BINDIR}/vim >/dev/null 2>&1 else echo "Creating BINDIR if it doesn't exist..." mkdir -p ${BINDIR} fi if [ ! -d ${DISTDIR} ]; then echo "Creating DISTDIR if it doesn't exist..." mkdir -p ${DISTDIR} fi
 * 1) Check for existing vim install and remove it if exists. Else create it.

set +e cd ${DISTDIR} WGETOPT="-t1 -T10 -w5 -q -c"
 * 1) Grab the required source archives.
 * 1) Wget options

if [ -a ${DISTDIR}/${VIM}.tar.bz2 ]; then echo "Skipping wget of ${VIM}.tar.bz2" else echo "Downloading ${VIM}.tar.bz2" wget $WGETOPT ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/${VIM}.tar.bz2 # If primary mirror fails, use the alternative mirror. if [ -a ${DISTDIR}/${VIM}.tar.bz2 ]; then echo "Got ${VIM}.tar.bz2" else wget $WGETOPT ftp://ftp.vim.org/pub/vim/unix/${VIM}.tar.bz2 # Check to make sure the alternative mirror worked. if [ -a ${DISTDIR}/${VIM}.tar.gz ]; then echo "Got ${VIM}.tar.gz" else echo "Failed to get ${VIM}.tar.bz2. Aborting install!" exit 0 fi fi fi
 * 1) Do a bit of error checking while grabbing the sources.

set -e cd ${SRCDIR} echo "Extracting ${VIM}..." tar xjf ${DISTDIR}/${VIM}.tar.bz2 echo "Done."
 * 1) Unpack the source archives.

cd ${SRCDIR}/vim*/src ./configure ${VIMFEATURES} nice -n ${NICE} make mv ${SRCDIR}/vim*/src/vim ${BINDIR}/ mv ${SRCDIR}/vim*/runtime/* ${INSTALLDIR}/
 * 1) Compile and install the package(s).
 * 1) make clean
 * 1) Move our newly created binary to our binaries directory.
 * 1) Move the contents of the runtime directory to our install path.

sleep 2s cd ${HOME} && clear
 * 1) Post install clean-up.

strip --strip-all ${BINDIR}/vim
 * 1) Strip debug info out of the binary.

rm -rf ${SRCDIR} if [ ${DISTDEL} == "Yes" ]; then rm -rf ${DISTDIR} elif [ ${DISTDEL} == "No" ]; then echo "Your DISTDIR will not be cleaned." else echo "Unknown DISTDEL option! Wiping the contents of your DISTDIR by default." sleeps 1s rm -rf ${DISTDIR} fi

echo "Installation completed!" `date +%r`
 * 1) End of install


 * EOF

Further information on what features you can use for the install script are available here: http://vimdoc.sourceforge.net/htmldoc/eval.html#feature-list.

Now modify your .bash_profile to include your binary path directory (ie. /home/user/bin), the VIM Runtime [so it can find ftplugin], and the location of VIM: umask 002 PS1='[\h]$ ' export EDITOR="~/bin/vim" export VIMRUNTIME="~/share/vim" PATH=~/bin:$PATH;

Done!

Manual install
Alternate instructions to install vim manually (without the install script). Use this if you don't want the install script to accidentally delete anything important, or you're not concerned with a minimal sized install.

Download the source hg clone https://vim.googlecode.com/hg/ vim Configure and install cd vim ./configure --prefix=${HOME}/local \ --enable-perlinterp \ --enable-rubyinterp \ --enable-pythoninterp \ --enable-multibyte \ --disable-netbeans \ --with-features=big \ --disable-gui \ --without-x make make install Make sure  is on your path. Add these lines to your  (or to your   if your   sources your  ). export PATH="$HOME/local/bin:$PATH" You can also run this line on the command prompt to change your path for your current session, but it will not have any effect the next time you log in unless it is set in your  or.

Customization
To change the default behavior of VIM, we need to create/edit .vimrc in our home directory. Reasons you might wish to do this may be:
 * Syntax Highlighting
 * Cursor position display (to show which line you're on)
 * Auto-Indexing
 * Q Formating
 * Smart Tab Sizes
 * Spell-Checking
 * etc...

.vimrc example: set nocompatible	" Use Vim defaults set smarttab		" Use smart tab sizes set ttyfast			" Indicates a fast terminal connection set ignorecase		" Ignore cases in search patterns set tabstop=3		" Number of spaces that a  in the file counts for set incsearch		" Display the match for a search pattern halfway through typing it set ruler			" Show the cursor position all the time set bs=2				" Allow backspacing over everything in insert mode set ai				" Always set auto-indexing on set history=50		" keep 50 lines of command history set nomodeline		" Modeline is disabled due to bug #14088 and #73715 set viminfo='20,\"500	" Keep a .viminfo file.

" In case you want to use Vim's built-in spellchecker, uncomment the lines below: " set spell " set spelllang=en

" Enables/Disables syntax highlighting when the terminal has colors. " Also switches on hightlighting the last used search pattern. syntax on set hlsearch

" Don't use Ex mode. Use Q for formatting. map Q gq

" When displaying line numbers, don't use an annoyingly wide number column. " This doesn't enable line numbers. The value given is a minmum width to use " for the number column, not a fixed size. if v:version >= 700		 set numberwidth=3 endif

" Enable plugin-provided filetype settings, but only if the ftplugin " directory exists. if isdirectory(expand("$VIMRUNTIME/ftplugin")) filetype plugin on endif

" Fix &shell, see bug #101665 if "" == &shell		 if executable("/bin/bash")					 set shell=/bin/bash		  elseif executable("/bin/sh")					 set shell=/bin/sh		  endif endif

Additional .vimrc options can be found here: http://vimdoc.sourceforge.net/htmldoc/options.html#options