dotfiles/vim/.vimrc

164 lines
3.4 KiB
VimL
Raw Normal View History

2016-08-13 16:06:49 -04:00
call plug#begin('~/.vim/plugged')
2021-12-21 13:19:10 -05:00
Plug 'chrisbra/matchit'
2022-01-12 21:35:49 -05:00
Plug 'dhruvasagar/vim-zoom'
2021-12-21 13:19:10 -05:00
Plug 'junegunn/fzf'
2021-03-31 23:32:22 -04:00
Plug 'moll/vim-bbye'
2021-12-21 13:19:10 -05:00
Plug 'ntpeters/vim-better-whitespace'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
2022-03-20 21:12:07 -04:00
Plug 'tpope/vim-rhubarb'
2016-08-13 16:06:49 -04:00
Plug 'tpope/vim-surround'
" languages
2022-01-24 10:30:45 -05:00
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
2022-05-18 10:45:30 -04:00
Plug 'hashivim/vim-terraform'
Plug 'rust-lang/rust.vim'
2016-08-13 16:06:49 -04:00
Plug 'tpope/vim-rails'
Plug 'vim-ruby/vim-ruby'
2018-01-03 11:49:50 -05:00
2016-08-13 16:06:49 -04:00
call plug#end()
2021-12-21 13:19:10 -05:00
2022-01-12 08:37:48 -05:00
" STATUS LINE
set statusline=
2022-01-12 21:35:49 -05:00
set statusline+=%<\ %f%{zoom#statusline()}
2022-01-12 08:37:48 -05:00
set statusline+=\ %m%r%y%w%=
set statusline+=\ Line:\ %l\/%L\ [%p%%]
set statusline+=\ Col:\ %v
set statusline+=\ Buf:\ #%n
set statusline+=\ " trailing space
2021-12-21 13:19:10 -05:00
" SETTINGS
2016-08-15 20:25:07 -04:00
filetype plugin indent on
2016-08-13 16:06:49 -04:00
2022-01-12 08:37:48 -05:00
set autowrite
2021-12-21 13:19:10 -05:00
set backspace=2 " Backspace over indent, eol, start of insert
set cpoptions+=$ " delimit end of change text
2022-01-12 08:37:48 -05:00
set endofline
set laststatus=2 " always show status line
2021-12-21 13:19:10 -05:00
set nobackup
set noswapfile
2022-01-12 08:37:48 -05:00
set nowrap
set scrolloff=3
set showmatch
set showmode
2021-12-21 13:19:10 -05:00
set timeoutlen=500 " Don't wait too long (ambiguous leaders)
set virtualedit=all " Cursor can go anywhere
2022-01-12 08:37:48 -05:00
set hlsearch
set ignorecase
set incsearch
set smartcase
set wrapscan
2021-12-21 13:19:10 -05:00
set number
2022-01-12 08:37:48 -05:00
set relativenumber
2021-12-21 13:19:10 -05:00
set textwidth=80
2022-01-12 08:37:48 -05:00
set colorcolumn=80,120
2021-12-21 13:19:10 -05:00
2022-01-14 22:44:39 -05:00
" For commands
set infercase
set wildcharm=<tab>
set wildignorecase
set wildmenu
set wildmode=list:longest,full
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
2014-05-11 02:48:01 -04:00
2022-01-12 08:37:48 -05:00
if has('persistent_undo')
set undolevels=5000
set undodir=$HOME/.vim/undo
set undofile
endif
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
2021-12-21 13:19:10 -05:00
" typo-city
:command W w
:command Wq wq
2014-05-09 01:16:01 -04:00
2021-12-21 13:19:10 -05:00
" quick replaceement
nmap S :%s//g<LEFT><LEFT>
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 = ","
2021-12-21 13:19:10 -05:00
map <Leader>sz :so ~/.vimrc<cr>
2013-10-01 14:36:44 -04:00
2021-12-21 13:19:10 -05:00
" copy/paste (system buffer)
map <Leader>cp "+y
map <Leader>pa "+p
2013-10-14 00:19:08 -04:00
2022-01-12 08:37:48 -05:00
" tabbing
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>
map <Leader>st :let @/ = "\t"<cr>
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
2021-12-21 13:19:10 -05:00
" github
map <Leader>gg :exe "!hub gist create -o %:p"<cr><cr>
2013-04-29 13:32:51 -04:00
2022-05-21 09:59:42 -04:00
" filetype overrides
au Filetype rust set colorcolumn=100
2016-08-13 16:06:49 -04:00
" PLUGIN CONFIGURATION
2021-12-21 13:19:10 -05:00
" fzf
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""'
noremap <C-p> :FZF<CR>
2021-11-02 20:14:26 -04:00
2022-05-18 10:45:30 -04:00
" rust.vim
let g:rustfmt_autosave = 1
2021-12-21 13:19:10 -05:00
" vim-bbye
nnoremap <silent> <Leader>bd :Bdelete<CR>
2013-10-01 14:36:44 -04:00
2021-12-21 13:19:10 -05:00
" vim-better-whitespace
highlight ExtraWhitespace ctermbg=red
map <Leader>fw :StripWhitespace<cr>
2021-12-21 13:19:10 -05:00
" vim-eunuch
map <Leader>sa :Move %<tab>
2022-01-12 08:37:48 -05:00
" vim-fugitive
autocmd FileType fugitiveblame nmap <buffer> q gq
command! Gblame :G blame
map <Leader>gb :Git blame<cr>
2022-03-20 21:12:07 -04:00
map <Leader>gh :GBrowse<cr>
2021-12-21 13:19:10 -05:00
" vim-plug
map <Leader>pc :PlugClean<cr>
map <Leader>pi :PlugInstall<cr>
map <Leader>pu :PlugUpdate<cr>
2018-05-30 09:14:30 -04:00
2022-01-12 08:37:48 -05:00
" vim-terraform
let g:terraform_align=1
" zoomwintab.vim
2022-01-12 21:35:49 -05:00
nmap <C-w>z <Plug>(zoom-toggle)
nmap <C-w><C-z> <Plug>(zoom-toggle)
let g:zoom#statustext='Z'
function! MyCtrlW()
let char = nr2char(getchar())
if get(t:, 'zoomed', 0) == 1
if char is# 'v' || char is# 's' || char is# '' || char is# ''
return ""
endif
end
return "\<C-w>".char
endfunction
2022-01-12 21:35:49 -05:00
nnoremap <expr> <C-w> MyCtrlW()