Skip to content

Instantly share code, notes, and snippets.

@btedev
Created July 10, 2013 13:52
Show Gist options
  • Save btedev/5966450 to your computer and use it in GitHub Desktop.
Save btedev/5966450 to your computer and use it in GitHub Desktop.
My vimrc
"Turn off any hacks vim does to be vi backwards-compatible
set nocompatible
"Set Mapleader
let mapleader = ","
let g:mapleader = ","
"Use pathogen to manage plugin bundles
"See http://www.vim.org/scripts/script.php?script_id=2332
filetype off
call pathogen#runtime_append_all_bundles()
filetype plugin indent on
"Prevent modelines exploits
set modelines=0
"Use 2 spaces as default tab
set nowrap " turn off wrapping, may turn on selectively :set wrap
set expandtab " Substitute spaces for tabs
set tabstop=2
set softtabstop=2
set shiftwidth=2
"Increase default line spacing
set linespace=2
"Allow yanks to be copied to clipboard by default
set clipboard=unnamed
"Set to autoread when a file is changed from the outside
set autoread
"Set default padding when using Align (before, after)
call Align#AlignCtrl('p1P1')
"Open a bash shell using ConqueTerm via ,h
nmap <leader>h :ConqueTerm bash
"Nerd Tree commands and options (open with ,,)
map <Leader>, :NERDTreeToggle<cr>
"Find (file find with syntax :Find *apattern*) open with ,f
map <Leader>f :Find
"New tab (open with ,t)
map <Leader>t :tabnew <cr>
"Most Recently Used files (open with ,m)
map <Leader>m :MRU<cr>
"Buffer (:b), e.g. switch to buffer 3 via :b3<enter>
map <Leader>b :b
" Open a scratch buffer by ,<tab>
map <Leader><tab> :Scratch <cr>
" Searching
set ignorecase " Ignore case in searching...
set smartcase " ...unless you use capitals in your search string
set incsearch " Incremental searches (begin matching as search is typed)
set hlsearch " Highlight search
set nohls " ...but unhighlight once done
" Tab completion
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
" Status bar
set laststatus=2
" Remember last location in file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
endif
" Enable syntastic syntax checking
let g:syntastic_enable_signs=1
let g:syntastic_quiet_warnings=1
"Other Options
set encoding=utf-8
set visualbell " Show, don't bonk
set wildmenu " Menu at the bottom of each window
set showmode " Show insert mode, etc.
set showcmd " Show command being typed
set guioptions-=T " Hide MacVim toolbar by default
set ruler " Show current cursor position along bottom
set number " Turn on line numbers
set nuw=4 " Number width (good up to 9999 lines)
set backspace=indent,eol,start "allow backspacing in insert mode
set showmatch " Show matching brackets
nnoremap <tab> % " Remap tab to % to match bracket pairs
vnoremap <tab> % " Same
set wrap " Wrap long lines
set textwidth=79
set formatoptions=qr
inoremap <F1> <ESC> " Turn off F1 for help (because it's right next to Esc & very easy to hit accidentally)
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
syntax on " Syntax highlight
"Because I prefer to not have .swp and ~ files, take the risk of no swap &
"backup
set nobackup "no backup files
set nowritebackup "only in case you don't want a backup file while editing
set noswapfile "no swap files
" for rspec
iab sbf should be_false
iab sbt should be_true
iab snbn should_not be_nil
iab sbn should be_nil
"Font info (uncomment current hotness)
set gfn=Source\ Code\ Pro\ 14
set guifont=Source\ Code\ Pro:h14
"set gfn=Menlo\ 14
"set guifont=Menlo:h14
"set gfn=Consolas\ 15
"set guifont=Consolas:h15
"set gfn=Inconsolata\ 15
"set guifont=Inconsolata:h15
"set gfn=DejaVu\ Sans\ Mono\ 14
"set guifont=DejaVu\ Sans\ Mono:h14
"Tab maps
map <Leader>t1 1gt
map <Leader>t2 2gt
map <Leader>t3 3gt
map <Leader>t4 4gt
map <Leader>t5 5gt
map <Leader>t6 6gt
map <Leader>t7 7gt
map <Leader>t8 8gt
map <Leader>t9 9gt
"Color schemes
:colorscheme codeschool
":colorscheme rootwater
":colorscheme blackdust
":colorscheme anotherdark
":colorscheme pyte
":colorscheme jellybeans+
":colorscheme freya
":colorscheme spring
":colorscheme dusk
":colorscheme molokai
":colorscheme oceandeep
":colorscheme camo
":colorscheme darkblue2
":colorscheme moria
":colorscheme chocolateliquor
":colorscheme dw_cyan
":colorscheme metacosm
":colorscheme inkpot
":colorscheme asu1dark
":colorscheme tabula
":colorscheme bluegreen
":colorscheme darkbone
" DB parameters for dbext (see h: dbext)
let g:dbext_default_profile_mysql_1 = 'type=MYSQL:user=root:passwd=@askg:dbname=@askg:host=@askg'
let g:dbext_default_profile = 'mysql_1'
" Vim-slime config
let g:slime_target = "tmux"
let g:slime_paste_file = tempname()
" Run rspec on the current file via ,r
map <Leader>r :!rspec %<cr>
" Speed movement betwen windows and window splitting
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-s> <C-w>s
" Toggle between current and last buffer
nnoremap <leader>l <C-^>
" Shortcut to colorscheme
nnoremap <leader>c :colorscheme
" Fix trailing whitespace (via vim-whitespace plugin)
nnoremap <leader>fw :FixWhitespace<cr>
" Remap normal mode K to <C-w>k because it's too easy to
" mistype. By default K searches ri for the word under the cursor
nnoremap <S-K> <C-w>k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment