summaryrefslogtreecommitdiffhomepage
path: root/.exrc
blob: 252d6327900949decec0c793e77b066ed8d74da5 (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
set runtimepath+=contrib/vim

" We make use of this feature, so set this in the environment so that all
" Ex-calls to templ are aware of this
call setenv('TEMPL_EXPERIMENT', 'rawgo')

function s:SaveExcursion(cmd)
	let l:win = winsaveview()
	silent execute 'keepjumps %!' .. a:cmd
	call winrestview(l:win)
endfunction

autocmd BufNewFile,BufRead */data/mintages/*
	\   setfiletype mintage
	\ | setlocal nowrap
autocmd BufNewFile,BufRead */cmd/exttmpl/*
	\ setlocal makeprg=go\ build\ ./cmd/exttmpl
autocmd BufNewFile,BufRead */cmd/mfmt/*
	\ setlocal makeprg=go\ build\ ./cmd/mfmt

autocmd FileType go autocmd BufWritePre <buffer>
	\ call s:SaveExcursion('gofmt -s')
autocmd FileType mintage autocmd BufWritePre <buffer>
	\ call s:SaveExcursion('./mfmt')
autocmd FileType templ autocmd BufWritePre <buffer>
	\ call s:SaveExcursion('templ fmt')

nnoremap <silent> gM :wall \| make all-i18n<CR>
nnoremap <silent> <LocalLeader>t :vimgrep /\CTODO/ **/*<CR>

let &wildignore = netrw_gitignore#Hide() . ',.git/*,vendor/*'
let g:netrw_list_hide .= ',.*\\.gen\\..*,.*_templ\\.go$'