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