dotfiles/vimrc

182 lines
5.2 KiB
VimL
Raw Normal View History

2016-08-13 16:06:49 -04:00
" PLUGINS
call plug#begin('~/.vim/plugged')
" colors
Plug 'nanotech/jellybeans.vim'
Plug 'joshdick/onedark.vim'
2016-08-13 16:06:49 -04:00
" keepers
Plug 'airblade/vim-gitgutter'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
2017-09-12 09:11:38 -04:00
Plug 'ntpeters/vim-better-whitespace'
2016-08-13 16:06:49 -04:00
Plug 'rbgrouleff/bclose.vim'
2016-08-18 19:10:48 -04:00
Plug 'tpope/vim-endwise'
2017-09-12 09:11:38 -04:00
Plug 'tpope/vim-eunuch' " move files
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-git'
2016-08-13 16:06:49 -04:00
Plug 'tpope/vim-surround'
Plug 'troydm/zoomwintab.vim'
2016-08-13 16:06:49 -04:00
" languages
Plug 'posva/vim-vue'
Plug 'tpope/vim-markdown'
Plug 'tpope/vim-rails'
Plug 'vim-ruby/vim-ruby'
2018-01-03 11:49:50 -05:00
" Testing
" Plug 'w0rp/ale'
2016-08-13 16:06:49 -04:00
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=
set statusline+=%<\ %f%{ZoomState()}
set statusline+=\ %m%r%y%w%= " what am i doing here
set statusline+=\ Line:\ %l\/%L\ [%p%%]
set statusline+=\ Col:\ %c
set statusline+=\ Buf:\ #%n
set statusline+=\ " trailing space is with purpose
2016-08-13 16:06:49 -04:00
" OPTIONS
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
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 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
2018-01-03 11:49:50 -05:00
set colorcolumn=80,120 " Ruler at line 80, 120
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
2016-08-18 19:10:48 -04:00
set wildcharm=<tab> " Allow use of tab in macros
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
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
2018-01-03 11:49:50 -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
" Make fzf act like ctrlp
nnoremap <C-p> :Files<CR>
2016-08-13 16:06:49 -04:00
" ZoomWin
nnoremap <C-w>z :ZoomWinTabToggle<CR>
nnoremap <C-w><C-z> :ZoomWinTabToggle<CR>
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>
2017-09-12 09:11:38 -04:00
map <Leader>fw :StripWhitespace<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>
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
set t_8f=[38;2;%lu;%lu;%lum
set t_8b=[48;2;%lu;%lu;%lum
if has('nvim')
set termguicolors
set cursorline " Highlight current line
set cursorcolumn " Highlight current column
colorscheme onedark
else
colorscheme jellybeans
endif
2016-08-13 16:06:49 -04:00
syntax enable
2013-10-01 14:36:44 -04:00
2017-09-12 09:11:38 -04:00
highlight ExtraWhitespace ctermbg=196
" fzf
let $FZF_DEFAULT_COMMAND = 'ag -g ""'
" ZoomWin
function! ZoomState()
if exists('t:zoomwintab')
return 'Z'
else
return ''
endif
endfunction