aboutsummaryrefslogtreecommitdiff
path: root/vimrc
blob: 00f64f60e01afd1e70717a183f1680c4e2527b48 (plain) (blame)
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
" make 256color in tmux work
set background=dark

if 1
	augroup vimStartup
		au!
	
		autocmd BufReadPost *
			\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
			\ |		exe "normal! g`\""
			\ | endif
	augroup END
endif

augroup go_save | au!
	autocmd BufWritePost *.go !goimports -l -w '%:p:h'
	autocmd BufWritePost *.go edit!
	autocmd BufWritePost *.go redraw!
augroup end

augroup rust_save | au!
	autocmd BufWritePost *.rs !cargo fmt
	autocmd BufWritePost *.rs edit!
	autocmd BufWritePost *.rs redraw!
augroup end

augroup zig_save | au!
	autocmd BufWritePost *.zig !zig fmt '%:p:h'
	autocmd BufWritePost *.zig edit!
	autocmd BufWritePost *.zig redraw!
	autocmd BufWritePost *.zon !zig fmt '%:p:h'
	autocmd BufWritePost *.zon edit!
	autocmd BufWritePost *.zon redraw!
augroup end

autocmd FileType rust setlocal ts=4 sw=4 softtabstop=4 expandtab
autocmd FileType zig setlocal ts=4 sw=4 softtabstop=4 expandtab
autocmd FileType yaml setlocal ts=2 sw=2 softtabstop=2 expandtab
autocmd FileType nroff setlocal expandtab

autocmd FileType gitcommit setlocal textwidth=72 formatoptions-=t

nnoremap <Enter> moO<Esc>`o

set autoindent
set number relativenumber
set hls is
set ttm=100
syntax off
filetype detect