Skip to content

Instantly share code, notes, and snippets.

@will-clarke
Created January 27, 2015 15:07
Show Gist options
  • Save will-clarke/fb05ba2a3e82f78c4b1a to your computer and use it in GitHub Desktop.
Save will-clarke/fb05ba2a3e82f78c4b1a to your computer and use it in GitHub Desktop.
set ttymouse=xterm2
set mouse=a
let mapleader = " "
noremap ; :
imap jk <ESC>
noremap ; :
noremap : ;
set backspace=2
noremap <Leader>n :NERDTreeFind<CR>
noremap <Leader>m :NERDTreeToggle<CR>
" Thoughtbot vim:
map <Leader>a :call RunAllSpecs()<CR>
set nowrap
" To remember how to force save if you have an E212 error message
ca w!! w !sudo tee "%"
inoremap <silent> <C-q> <ESC>:q<CR><ESC>
nnoremap <silent> <C-q> :q<CR>
inoremap <silent> <C-q><C-q><C-q> <ESC>:q!<CR><ESC>
nnoremap <silent> <C-q><C-q><C-q> :q!<CR>
noremap <C-s> :update<CR><ESC>
vnoremap <C-s> <C-C>:update<CR><ESC>
inoremap <C-s> <C-O>:update<CR><ESC>
noremap <silent><C-e> :CtrlP<CR>
function! ToggleBackground()
let &background = ( &background == "dark"? "light" : "dark" )
endfunction
syntax enable
set background=dark
colorscheme solarized
set background=dark
noremap <f2> :call ToggleBackground()<CR>
nnoremap <F6> :buffers<CR>:buffer<Space>
set clipboard=unnamed
noremap <leader>y :.w !pbcopy<CR><CR>
" vnoremap <leader>y :w !pbcopy<CR><CR>
vnoremap <silent><leader>y y:call system("pbcopy", getreg("\""))<CR>
noremap <leader>p :set paste<cr>:r !pbpaste<cr>:set nopaste<cr>
" vmap <leader>c :w !pbcopy<CR><CR>
let g:gist_clip_command = 'pbcopy'
" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" bind \ (backward slash) to grep shortcut
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
nnoremap \ :Ag<SPACE>
" For Nerd commenter
filetype plugin on
set noeol
" Default mapping
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
" let g:rspec_command = "Dispatch rspec {spec}"
" let g:rspec_runner = "os_x_iterm"
let g:rspec_command = "! foreman run rspec --drb {spec}"
" gx to open links
let g:netrw_browsex_viewer="google-chrome"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment