config/modules/base/users/vimrc
2023-08-18 18:43:34 +03:00

92 lines
2.6 KiB
VimL

if $VIM_PATH != ""
let $PATH = $VIM_PATH
endif
syntax on
filetype plugin indent on
set et ts=4 sw=4 sts=4 nu hlsearch ruler ignorecase smartcase nomodeline bg=dark incsearch
set path=**/* grepprg=rg\ --vimgrep grepformat^=%f:%l:%c:%m backspace=2 nojs
set laststatus=1
nnoremap <Leader>\ gqj
command OLD :enew | setl buftype=nofile | 0put =v:oldfiles | nnoremap <buffer> <CR> :e <C-r>=getline('.')<CR><CR>
let g:gutentags_enabled = 0
let g:gutentags_generate_on_new = 0
let g:gutentags_cache_dir = '~/.vim/ctags'
let b:gutentags_file_list_command = 'git ls-files'
call matchadd('ColorColumn', '\%81v', 100)
" thanks to drew de vault's vimrc, except swearing
set mouse=a
set backupdir=~/.cache directory=~/.cache
"nnoremap Q :grep <cword><CR>
nmap gs :grep <cursor><CR>
" bits from vim-sensible
set autoindent smarttab nrformats-=octal
nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
set wildmenu sidescrolloff=5 display+=lastline encoding=utf-8
set formatoptions+=j history=1000 tabpagemax=50 sessionoptions-=options
" so Gdiff and vimdiff output are somewhat readable
if &diff
syntax off
endif
if has("patch-8.1-0360")
set diffopt+=algorithm:patience
endif
"nmap gs :rg :grep <cword>
" html
au FileType html,gohtmltmpl setlocal ts=2 sw=2 sts=2
" ruby
au BufRead,BufNewFile Vagrantfile setfiletype ruby
" starlark
au BufRead,BufNewFile *.star setfiletype python
" puppet
au BufRead,BufNewFile *.pp setfiletype puppet
au FileType puppet setlocal ts=2 sw=2 sts=2 syntax=ruby
au FileType puppet let g:gutentags_enabled = 1
au FileType puppet let b:gutentags_file_list_command = 'git ls-files *.pp'
au FileType puppet nnoremap <buffer> <C-]> :call search('\s', 'b')<cr>:call search('\w')<cr>vE<C-]>
"au FileType puppet nnoremap <buffer> <C-]> :call search('\s', 'b')<cr>:call search('\w')<cr>:call search('[^a-z:]\|$', 's')<cr>hv`'<C-]>
" puppet
au BufRead,BufNewFile *.j2 setfiletype django
" avro
au BufRead,BufNewFile *.avsc setfiletype json
au BufRead,BufNewFile *.avsc setlocal ts=2 sw=2 sts=2
" redo
au BufRead,BufNewFile *.do setfiletype sh
" go
au FileType go setlocal noet
au FileType go nnoremap <buffer> <C-]> :GoDef<CR>
au FileType go let g:go_template_autocreate = 0
au FileType go let g:go_fmt_command = "goimports"
" strace
au FileType strace setlocal nonu
" yaml
au FileType yaml setlocal ts=2 sw=2 sts=2
" sql
au FileType sql setlocal formatprg=pg_format\ -
au FileType sql setlocal ts=2 sw=2 sts=2
let g:loaded_sql_completion = 0
let g:omni_sql_no_default_maps = 1
" mail
autocmd BufRead,BufNewFile *mutt-* setfiletype mail
" TeX
au FileType tex setlocal spell spelllang=en_us ts=2 sw=2 sts=2