.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
syntax on
colors patine
" weird defaults
set tabstop=4
set shiftwidth=4
set scrolloff=10
set hlsearch
set smartcase
set timeoutlen=1000 ttimeoutlen=0 " esc is immediate
set t_Co=256 " it's 2019 ffs
set backspace=indent,eol,start
set wildmode=longest,list,full
map <F1> <Esc>
imap <F1> <Esc>
" Protect changes between writes. Default values of
" updatecount (200 keystrokes) and updatetime
" (4 seconds) are fine
set swapfile
set directory^=~/.vim/swap//
" protect against crash-during-write
set writebackup
" but do not persist backup after successful write
set nobackup
" use rename-and-write-new method whenever safe
set backupcopy=auto
" patch required to honor double slash at end
if has("patch-8.1.0251")
" consolidate the writebackups -- not a big
" deal either way, since they usually get deleted
set backupdir^=~/.vim/backup//
end
" persist the undo tree for each file
set undofile
set undodir^=~/.vim/undo//
" quickfix shortcuts
nmap ]q :cnext<cr>
nmap ]Q :clast<cr>
nmap [q :cprev<cr>
nmap [Q :cfirst<cr>
" shortcutz
nnoremap <CR> :nohlsearch<CR><CR> " enter clears hl
map <silent> <F4> :make<cr><cr><cr> " make all the things
set pastetoggle=<C-p> " control+p to toggle pasting
" mail
autocmd FileType mail setlocal tw=72 spell spelllang=en
" markdown
autocmd FileType markdown setlocal noruler spell spelllang=en
" ruby
autocmd FileType ruby setlocal shiftwidth=2 softtabstop=2 expandtab