1
2
3
4
5
6 "Software"
7
8
9
10
11
12
13
14
15 "AS IS"
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 set nocompatible
41
42
43
44
45 let mapleader = '\'
46 let maplocalleader = '\'
47
+ - 48 +-- 39 lines: System Dependencies:
48
| 49 let g:jm_vimrc = {}
| 50
| 51
| 52
| 53 let g:jm_vimrc.docs = {}
| 54
| 55
| 56
| 57 let g:jm_vimrc.docs.commands = {}
| 58
| 59
| 60
| 61 let g:jm_vimrc.docs.mappings = {}
| 62
| 63
| 64 let g:jm_vimrc.deps = #{
| 65 \ jshell: 'jshell',
| 66 \ curl: 'curl',
| 67 \ blaze: 'blaze',
| 68 \ javap: 'javap',
| 69 \ ag: 'ag',
| 70 \ fish: 'fish',
| 71 \ python: 'python3',
| 72 \ }
| 73
| 74
| 75 let g:jm_vimrc.is_mac = system('uname -s') =~# 'Darwin'
| 76
| 77
| 78 let g:jm_vimrc.has_python = has('python3')
| 79
| 80
| 81 let g:jm_vimrc.deps.JavaClassnameList = {-> systemlist('fish -c "classpath list-all-classes"')}
| 82 let g:jm_vimrc.deps.ClasspathJarList = {-> systemlist('fish -c classpath')}
| 83
| 84 let g:jm_vimrc.deps.google_java_executable = 'google-java-format'
| 85 let g:jm_vimrc.deps.buildozer = 'fish -c buildozer'
| 86
87
+ - 88 +-- 28 lines: Playground:
88
| 89 let s:pg_items = (g:jm_vimrc.is_mac)
| 90 \ ? #{
| 91 \ co: 'Files ~/Playground',
| 92 \ cj: 'Files ~/Playground/jdk/src/java.base/share/classes',
| 93 \ pg: 'Files ~/Playground',
| 94 \ n: 'Files ~/Playground/jmendio/n',
| 95 \ v: 'edit ~/.vimrc',
| 96 \ }
| 97 \ : #{
| 98 \ a: 'Files ~/code/abseil-cpp/absl',
| 99 \ co: 'Files ~/code',
| 100 \ cg: 'Files ~/code/guava/guava/src',
| 101 \ cj: 'Files ~/code/jdk/src/java.base/share/classes',
| 102 \ cv: 'Files ~/code/opencv/modules/core',
| 103 \ cp: 'Files ~/code/pandas',
| 104 \ cd: 'Files ~/code/dagger',
| 105 \ cb: 'Files ~/code/basis',
| 106 \ cO: 'Files /usr/lib/ocaml',
| 107 \ j: 'Files ~/junk',
| 108 \ n: 'Files ~/jmendio/n',
| 109 \ v: 'edit ~/.vimrc',
| 110 \ }
| 111 for [key, path] in items(s:pg_items)
| 112 execute printf('nnoremap <leader>e%s :%s<cr>', key, path)
| 113 let g:jm_vimrc.docs.mappings['\e' .. key] = 'Run :' .. path
| 114 endfor
| 115
116
+ - 117 +-- 86 lines: Plugins (vim-plug):
117
| 118 call plug#begin('~/.vim/bundle')
| 119
| 120
| 121 Plug 'morhetz/gruvbox'
| 122 Plug 'tpope/vim-surround'
| 123 Plug 'scrooloose/nerdtree'
| 124 Plug 'godlygeek/tabular'
| 125 if g:jm_vimrc.has_python
| 126 Plug 'SirVer/ultisnips'
| 127 Plug 'Valloric/YouCompleteMe'
| 128 endif
| 129 Plug 'honza/vim-snippets'
| 130 Plug 'junegunn/fzf', {'do': {-> fzf#install()}}
| 131 Plug 'junegunn/fzf.vim'
| 132 Plug 'junegunn/vim-easy-align'
| 133 Plug 'tpope/vim-fugitive'
| 134 Plug 'moll/vim-bbye'
| 135 Plug 'scrooloose/nerdcommenter'
| 136 Plug 'jiangmiao/auto-pairs'
| 137 Plug 'tpope/vim-repeat'
| 138 Plug 'triglav/vim-visual-increment'
| 139 Plug 'tmhedberg/SimpylFold'
| 140 Plug 'majutsushi/tagbar'
| 141 Plug 'pangloss/vim-javascript'
| 142 Plug 'nelstrom/vim-markdown-folding'
| 143 Plug 'justinmk/vim-syntax-extra'
| 144 Plug 'jpalardy/vim-slime'
| 145 Plug 'itchyny/lightline.vim'
| 146 Plug 'ap/vim-buftabline'
| 147 Plug 'airblade/vim-gitgutter'
| 148 Plug 'google/vim-maktaba'
| 149 Plug 'google/vim-codefmt'
| 150 Plug 'google/vim-glaive'
| 151 Plug 'frazrepo/vim-rainbow'
| 152 Plug 'AndrewRadev/splitjoin.vim'
| 153 Plug 'AndrewRadev/linediff.vim'
| 154 Plug 'shiracamus/vim-syntax-x86-objdump-d'
| 155 Plug 'romainl/vim-devdocs'
| 156 if isdirectory('$OCAML_OCP_INDENT')
| 157 Plug $OCAML_OCP_INDENT
| 158 endif
| 159 if exists("$BASIS")
| 160 Plug $BASIS, { 'rtp': 'vim' }
| 161 else
| 162 Plug 'jmend736/basis', { 'rtp': 'vim' }
| 163 endif
| 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 call plug#end()
| 189
| 190 if !exists('g:loaded_plug')
| 191 echoerr "ERROR: vim-plug is REQUIRED https://github.com/junegunn/vim-plug"
| 192 finish
| 193 endif
| 194
| 195
| 196 call glaive#Install()
| 197
| 198 Glaive codefmt
| 199 \ google_java_executable=`g:jm_vimrc.deps.google_java_executable`
| 200 \ clang_format_style='Google'
| 201
| 202
203
+ - 204 +--101 lines: General Options:
204
| 205 filetype plugin indent on
| 206
| 207 set t_Co=256
| 208 set t_ut=
| 209
| 210 set scrolloff=0
| 211
| 212 set shell=/bin/bash
| 213
| 214 set hidden
| 215
| 216 set tabstop=2
| 217 set softtabstop=2
| 218 set shiftwidth=2
| 219 set expandtab
| 220 set smarttab
| 221
| 222 set autoindent
| 223 set smartindent
| 224
| 225
| 226 set backspace=indent,eol,start
| 227
| 228 set list
| 229 set listchars=tab:\>\ ,trail:·,extends:→,precedes:←
| 230
| 231 set number
| 232 set numberwidth=4
| 233 set relativenumber
| 234 set noruler
| 235 set showcmd
| 236
| 237 set statusline=%f\ %=L:%l/%L\ %c\ (%p%%)
| 238
| 239 set wildmenu
| 240 set wildmode=longest,list,full
| 241
| 242 set hlsearch
| 243 set incsearch
| 244 set foldopen-=search
| 245
| 246
| 247
| 248 set ignorecase
| 249 set smartcase
| 250
| 251
| 252 set fileencodings=utf-8
| 253 set tags=tags
| 254 set tags+=/usr/include/**/tags
| 255 set printoptions=number:y,duplex:long,paper:letter
| 256 if g:jm_vimrc.is_mac
| 257 set clipboard=unnamed
| 258 else
| 259 set clipboard=unnamedplus
| 260 endif
| 261 set errorbells
| 262 set laststatus=2
| 263 set cursorline
| 264 set sessionoptions=
| 265 \blank,
| 266 \curdir,
| 267 \folds,
| 268 \help,
| 269 \localoptions,
| 270 \options,
| 271 \tabpages,
| 272 \winsize,
| 273 \terminal
| 274
| 275 set directory=~/.swaps//
| 276
| 277
| 278 digraphs el 8712
| 279 digraphs in 8712
| 280 digraphs ni 8713
| 281 digraphs es 8709
| 282 digraphs ss 8834
| 283 digraphs se 8838
| 284 digraphs ns 8836
| 285 digraphs nS 8840
| 286 digraphs nn 8745 " Intersection
| 287 digraphs uu 8746
| 288 digraphs un 8746
| 289 digraphs co 8728
| 290 digraphs \|> 8614
| 291 digraphs tl 8598
| 292 digraphs tr 8599
| 293 digraphs br 8600
| 294 digraphs bl 8601
| 295 digraphs -u 8593
| 296 digraphs -d 8595
| 297 digraphs c. 183
| 298 digraphs .. 183
| 299
| 300
| 301 colorscheme gruvbox
| 302 syntax enable
| 303 set bg=dark
| 304
305
+ - 306 +-- 69 lines: Plugin Settings:
306
| 307
| 308 let g:lightline = {
| 309 \ 'active': {
| 310 \ 'left': [['mode', 'paste'], ['filename', 'modified']],
| 311 \ 'right': [['winlayout', 'winid_bufnr', 'lineinfo'], ['percent', 'foldlevel'], ['readonly']]
| 312 \ },
| 313 \ 'inactive': {
| 314 \ 'left': [['filename', 'modified']],
| 315 \ 'right': [['winlayout', 'winid_bufnr', 'lineinfo'], ['readonly']]
| 316 \ },
| 317 \ 'component_type': {
| 318 \ 'readonly': 'error',
| 319 \ },
| 320 \ 'component': {
| 321 \ 'winid_bufnr': '[%{winnr()}/%{win_getid()}(%{Layout()[win_getid()]})]{%{bufnr()}}',
| 322 \ 'foldlevel': '%{(&foldenable) ? &foldlevel : "-"}f',
| 323 \ },
| 324 \ }
| 325
| 326 let $FZF_DEFAULT_COMMAND = 'ag -l'
| 327
| 328 let g:html_dynamic_folds = v:true
| 329
| 330
| 331
| 332
| 333
| 334 let g:ycm_auto_trigger = 1
| 335 let g:ycm_disable_signature_help = 1
| 336 let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
| 337 let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
| 338
| 339 let g:slime_target = "tmux"
| 340
| 341
| 342 let g:bss_markdown_fix = 1
| 343
| 344 let g:bss_java_fix = 1
| 345
| 346 let g:vim_markdown_new_list_item_indent = 0
| 347 let g:vim_markdown_folding_disabled = 1
| 348 let g:markdown_fold_style = 'nested'
| 349
| 350 let g:NERDCompactSexyComs = v:true
| 351 let g:NERDCommentEmptyLines = v:true
| 352 let g:NERDDefaultAlign = 'left'
| 353
| 354 let g:tagbar_sort = v:false
| 355
| 356
| 357 let g:buftabline_numbers = 2
| 358 let g:buftabline_indicators = v:true
| 359 let g:buftabline_separators = v:false
| 360
| 361 let g:netre_liststyle=3
| 362
| 363 let g:tex_flavor='latex'
| 364
| 365 let g:UltiSnipsExpandTrigger="<tab>"
| 366 let g:UltiSnipsJumpForwardTrigger="<c-j>"
| 367 let g:UltiSnipsJumpBackwardTrigger="<c-z>"
| 368 let g:UltiSnipsEditSplit="vertical"
| 369
| 370 let g:gitgutter_sign_added = '··'
| 371 let g:gitgutter_sign_modified = '··'
| 372 let g:gitgutter_sign_removed = '·'
| 373 let g:gitgutter_sign_modified_removed = '·'
| 374
375
+ - 376 +--146 lines: Keymappings:
376
| 377
| 378
| 379
| 380
| 381
| 382
| 383
| 384
| 385
| 386
| 387 let g:jm_vimrc.docs.mappings['<C-[hjkl]>'] =
| 388 \ 'Move between windows by holding CTRL'
| 389 noremap <C-j> <C-W>j
| 390 noremap <C-k> <C-W>k
| 391 noremap <C-h> <C-W>h
| 392 noremap <C-l> <C-W>l
| 393
| 394 let g:jm_vimrc.docs.mappings['<C-[←↑↓→]>'] =
| 395 \ 'Move visual selection'
| 396 vnoremap <C-Up> koko
| 397 vnoremap <C-Down> jojo
| 398 vnoremap <C-Left> hoho
| 399 vnoremap <C-Right> lolo
| 400
| 401 let g:jm_vimrc.docs.mappings['[['] =
| 402 \ 'Enable [[,][,]],[] to operate on non-col-1-{}'
| 403
| 404 nnoremap [[ ?{<CR>w99[{
| 405 nnoremap ][ /}<CR>b99]}
| 406 nnoremap ]] j0[[%/{<CR>
| 407 nnoremap [] k$][%?}<CR>
| 408
| 409 let g:jm_vimrc.docs.mappings['\q'] =
| 410 \ 'Delete current buffer without changing window layout'
| 411 nnoremap <leader>q :Bdelete<cr>
| 412
| 413 let g:jm_vimrc.docs.mappings["\\'"] =
| 414 \ 'Open NERDTree (file explorer)'
| 415 nnoremap <leader>' :NERDTreeToggle<cr>
| 416
| 417 let g:jm_vimrc.docs.mappings['\"'] =
| 418 \ 'Open NERDTree (file explorer) to current file'
| 419 nnoremap <leader>" :NERDTreeFind<cr>
| 420
| 421 let g:jm_vimrc.docs.mappings['\<Tab>'] =
| 422 \ 'Open Tagbar'
| 423 nnoremap <leader><tab> :TagbarToggle<cr>
| 424
| 425 let g:jm_vimrc.docs.mappings['<F10>'] =
| 426 \ 'Toggle paste'
| 427 set pastetoggle=<F10>
| 428
| 429 let g:jm_vimrc.docs.mappings['<F9>'] =
| 430 \ 'Toggle virtualedit=all'
| 431 nnoremap <F9> :let &ve = <C-r>=empty(&ve) ? '"all"' : '""'<cr><cr>
| 432
| 433 let g:jm_vimrc.docs.mappings['<C-r><C-f>'] =
| 434 \ '[modes:ic] Insert file name root'
| 435 inoremap <C-r><C-f> <C-r>=expand('%:p:t:r')<cr>
| 436 cnoremap <C-r><C-f> <C-r>=expand('%:p:t:r')<cr>
| 437
| 438 let g:jm_vimrc.docs.mappings['<C-r><C-t>'] =
| 439 \ '[modes:ic] Insert file name root'
| 440 inoremap <C-r><C-t> <C-r>=bss#blaze#BlazeTarget()<cr>
| 441 cnoremap <C-r><C-t> <C-r>=bss#blaze#BlazeTarget()<cr>
| 442
| 443 let g:jm_vimrc.docs.mappings['<C-p>'] =
| 444 \ 'Fuzzy-search PWD'
| 445 nnoremap <C-p> :Files<cr>
| 446
| 447 let g:jm_vimrc.docs.mappings['\w'] =
| 448 \ 'Clear search highlights (:nohlsearch)'
| 449 nnoremap <silent> <leader>w :nohlsearch<Bar>:echo<cr>
| 450
| 451 let g:jm_vimrc.docs.mappings['<F11>'] =
| 452 \ 'Ensure non-syntax toplevel text is spell-checked'
| 453 noremap <F11> :syntax spell toplevel<cr>
| 454 let g:jm_vimrc.docs.mappings['<F12>'] =
| 455 \ 'Toggle spell checking'
| 456 noremap <F12> :setlocal spell! spelllang=en_us<cr>
| 457
| 458 let g:jm_vimrc.docs.mappings['<Space>l'] =
| 459 \ 'Open Git ("Change [L]ist")'
| 460 nnoremap <leader>l :Git<cr>
| 461
| 462 let g:jm_vimrc.docs.mappings['<C-w><C-z>'] =
| 463 \ 'Set window height to 10 and fix the height'
| 464 nnoremap <C-w><C-z> :FixHeight 10<cr>
| 465 nnoremap <C-w>z :FixHeight 10<cr>
| 466
| 467 let g:jm_vimrc.docs.mappings['K'] =
| 468 \ 'Do grep for word under cursor'
| 469 nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
| 470
| 471 let g:jm_vimrc.docs.mappings['\\'] =
| 472 \ 'Show :tags'
| 473 nnoremap <leader><leader> :tags<cr>
| 474
| 475 let g:jm_vimrc.docs.mappings['\s'] =
| 476 \ 'Refresh UltSnips snippets'
| 477 nnoremap <leader>s :call UltiSnips#RefreshSnippets()<cr>
| 478
| 479 let g:jm_vimrc.docs.mappings['\<Space>'] =
| 480 \ 'Toggle foldcolumn'
| 481 nnoremap <leader><space> :let &l:foldcolumn = (&l:foldcolumn) ? 0 : 3<cr>
| 482
| 483 let g:jm_vimrc.docs.mappings['\a'] =
| 484 \ 'Trigger EasyAlign (See :Wtf ea)'
| 485 xmap <leader>a <Plug>(EasyAlign)
| 486 nmap <leader>a <Plug>(EasyAlign)
| 487
| 488 let g:jm_vimrc.docs.mappings['\O'] =
| 489 \ 'Run `open %`'
| 490 xmap <leader>O :<C-u>!open %<cr>
| 491 nmap <leader>O :<C-u>!open %<cr>
| 492
| 493 let g:jm_vimrc.docs.mappings["C-W !"] =
| 494 \ 'Toggle buflisted'
| 495 nnoremap <C-W>l :set buflisted!<cr>
| 496
| 497 nnoremap <space>c :YcmCompleter GetType<cr>
| 498 nnoremap <space>cq :YcmCompleter GoToDocumentOutline<cr>
| 499 nnoremap <space>cc :YcmCompleter GoToCallers<cr>
| 500 nnoremap <space>cC :YcmCompleter GoToDefinition<cr>
| 501 nnoremap <space>cf :YcmCompleter FixIt<cr>
| 502 nnoremap <space>cd :YcmCompleter GetDoc<cr>
| 503 nnoremap <space>ct :YcmCompleter GetType<cr>
| 504
| 505 let g:jm_vimrc.docs.mappings['\a[:(]'] =
| 506 \ 'Extra/overriden EasyAlign items'
| 507 let g:easy_align_delimiters = bss#extra#EasyAlignDelimiters()
| 508
| 509 let g:jm_vimrc.docs.mappings['\[0-9]'] =
| 510 \ 'Switch to buffer (from buftabline)'
| 511 nmap <leader>1 <Plug>BufTabLine.Go(1)
| 512 nmap <leader>2 <Plug>BufTabLine.Go(2)
| 513 nmap <leader>3 <Plug>BufTabLine.Go(3)
| 514 nmap <leader>4 <Plug>BufTabLine.Go(4)
| 515 nmap <leader>5 <Plug>BufTabLine.Go(5)
| 516 nmap <leader>6 <Plug>BufTabLine.Go(6)
| 517 nmap <leader>7 <Plug>BufTabLine.Go(7)
| 518 nmap <leader>8 <Plug>BufTabLine.Go(8)
| 519 nmap <leader>9 <Plug>BufTabLine.Go(9)
| 520 nmap <leader>0 <Plug>BufTabLine.Go(10)
| 521
522
+ - 523 +--221 lines: Commands:
523
| 524
| 525
| 526
| 527
| 528
| 529
| 530
| 531
| 532
| 533 if !exists('g:jm_term') || !exists('g:jm_terms')
| 534 let g:jm_term = bss#view#TermView()
| 535 let g:jm_terms = {}
| 536 endif
| 537 let g:jm_vimrc.docs.commands['Term'] =
| 538 \ 'Run a terminal command in a reused window'
| 539 command! -nargs=* -complete=shellcmd Term
| 540 \ eval g:jm_term.Run(<q-args>)
| 541
| 542 let g:jm_vimrc.docs.commands['Terms'] =
| 543 \ 'Run a terminal command in a reused named window. Terms [name] [cmd]...'
| 544 command! -nargs=* -complete=shellcmd Terms
| 545 \ eval bss#SetDefault(g:jm_terms, [<f-args>][0], {-> bss#view#TermView()})
| 546 \ .Run([<f-args>][1:]->join(' '))
| 547
| 548 let g:jm_vimrc.docs.commands['ReplaceR'] =
| 549 \ 'Locally set \r to run :Term with the specified command'
| 550 command! -nargs=+ ReplaceR
| 551 \ nnoremap <buffer> <localleader>r :Term <args><cr>
| 552
| 553 let g:jm_vimrc.docs.commands['ReplaceRTarget'] =
| 554 \ 'Set \r to bazel target of the current file'
| 555 command! -bar ReplaceRTarget
| 556 \ execute 'ReplaceR' BlazeGuessCommand()
| 557
| 558 let g:jm_vimrc.docs.commands['StopAllJobs'] =
| 559 \ 'Stop all running jobs'
| 560 command! -bar StopAllJobs eval job_info()->map('job_stop(v:val)')
| 561
| 562 let g:jm_vimrc.docs.commands['ListAllJobs'] =
| 563 \ 'List all running jobs'
| 564 command! -bar -bang ListAllJobs
| 565 \ call bss#PP(job_info()->filter('<bang>0 || (job_status(v:val) == "run")'))
| 566
| 567 let g:jm_vimrc.docs.commands['DumpAllJobs'] =
| 568 \ 'List job_infos for all running jobs'
| 569 command! -bar -bang DumpAllJobs
| 570 \ call bss#PP(job_info()->filter('<bang>0 || (job_status(v:val) == "run")')->map('job_info(v:val)'))
| 571
| 572 let g:jm_vimrc.docs.commands['SetupClasspath'] =
| 573 \ 'Set classpath to jm_vimrc.deps.ClasspathJarList()'
| 574 command! -bar SetupClasspath
| 575 \ let $CLASSPATH = join(g:jm_vimrc.deps.ClasspathJarList(), ':')
| 576
| 577 let g:jm_vimrc.docs.commands['SetupTargetClasspath'] =
| 578 \ 'Set classpath to blaze target included jars'
| 579 command! -bar SetupTargetClasspath
| 580 \ let $CLASSPATH = s:TargetClasspath()
| 581
| 582 let g:jm_vimrc.docs.commands['SetupCV'] =
| 583 \ 'Setup $LDFLAGS, $CFLAGS and &path for OpenCV development'
| 584 command! -bar SetupCV
| 585 \ let $LDFLAGS = '-lopencv_core -lopencv_imgcodecs -lopencv_imgproc' |
| 586 \ let $CFLAGS = '-I/usr/include/opencv4' |
| 587 \ let &path ..= ',/usr/include/opencv4,/usr/include/c++/10/'
| 588
| 589 let g:jm_vimrc.docs.commands['FixHeight'] =
| 590 \ 'Resize window and fix its height'
| 591 command! -nargs=1 FixHeight
| 592 \ resize <args> | set winfixheight
| 593
| 594 let g:jm_vimrc.docs.commands['SetupTermRainbow'] =
| 595 \ 'Add Rainbow-coloring to terminals'
| 596 command! -bar SetupTermRainbow
| 597 \ autocmd TerminalOpen * RainbowLoad
| 598
| 599 let g:jm_vimrc.docs.commands['SetupAutoread'] =
| 600 \ 'Enable autoread and add checktime autocmd'
| 601 command! -bar SetupAutoread
| 602 \ set autoread | autocmd FocusGained,BufEnter * checktime
| 603
| 604 let g:jm_vimrc.docs.commands['RemoveTrailingWhitespace'] =
| 605 \ 'Removes all trailing whitespace from the selected lines'
| 606 command! -range=% RemoveTrailingWhitespace
| 607 \ <line1>,<line2>s/\s\+$//
| 608
| 609 let g:jm_vimrc.docs.commands['SetupMatchHex'] =
| 610 \ 'Match hex numbers'
| 611 command! -bar SetupMatchHex
| 612 \ match GruvboxAqua /\<0x0*\zs[1-9a-f]\x*\>/
| 613
| 614 let g:jm_vimrc.docs.commands['SetupMatchNum'] =
| 615 \ 'Match decimal numbers'
| 616 command! -bar SetupMatchNum
| 617 \ match GruvboxAqua /\<\(0x\)\?0*\zs[1-9a-f]\x*\>/
| 618
| 619 let g:jm_vimrc.docs.commands['RefreshSnippets'] =
| 620 \ 'Refresh ultisnips'
| 621 command! -bar RefreshSnippets
| 622 \ call UltiSnips#RefreshSnippets()
| 623
| 624 let g:jm_vimrc.docs.commands['Dis'] =
| 625 \ 'Setup terminal for viewing objdump output ($ objdump -d ... | vim +Dis -)'
| 626 command! -bar Dis
| 627 \ setlocal ft=dis buftype=nofile
| 628
| 629 let g:jm_vimrc.docs.commands['Center'] =
| 630 \ 'Block alignment-preserving :center'
| 631 call bss#draw#block#RegisterCommands()
| 632
| 633 let g:jm_vimrc.docs.commands['ToggleFoldOpenSearch'] =
| 634 \ 'Toggle search on foldopen option'
| 635 command! ToggleFoldOpenSearch
| 636 \ if stridx(&foldopen, "search") == -1 |
| 637 \ set foldopen+=search |
| 638 \ echo "ENABLED foldopen search" |
| 639 \ else |
| 640 \ set foldopen-=search |
| 641 \ echo "DISABLED foldopen search" |
| 642 \ endif
| 643
| 644 let g:jm_vimrc.docs.commands['SetupMath'] =
| 645 \ 'Set up abbreviations for math symbols'
| 646 command! SetupMath
| 647 \ execute 'iabbrev <buffer> nn ∩' |
| 648 \ execute 'iabbrev <buffer> uu ∪' |
| 649 \ execute 'iabbrev <buffer> in ∈' |
| 650 \ execute 'iabbrev <buffer> ni ∉' |
| 651 \ execute 'iabbrev <buffer> ss ⊂' |
| 652 \ execute 'iabbrev <buffer> se ⊆' |
| 653 \ execute 'iabbrev <buffer> ns ⊄' |
| 654 \ execute 'iabbrev <buffer> AN ∧' |
| 655 \ execute 'iabbrev <buffer> OR ∨' |
| 656 \ execute 'iabbrev <buffer> es ∅' |
| 657 \ execute 'iabbrev <buffer> => ⇒' |
| 658 \ execute 'iabbrev <buffer> == ⇔' |
| 659 \ execute 'iabbrev <buffer> != ≠' |
| 660 \ execute 'iabbrev <buffer> co ∘' |
| 661 \ execute 'iabbrev <buffer> FA ∀' |
| 662 \ execute 'iabbrev <buffer> TE ∃' |
| 663 \ execute 'iabbrev <buffer> \|> ↦'
| 664
| 665 let g:jm_vimrc.docs.commands['PyHelp'] =
| 666 \ 'Look-up help for python expression (: PyHelp <pkg> <cls>)'
| 667 command! -nargs=+ -bang PyHelp
| 668 \ call py3eval((<bang>0) ? printf('help(%s)', <q-args>) : printf('help(__import__("%s").%s)', <f-args>))
| 669
| 670 let g:jm_vimrc.docs.commands['MakeOrSetup'] =
| 671 \ 'Run blaze, make, or create a Makefile with included commands (using ; as separator)'
| 672 command! -nargs=+ MakeOrSetup call s:MakeOrSetup(<q-args>)
| 673 function! s:MakeOrSetup(cmds) abort
| 674 if filereadable('WORKSPACE')
| 675 execute 'Term blaze build' BlazeTarget()
| 676 elseif filereadable('Makefile')
| 677 Term make
| 678 else
| 679 let l:cmds = substitute(a:cmds, '%', expand('%'), 'g')
| 680 let l:lines = split(l:cmds, ';')->map('trim(v:val)')
| 681 let l:cursor = bss#cursor#SaveWithBuf()
| 682 try
| 683 redir > Makefile
| 684 silent echo '.PHONY: all'
| 685 silent echo 'all:'
| 686 for l:cmd in l:lines
| 687 silent echo ' ' .. l:cmd
| 688 endfor
| 689 redir END
| 690 silent edit Makefile
| 691 Term make
| 692 finally
| 693 call l:cursor.Restore()
| 694 endtry
| 695 endif
| 696 endfunction
| 697
| 698 let g:jm_vimrc.docs.commands['SetupYcmClasspath'] =
| 699 \ 'Create .ycm_extra_conf.py with CLASSPATH'
| 700 command! -bang SetupYcmClasspath
| 701 \ call s:SetupYcmClasspath($CLASSPATH)
| 702 function! s:SetupYcmClasspath(classpath) abort
| 703 let l:classpath = split(a:classpath, ':')
| 704 let l:lines = s:GenerateYcm(l:classpath)
| 705 if filereadable('.ycm_extra_conf.py')
| 706 throw 'ERROR(FileExists): .ycm_extra_conf.py already exists!'
| 707 else
| 708 call writefile(l:lines, '.ycm_extra_conf.py')
| 709 YcmRestartServer
| 710 endif
| 711 endfunction
| 712 function! s:GenerateYcm(classpath) abort
| 713 let l:path = a:classpath
| 714 \->map('string(v:val)')
| 715 \->join(", ")
| 716 let l:lines =<< eval trim END
| 717 def Settings(**kwargs):
| 718 if kwargs["language"] == "java":
| 719 return {{
| 720 "ls": {{
| 721 "java.project.referencedLibraries": [{l:path}]
| 722 }}
| 723 }}
| 724 END
| 725 return l:lines
| 726 endfunction
| 727
| 728 let g:jm_vimrc.docs.commands['SetupOcamlformat'] =
| 729 \ 'Create a basic .ocamlformat'
| 730 command! SetupOcamlformat call s:SetupOcamlformat()
| 731 function! s:SetupOcamlformat() abort
| 732 if !filereadable('.ocamlformat')
| 733 call writefile(['profile = default'], '.ocamlformat')
| 734 endif
| 735 endfunction
| 736
| 737
| 738 if executable('ag')
| 739
| 740 set grepprg=ag\ --nogroup\ --nocolor\ --ignore=tags\ --vimgrep
| 741 set grepformat^=%f:%l:%c:%m
| 742 endif
| 743
744
+ - 745 +--273 lines: FT-Specific Settings:
745
| 746
| 747
| 748
| 749
| 750
| 751
| 752
| 753
| 754
| 755
| 756
| 757
| 758
| 759
| 760
| 761
| 762
| 763 augroup ft_latex
| 764 autocmd!
| 765 autocmd FileType tex setlocal nocursorline
| 766 autocmd FileType tex setlocal tabstop=4 shiftwidth=4
| 767 autocmd FileType tex nnoremap <buffer> <localleader>r
| 768 \ :execute 'Term fish -c "mkt ' .. expand('%') .. '"'<cr>
| 769 augroup END
| 770
| 771 augroup ft_dot
| 772 autocmd!
| 773 autocmd FileType dot setlocal tabstop=2 shiftwidth=2
| 774 autocmd FileType dot nnoremap <buffer> <localleader>r
| 775 \ :execute 'Term dot -T svg -O' expand('%') <cr>
| 776 augroup END
| 777
| 778 augroup ft_c
| 779 autocmd!
| 780 autocmd FileType c setlocal tabstop=2 shiftwidth=2
| 781 autocmd FileType c setlocal foldmethod=syntax
| 782 autocmd FileType c nnoremap <buffer> <localleader>r
| 783 \ :Term make<CR>
| 784 autocmd FileType c nnoremap <buffer> <localleader>R
| 785 \ :MakeOrSetup gcc -Wall -O3 -o a.out %; ./a.out; rm a.out<cr>
| 786 augroup END
| 787
| 788
| 789 augroup ft_cc
| 790 autocmd!
| 791 autocmd FileType cpp setlocal tabstop=2 shiftwidth=2
| 792 autocmd FileType cpp setlocal foldmethod=syntax
| 793 autocmd FileType cpp nnoremap <buffer> <localleader>t
| 794 \ :term <C-r>=BlazeGuessCommand()<CR>
| 795 autocmd FileType cpp nnoremap <buffer> <localleader>r
| 796 \ :MakeOrSetup
| 797 \ clang++-12 -std=c++17 $(CFLAGS) -o build % $(LDFLAGS);
| 798 \ ./build<CR>
| 799 autocmd FileType cpp nnoremap <buffer> <space>f
| 800 \ :FormatCode<CR>
| 801 autocmd FileType cpp
| 802 \ if exists('g:jm_setup_cpp_cv') |
| 803 \ SetupCV |
| 804 \ endif
| 805 autocmd FileType cpp
| 806 \ if expand('%:p') =~ '/home/jmend/pg' |
| 807 \ silent ReplaceRTarget |
| 808 \ endif
| 809 augroup END
| 810
| 811 augroup ft_gdb
| 812 autocmd!
| 813 autocmd FileType gdb nnoremap <buffer> <localleader>r
| 814 \ :execute 'Term gdb -q -x' expand('%')<cr>
| 815 augroup END
| 816
| 817 augroup ft_python
| 818 autocmd!
| 819 autocmd FileType python command! RunPython
| 820 \ execute "Term" g:jm_vimrc.deps.python expand('%')
| 821 autocmd FileType python command! RunPythonTests
| 822 \ execute "Term" g:jm_vimrc.deps.python "-m pytest" expand('%')
| 823 autocmd FileType python command! RunPythonTypechecks
| 824 \ execute "Term" g:jm_vimrc.deps.python "-m mypy --ignore-missing-imports --follow-imports=skip " expand("%")
| 825 autocmd FileType python command! RunPythonMPL
| 826 \ StopAllJobs | eval timer_start(0, {-> execute('RunPython')})
| 827 autocmd FileType python nnoremap <buffer> <localleader>r
| 828 \ :RunPython<cr>
| 829 autocmd FileType python nnoremap <buffer> <localleader>R
| 830 \ :RunPythonTests<cr>
| 831 autocmd FileType python nnoremap <buffer> <localleader>t
| 832 \ :RunPythonTypechecks<cr>
| 833 autocmd FileType python nnoremap <buffer> <space>f
| 834 \ :FormatCode<CR>
| 835
| 836 autocmd BufNewFile .ycm_extra_conf.py call setline('.', [
| 837 \ 'def Settings(**kwargs):',
| 838 \ ' if kwargs["language"] == "java":',
| 839 \ ' return {',
| 840 \ ' "ls": {',
| 841 \ ' "java.project.referencedLibraries": ["~/.jars/*.jar"]',
| 842 \ ' }',
| 843 \ ' }',
| 844 \ ])
| 845
| 846
| 847 augroup END
| 848
| 849 augroup ft_scheme
| 850 autocmd!
| 851 autocmd FileType scheme setlocal colorcolumn=79
| 852 autocmd FileType scheme let g:lisp_rainbow = v:true
| 853 autocmd FileType scheme nnoremap <buffer> <localleader>r
| 854 \ :w<CR> :Term mit-scheme --load % <CR>
| 855 augroup END
| 856
| 857 augroup ft_java
| 858 autocmd!
| 859 autocmd FileType java
| 860 \ setlocal tabstop=2 softtabstop=2 tabstop=2 shiftwidth=2 smarttab
| 861 autocmd FileType java
| 862 \ setlocal foldmethod=marker foldmarker={,}
| 863 autocmd FileType java nnoremap <space>f :FormatCode<cr>
| 864 autocmd FileType java nnoremap <space>F :set bt=nowrite <bar> FormatCode<cr>
| 865 autocmd FileType java vnoremap <space>f :FormatLines<cr>
| 866 if filereadable('Makefile')
| 867 autocmd FileType java nnoremap <silent> <buffer> <localleader>r
| 868 \ :Term make<cr>
| 869 elseif filereadable('WORKSPACE')
| 870 autocmd FileType java nnoremap <silent> <buffer> <localleader>r
| 871 \ :execute "Term blaze run " .. join(<SID>BlazeTargets(expand("%")), " ")<cr>
| 872 elseif filereadable('gradlew')
| 873 autocmd FileType java nnoremap <silent> <buffer> <localleader>r
| 874 \ :Term ./gradlew test --rerun<cr>
| 875 else
| 876 autocmd FileType java nnoremap <silent> <buffer> <localleader>r
| 877 \ :MakeOrSetup java %<cr>
| 878 endif
| 879 autocmd FileType java nnoremap <silent> <buffer> <localleader>R
| 880 \ :Term ./gradlew run<cr>
| 881 autocmd FileType java let b:surround_99 = "{@code \r}"
| 882 augroup END
| 883
| 884 augroup ft_kotlin
| 885 autocmd!
| 886 autocmd FileType kotlin
| 887 \ setlocal tabstop=2 softtabstop=2 tabstop=2 shiftwidth=2 smarttab
| 888 if filereadable('Makefile')
| 889 autocmd FileType kotlin nnoremap <silent> <buffer> <localleader>r
| 890 \ :Term make<cr>
| 891 elseif filereadable('gradlew')
| 892 autocmd FileType kotlin nnoremap <silent> <buffer> <localleader>r
| 893 \ :Term ./gradlew test --rerun<cr>
| 894 else
| 895 autocmd FileType kotlin nnoremap <silent> <buffer> <localleader>r
| 896 \ :MakeOrSetup ./gradlew run %<cr>
| 897 endif
| 898 autocmd FileType kotlin nnoremap <silent> <buffer> <localleader>R
| 899 \ :Term ./gradlew run<cr>
| 900 augroup END
| 901
| 902 augroup ft_jar
| 903 autocmd!
| 904 autocmd FileType jar
| 905 \ call zip#Browse(expand("<amatch>"))
| 906 autocmd FileType jar
| 907 \ setlocal buflisted
| 908 augroup END
| 909
| 910 augroup ft_class
| 911 autocmd!
| 912 autocmd BufReadCmd *.class
| 913 \ call bss#java#javap#Browse(expand("<amatch>"))
| 914 augroup END
| 915
| 916 augroup ft_javascript
| 917 autocmd!
| 918 autocmd FileType javascript
| 919 \ setlocal tabstop=2 softtabstop=2 tabstop=2 smarttab
| 920 autocmd FileType javascript nnoremap <buffer> <localleader>r
| 921 \ :execute "Term node " .. expand('%')<cr>
| 922 autocmd FileType javascript nnoremap <buffer> <localleader>R
| 923 \ :Term webpack<CR>
| 924 autocmd FileType javascript nnoremap <buffer> <space>f
| 925 \ :FormatCode<CR>
| 926 augroup END
| 927
| 928 augroup ft_markdown
| 929 autocmd!
| 930 autocmd FileType markdown set textwidth=72 smartindent autoindent
| 931 autocmd FileType markdown set cinwords+=:
| 932
| 933 autocmd FileType markdown nnoremap <buffer> ]h :<c-u>call search('\v^#+ ', 'Wz')<cr>
| 934 autocmd FileType markdown nnoremap <buffer> [h :<c-u>call search('\v^#+ ', 'bWz')<cr>
| 935
| 936
| 937
| 938 autocmd FileType markdown command! SetupR nnoremap <buffer> <localleader>r
| 939 \ :call execute(printf(
| 940 \ "Term pandoc %s -s --highlight-style kate --pdf-engine=xelatex -o %s.pdf",
| 941 \ expand('%:p'),
| 942 \ expand('%:t:r'),
| 943 \ ))<cr>
| 944
| 945 autocmd FileType markdown command! JmMdQuotesAsComments match GruvboxFg3 /^\s*>.*/
| 946
| 947 if !exists('g:bss_markdown_fix') || !g:bss_markdown_fix
| 948
| 949
| 950 autocmd FileType markdown syntax clear markdownCodeBlock
| 951 autocmd FileType markdown syntax region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\).*$" end="^\s*\z1\ze\s*$" keepend
| 952 autocmd FileType markdown syntax region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\).*$" end="^\s*\z1\ze\s*$" keepend
| 953
| 954
| 955 autocmd FileType markdown highlight link markdownH1 GruvboxRedBold
| 956 autocmd FileType markdown highlight link markdownH2 GruvboxBlueBold
| 957 autocmd FileType markdown highlight link markdownH3 GruvboxGreenBold
| 958 autocmd FileType markdown highlight link markdownH4 GruvboxPurpleBold
| 959
| 960
| 961 autocmd FileType markdown highlight link markdownBold GruvboxFg4
| 962 autocmd FileType markdown highlight link markdownBoldDelimiter GruvboxFg4
| 963 autocmd FileType markdown highlight link markdownItalic GruvboxFg2
| 964 autocmd FileType markdown highlight link markdownItalicDelimiter GruvboxFg2
| 965 endif
| 966 augroup END
| 967
| 968 augroup ft_vim
| 969 autocmd!
| 970 autocmd FileType vim setlocal foldmethod=marker shiftwidth=2
| 971 autocmd FileType vim nnoremap <buffer> <localleader>r
| 972 \ :source %<cr>
| 973 autocmd FileType vim nnoremap K :help <C-r><C-w><CR>
| 974 augroup END
| 975
| 976 augroup ft_fish
| 977 autocmd!
| 978 autocmd FileType fish setlocal tabstop=4 shiftwidth=4 smartindent
| 979 autocmd FileType fish nnoremap <buffer> <space>f
| 980 \ :0,$!fish_indent<cr>
| 981 autocmd FileType fish setlocal omnifunc=bss#fish#Complete
| 982 augroup END
| 983
| 984 augroup ft_make
| 985 autocmd!
| 986 autocmd FileType make nnoremap <buffer> <localleader>r
| 987 \ :Term make<cr>
| 988 augroup END
| 989
| 990 augroup ft_ocaml
| 991 autocmd!
| 992 autocmd FileType ocaml
| 993 \ setlocal tabstop=2 softtabstop=2 tabstop=2 smarttab
| 994 autocmd FileType ocaml nnoremap <space>f :FormatCode<cr>
| 995 autocmd FileType ocaml vnoremap <space>f :FormatLines<cr>
| 996 if filereadable('Makefile')
| 997 autocmd FileType ocaml nnoremap <silent> <buffer> <localleader>r
| 998 \ :Term make<cr>
| 999 elseif filereadable('dune-project')
| 1000 autocmd FileType ocaml nnoremap <silent> <buffer> <localleader>r
| 1001 \ :Term dune build<cr>
| 1002 else
| 1003 autocmd FileType ocaml nnoremap <silent> <buffer> <localleader>r
| 1004 \ :execute 'Term ocaml' expand("%")<cr>
| 1005 endif
| 1006 if isdirectory('/usr/bin/ocaml')
| 1007 autocmd FileType ocaml set path+=/usr/lib/ocaml
| 1008 endif
| 1009 augroup END
| 1010
| 1011
| 1012 augroup cfg_quickfix_fix
| 1013 autocmd QuickFixCmdPost [^l]* nested cwindow
| 1014 autocmd QuickFixCmdPost l* nested lwindow
| 1015 augroup end
| 1016
| 1017
1018
+ - 1019 +--525 lines: Misc:
1019
| 1020
| 1021
| 1022
| 1023
| 1024
| 1025
| 1026
| 1027
|+ |- 1028 +--- 94 lines:
1028
|| 1029 let g:jm_vimrc.docs.commands['FindImport'] =
|| 1030 \ 'Given a name, find the corresponding import and add an import statment'
|| 1031 nnoremap <space>t :call <SID>FindImport(expand('<cword>'))<CR>
|| 1032 command -nargs=1 FindImport call <SID>FindImport(<q-args>)
|| 1033 function! s:FindImport(word) abort
|| 1034
|| 1035 if &filetype ==# 'cpp'
|| 1036 let l:res = g:jm_vimrc.cc_import_cache
|| 1037 \->copy()
|| 1038 \->filter({incl, names -> index(names, a:word) != -1})
|| 1039 \->keys()
|| 1040 \->map({k, incl -> printf("#include %s", incl)})
|| 1041 if len(l:res) == 0
|| 1042 echo "FindImport: `" .. a:word .. "` not found!"
|| 1043 elseif len(l:res) > 1
|| 1044 call maktaba#ui#selector#Create(l:res)
|| 1045 \.WithMappings({'<cr>': [function("s:AddImportCpp")->get("name"), 'Close', 'Add import']})
|| 1046 \.Show()
|| 1047 else
|| 1048 call s:AddImportCpp(l:res[0])
|| 1049 endif
|| 1050 return
|| 1051 endif
|| 1052
|| 1053 if &filetype !=# 'java'
|| 1054 throw 'ERROR(InvalidFiletype)'
|| 1055 return
|| 1056 endif
|| 1057
|| 1058
|| 1059 if (has_key(g:jm_vimrc.java_import_cache, a:word))
|| 1060 call s:AddOrSelectImport(get(g:jm_vimrc.java_import_cache, a:word)->mapnew({_, w -> printf('import %s;', w)}))
|| 1061 return
|| 1062 endif
|| 1063
|| 1064
|| 1065 let l:results = printf(
|| 1066 \ '%s --nofilename --nobreak %s',
|| 1067 \ g:jm_vimrc.deps.ag,
|| 1068 \ shellescape(printf('import .+\b%s\b;', a:word)))
|| 1069 \->systemlist()
|| 1070 \->sort()
|| 1071 \->uniq()
|| 1072
|| 1073
|| 1074 if empty(l:results)
|| 1075 let l:results = g:jm_vimrc.deps.JavaClassnameList()
|| 1076 \->filter('v:val =~# a:word')
|| 1077 \->map('"import " .. v:val .. ";"')
|| 1078 endif
|| 1079
|| 1080 call s:AddOrSelectImport(l:results)
|| 1081 endfunction
|| 1082
|| 1083 function! s:AddOrSelectImport(options) abort
|| 1084 if len(a:options) == 1
|| 1085 call s:AddImport(a:options[0])
|| 1086 elseif len(a:options) > 1
|| 1087 call maktaba#ui#selector#Create(a:options)
|| 1088 \.WithMappings({'<cr>': [function("s:AddImport")->get("name"), 'Close', 'Add import']})
|| 1089 \.Show()
|| 1090 endif
|| 1091 endfunction
|| 1092
|| 1093 function! s:AddImport(import) abort
|| 1094 let l:result = search(a:import, 'nw')
|| 1095 if l:result == 0
|| 1096 let l:start = search('^import', 'nw')
|| 1097 if l:start == 0
|| 1098 let l:start = search('^package', 'nw')
|| 1099 call append(l:start, [""])
|| 1100 let l:start += 1
|| 1101 endif
|| 1102 call append(l:start, [a:import])
|| 1103
|| 1104 echom "Adding: " .. a:import
|| 1105 else
|| 1106 echom "Already Present: " .. a:import
|| 1107 endif
|| 1108 endfunction
|| 1109
|| 1110 function! s:AddImportCpp(import) abort
|| 1111 let l:result = search(a:import, 'nw')
|| 1112 if l:result == 0
|| 1113 let l:start = search('^#include', 'nw')
|| 1114 call append(l:start, [a:import])
|| 1115
|| 1116 echom "Adding: " .. a:import
|| 1117 else
|| 1118 echom "Already Present: " .. a:import
|| 1119 endif
|| 1120 endfunction
|| 1121
| 1122
| 1123
| 1124
|+ |- 1125 +--- 40 lines:
1125
|| 1126 let g:jm_vimrc.docs.commands['Javap'] =
|| 1127 \ 'Execute Javap and show output with highlighting'
|| 1128 command! -nargs=? -complete=customlist,<SID>JavapComplete -bang
|| 1129 \ Javap call <SID>Javap(<q-args>, "<bang>" ==# '!')
|| 1130 function! s:Javap(arg, search) abort
|| 1131 if empty($CLASSPATH)
|| 1132 SetupClasspath
|| 1133 endif
|| 1134
|| 1135
|| 1136 let l:cls = empty(a:arg) ? @" : a:arg
|| 1137 let l:cls = substitute(l:cls, '\(;\|<.\+>\)', '', 'ga')
|| 1138
|| 1139 if a:search
|| 1140 let l:results = s:JavapComplete(l:cls, v:none, v:none)
|| 1141 if len(l:results) == 1
|| 1142 let l:cls = l:results[0]
|| 1143 else
|| 1144 call maktaba#ui#selector#Create(l:results)
|| 1145 \.WithMappings({'<cr>': [function("s:JavapOpen")->get("name"), 'Close', 'Open window']})
|| 1146 \.Show()
|| 1147 return
|| 1148 endif
|| 1149 endif
|| 1150
|| 1151 eval g:jm_term
|| 1152 \.Run(join([g:jm_vimrc.deps.javap, l:cls], ' '))
|| 1153 \.Exec('set ft=java')
|| 1154 endfunction
|| 1155
|| 1156 function! s:JavapComplete(arg_lead, cmd_line, cursor_pos) abort
|| 1157 return g:jm_vimrc.deps.JavaClassnameList()
|| 1158 \->filter('v:val =~# a:arg_lead')
|| 1159 endfunction
|| 1160
|| 1161 function! s:JavapOpen(cls) abort
|| 1162 execute 'Javap ' .. a:cls
|| 1163 endfunction
|| 1164
| 1165
| 1166
| 1167
| 1168
|+ |- 1169 +--- 62 lines:
1169
|| 1170 let g:jm_vimrc.docs.commands['MavenSearch'] =
|| 1171 \ 'Search maven, then either add a dependecy or download the jar'
|| 1172 command! -nargs=1 MavenSearch call <SID>MavenSearch(<q-args>)
|| 1173 command! -nargs=1 M MavenSearch <args>
|| 1174 function! s:MavenSearch(query) abort
|| 1175 const l:query_url = printf(
|| 1176 \ 'https://search.maven.org/solrsearch/select?q=%s&rows=20&wt=json',
|| 1177 \ a:query)
|| 1178
|| 1179 const l:query_cmd = join([
|| 1180 \ g:jm_vimrc.deps.curl,
|| 1181 \ '-s',
|| 1182 \ printf('"%s"', l:query_url),
|| 1183 \ ])
|| 1184
|| 1185 let l:msg = system(l:query_cmd)
|| 1186 let l:resp = json_decode(l:msg).response
|| 1187
|| 1188 if l:resp.numFound == 0
|| 1189 echom "None found!"
|| 1190 return
|| 1191 endif
|| 1192 let l:docs = l:resp.docs
|| 1193 const l:mappings = {
|| 1194 \ '<cr>': [function("s:MInsert")->get("name"), 'Close', 'Insert below'],
|| 1195 \ 'D': [function("s:MDownload")->get("name"), 'Close', 'Insert below'],
|| 1196 \ }
|| 1197 call maktaba#ui#selector#Create(map(l:docs, 'v:val.id .. ":" .. v:val.latestVersion'))
|| 1198 \.WithMappings(l:mappings)
|| 1199 \.Show()
|| 1200 endfunction
|| 1201
|| 1202 function! s:MInsert(msg) abort
|| 1203 let l:spaces = getline('.')->matchstr('^\s*')
|| 1204 call append(line('.'), printf("%simplementation '%s'", l:spaces, a:msg))
|| 1205 endfunction
|| 1206
|| 1207 function! s:MDownload(msg) abort
|| 1208 let [l:package, l:name, l:version] = split(a:msg, ':')
|| 1209 let l:url_package = substitute(l:package, '\.', '/', 'g')
|| 1210 let l:url = printf('https://repo1.maven.org/maven2/%s/%s/%s/',
|| 1211 \ l:url_package,
|| 1212 \ l:name,
|| 1213 \ l:version)
|| 1214 let l:file = printf('%s-%s.jar', l:name, l:version)
|| 1215 let l:file_url = l:url .. l:file
|| 1216 echom l:url .. l:file
|| 1217
|| 1218 const l:cmd = join([
|| 1219 \ g:jm_vimrc.deps.curl,
|| 1220 \ '-o',
|| 1221 \ shellescape(l:file),
|| 1222 \ '-s',
|| 1223 \ shellescape(l:file_url),
|| 1224 \ ])
|| 1225 silent call system(l:cmd)
|| 1226 if v:shell_error
|| 1227 echom 'ERROR: Could not download! ' .. l:file_url
|| 1228 endif
|| 1229 endfunction
|| 1230
| 1231
| 1232
| 1233
| 1234
| 1235
| 1236
| 1237
| 1238
| 1239
| 1240
| 1241
| 1242
| 1243
| 1244
| 1245
| 1246
|+ |- 1247 +--- 69 lines:
1247
|| 1248 function! s:BlazeTargets(fname) abort
|| 1249 let l:query = printf(
|| 1250 \ 'same_pkg_direct_rdeps(%s)',
|| 1251 \ fnamemodify(a:fname, ":p:."),
|| 1252 \ )
|| 1253
|| 1254 let l:command = printf(
|| 1255 \ "%s query '%s'",
|| 1256 \ g:jm_vimrc.deps.blaze,
|| 1257 \ l:query,
|| 1258 \ )
|| 1259 return filter(systemlist(l:command), 'v:val =~# "^//"')
|| 1260 endfunction
|| 1261
|| 1262 function! BlazeGuessCommand(show = v:false) abort
|| 1263 let l:fname = expand('%:p')
|| 1264
|| 1265 let l:target = BlazeTarget()
|| 1266 if l:target ==# "???"
|| 1267 echom "Can't find blaze target!"
|| 1268 return "false"
|| 1269 endif
|| 1270
|| 1271 let l:action = 'build'
|| 1272 if l:fname =~# '\v(_test.cc|Test.java)$' || l:target =~# '\v(_test|Test)$'
|| 1273 let l:action = 'test'
|| 1274 elseif l:fname =~# '\v(main.cc|_bin.cc|Bin.java)$' || l:target =~# '\v(_bin|Bin|main|Main)$'
|| 1275 let l:action = 'run'
|| 1276 elseif l:fname =~# '\v(_bench.cc)$' || l:target =~# '\v(_bench)$'
|| 1277 let l:action = 'run -c opt'
|| 1278 endif
|| 1279
|| 1280 let l:command = printf(
|| 1281 \ "%s %s %s",
|| 1282 \ g:jm_vimrc.deps.blaze,
|| 1283 \ l:action,
|| 1284 \ l:target,
|| 1285 \ )
|| 1286 if a:show
|| 1287 echom 'Using:' l:command
|| 1288 endif
|| 1289 return l:command
|| 1290 endfunction
|| 1291
|| 1292 function! BlazeTarget() abort
|| 1293 return get(s:BlazeTargets(expand('%:p')), 0, "???")
|| 1294 endfunction
|| 1295
|| 1296 function! s:TargetClasspath() abort
|| 1297 let l:target = BlazeTarget()
|| 1298 if l:target ==# "???"
|| 1299 echom "Can't find blaze target!"
|| 1300 return ""
|| 1301 endif
|| 1302
|| 1303 let l:lines = systemlist(printf('blaze print_action "%s"', l:target))
|| 1304 let l:jars = filter(l:lines, {_, v -> v =~# '^\s\+\(outputjar\|classpath\): "[^"]*"'})
|| 1305 \->map({_, v -> matchlist(v, '"\([^"]*\)"')[1]})
|| 1306 return join(l:jars, ':')
|| 1307 endfunction
|| 1308
|| 1309 function! s:CompleteTargets(arg_lead, cmd_line, cursor_pos) abort
|| 1310 if a:arg_lead =~ '^//.*'
|| 1311 return systemlist(printf('%s query ... 2>&1', g:jm_vimrc.deps.blaze))
|| 1312 \->filter('v:val =~# "' .. a:arg_lead .. '"')
|| 1313 endif
|| 1314 endfunction
|| 1315
| 1316
| 1317
| 1318
|+ |- 1319 +--- 16 lines:
1319
|| 1320 let g:jm_vimrc.docs.commands['Touch'] =
|| 1321 \ 'Create files and directories'
|| 1322 command! -nargs=* Touch call s:Touch([<f-args>])
|| 1323 function! s:Touch(paths) abort
|| 1324 for l:path in a:paths
|| 1325 let l:dir = fnamemodify(l:path, ':h')
|| 1326 if l:dir !=# '.' && !isdirectory(l:dir)
|| 1327 call system('mkdir -p ' .. shellescape(l:dir))
|| 1328 endif
|| 1329 if !filereadable(l:path)
|| 1330 call system('touch ' .. shellescape(l:path))
|| 1331 endif
|| 1332 endfor
|| 1333 endfunction
|| 1334
| 1335
| 1336
| 1337
|+ |- 1338 +--- 8 lines:
1338
|| 1339 let g:jm_vimrc.docs.commands['CurrentHLGroup'] =
|| 1340 \ 'Echo name of the highlight group under the cursor'
|| 1341 command! CurrentHLGroup echo s:SyntaxItem()
|| 1342 function! s:SyntaxItem()
|| 1343 return synIDattr(synID(line("."), col("."), 1), "name")
|| 1344 endfunction
|| 1345
| 1346
| 1347
| 1348
| 1349
| 1350
| 1351
|+ |- 1352 +--- 9 lines:
1352
|| 1353 function! s:Async(Fn)
|| 1354 eval timer_start(0, a:Fn)
|| 1355 endfunction
|| 1356
|| 1357 function! s:AsyncExec(...)
|| 1358 eval s:Async({-> execute(join(map(a:000, function('string'))))})
|| 1359 endfunction
|| 1360
| 1361
| 1362
| 1363
|+ |- 1364 +--- 17 lines:
1364
|| 1365 let g:jm_vimrc.docs.commands['ConcealK'] =
|| 1366 \ 'Define conceal rules: eg. ConcealK lambda:λ'
|| 1367 command! -complete=expression -nargs=1 ConcealK call <SID>ConcealK(<q-args>)
|| 1368 function! s:ConcealK(repl_str) abort
|| 1369 let l:repl = {}
|| 1370 let l:i = 0
|| 1371 for [l:keyword, l:replacement] in split(a:repl_str, ' ')->map('v:val->split(":")')
|| 1372 let l:i += 1
|| 1373 execute 'syntax keyword'
|| 1374 \ printf('ConcealK%03d', l:i) l:keyword
|| 1375 \ 'conceal' printf('cchar=%s', l:replacement)
|| 1376 endfor
|| 1377 setlocal conceallevel=1
|| 1378 setlocal concealcursor=ni
|| 1379 endfunction
|| 1380
| 1381
| 1382
| 1383
|+ |- 1384 +--- 5 lines:
1384
|| 1385 let g:jm_vimrc.docs.commands['ReadExecute'] =
|| 1386 \ 'Execute then read the output of that vim command'
|| 1387 command! -nargs=* -complete=command ExecuteRead eval append(line('.'), execute(<q-args>)->split("\n"))
|| 1388
| 1389
| 1390
| 1391
|+ |- 1392 +--- 9 lines:
1392
|| 1393 let g:jm_vimrc.docs.commands['Bdz'] =
|| 1394 \ 'Run buildozer on current target (or :__pkg__ if none exists)'
|| 1395 command! -nargs=* Bdz echom
|| 1396 \ system(printf("fish -c \"buildozer '%s' %s\"",
|| 1397 \ join([<f-args>], ' '),
|| 1398 \ BlazeTarget() != '???' ? BlazeTarget() : ':__pkg__'
|| 1399 \ ))
|| 1400
| 1401
| 1402
| 1403 "format:`cmd`""format: END"
|+ |- 1404 +--- 38 lines:
1404
|| 1405 let g:jm_vimrc.docs.commands['JemFormat'] =
|| 1406 \ 'Format lines between "format:`cmd`" to "format: END"'
|| 1407 command! -nargs=* -complete=customlist,<SID>JemFormatComplete JemFormat eval s:JemFormat[<q-args>]()
|| 1408 let s:JemFormat = {
|| 1409 \ '' : {-> s:JemFormat.format()},
|| 1410 \ 'help' : {-> bss#PP(s:JemFormat, v:true)},
|| 1411 \ }
|| 1412 function! s:JemFormatComplete(arglead, cmdline, curpos) abort
|| 1413 return keys(s:JemFormat)->filter({k, v -> !stridx(v, a:arglead)})
|| 1414 endfunction
|| 1415
|| 1416 function! s:JemFormat.format() abort dict
|| 1417 let command = self.find()
|| 1418 if !empty(command)
|| 1419 silent execute command
|| 1420 endif
|| 1421 endfunction
|| 1422
|| 1423 function! s:JemFormat.find() abort dict
|| 1424 let [_, num, col; _] = getcurpos()
|| 1425 let start_pat = '\v.*for' .. 'mat: `([^`]+)`.*'
|| 1426 let end_pat = '\v.*for' .. 'mat: END.*'
|| 1427 let start_lines = matchbufline(bufnr(), start_pat, 1, num)
|| 1428 let start_line = bss#Last(start_lines)
|| 1429 let end_line = start_line
|| 1430 \->bss#Get('lnum')
|| 1431 \->bss#Apply({l -> matchbufline(bufnr(), end_pat, l, '$')})
|| 1432 \->bss#Apply('bss#Last')
|| 1433 \->bss#Or('$')
|| 1434 if start_line is v:none
|| 1435 return ''
|| 1436 endif
|| 1437 let range = [start_line.lnum + 1, end_line.lnum - 1]->join(',')
|| 1438 let command = substitute(start_line.text, start_pat, '\1', '')
|| 1439 return join([range, command], ' ')
|| 1440 endfunction
|| 1441
| 1442
| 1443
| 1444
| 1445
| 1446
| 1447
| 1448
| 1449
|+ |- 1450 +--- 50 lines:
1450
|| 1451 command! -nargs=1 -complete=file SetupAppendMarkdownBlock
|| 1452 \ nnoremap <buffer> \r :AppendMarkdownBlock <args><cr>
|| 1453 command! -nargs=1 -complete=file -range=% AppendMarkdownBlock
|| 1454 \ eval AppendMarkdownBlock(<q-args>, <line1>, <line2>)
|| 1455 command! -nargs=1 -complete=file AppendMarkdownBlockDebug
|| 1456 \ eval AppendMarkdownBlock(<q-args>, 0, '$', v:true)
|| 1457
|| 1458 function! AppendMarkdownBlock(fname, begin=0, end='$', debug=v:false) abort
|| 1459 let lines = getline(a:begin, a:end)->s:Markdown_lines2codeblock()
|| 1460 if !a:debug
|| 1461 call s:AppendMarkdownBlock_write(a:fname, lines)
|| 1462 else
|| 1463 call s:AppendMarkdownBlock_dump(a:fname, lines)
|| 1464 endif
|| 1465 endfunction
|| 1466
|| 1467
|| 1468
|| 1469
|| 1470 function! s:Markdown_lines2codeblock(lines) abort
|| 1471 let prefix = '```'
|| 1472 let suffix = prefix
|| 1473 return [prefix] + a:lines + [suffix]
|| 1474 endfunction
|| 1475
|| 1476
|| 1477
|| 1478
|| 1479
|| 1480 function! s:AppendMarkdownBlock_write(fname, lines) abort
|| 1481 let prefix = (readfile(a:fname)->bss#Last()->empty())
|| 1482 \ ? [] : [""]
|| 1483 call writefile(prefix + a:lines, a:fname, 'a')
|| 1484 echom "Wrote file" a:fname
|| 1485 endfunction
|| 1486
|| 1487
|| 1488
|| 1489
|| 1490 function! s:AppendMarkdownBlock_dump(fname, lines) abort
|| 1491
|| 1492 echo 'fname:' a:fname
|| 1493 echo 'lines:'
|| 1494 echo
|| 1495 for l in a:lines
|| 1496 echo ' ' .. l
|| 1497 endfor
|| 1498 endfunction
|| 1499
| 1500
| 1501
| 1502
|+ |- 1503 +--- 17 lines:
1503
|| 1504 command! -nargs=? -complete=customlist,s:SetupSlimeTarget_Complete SetupSlimeTarget call s:SetupSlimeTarget(<q-args>)
|| 1505 let s:SlimeTargets = [
|| 1506 \ 'tmux',
|| 1507 \ 'vimterminal',
|| 1508 \ ]
|| 1509 function! s:SetupSlimeTarget(arg) abort
|| 1510 if empty(a:arg)
|| 1511 echom printf('Current slime target: %s', g:slime_target)
|| 1512 else
|| 1513 let g:slime_target = a:arg
|| 1514 endif
|| 1515 endfunction
|| 1516 function! s:SetupSlimeTarget_Complete(arg, ...) abort
|| 1517 return s:SlimeTargets->filter('stridx(v:val, a:arg) == 0')
|| 1518 endfunction
|| 1519
| 1520
| 1521 function! Layout() abort
| 1522 let layout = winlayout()
| 1523 return s:InvertLayout(layout)
| 1524 endfunction
| 1525 function! s:InvertLayout(l, path=[]) abort
| 1526 if len(a:l) != 2
| 1527 throw "ERROR(InvalidArguments): s:InvertLayout expects only 2-element lists"
| 1528 endif
| 1529 let [kind, val] = a:l
| 1530 if kind ==# 'leaf'
| 1531 return {val: join(a:path, '')}
| 1532 elseif kind ==# 'col'
| 1533 return val
| 1534 \->map('s:InvertLayout(v:val, a:path + ["|"])')
| 1535 \->reduce({a, b -> extend(a, b)})
| 1536 elseif kind ==# 'row'
| 1537 return val
| 1538 \->map('s:InvertLayout(v:val, a:path + ["-"])')
| 1539 \->reduce({a, b -> extend(a, b)})
| 1540 endif
| 1541 endfunction
| 1542
| 1543
1544
+ - 1545 +-- 5 lines: Notes
1545
| 1546 let s:Wtf = bss#wtf#Initialize()
| 1547 call bss#wtf#AddDict(['mappings', 'm'], g:jm_vimrc.docs.mappings)
| 1548 call bss#wtf#AddDict(['commands', 'c'], g:jm_vimrc.docs.commands)
| 1549
1550
1551
1552
1553
1554 TODO
+ - 1555 +--271 lines: Java Import Cache:
1555
| 1556 let g:jm_vimrc.java_import_list =<< JAVA_IMPORT_LIST_END
| 1557 com.google.auto.common.AnnotationMirrors
| 1558 com.google.auto.common.AnnotationValues
| 1559 com.google.auto.common.BasicAnnotationProcessor
| 1560 com.google.auto.common.MoreElements
| 1561 com.google.auto.common.MoreTypes
| 1562 com.google.common.base.Stopwatch
| 1563 com.google.common.collect.ImmutableList
| 1564 com.google.common.collect.ImmutableMap
| 1565 com.google.common.collect.ImmutableSet
| 1566 com.google.common.collect.ImmutableTable
| 1567 com.google.common.collect.Lists
| 1568 com.google.common.collect.Streams
| 1569 com.google.common.collect.Table
| 1570 com.google.common.collect.Tables
| 1571 com.google.common.math.Stats
| 1572 com.google.common.math.StatsAccumulator
| 1573 com.google.common.util.concurrent.AbstractExecutionThreadService
| 1574 com.google.common.util.concurrent.AbstractFuture
| 1575 com.google.common.util.concurrent.AbstractScheduledService
| 1576 com.google.common.util.concurrent.AbstractTransformFuture
| 1577 com.google.common.util.concurrent.FutureCallback
| 1578 com.google.common.util.concurrent.Futures
| 1579 com.google.common.util.concurrent.ListenableFuture
| 1580 com.google.common.util.concurrent.ListenableFutureTask
| 1581 com.google.common.util.concurrent.ListenableScheduledFuture
| 1582 com.google.common.util.concurrent.ListenerCallQueue
| 1583 com.google.common.util.concurrent.ListeningExecutorService
| 1584 com.google.common.util.concurrent.ListeningScheduledExecutorService
| 1585 com.google.common.util.concurrent.MoreExecutors
| 1586 com.google.common.util.concurrent.SettableFuture
| 1587 com.google.common.util.concurrent.Uninterruptibles
| 1588 com.squareup.javapoet.ClassName
| 1589 com.squareup.javapoet.CodeBlock
| 1590 com.squareup.javapoet.FieldSpec
| 1591 com.squareup.javapoet.JavaFile
| 1592 com.squareup.javapoet.MethodSpec
| 1593 com.squareup.javapoet.ParameterSpec
| 1594 com.squareup.javapoet.ParameterizedTypeName
| 1595 com.squareup.javapoet.TypeName
| 1596 com.squareup.javapoet.TypeSpec
| 1597 dagger.Binds
| 1598 dagger.BindsInstance
| 1599 dagger.Component
| 1600 dagger.MapKey
| 1601 dagger.Module
| 1602 dagger.Provides
| 1603 dagger.multibindings.ClassKey
| 1604 dagger.multibindings.ElementsIntoSet
| 1605 dagger.multibindings.IntKey
| 1606 dagger.multibindings.IntoMap
| 1607 dagger.multibindings.IntoSet
| 1608 dagger.multibindings.LongKey
| 1609 dagger.multibindings.Multibinds
| 1610 dagger.multibindings.StringKey
| 1611 dagger.producers.Produced
| 1612 dagger.producers.Producer
| 1613 dagger.producers.ProducerModule
| 1614 dagger.producers.Producers
| 1615 dagger.producers.Produces
| 1616 dagger.producers.Production
| 1617 dagger.producers.ProductionComponent
| 1618 dagger.producers.ProductionScope
| 1619 dagger.producers.ProductionSubcomponent
| 1620 dagger.producers.monitoring.ProducerMonitor
| 1621 dagger.producers.monitoring.ProducerToken
| 1622 dagger.producers.monitoring.ProductionComponentMonitor
| 1623 java.io.IOException
| 1624 java.lang.reflect.AnnotatedElement
| 1625 java.lang.reflect.Executable
| 1626 java.lang.reflect.Field
| 1627 java.lang.reflect.GenericDeclaration
| 1628 java.lang.reflect.Method
| 1629 java.lang.reflect.Modifier
| 1630 java.lang.reflect.Type
| 1631 java.nio.file.Files
| 1632 java.nio.file.Path
| 1633 java.util.ArrayList
| 1634 java.util.Arrays
| 1635 java.util.Collection
| 1636 java.util.HashMap
| 1637 java.util.HashSet
| 1638 java.util.Iterator
| 1639 java.util.LinkedList
| 1640 java.util.List
| 1641 java.util.Map
| 1642 java.util.NavigableMap
| 1643 java.util.Optional
| 1644 java.util.OrderedMap
| 1645 java.util.Set
| 1646 java.util.TreeMap
| 1647 java.util.TreeSet
| 1648 java.util.concurrent.ConcurrentHashMap
| 1649 java.util.concurrent.CopyOnWriteArrayList
| 1650 java.util.concurrent.ExecutionException
| 1651 java.util.concurrent.Executor
| 1652 java.util.concurrent.ExecutorService
| 1653 java.util.concurrent.Executors
| 1654 java.util.concurrent.Future
| 1655 java.util.concurrent.ThreadPoolExecutor
| 1656 java.util.concurrent.TimeUnit
| 1657 java.util.concurrent.atomic.AtomicInteger
| 1658 java.util.concurrent.atomic.AtomicLong
| 1659 java.util.concurrent.atomic.LongAdder
| 1660 java.util.function.Consumer
| 1661 java.util.function.Function
| 1662 java.util.function.Predicate
| 1663 java.util.function.Supplier
| 1664 java.util.stream.Collector
| 1665 java.util.stream.Collectors
| 1666 java.util.stream.Stream
| 1667 javax.annotation.processing.AbstractProcessor
| 1668 javax.annotation.processing.Completion
| 1669 javax.annotation.processing.Completions
| 1670 javax.annotation.processing.Filer
| 1671 javax.annotation.processing.FilerException
| 1672 javax.annotation.processing.Generated
| 1673 javax.annotation.processing.Messager
| 1674 javax.annotation.processing.ProcessingEnvironment
| 1675 javax.annotation.processing.Processor
| 1676 javax.annotation.processing.RoundEnvironment
| 1677 javax.annotation.processing.SupportedAnnotationTypes
| 1678 javax.annotation.processing.SupportedOptions
| 1679 javax.annotation.processing.SupportedSourceVersion
| 1680 javax.inject.Inject
| 1681 javax.inject.Named
| 1682 javax.inject.Provider
| 1683 javax.inject.Qualifier
| 1684 javax.inject.Singleton
| 1685 javax.lang.model.element.Element
| 1686 javax.lang.model.element.ElementVisitor
| 1687 javax.lang.model.element.ExecutableElement
| 1688 javax.lang.model.element.Modifier
| 1689 javax.lang.model.element.TypeElement
| 1690 javax.lang.model.type.TypeMirror
| 1691 org.apache.commons.lang3.builder.ReflectionToStringBuilder
| 1692 org.apache.commons.lang3.builder.ToStringStyle
| 1693 org.objectweb.asm.ClassReader
| 1694 org.objectweb.asm.ClassVisitor
| 1695 org.objectweb.asm.ClassWriter
| 1696 org.objectweb.asm.FieldVisitor
| 1697 org.objectweb.asm.MethodVisitor
| 1698 org.objectweb.asm.Opcodes
| 1699 org.objectweb.asm.TypePath
| 1700 org.openjdk.jmh.annotations.AuxCounters
| 1701 org.openjdk.jmh.annotations.Benchmark
| 1702 org.openjdk.jmh.annotations.BenchmarkMode
| 1703 org.openjdk.jmh.annotations.CompilerControl
| 1704 org.openjdk.jmh.annotations.Fork
| 1705 org.openjdk.jmh.annotations.Group
| 1706 org.openjdk.jmh.annotations.GroupThreads
| 1707 org.openjdk.jmh.annotations.Level
| 1708 org.openjdk.jmh.annotations.Measurement
| 1709 org.openjdk.jmh.annotations.Mode
| 1710 org.openjdk.jmh.annotations.OperationsPerInvocation
| 1711 org.openjdk.jmh.annotations.OutputTimeUnit
| 1712 org.openjdk.jmh.annotations.Param
| 1713 org.openjdk.jmh.annotations.Scope
| 1714 org.openjdk.jmh.annotations.Setup
| 1715 org.openjdk.jmh.annotations.State
| 1716 org.openjdk.jmh.annotations.TearDown
| 1717 org.openjdk.jmh.annotations.Threads
| 1718 org.openjdk.jmh.annotations.Timeout
| 1719 org.openjdk.jmh.annotations.Warmup
| 1720 org.openjdk.jmh.infra.BenchmarkParams
| 1721 org.openjdk.jmh.infra.Blackhole
| 1722 org.openjdk.jmh.infra.Control
| 1723 org.openjdk.jmh.infra.IterationParams
| 1724 org.openjdk.jmh.infra.ThreadParams
| 1725 org.openjdk.jmh.results.RunResult
| 1726 org.openjdk.jmh.results.format.ResultFormatType
| 1727 org.openjdk.jmh.runner.Runner
| 1728 org.openjdk.jmh.runner.RunnerException
| 1729 org.openjdk.jmh.runner.options.CommandLineOptionException
| 1730 org.openjdk.jmh.runner.options.CommandLineOptions
| 1731 org.openjdk.jmh.runner.options.Options
| 1732 org.openjdk.jmh.runner.options.OptionsBuilder
| 1733 static com.google.common.collect.ImmutableList.toImmutableList
| 1734 static com.google.common.collect.ImmutableSet.toImmutableSet
| 1735 static com.google.common.truth.Truth.assertThat
| 1736 static com.google.common.truth.Truth.assertWithMessage
| 1737 static com.google.common.util.concurrent.MoreExecutors.directExecutor
| 1738 static java.util.concurrent.TimeUnit.DAYS
| 1739 static java.util.concurrent.TimeUnit.HOURS
| 1740 static java.util.concurrent.TimeUnit.MICROSECONDS
| 1741 static java.util.concurrent.TimeUnit.MILLISECONDS
| 1742 static java.util.concurrent.TimeUnit.MINUTES
| 1743 static java.util.concurrent.TimeUnit.NANOSECONDS
| 1744 static java.util.concurrent.TimeUnit.SECONDS
| 1745 static java.util.stream.Collectors.averagingDouble
| 1746 static java.util.stream.Collectors.averagingInt
| 1747 static java.util.stream.Collectors.averagingLong
| 1748 static java.util.stream.Collectors.collectingAndThen
| 1749 static java.util.stream.Collectors.counting
| 1750 static java.util.stream.Collectors.filtering
| 1751 static java.util.stream.Collectors.flatMapping
| 1752 static java.util.stream.Collectors.groupingBy
| 1753 static java.util.stream.Collectors.joining
| 1754 static java.util.stream.Collectors.mapping
| 1755 static java.util.stream.Collectors.maxBy
| 1756 static java.util.stream.Collectors.minBy
| 1757 static java.util.stream.Collectors.partitioningBy
| 1758 static java.util.stream.Collectors.reducing
| 1759 static java.util.stream.Collectors.summarizingDouble
| 1760 static java.util.stream.Collectors.summarizingInt
| 1761 static java.util.stream.Collectors.summarizingLong
| 1762 static java.util.stream.Collectors.summingDouble
| 1763 static java.util.stream.Collectors.summingInt
| 1764 static java.util.stream.Collectors.summingLong
| 1765 static java.util.stream.Collectors.toCollection
| 1766 static java.util.stream.Collectors.toConcurrentMap
| 1767 static java.util.stream.Collectors.toList
| 1768 static java.util.stream.Collectors.toMap
| 1769 static java.util.stream.Collectors.toSet
| 1770 static java.util.stream.Collectors.toUnmodifiableList
| 1771 static java.util.stream.Collectors.toUnmodifiableMap
| 1772 static java.util.stream.Collectors.toUnmodifiableSet
| 1773 java.net.ServerSocket
| 1774 java.net.Socket
| 1775 java.io.OutputStream
| 1776 com.google.common.flogger.FluentLogger
| 1777 static com.google.common.util.concurrent.Futures.immediateFuture
| 1778 java.util.concurrent.atomic.AtomicReference
| 1779 static com.google.common.util.concurrent.Futures.immediateVoidFuture
| 1780 java.util.concurrent.atomic.AtomicMarkableReference
| 1781 java.util.Random
| 1782 java.time.Instant
| 1783 static com.google.common.base.Preconditions.checkArgument
| 1784 static com.google.common.base.Preconditions.checkNotNull
| 1785 static org.mockito.Mockito.mock
| 1786 static org.mockito.Mockito.verify
| 1787 static org.mockito.ArgumentMatchers.any
| 1788 static org.mockito.Mockito.times
| 1789 static org.mockito.AdditionalMatchers.and
| 1790 static org.mockito.ArgumentMatchers.assertArg
| 1791 JAVA_IMPORT_LIST_END
| 1792
| 1793 command! AddJavaImport call AddJavaImport(getline('.'))
| 1794 function! AddJavaImport(content) abort
| 1795 let content = a:content
| 1796 \->substitute('^import ', '', '')
| 1797 \->substitute(';$', '', '')
| 1798 if index(g:jm_vimrc.java_import_list, content) != -1
| 1799 echom "Already present:" content
| 1800 return
| 1801 endif
| 1802 let lines = readfile($MYVIMRC)
| 1803 let index = match(lines, '^JAVA_IMPORT_LIST_END$')
| 1804 call insert(lines, content, index)
| 1805 call writefile(lines, $MYVIMRC)
| 1806 echom "Added:" content
| 1807 endfunction
| 1808
| 1809 function! s:ProcessJavaImportList(import_list) abort
| 1810 let cache = {}
| 1811 for elem in a:import_list
| 1812 let name = slice(elem, strridx(elem, '.') + 1)
| 1813 if has_key(cache, name)
| 1814 call add(cache[name], elem)
| 1815 else
| 1816 let cache[name] = [elem]
| 1817 endif
| 1818 endfor
| 1819 return cache
| 1820 endfunction
| 1821
| 1822 let g:jm_vimrc.java_import_cache =
| 1823 \ s:ProcessJavaImportList(g:jm_vimrc.java_import_list)
| 1824
| 1825
1826
1827
+ - 1828 +--193 lines: C++ Import Cache:
1828
| 1829 let g:jm_vimrc.cc_import_cache = {
| 1830 \ '"absl/flags/flag.h"': ['ABSL_FLAG', 'GetFlag'],
| 1831 \ '"absl/flags/declare.h"': ['ABSL_DECLARE_FLAG'],
| 1832 \ '"absl/flags/parse.h"': ['ParseCommandLine'],
| 1833 \ '"absl/flags/usage.h"': ['ProgramUsageMessage', 'SetProgramUsageMessage'],
| 1834 \ '"absl/strings/str_join.h"': ['StrJoin'],
| 1835 \ '"absl/strings/str_cat.h"': ['StrCat'],
| 1836 \ '"absl/strings/str_replace.h"': ['StrReplaceAll'],
| 1837 \ '"absl/strings/str_split.h"': ['StrSplit'],
| 1838 \ '"absl/status/status.h"': ['Status'],
| 1839 \ '"absl/status/statusor.h"': ['StatusOr'],
| 1840 \ '<opencv2/core.hpp>': [
| 1841 \ 'Mat',
| 1842 \ 'Mat_',
| 1843 \ 'Mat1b', 'Mat2b', 'Mat3b', 'Mat4b',
| 1844 \ 'Mat1i', 'Mat2i', 'Mat3i', 'Mat4i',
| 1845 \ 'Mat1f', 'Mat2f', 'Mat3f', 'Mat4f',
| 1846 \ 'Mat1d', 'Mat2d', 'Mat3d', 'Mat4d',
| 1847 \ 'Matx',
| 1848 \ 'Matx22f', 'Matx33f', 'Matx44f',
| 1849 \ 'Matx21f', 'Matx31f', 'Matx41f',
| 1850 \ 'Matx22d', 'Matx33d', 'Matx44d',
| 1851 \ 'Matx21d', 'Matx31d', 'Matx41d',
| 1852 \ 'Vec',
| 1853 \ 'Vec1b', 'Vec2b', 'Vec3b', 'Vec4b', 'Vec6b',
| 1854 \ 'Vec1i', 'Vec2i', 'Vec3i', 'Vec4i', 'Vec6i',
| 1855 \ 'Vec1f', 'Vec2f', 'Vec3f', 'Vec4f', 'Vec6f',
| 1856 \ 'Vec1d', 'Vec2d', 'Vec3d', 'Vec4d', 'Vec6d',
| 1857 \ 'Scalar_', 'Scalar',
| 1858 \ 'Point_', 'Point2i', 'Point2l', 'Point2f', 'Point2d',
| 1859 \ 'Point3_', 'Point3i', 'Point3l', 'Point3f', 'Point3d',
| 1860 \ 'abs',
| 1861 \ 'exp', 'log',
| 1862 \ 'pow', 'sqrt',
| 1863 \ ],
| 1864 \ '<opencv2/imgcodecs.hpp>': ['imread', 'imwrite'],
| 1865 \ '<opencv2/imgproc.hpp>': ['circle'],
| 1866 \ '<utility>': [
| 1867 \ 'forward', 'declval',
| 1868 \ 'move', 'swap', 'exchange',
| 1869 \ 'integer_sequence', 'make_integer_sequence',
| 1870 \ 'index_sequence', 'make_index_sequence',
| 1871 \ 'pair', 'make_pair',
| 1872 \ ],
| 1873 \ '<memory>': ['unique_ptr', 'make_unique'],
| 1874 \ '<vector>': ['vector'],
| 1875 \ '<tuple>': [
| 1876 \ 'tuple',
| 1877 \ 'tuple_size',
| 1878 \ 'tuple_element',
| 1879 \ 'get',
| 1880 \ ],
| 1881 \ '<type_traits>': [
| 1882 \ 'enable_if', 'conditional',
| 1883 \ 'enable_if_t', 'conditional_t',
| 1884 \ 'integral_constant', 'bool_constant',
| 1885 \ 'true_type', 'false_type',
| 1886 \ 'conjunction', 'disjunction', 'negation',
| 1887 \ 'conjunction_v', 'disjunction_v', 'negation_v',
| 1888 \ 'is_same', 'is_base_of', 'is_convertible',
| 1889 \ 'is_same_v', 'is_base_of_v', 'is_convertible_v',
| 1890 \ ],
| 1891 \ '<array>': ['array'],
| 1892 \ '<valarray>': ['valarray'],
| 1893 \ '<cstddef>': [
| 1894 \ 'size_t', 'ptrdiff_t', 'nullptr_t',
| 1895 \ ],
| 1896 \ '<future>': [
| 1897 \ 'future', 'promise', 'async', 'launch',
| 1898 \ ],
| 1899 \ '<thread>': [
| 1900 \ 'thread', 'this_thread', 'yield', 'get_id', 'sleep_for',
| 1901 \ ],
| 1902 \ '<cstdint>': [
| 1903 \ 'int8_t', 'int16_t', 'int32_t', 'int64_t',
| 1904 \ 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
| 1905 \ ],
| 1906 \ '<cmath>': [
| 1907 \ 'abs',
| 1908 \ 'exp', 'log', 'log2', 'log10',
| 1909 \ 'pow', 'sqrt', 'hypot',
| 1910 \ 'sin', 'cos', 'tan',
| 1911 \ 'asin', 'acos', 'atan',
| 1912 \ 'sinh', 'cosh', 'tanh',
| 1913 \ 'asinh', 'acosh', 'atanh',
| 1914 \ 'ceil', 'floor', 'trunc', 'round',
| 1915 \ ],
| 1916 \ '<string>': [
| 1917 \ 'string',
| 1918 \ 'to_string',
| 1919 \ 'stoi', 'stol', 'stoul', 'stoll', 'stoull',
| 1920 \ 'stof', 'stod', 'stold',
| 1921 \ ],
| 1922 \ '<map>': ['map'],
| 1923 \ '<unordered_map>': ['unordered_map'],
| 1924 \ '<set>': ['set'],
| 1925 \ '<iostream>': [
| 1926 \ 'cout', 'cin', 'cerr',
| 1927 \ 'endl',
| 1928 \ ],
| 1929 \ '<ios>': [
| 1930 \ 'internal', 'left', 'right',
| 1931 \ 'boolalpha', 'showbase', 'showpos',
| 1932 \ 'dec', 'hex', 'oct',
| 1933 \ 'fixed', 'scientific', 'default',
| 1934 \ ],
| 1935 \ '<format>': ['format'],
| 1936 \ '<iomanip>': [
| 1937 \ 'setw',
| 1938 \ 'quoted',
| 1939 \ ],
| 1940 \ '<unordered_set>': ['unordered_set'],
| 1941 \ '<optional>': ['optional'],
| 1942 \ '<complex>': ['complex'],
| 1943 \ '<initializer_list>': ['initializer_list'],
| 1944 \ '<numeric>': [
| 1945 \ 'iota',
| 1946 \ 'accumulate',
| 1947 \ 'reduce',
| 1948 \ 'inner_product',
| 1949 \ 'adjacent_difference',
| 1950 \ 'partial_sum',
| 1951 \ ],
| 1952 \ '<cstdlib>': [
| 1953 \ 'system',
| 1954 \ 'exit',
| 1955 \ 'getenv',
| 1956 \ 'malloc',
| 1957 \ 'free',
| 1958 \ 'aligned_malloc',
| 1959 \ ],
| 1960 \ '<random>': [
| 1961 \ 'random_device',
| 1962 \ 'mt19937',
| 1963 \ 'mt19937_64',
| 1964 \ 'uniform_real_distribution',
| 1965 \ 'uniform_int_distribution',
| 1966 \ 'normal_distribution',
| 1967 \ ],
| 1968 \ '<functional>': [
| 1969 \ 'function',
| 1970 \ 'plus', 'minus', 'multiplies', 'divides',
| 1971 \ 'equal_to', 'not_equal_to',
| 1972 \ 'greater', 'less', 'greater_equal', 'less_equal',
| 1973 \ 'logical_and', 'logical_or', 'logical_not',
| 1974 \ 'bit_end', 'bit_or', 'bit_xor', 'bit_not',
| 1975 \ ],
| 1976 \ '<algorithm>': [
| 1977 \
| 1978 \ 'all_of', 'any_of', 'none_of',
| 1979 \ 'for_each', 'for_each_n',
| 1980 \ 'count', 'count_if',
| 1981 \ 'mismatch',
| 1982 \ 'find', 'find_if', 'find_if_not',
| 1983 \ 'find_end', 'find_first_of', 'adjacent_find',
| 1984 \ 'search', 'search_n',
| 1985 \
| 1986 \ 'copy', 'copy_backward', 'move', 'move_backward', 'copy_n',
| 1987 \ 'fill', 'fill_n', 'transform', 'generate', 'generate_n',
| 1988 \ 'remove', 'remove_if', 'remove_copy', 'remove_copy_if',
| 1989 \ 'replace', 'replace_if', 'replace_copy', 'replace_copy_if',
| 1990 \ 'swap', 'swap_ranges', 'swap_iter',
| 1991 \ 'reverse', 'reverse_copy', 'rotate',
| 1992 \ 'rotate_copy',
| 1993 \ 'shuffle',
| 1994 \ 'max', 'min', 'max_element', 'min_element', 'minmax',
| 1995 \ ],
| 1996 \ '"absl/algorithm/container.h"': [
| 1997 \
| 1998 \ 'c_all_of', 'c_any_of', 'c_none_of',
| 1999 \ 'c_for_each', 'c_for_each_n',
| 2000 \ 'c_count', 'c_count_if',
| 2001 \ 'c_mismatch',
| 2002 \ 'c_find', 'c_find_if', 'c_find_if_not',
| 2003 \ 'c_find_end', 'c_find_first_of', 'c_adjacent_find',
| 2004 \ 'c_search', 'c_search_n',
| 2005 \
| 2006 \ 'c_copy', 'c_copy_backward', 'c_move', 'c_move_backward', 'c_copy_n',
| 2007 \ 'c_fill', 'c_fill_n', 'c_transform', 'c_generate', 'c_generate_n',
| 2008 \ 'c_remove', 'c_remove_if', 'c_remove_copy', 'c_remove_copy_if',
| 2009 \ 'c_replace', 'c_replace_if', 'c_replace_copy', 'c_replace_copy_if',
| 2010 \ 'c_swap', 'c_swap_ranges', 'c_swap_iter',
| 2011 \ 'c_reverse', 'c_reverse_copy', 'c_rotate',
| 2012 \ 'c_rotate_copy',
| 2013 \ 'c_shuffle',
| 2014 \ ],
| 2015 \ '<iterator>': [
| 2016 \ 'istream_iterator',
| 2017 \ 'ostream_iterator',
| 2018 \ ],
| 2019 \ }
| 2020