" New vimrc! Jan 2020 " " We want to load this first - everything else I include overrides it runtime! plugin/sensible.vim " try to speed vim on openbsd " https://www.reddit.com/r/openbsd/comments/9t3t4q/vim_81_slow_on_openbsd/ let sh_minlines=100 let sh_maxlines=600 set synmaxcol=300 set noshowmatch set synmaxcol=200 set shell=/usr/local/bin/fish set nocompatible set cmdheight=1 set re=1 "" Fuck - this does speed up vim a bit https://stackoverflow.com/questions/19030290/syntax-highlighting-causes-terrible-lag-in-vim set foldmethod=manual set encoding=utf-8 set modelines=0 " set relativenumber ! might slow down vim set autoindent set showmode set nocursorline set ttyfast "set ttimeout set notimeout set nottimeout set backspace=indent,eol,start set laststatus=2 set history=1000 " remember more commands and search history set undolevels=1000 " use many muchos levels of undo set wildignore=*.swp,*.bak,*.pyc,*.class set visualbell " don't beep set noerrorbells " don't beep set number set fillchars=diff:⣿,vert:\| set ruler " show the cursor position all the time set showcmd " display incomplete commands set vb "set list set listchars=tab:▸\ ,eol:¬,extends:❯,precedes:❮ set lazyredraw set matchtime=3 set showbreak=↪ set splitbelow set splitright set autowrite set linebreak set fileencodings=utf-8 set path+=** " Searching and movement ... nnoremap / /\v vnoremap / /\v set ignorecase set smartcase set incsearch set showmatch set hlsearch set gdefault set scrolloff=3 set sidescroll=1 set sidescrolloff=10 set virtualedit+=block nnoremap :noh:call clearmatches() " open a Quickfix window for the last search nnoremap / :execute 'vimgrep /'.@/.'/g %':copen " vim-plug call plug#begin('~/.vim/plugged') Plug 'fatih/vim-go', { 'tag': '*' } " Initialize plugin system call plug#end() " colorscheme set background=dark let gruvbox_bold=0 let g:gruvbox_contrast_dark='medium' " colorscheme gruvbox "backups/swap set noswapfile set nobackup " persist the undo tree for each file set undofile set undodir^=~/.vim/undo// " Formatting, like Textmate nnoremap Q gqip " " Django ... augroup ft_django au! au BufNewFile,BufRead urls.py setlocal nowrap au BufNewFile,BufRead urls.py normal! zR au BufNewFile,BufRead dashboard.py normal! zR au BufNewFile,BufRead local_settings.py normal! zR au BufNewFile,BufRead admin.py setlocal filetype=python.django au BufNewFile,BufRead urls.py setlocal filetype=python.django au BufNewFile,BufRead models.py setlocal filetype=python.django au BufNewFile,BufRead views.py setlocal filetype=python.django au BufNewFile,BufRead settings.py setlocal filetype=python.django au BufNewFile,BufRead settings.py setlocal foldmethod=marker au BufNewFile,BufRead forms.py setlocal filetype=python.django au BufNewFile,BufRead common_settings.py setlocal filetype=python.django au BufNewFile,BufRead common_settings.py setlocal foldmethod=marker augroup END " " Mutt ... augroup ft_muttrc au! au BufRead,BufNewFile *.muttrc set ft=muttrc au FileType muttrc setlocal foldmethod=marker foldmarker=,}}} augroup END " " General python properness ... autocmd FileType python set sw=4 autocmd FileType python set ts=4 autocmd FileType python set sts=4 autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType html set omnifunc=htmlcomplete#Complete syntax on filetype indent on filetype plugin on set omnifunc=syntaxcomplete#Complete " Do not scan included files when doing autocomplete " When doing C-n in default Vim autocomplete, it looks through all " includes which can take time. We can turn it off... This is referenced " at https://stackoverflow.com/questions/2169645/vims-autocomplete-is-excruciatingly-slow " and on p287 of Practical Vim set complete-=i " Go stuff let g:go_highlight_fields = 1 let g:go_highlight_functions = 1 let g:go_highlight_function_calls = 1 let g:go_highlight_extra_types = 1 let g:go_highlight_operators = 1 let g:go_auto_type_info = 1 let test#go#runner = 'gotest' let g:go_term_mode = "split" let g:go_term_height = 10 "autocmd FileType go nmap r :w:split terminal go run % autocmd FileType go nmap r :GoRun " highlights the variable in the file for you.. "let g:go_auto_sameids = 1 " auto import... let g:go_fmt_command = "goimports" " automatic type info on cursor let g:go_auto_type_info = 1 "let g:go_snippet_engine = "neosnippet" au Filetype go nmap ga (go-alternate-edit) au Filetype go nmap gah (go-alternate-split) au Filetype go nmap gav (go-alternate-vertical) au FileType go nmap :GoTest -short au FileType go nmap :DlvToggleBreakpoint au FileType go nmap :DlvTest au FileType go nmap :DlvDebug au FileType go nmap :GoRename " vim-test " use vim-dispatch to run tests in the quickfix window " from Modern Vim Ch.4 " the mappings below are from vim-test " https://github.com/vim-test/vim-test " dispatch opens send test output to quickfix window let test#strategy = "vimterminal" let test#python#runner = "pytest" let test#neovim#term_position = "topleft" let test#python#pytest#options = '-vvv --tb=short' let test#go#runner = 'gotest' "let test#go#gotest#options = '-v' " To run mypy using vim-dispath -with Dispatch autocmd FileType python let b:dispatch = 'mypy --ignore-missing-imports' nmap t :TestNearest nmap t :TestFile nmap t :TestSuite "nmap t :TestLast nmap :TestLast nmap t :TestVisit " " wildignore set wildignore=*.swp,*.bak,*.pyc,*.class set wildignore+=.hg,.git,.svn " Version control set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files set wildignore+=*.spl " compiled spelling word lists set wildignore+=*.sw? " Vim swap files set wildignore+=*.DS_Store " OSX bullshit set wildignore+=*.luac " Lua byte code set wildignore+=migrations " Django migrations set wildignore+=*.pyc " Python byte code set wildignore+=*.orig " Merge resolution files " make complete popupmenu better set completeopt=longest,menuone " leader let maplocalleader = "\\" let mapleader = "," " Ag if executable("ag") set grepprg=ag\ --nogroup\ --nocolor\ --ignore-case\ --column set grepformat=%f:%l:%c:%m,%f:%l:%m endif " maps nnoremap b :b nnoremap g :grep nnoremap q :b# nnoremap :noh:call clearmatches() nnoremap e :e ./**/ " nice search in buffer " (example use :14 to select from menu) nnoremap S :g//# " playing with Python syntax highlighting highlight pythonString cterm=NONE ctermbg=NONE ctermfg=65 highlight pythonQuotes cterm=NONE ctermbg=NONE ctermfg=65 highlight pythonBuiltin cterm=NONE ctermbg=NONE ctermfg=32 " ghetto linting autocmd FileType python setlocal makeprg=flake8 " this makes the quickfix window open automatically after autocmd QuickFixCmdPost [^l]* cwindow " nice statusline "set statusline=%-20F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v] "set statusline+=%{gutentags#statusline()} set statusline=%<\ %f\ %m%r%y%w%=\ L:\ \%l\/\%L\ C:\ \%c\