" General options set backspace=indent,eol,start set cindent autoindent set confirm set encoding=utf-8 set incsearch set hidden set mouse=a set nocompatible set noexpandtab set nohlsearch set number set ruler set showcmd set showmatch set showmode set tags=./tags,tags,/usr/src/sys/arch/amd64/tags,/var/db/libc.tags set t_Co=256 set ttyfast source /usr/share/vim/vim82/ftplugin/man.vim filetype plugin on nnoremap :tag nnoremap :pop nnoremap :bprev " fix glitches in certain terminals " backspace imap ^? ^H " f7 toggles spelling on/off nn :setlocal spell! spell? " view binary files as hex " Convert to hex and back; does not save changes nn :%!xxd -g 1 nn :%!xxd -g 1 -r " makefile magic " compiler stuff let g:compiler_gcc_ignore_unmatched_lines=1 let mapleader=',' " quickfix :make nmap m :wa:silent! make \| redraw! \| cw vmap m :wa:silent! make \| redraw! \| cw nn ,c :silent! make clean \| redraw! \| cw " handy shortcuts map h :ccl map s :cw map l :cl " jump between messages map n :cn map p :cp " format selection map f :!fmt " @c comment, @u uncomment, @p print function name let @u='0xx$xx^[' let @c='I/*^[A*/^[' let @p='ofprintf(stderr, "%s\n", __func__);^[' :ab #d #define :ab #i #include autocmd FileType make setlocal noexpandtab autocmd FileType c setlocal noexpandtab autocmd FileType cc setlocal noexpandtab autocmd FileType python setlocal expandtab shiftwidth=4 softtabstop=4 autocmd FileType ada setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=3 " Plugins " Initialization call plug#begin('~/.vim/bundle') Plug 'scrooloose/nerdtree' Plug 'junegunn/fzf' Plug 'fatih/vim-go', { 'for': 'go' } Plug 'ambv/black', { 'for': 'python' } Plug 'mileszs/ack.vim' Plug 'racer-rust/vim-racer', { 'for': 'rust' } " Themes Plug 'KKPMW/oldbook-vim' Plug 'agreco/vim-citylights' Plug 'xdefrag/vim-beelzebub' Plug 'logico-dev/typewriter' Plug 'vim-scripts/wombat256.vim' call plug#end() " NERDTree map o :NERDTree " FZF nmap (fzf-maps-n) xmap (fzf-maps-x) omap (fzf-maps-o) imap (fzf-complete-word) imap (fzf-complete-path) imap (fzf-complete-file-ag) imap (fzf-complete-line) command! FZFBuffers call fzf#run({'source': map(range(1, bufnr('$')), 'bufname(v:val)'), 'sink': 'e', 'down': '30%'}) map b :FZFBuffers " Ack if executable('ag') let g:ackprg = 'ag --vimgrep' endif " The space is signficant. map / :Ack " Go stuff map i :GoImports map i :GoImports let g:go_fmt_autosave = 1 let g:go_fmt_command = "goimports" au FileType rust nmap gd (rust-def) autocmd Filetype c,cpp inoremap t :wa:silent! make test \| redraw! \| cw autocmd Filetype go map t :wa:GoTest autocmd Filetype go map C-] :w:GoDef autocmd Filetype go map C-\ :w:GoDefPop colorscheme oldbook