Skip to content

Instantly share code, notes, and snippets.

@rubysolo
Created October 27, 2011 19:49
Show Gist options
  • Save rubysolo/1320665 to your computer and use it in GitHub Desktop.
Save rubysolo/1320665 to your computer and use it in GitHub Desktop.
set nocompatible
let mapleader = ","
call pathogen#infect()
syntax on
filetype plugin indent on
color herald
let mapleader = ","
let g:mapleader = ","
" edit/reload .vimrc
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
" line numbers
set number
set ruler
set encoding=utf-8
" line/space handling
set nowrap
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set hidden
set list listchars=tab:▸\ ,trail:·,eol:¬
nnoremap ; :
" searching
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch
nnoremap <leader><space> :noh<cr>
nnoremap <tab> %
vnoremap <tab> %
set scrolloff=5
if exists(":Tabularize")
nmap <leader>a= :Tabularize /=<CR>
vmap <leader>a= :Tabularize /=<CR>
nmap <leader>a. :Tabularize /=><CR>
vmap <leader>a. :Tabularize /=><CR>
nmap <leader>a: :Tabularize /:\zs<CR>
vmap <leader>a: :Tabularize /:\zs<CR>
endif
" enable matchit
runtime macros/matchit.vim
" map control L to hash rocket
imap <C-l> <Space>=><Space>
" better filename tab completion for commands
set wildmode=longest:full
set wildmenu
" expand %% to directory containing file in current buffer
cabbr <expr> %% expand('%:p:h')
function! Preserve(command)
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
nmap _$ :call Preserve("%s/\\s\\+$//e")<CR>
nmap _= :call Preserve("normal gg=G")<CR>
" text bubbling
nmap <C-Up> [e
nmap <C-Down> ]e
vmap <C-Up> [egv
vmap <C-Down> ]egv
" CoffeeScript
au BufWritePost *.coffee silent CoffeeMake! -b | cwindow | redraw!
" line/column highlighting
set cursorline
set cursorcolumn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment