Created
September 13, 2016 07:49
-
-
Save simonmorley/6fcdc7c0b254a63082a41c039707dbb3 to your computer and use it in GitHub Desktop.
This file contains 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
" plugins expect bash - not fish, zsh, etc | |
set shell=bash | |
" which key should be the <leader> | |
" (\ is the default, but ',' is more common, and easier to reach) | |
let mapleader="," | |
" pathogen will load the other modules | |
execute pathogen#infect() | |
" we want to tell the syntastic module when to run | |
" we want to see code highlighting and checks when we open a file | |
" but we don't care so much that it reruns when we close the file | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 0 | |
" we also want to get rid of accidental trailing whitespace on save | |
autocmd BufWritePre * :%s/\s\+$//e | |
" tell vim to allow you to copy between files, remember your cursor | |
" position and other little nice things like that | |
set viminfo='100,\"2500,:200,%,n~/.viminfo | |
" use goimports for formatting | |
let g:go_fmt_command = "goimports" | |
" turn highlighting on | |
let g:go_highlight_functions = 1 | |
let g:go_highlight_methods = 1 | |
let g:go_highlight_structs = 1 | |
let g:go_highlight_operators = 1 | |
let g:go_highlight_build_constraints = 1 | |
let g:syntastic_go_checkers = ['go', 'golint', 'errcheck'] | |
" let g:syntastic_go_checkers = ['go'] | |
" Open go doc in vertical window, horizontal, or tab | |
" au Filetype go nnoremap <leader>v :vsp <CR>:exe "GoDef" <CR> | |
" au Filetype go nnoremap <leader>s :sp <CR>:exe "GoDef"<CR> | |
" au Filetype go nnoremap <leader>t :tab split <CR>:exe "GoDef"<CR> | |
set autoindent | |
set autoread " reload files when changed on disk, i.e. via `git checkout` | |
set backspace=2 " Fix broken backspace in some setups | |
set backupcopy=yes " see :help crontab | |
set clipboard=unnamed " yank and paste with the system clipboard | |
set directory-=. " don't store swapfiles in the current directory | |
set encoding=utf-8 | |
set expandtab " expand tabs to spaces | |
set ignorecase " case-insensitive search | |
set incsearch " search as you type | |
set laststatus=2 " always show statusline | |
set list " show trailing whitespace | |
set listchars=tab:▸\ ,trail:▫ | |
set number " show line numbers | |
set ruler " show where you are | |
set scrolloff=3 " show context above/below cursorline | |
set shiftwidth=2 " normal mode indentation commands use 2 spaces | |
set showcmd | |
set smartcase " case-sensitive search if any caps | |
set softtabstop=2 " insert mode tab and backspace use 2 spaces | |
set tabstop=8 " actual tabs occupy 8 characters | |
set wildignore=log/**,node_modules/**,target/**,tmp/**,*.rbc | |
set wildmenu " show a navigable menu for tab completion | |
set wildmode=longest,list,full | |
set nolist | |
map <leader>p mzgg=G`z | |
" in case you forgot to sudo | |
cnoremap w!! %!sudo tee > /dev/null % | |
" plugin settings | |
let g:ctrlp_match_window = 'order:ttb,max:20' | |
let g:NERDSpaceDelims=1 | |
let g:gitgutter_enabled = 1 | |
" Use The Silver Searcher https://github.com/ggreer/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 ""' | |
endif | |
" " fdoc is yaml | |
" autocmd BufRead,BufNewFile *.fdoc set filetype=yaml | |
" " md is markdown | |
" autocmd BufRead,BufNewFile *.md set filetype=markdown | |
" autocmd BufRead,BufNewFile *.md set spell | |
" " extra rails.vim help | |
" autocmd User Rails silent! Rnavcommand decorator app/decorators -glob=**/* -suffix=_decorator.rb | |
" autocmd User Rails silent! Rnavcommand observer app/observers -glob=**/* -suffix=_observer.rb | |
" autocmd User Rails silent! Rnavcommand feature features -glob=**/* -suffix=.feature | |
" autocmd User Rails silent! Rnavcommand job app/jobs -glob=**/* -suffix=_job.rb | |
" autocmd User Rails silent! Rnavcommand mediator app/mediators -glob=**/* -suffix=_mediator.rb | |
" autocmd User Rails silent! Rnavcommand stepdefinition features/step_definitions -glob=**/* -suffix=_steps.rb | |
" " automatically rebalance windows on vim resize | |
" autocmd VimResized * :wincmd = | |
" autocmd BufNewFile,BufReadPost *.md set filetype=markdown | |
" Fix Cursor in TMUX | |
if exists('$TMUX') | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
else | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
endif | |
" Don't copy the contents of an overwritten selection. | |
vnoremap p "_dP | |
" Go crazy! | |
if filereadable(expand("~/.vimrc.local")) | |
" In your .vimrc.local, you might like: | |
" | |
" set autowrite | |
" set nocursorline | |
" set nowritebackup | |
" set whichwrap+=<,>,h,l,[,] " Wrap arrow keys between lines | |
" | |
" autocmd! bufwritepost .vimrc source ~/.vimrc | |
" noremap! jj <ESC> | |
source ~/.vimrc.local | |
endif | |
" Enable basic mouse behavior such as resizing buffers. | |
set mouse=a | |
if exists('$TMUX') " Support resizing in tmux | |
set ttymouse=xterm2 | |
endif | |
" " keyboard shortcuts | |
" let mapleader = ',' | |
noremap <C-h> <C-w>h | |
noremap <C-j> <C-w>j | |
noremap <C-k> <C-w>k | |
noremap <C-l> <C-w>l | |
noremap <leader>l :Align | |
nnoremap <leader>a :Ag<space> | |
nnoremap <leader>b :CtrlPBuffer<CR> | |
nnoremap <leader>d :NERDTreeToggle<CR> | |
nnoremap <leader>f :NERDTreeFind<CR> | |
nnoremap <leader>t :CtrlP<CR> | |
nnoremap <leader>T :CtrlPClearCache<CR>:CtrlP<CR> | |
nnoremap <leader>] :TagbarToggle<CR> | |
nnoremap <leader><space> :call whitespace#strip_trailing()<CR> | |
nnoremap <leader>g :GitGutterToggle<CR> | |
noremap <silent> <leader>V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR> | |
" gui settings | |
if (&t_Co == 256 || has('gui_running')) | |
if ($TERM_PROGRAM == 'iTerm.app') | |
set background=dark | |
colorscheme solarized | |
else | |
colorscheme desert | |
endif | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment