dotfiles/vim/.vimrc

115 lines
2.6 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'
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'
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 '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
" SETTINGS
2016-08-15 20:25:07 -04:00
filetype plugin indent on
2016-08-13 16:06:49 -04:00
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
2021-12-21 13:19:10 -05:00
set endofline " Add newline to end of file
set nobackup
set noswapfile
set nowrap " Disable wrapping by default
2021-12-21 13:19:10 -05:00
set scrolloff=3 " Keep cursor from touching edges
set showmode " Show current mode
set timeoutlen=500 " Don't wait too long (ambiguous leaders)
set virtualedit=all " Cursor can go anywhere
set hlsearch " Search highlights
set ignorecase " Ignore case with search
2021-12-21 13:19:10 -05:00
set incsearch " Search as you type
set smartcase " Search will not ignore uppercase
2021-12-21 13:19:10 -05:00
set wrapscan " Wrapped search
set number
2021-12-21 13:19:10 -05:00
set relativenumber " Relative line numbers
set textwidth=80
set colorcolumn=80,120 " Ruler at line 80, 120
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
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
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
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
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>
" Fugitive
autocmd FileType fugitiveblame nmap <buffer> q gq
command! Gblame :G blame
map <Leader>gb :Git blame<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
2021-12-21 13:19:10 -05:00
" zoomwintab
nnoremap <C-w>z :ZoomWinTabToggle<CR>
nnoremap <C-w><C-z> :ZoomWinTabToggle<CR>
function! ZoomState()
if exists('t:zoomwintab')
return 'Z'
else
return ''
endif
endfunction