(because everyone has got to have their own Vim post)

I'm pretty much settled on using Vim as my editor of choice after giving up BBEdit (many moons ago) and trying to find a good free alternative. I went through everything (Smultron, oh, no, actually that's it) before making a concerted effort to learn Vim. I guess at the time I must have been spending a lot of time in the terminal (perhaps in the days when I had proper webhosting).

Since I'm as cross platform as can be nowadays (windows, mac, and linux) Vim is an ideal choice and makes far more sense than ending up with a mac specific editor (as much as I'd love to be on my mac all the time). I've not managed to get Vim running on Slax as well as I'd like, but I guess I'll sort it eventually (ha! fixed before I even got around to posting this; the mistake was just using the gvim module, whereas you need the base vim module as well in order to get all the runtime scripts so you have menu's, etc).

Now I'm just trying to find a bare minimum of plugins and config options to be happy. I don't want a huge vim configuration file I don't understand - I've tried using other people's Vim config files and figure it's easier to start from scratch.

As far as plugins goes, I think Vim suffers a little from the general open source problem of too many bloody options. I.e. there are loads of plugins that do the same thing, how do you know which one to pick? Which one is still being actively developed? It's the same for Firefox plugins, etc, although at least they have a review and commenting system. Vim plugins don't.

Anyway. Here's what I'm using. I'm mainly going to program in Ruby also dabble in the occasional bit of HTML and CSS, so that's my slant in getting Vim setup. I shall update as needed (especially with getting config options that have consistent results across all three platforms, i.e. MacVim and Windows seem to have some better default settings than in Slax)

Config Options

"This is no longer up to date. It got more complicated...

"My vimrc file. Trying to keep it as simple and cross platform as possible

set tabstop=4 "Number of spaces that a tab character takes
set softtabstop=4 "after reading the docs, I still don't get all the tab options.
set noexpandtab "I don't want tab characters converted to spaces
set shiftwidth=4 "number of spaces used for each step of auto-indent
set smarttab autoindent "copy indent from current line when starting new line
set guifont=Consolas:h10 "Nice font Use Inconsolata:h13 on OSX, Linux.
set guifontwide=MingLiU:h10 "For windows to display mixed character sets
set enc=utf-8 "Whatever
set number "Turn on line numbers
set numberwidth=6 "Set width of line numbers
highlight LineNr guifg=white guibg=lightgray "Line number colours
set wrap "Default to line wrapping
set showtabline=2 "Always show the tab bar in the gui
set incsearch "Fortunately highlighting seems to be on in all three platforms
let Tlist_Ctags_Cmd="\"C:\\Program Files\\ctags58\\ctags.exe\"" "Windows only at mo'
set guioptions-=T "remove toolbar
colorscheme solarized
set autochdir
set nobackup
"let coffee_compile_on_save = 1
autocmd BufWritePost *.coffee silent CoffeeMake! -b | copen
set statusline=[FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ [LINELEN=%{strlen(getline('.'))}]
set laststatus=2
filetype off "for pathogen
call pathogen#runtime_append_all_bundles()
filetype plugin indent on "for pathogen
map <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR> "Windows only, fullscreen Vim

Link to gist

Plugins

  • pathogen - For far more sane installation of vim plugins. Install this first!
  • closetag - For closing open tags
  • Autoclose - Autoclose brackets as you type the opening bracket. I wish this could be expanded to other tags.
  • Matchit - Very, very handy, especially when programming to try and find the closing end statement, etc.
  • NERDTree - Built in directory browser. Not absolutely necessary with gvim, but handy.
  • snipMate - TextMate style snippets. Very cool. There are a couple of other options (ruby_imapssnippetsEMU), but this one seems to be the best one.
  • surround - Looks quite handy for editing pairs of tags.
  • NERD Commenter - easily comment lines and sections of any code
  • EasyGrep - As name suggests EASILY perform find and replace across multiple files. Just ace.
  • ragtag - Because Tim Pope made it.
  • ~Supertab~ - I hear it's good, but not actually got around to using yet.
  • taglist - Think I mainly used this when I played with C.
  • Vim-R-Plugin - For working with R.
  • Full Screen Vim for Windows - This is great!

And worth a mention, but I'm not using it: Command-T. This is an interesting plugin to quickly open files by typing in a few letters of their path or filename. It's based on a Textmate feature. However, installing it is a bit of a palaver and (especially on Windows) requires certain versions of Vim, Ruby, and Ruby developer tools so you can build the extension once you've installed it. I tried it using the non-recommended versions (Vim 7.3 and Ruby 1.9.1) and it crashed. Just seems a lot of hassle for what it's worth.