""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Mikes fucking rad .vimrc file " You'll need Vim 7.1 or better for most of these. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set nocompatible " get out of horrible vi-compatible mode filetype on " detect the type of file set history=10000 " How many lines of history to remember set cf " enable error files and error jumping set clipboard+=unnamed " turns out I do like clipboard set ffs=unix,dos,mac " support all three, in this order filetype plugin on " load filetype plugins set viminfo+=! " make sure it can save viminfo set isk+=_,$,@,%,#,- " none of these should be word dividers, so make them not be """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Theme/Colors """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set term=xterm-256color set background=dark " we are using a dark background syntax on " syntax highlighting on colorscheme zenburn " zenburn RULES. set t_Co=256 set lsp=1 " space it out a little more (easier to read) set wildmenu " turn on wild menu set ruler " Always show current positions along the bottom set cmdheight=1 " the command bar is 1 high set lz " do not redraw while running macros (much faster) (LazyRedraw) set hid " you can change buffer without saving set backspace=2 " make backspace work normal set whichwrap+=<,>,h,l " backspace and cursor keys wrap to set shortmess=atI " shortens messages to avoid 'press a key' prompt set report=0 " tell us when anything is changed via :... set noerrorbells " don't make noise """""" " kick-ass statusline """""" function! CurDir() let curdir = substitute(getcwd(), '/home/mike', "~/", "g") return curdir endfunction "Format the statusline set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L\ Column:\%c """"""""""""""""""""""""""""" " Super awesome search thing (press * or #) """""""""""""""""""""""""""""" " From an idea by Michael Naumann function! VisualSearch(direction) range let l:saved_reg = @" execute "normal! vgvy" let l:pattern = escape(@", '\\/.*$^~[]') let l:pattern = substitute(l:pattern, "\n$", "", "") if a:direction == 'b' execute "normal ?" . l:pattern . "^M" else execute "normal /" . l:pattern . "^M" endif let @/ = l:pattern let @" = l:saved_reg endfunction "Basically you press * or # to search for the current selection !! Really useful vnoremap * :call VisualSearch('f') vnoremap # :call VisualSearch('b') set viminfo='10,\"100,:20,%,n~/.viminfo au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif """"""""""""""""""""""""""""""""""""""" " Misc stuff to do that makes sense """"""""""""""""""""""""""""""""""""""" set nobackup " turn off file backup, because its fucking balls set nowb set noswapfile set smarttab set laststatus=2 " always show the status line set ai " autoindent set si " smartindent set cindent " do c-style indenting set tabstop=8 " tab spacing (settings below are just to unify it) set softtabstop=8 " unify set shiftwidth=8 " unify set noexpandtab " real tabs please! set nonu " I don't like fucking numbers. set nowrap " do not wrap lines set smarttab autoindent " use tabs at the start of a line, spaces elsewhere set expandtab set incsearch set paste set ignorecase smartcase set showmatch set ttyfast " smoother changes filetype plugin on filetype indent on syntax enable " I keep typing :Q! instead of :q! and it's fucking annoying " this fixes it ;) command -bang -bar Q :q "this is some more visual tweaking, but i can't be fucked moving it up " lets comments look the same set comments+=b:\" set comments+=n:: set comments+=b:#