dotfiles/vimrc

171 lines
4.8 KiB
VimL
Raw Normal View History

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-15 22:41:18 -04:00
Plug 'atomaka/renamefile.vim'
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'
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
set statusline=%<\ %{GitState()}%f%{ZoomState()}\ %m%r%y%w%=%l\/%-6L\ %3c\
2016-08-13 16:06:49 -04:00
" OPTIONS
set fileformats=unix,mac,dos " File format prefer unix endings
set endofline " Add newlien at end of file
set shellslash " Forward slashes
set nobackup " No backup files
2016-08-13 16:06:49 -04:00
set noswapfile " Hope for the best
set formatoptions=crq
2013-04-29 02:31:18 -04:00
set textwidth=80
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
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
set nomodeline
set relativenumber " Relative line numbers
set number
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
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
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
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/*
" 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
" 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
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-15 22:41:18 -04:00
map <Leader>sa :RenameFile<cr>
2013-07-19 01:39:58 -04:00
map <Leader>se :e ~/.vimrc<cr>
map <Leader>sc :pclose<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
" fugitive
function! GitState()
return system("[[ -n \"$(git status --porcelain " . shellescape(expand("%")) . ")\" ]] && echo -n +")
endfunction
2016-02-22 14:04:11 -05:00
" go
let g:go_fmt_command = "goimports"
" 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