windows snippets

How to make GVim look and behave better on Windows

Tagged gvim, _vimrc, windows, vim  Languages 

I use this configuration with GVim (sometimes I'm forced to use Windows). It makes the GVim behave and look better.

" Start maximized
au GUIEnter * simalt ~x

" Use CUA keystrokes for clipboard: CTRL-X, CTRL-C, CTRL-V and CTRL-z
source $VIMRUNTIME/mswin.vim

syntax on
set nocompatible
filetype on
filetype indent on
filetype plugin on

" General options
set incsearch
set ignorecase smartcase 

" Use two space tabs
set tabstop=2
set shiftwidth=2
set expandtab

" No menus and no toolbar
"set guioptions-=m  
set guioptions-=T

set guifont=Consolas:h11:cANSI

highlight Normal guifg=White   guibg=Black
highlight Cursor guifg=Black   guibg=White
highlight Keyword guifg=#FF6600
highlight Define guifg=#FF6600
highlight Comment guifg=#9933CC
highlight Type guifg=White gui=NONE
highlight rubySymbol guifg=#339999 gui=NONE
highlight Identifier guifg=White gui=NONE
highlight rubyStringDelimiter guifg=#66BB00
highlight rubyInterpolation guifg=White
highlight rubyPseudoVariable guifg=#339999
highlight Constant guifg=#FFEE98
highlight Function guifg=#FFCC00 gui=NONE
highlight Include guifg=#FFCC00 gui=NONE
highlight Statement guifg=#FF6600 gui=NONE
highlight String guifg=#66BB00
highlight Search guibg=White

function RubyEndToken ()
  let current_line = getline( '.' )
  let braces_at_end = '{\s*\(|\(,\|\s\|\w\)*|\s*\)\?$'
  let stuff_without_do = '^\s*\(class\|if\|unless\|begin\|case\|for\|module\|while\|until\|def\)'
  let with_do = 'do\s*\(|\(,\|\s\|\w\)*|\s*\)\?$'

  if match(current_line, braces_at_end) >= 0
    return "\<CR>}\<C-O>O" 
  elseif match(current_line, stuff_without_do) >= 0
    return "\<CR>end\<C-O>O" 
  elseif match(current_line, with_do) >= 0
    return "\<CR>end\<C-O>O" 
    return "\<CR>" 

function UseRubyIndent ()
  setlocal tabstop=8
  setlocal softtabstop=2
  setlocal shiftwidth=2
  setlocal expandtab

  imap <buffer> <CR> <C-R>=RubyEndToken()<CR>

autocmd FileType ruby,eruby call UseRubyIndent()

GVim _vimrc file

Tagged windows, gvim  Languages 
set history=100

let mapleader = ","
set tabstop=2
set smarttab
set shiftwidth=2
set autoindent
set expandtab
set backspace=start,indent

autocmd FileType make     set noexpandtab
autocmd FileType python   set noexpandtab

set number
set hlsearch
syntax on

let g:fuzzy_trim_length = 3000
let g:fuzzy_ignore = "*.log"
let g:fuzzy_matching_limit = 70

map ,t :FuzzyFinderTextMate<CR>
map ,b :FuzzyFinderBuffer<CR>

map ,d :execute 'NERDTreeToggle ' . getcwd()<CR>

set guifont=Bitstream\ Vera\ Sans\ Mono:h9

au GUIEnter * simalt ~x

colorscheme railscasts
" set guifont=consolas:h8

How to install thin, rack and eventmachine on Windows/Cygwin

Tagged rack, eventmachine, windows, cygwin, thin  Languages bash

There's no official Windows binary release of eventmachine for the latest version of thin (1.0.0). Thin needs at least version (0.12.2) of eventmachine, so you'll have to use the latest GitHub code (currently 0.12.3) to install thin on Windblows and CygWin:

git clone git://
cd eventmachine
rake gem
gem install pkg/eventmachine-0.12.3.gem
gem install thin rack