2016-08-13 16:06:49 -04:00
|
|
|
" PLUGINS
|
|
|
|
call plug#begin('~/.vim/plugged')
|
|
|
|
|
|
|
|
" colors
|
|
|
|
Plug 'alessandroyorba/alduin'
|
|
|
|
Plug 'nanotech/jellybeans.vim'
|
|
|
|
|
|
|
|
" keepers
|
|
|
|
Plug 'airblade/vim-gitgutter'
|
2016-08-16 00:27:42 -04:00
|
|
|
Plug 'atomaka/ZoomWin' " vim-scripts not up to date
|
2016-08-13 16:06:49 -04:00
|
|
|
Plug 'bronson/vim-trailing-whitespace'
|
|
|
|
Plug 'ctrlpvim/ctrlp.vim'
|
|
|
|
Plug 'rbgrouleff/bclose.vim'
|
2016-08-18 19:10:48 -04:00
|
|
|
Plug 'tpope/vim-endwise'
|
|
|
|
Plug 'tpope/vim-eunuch'
|
2016-08-13 16:06:49 -04:00
|
|
|
Plug 'tpope/vim-surround'
|
|
|
|
|
|
|
|
" languages
|
|
|
|
Plug 'fatih/vim-go'
|
|
|
|
Plug 'posva/vim-vue'
|
|
|
|
Plug 'tpope/vim-markdown'
|
|
|
|
Plug 'tpope/vim-rails'
|
|
|
|
Plug 'vim-ruby/vim-ruby'
|
|
|
|
|
|
|
|
" maybe
|
|
|
|
Plug 'tommcdo/vim-lion'
|
|
|
|
Plug 'tpope/vim-fugitive'
|
|
|
|
Plug 'tpope/vim-repeat'
|
|
|
|
|
|
|
|
call plug#end()
|
2016-08-15 20:25:07 -04:00
|
|
|
filetype plugin indent on
|
2016-08-13 16:06:49 -04:00
|
|
|
|
|
|
|
" STATUS LINE
|
2016-08-18 19:10:48 -04:00
|
|
|
set statusline=%<\ %f%{ZoomState()}\ %m%r%y%w%=\ Line:\ %l\/%L\ [%p%%]\ Col:\ %c\ Buf:\ #%n\
|
2016-08-13 16:06:49 -04:00
|
|
|
|
|
|
|
" OPTIONS
|
2016-02-13 21:05:10 -05:00
|
|
|
set fileformats=unix,mac,dos " File format prefer unix endings
|
2016-08-18 19:10:48 -04:00
|
|
|
set endofline " Add newline at end of file
|
2016-02-13 21:05:10 -05:00
|
|
|
set shellslash " Forward slashes
|
|
|
|
set nobackup " No backup files
|
2016-08-13 16:06:49 -04:00
|
|
|
set noswapfile " Hope for the best
|
2013-05-09 17:02:25 -04:00
|
|
|
set formatoptions=crq
|
2013-04-29 02:31:18 -04:00
|
|
|
set textwidth=80
|
2016-02-13 21:05:10 -05:00
|
|
|
set cpoptions+=$ " delimit end of change text
|
|
|
|
set laststatus=2 " Always show status line
|
|
|
|
set showmode " Show current mode
|
|
|
|
set history=100 " History length
|
|
|
|
set cursorline " Highlight current line
|
|
|
|
set cursorcolumn " Highlight current column
|
|
|
|
set nowrap " Disable wrapping by default
|
|
|
|
set backspace=2 " Backspace over indent, eol, start of insert
|
|
|
|
set hlsearch " Search highlights
|
2016-08-13 16:06:49 -04:00
|
|
|
set wrapscan " Wrapped search
|
|
|
|
set incsearch " Search as you type
|
2016-02-13 21:05:10 -05:00
|
|
|
set ignorecase " Ignore case with search
|
|
|
|
set smartcase " Search will not ignore uppercase
|
|
|
|
set showcmd " Show command as you type
|
|
|
|
set ruler " Show cursor position
|
|
|
|
set autoindent " autoindent AND be smart about it
|
|
|
|
set smartindent
|
|
|
|
set colorcolumn=80 " Ruler at line 80
|
2013-05-09 17:02:25 -04:00
|
|
|
set nomodeline
|
2016-02-13 21:05:10 -05:00
|
|
|
set relativenumber " Relative line numbers
|
2013-08-19 19:43:39 -04:00
|
|
|
set number
|
2016-02-13 21:05:10 -05:00
|
|
|
set virtualedit=all " Cursor can go anywhere
|
|
|
|
set scrolloff=3 " Keep cursor from touching edges
|
|
|
|
set timeoutlen=500 " Don't wait too long (ambiguous leaders)
|
|
|
|
set showmatch " Show matching brackets
|
|
|
|
set hidden " Allow unsaved buffers to be hidden
|
2016-08-18 19:10:48 -04:00
|
|
|
set wildcharm=<tab> " Allow use of tab in macros
|
2016-02-13 21:05:10 -05:00
|
|
|
set wildmenu " Command line completion
|
|
|
|
set wildmode=list:longest,full " Better file completion
|
|
|
|
set infercase " Adjust completions to match case
|
|
|
|
set wildignorecase " Ignore case on commandline
|
|
|
|
set autowrite " Save file when focus is lost
|
2016-08-16 00:27:42 -04:00
|
|
|
set updatetime=250 " Make gitgutter autoupdate
|
2013-04-29 02:31:18 -04:00
|
|
|
" Tabs are 2 spaces
|
|
|
|
set tabstop=2
|
|
|
|
set softtabstop=2
|
|
|
|
set shiftwidth=2
|
|
|
|
set expandtab
|
2016-08-13 16:06:49 -04:00
|
|
|
set shiftround " make >> go to next tab
|
2016-08-18 19:10:48 -04:00
|
|
|
" some performance stuff
|
|
|
|
set lazyredraw
|
|
|
|
set ttyfast
|
|
|
|
set synmaxcol=256
|
2013-08-05 21:38:24 -04:00
|
|
|
" Show whitespace markers before cursor in insert mode
|
|
|
|
set list listchars=tab:\ \ ,trail:·
|
2014-12-12 12:59:19 -05:00
|
|
|
" Ignore stuff
|
|
|
|
set wildignore+=*/\.git/*
|
|
|
|
" Java
|
2014-12-12 13:51:31 -05:00
|
|
|
set wildignore+=*/build/*,*/grade/*,*\.class
|
2014-12-12 12:59:19 -05:00
|
|
|
" Frontend
|
|
|
|
set wildignore+=*/node_modules/*,*/bower_components/*,*/dist/*
|
2016-02-13 21:05:10 -05:00
|
|
|
" Persistent undo stuff
|
|
|
|
if has('persistent_undo')
|
|
|
|
set undolevels=5000
|
|
|
|
set undodir=$HOME/.vim/undo
|
|
|
|
set undofile
|
|
|
|
endif
|
2013-04-29 13:32:51 -04:00
|
|
|
|
2016-08-13 16:06:49 -04:00
|
|
|
" KEYBINDS
|
2016-02-13 21:05:10 -05:00
|
|
|
" quick replaceement
|
|
|
|
nmap S :%s//g<LEFT><LEFT>
|
2014-05-11 02:48:01 -04:00
|
|
|
|
2014-12-18 16:39:40 -05:00
|
|
|
" consistency is key - Y should act like C, D
|
|
|
|
map Y y$
|
|
|
|
|
2013-10-01 14:36:44 -04:00
|
|
|
" Don't cancel visual mode while indenting
|
|
|
|
vnoremap > >gv
|
|
|
|
vnoremap < <gv
|
|
|
|
|
2016-08-13 16:06:49 -04:00
|
|
|
" ZoomWin
|
|
|
|
nmap <c-w>z <Plug>ZoomWin
|
2014-05-09 01:16:01 -04:00
|
|
|
|
2016-08-13 16:06:49 -04:00
|
|
|
" LEADERS
|
2013-04-29 13:32:51 -04:00
|
|
|
let mapleader = ","
|
|
|
|
|
2013-10-01 14:36:44 -04:00
|
|
|
" tab swaps
|
2013-09-20 11:05:47 -04:00
|
|
|
map <Leader>2 :set tabstop=2 softtabstop=2 shiftwidth=2 expandtab<cr>
|
|
|
|
map <Leader>4 :set tabstop=4 softtabstop=4 shiftwidth=4 expandtab<cr>
|
|
|
|
map <Leader>a :set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab<cr>
|
2013-10-01 14:36:44 -04:00
|
|
|
|
2016-08-13 16:06:49 -04:00
|
|
|
" plugin
|
2016-08-15 22:41:18 -04:00
|
|
|
map <Leader>pc :PlugClean<cr>
|
|
|
|
map <Leader>pi :PlugInstall<cr>
|
|
|
|
map <Leader>pu :PlugUpdate<cr>
|
2013-10-14 00:19:08 -04:00
|
|
|
|
2014-05-08 23:47:44 -04:00
|
|
|
" clear search
|
2013-10-01 14:36:44 -04:00
|
|
|
map <Leader>cs :let @/ = ""<cr>
|
2014-05-08 23:47:44 -04:00
|
|
|
|
2016-02-11 08:42:06 -05:00
|
|
|
" bclose
|
|
|
|
nnoremap <silent> <Leader>bd :Bclose<CR>
|
|
|
|
nnoremap <silent> <Leader>bD :Bclose!<CR>
|
|
|
|
nnoremap <silent> <Leader>BD :Bclose!<CR>
|
|
|
|
|
2016-08-13 16:06:49 -04:00
|
|
|
" other
|
2016-08-26 13:40:18 -04:00
|
|
|
map <Leader>fj :%!python -m json.tool<cr>
|
2014-05-08 23:47:44 -04:00
|
|
|
map <Leader>fw :FixWhitespace<cr>
|
2016-08-13 16:06:49 -04:00
|
|
|
map <Leader>pm :set paste!<cr>
|
2016-08-18 19:10:48 -04:00
|
|
|
map <Leader>sa :Move %<tab>
|
2013-07-19 01:39:58 -04:00
|
|
|
map <Leader>se :e ~/.vimrc<cr>
|
2016-08-16 00:27:42 -04:00
|
|
|
map <Leader>sc :pclose<cr>
|
2016-08-18 19:10:48 -04:00
|
|
|
map <Leader>sw :SudoWrite<cr>
|
2013-07-19 01:39:58 -04:00
|
|
|
map <Leader>sz :so ~/.vimrc<cr>
|
2013-04-29 13:32:51 -04:00
|
|
|
|
2016-08-13 16:06:49 -04:00
|
|
|
" PLUGIN CONFIGURATION
|
|
|
|
" style
|
|
|
|
colorscheme jellybeans
|
|
|
|
syntax enable
|
2013-10-01 14:36:44 -04:00
|
|
|
|
2016-02-22 14:04:11 -05:00
|
|
|
" go
|
|
|
|
let g:go_fmt_command = "goimports"
|
2016-08-16 00:27:42 -04:00
|
|
|
|
|
|
|
" ZoomWin
|
|
|
|
function! ZWStatline(state)
|
|
|
|
if a:state
|
|
|
|
let t:zoomed = 1
|
|
|
|
else
|
|
|
|
let t:zoomed = 0
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
if !exists("g:ZoomWin_funcref")
|
|
|
|
let g:ZoomWin_funcref= function("ZWStatline")
|
|
|
|
endif
|
|
|
|
|
|
|
|
function! ZoomState()
|
|
|
|
if exists('t:zoomed') && t:zoomed
|
|
|
|
return 'Z'
|
|
|
|
else
|
|
|
|
return ''
|
|
|
|
endif
|
|
|
|
endfunction
|