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