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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
" 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=/bin/ksh
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 <leader><space> :noh<cr>:call clearmatches()<cr>
" calcurse
" markdown notes from https://www.youtube.com/watch?v=I_-MqgpEWFA
autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
" open a Quickfix window for the last search
nnoremap <silent> <leader>/ :execute 'vimgrep /'.@/.'/g %'<CR>:copen<CR>
" vim-plug
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go', { 'tag': '*' }
Plug 'altercation/vim-colors-solarized'
Plug 'vimwiki/vimwiki'
Plug 'tools-life/taskwiki'
Plug 'powerman/vim-plugin-AnsiEsc'
Plug 'farseer90718/vim-taskwarrior'
Plug 'majutsushi/tagbar'
call plug#end()
" colorscheme
set background=light
"colorscheme solarized
colorscheme default
"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 <leader>r :w<CR>:split <bar> terminal go run %<CR>
autocmd FileType go nmap <leader>r :GoRun<CR>
" 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 <leader>ga <Plug>(go-alternate-edit)
au Filetype go nmap <leader>gah <Plug>(go-alternate-split)
au Filetype go nmap <leader>gav <Plug>(go-alternate-vertical)
au FileType go nmap <F10> :GoTest -short<cr>
au FileType go nmap <F9> :DlvToggleBreakpoint<CR>
au FileType go nmap <S-F9> :DlvTest<CR>
au FileType go nmap <F11> :DlvDebug<CR>
au FileType go nmap <S-F5> :GoRename<CR>
" 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 <silent> t<C-n> :TestNearest<CR>
nmap <silent> t<C-f> :TestFile<CR>
nmap <silent> t<C-s> :TestSuite<CR>
"nmap <silent> t<C-l> :TestLast<CR>
nmap <silent> <S-F10> :TestLast<CR>
nmap <silent> t<C-g> :TestVisit<CR>
"
" 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 <leader>b :b <C-d>
nnoremap <leader>g :grep<space>
nnoremap <leader>q :b#<cr>
nnoremap <leader><space> :noh<cr>:call clearmatches()<cr>
nnoremap <leader>e :e ./**/
" nice search in buffer
" (example use :14 to select from menu)
nnoremap <leader>S :g//#<left><left>
" 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\
|