Created
October 8, 2010 10:04
-
-
Save craigw/616585 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filetype off | |
call pathogen#runtime_append_all_bundles() | |
filetype plugin indent on | |
set nocompatible | |
set modelines=0 | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set expandtab | |
syntax on | |
" Make it pretty! | |
colorscheme mustang | |
set encoding=utf-8 | |
set scrolloff=3 | |
set autoindent | |
set showmode | |
set showcmd | |
set hidden | |
set wildmenu | |
set wildmode=list:longest | |
set visualbell | |
set cursorline | |
set ttyfast | |
set ruler | |
set backspace=indent,eol,start | |
set laststatus=2 | |
" Handy when you want to do something to the previous/next N lines | |
set relativenumber | |
if has("undofile") | |
set undofile | |
endif | |
" Make it easy to read | |
set guifont=Monaco:h12 | |
" Scrollbar-be-gone | |
set guioptions=egmtT | |
" Text in columns >75 but <79 is a bit close to the gutter | |
hi LineProximity guibg="CCCC66 guifg="000000 ctermbg=darkyellow | |
let w:m1=matchadd('LineProximity', '\%<79v.\%>75v', -1) | |
" Text in columns >78 is bad bad bad | |
hi LineOverflow guibg="CC6666 guifg="000000 ctermbg=darkred | |
let w:m2=matchadd('LineOverflow', '\%>78v.\+', -1) | |
" Apply all that highlighting magic | |
autocmd VimEnter * autocmd WinEnter * let w:created=1 | |
autocmd VimEnter * let w:created=1 | |
autocmd WinEnter * if !exists('w:created') | let w:m1=matchadd('LineProximity', '\%<81v.\%>75v', -1) | endif | |
autocmd WinEnter * if !exists('w:created') | let w:m2=matchadd('LineOverflow', '\%>80v.\+', -1) | endif | |
let mapleader = "," | |
" Can I use the Regular Expressions I already know please? | |
nnoremap / /\v | |
vnoremap / /\v | |
" I don't usually care about case in my searches | |
set ignorecase | |
" Although if I put a capital letter in the search I probably do | |
set smartcase | |
" Most substitutions are going to be global. I'll add a /g if they're not. | |
set gdefault | |
set incsearch | |
set showmatch | |
" Make it obvious where the search results are | |
set hlsearch | |
" When the search is done I want to press ,<space> to clear it | |
nnoremap <leader><space> :noh<cr> | |
" Jump to the other parenthesis of this pair by hitting tab. | |
nnoremap <tab> % | |
vnoremap <tab> % | |
" Show invisibles and TRAILING WHITESPACE! ARGH! | |
set list | |
highlight RedundantSpaces term=standout ctermbg=red guibg=red | |
match RedundantSpaces /\s\+$\| \+\ze\t/ | |
set listchars=tab:▸\ ,eol:¬,trail:.,extends:> | |
" I need to learn to use hjkl to navigate to remove the left,down,up,right arrow actions | |
nnoremap <up> <nop> | |
nnoremap <down> <nop> | |
nnoremap <left> <nop> | |
nnoremap <right> <nop> | |
inoremap <up> <nop> | |
inoremap <down> <nop> | |
inoremap <left> <nop> | |
inoremap <right> <nop> | |
" Don't make me press g each time I want to go up/down | |
nnoremap j gj | |
nnoremap k gk | |
" Stop accidentally entering the help screen when I reach for escape | |
inoremap <F1> <ESC> | |
nnoremap <F1> <ESC> | |
vnoremap <F1> <ESC> | |
" Don't make me push shift each time I want to enter a command | |
nnoremap ; : | |
" Die trailing whitespace DIE | |
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR> | |
" Some handy Ruby bindings | |
nnoremap <leader>s :!spec % | |
nnoremap <leader>r :!rake | |
" Searching for stuff using Ack | |
nnoremap <leader>a :Ack | |
" Edit my .vimrc | |
nnoremap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr> | |
nnoremap <leader>w <C-w>v<C-w>l | |
" Move into windows using ctrl+direction. | |
nnoremap <C-h> <C-w>h | |
nnoremap <C-j> <C-w>j | |
nnoremap <C-k> <C-w>k | |
nnoremap <C-l> <C-w>l | |
" Switch between visual modes - line, visual, normal | |
nnoremap <leader>v V`] | |
" I have no idea what these do and no idea where I got them from | |
nnoremap <leader>ft Vatzf | |
nnoremap <leader>S ?{<CR>jV/^\s*\}?$<CR>k:sort<CR>:noh<CR> | |
nnoremap <leader>q gqip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment