dotfiles/vim/.vimrc

190 lines
5.5 KiB
VimL
Raw Normal View History

2016-08-13 16:06:49 -04:00
" PLUGINS
call plug#begin('~/.vim/plugged')
" colors
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'
2021-03-31 23:32:22 -04:00
Plug 'moll/vim-bbye'
2017-09-12 09:11:38 -04:00
Plug 'tpope/vim-eunuch' " move files
Plug 'tpope/vim-fugitive'
2021-11-02 20:14:26 -04:00
Plug 'tpope/vim-fugitive'
2016-08-13 16:06:49 -04:00
Plug 'tpope/vim-surround'
Plug 'troydm/zoomwintab.vim'
2021-11-02 20:14:26 -04:00
Plug 'chrisbra/matchit'
2016-08-13 16:06:49 -04:00
" languages
2020-01-21 10:04:13 -05:00
Plug 'leafgarland/typescript-vim'
2016-08-13 16:06:49 -04:00
Plug 'tpope/vim-markdown'
Plug 'tpope/vim-rails'
Plug 'vim-ruby/vim-ruby'
2021-11-02 09:48:51 -04:00
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'hashivim/vim-terraform'
2016-08-13 16:06:49 -04:00
2018-01-03 11:49:50 -05:00
" Testing
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%%]
2021-11-02 09:48:51 -04:00
set statusline+=\ Col:\ %v
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
2021-06-03 08:55:20 -04:00
" Fugitive
autocmd FileType fugitiveblame nmap <buffer> q gq
2021-06-08 08:40:27 -04:00
command! Gblame :G blame
2021-06-03 08:55:20 -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>
2016-02-11 08:42:06 -05:00
" bclose
2021-03-31 23:32:22 -04:00
nnoremap <silent> <Leader>bd :Bdelete<CR>
2016-02-11 08:42:06 -05:00
2016-08-13 16:06:49 -04:00
" other
2021-11-02 09:48:51 -04:00
map <Leader>cp "+y
map <Leader>pa "+p
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>
map <Leader>gg :exe "!hub gist create -o %:p"<cr><cr>
2020-10-05 14:00:07 -04:00
map <Leader>gi :GoImports<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>
2021-06-18 22:10:33 -04:00
map <Leader>sb :exe "!code --goto %:p:" . line(".")<cr><cr>
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
2021-11-02 20:14:26 -04:00
set cursorline " Highlight current line
set cursorcolumn " Highlight current column
set termguicolors
colorscheme onedark
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
2021-05-24 08:48:02 -04:00
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""'
2021-11-02 09:48:51 -04:00
let g:fzf_preview_window = []
2018-05-30 09:14:30 -04:00
" terraform
let g:terraform_align=1
" ZoomWin
function! ZoomState()
if exists('t:zoomwintab')
return 'Z'
else
return ''
endif
endfunction