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