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 +--286 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 augroup ft_coq
| 1017 autocmd!
| 1018 autocmd FileType coq
| 1019 \ setlocal tabstop=2 softtabstop=2 tabstop=2 smarttab
| 1020 if filereadable('Makefile')
| 1021 autocmd FileType coq nnoremap <silent> <buffer> <localleader>r
| 1022 \ :Term make<cr>
| 1023 else
| 1024 autocmd FileType coq nnoremap <silent> <buffer> <localleader>r
| 1025 \ :execute 'Term coqc' expand("%")<cr>
| 1026 endif
| 1027 augroup END
| 1028
| 1029
| 1030 augroup cfg_quickfix_fix
| 1031 autocmd QuickFixCmdPost [^l]* nested cwindow
| 1032 autocmd QuickFixCmdPost l* nested lwindow
| 1033 augroup end
| 1034
| 1035
1036
+ - 1037 +--559 lines: Misc:
1037
| 1038
| 1039
| 1040
| 1041
| 1042
| 1043
| 1044
| 1045
|+ |- 1046 +--- 94 lines:
1046
|| 1047 let g:jm_vimrc.docs.commands['FindImport'] =
|| 1048 \ 'Given a name, find the corresponding import and add an import statment'
|| 1049 nnoremap <space>t :call <SID>FindImport(expand('<cword>'))<CR>
|| 1050 command -nargs=1 FindImport call <SID>FindImport(<q-args>)
|| 1051 function! s:FindImport(word) abort
|| 1052
|| 1053 if &filetype ==# 'cpp'
|| 1054 let l:res = g:jm_vimrc.cc_import_cache
|| 1055 \->copy()
|| 1056 \->filter({incl, names -> index(names, a:word) != -1})
|| 1057 \->keys()
|| 1058 \->map({k, incl -> printf("#include %s", incl)})
|| 1059 if len(l:res) == 0
|| 1060 echo "FindImport: `" .. a:word .. "` not found!"
|| 1061 elseif len(l:res) > 1
|| 1062 call maktaba#ui#selector#Create(l:res)
|| 1063 \.WithMappings({'<cr>': [function("s:AddImportCpp")->get("name"), 'Close', 'Add import']})
|| 1064 \.Show()
|| 1065 else
|| 1066 call s:AddImportCpp(l:res[0])
|| 1067 endif
|| 1068 return
|| 1069 endif
|| 1070
|| 1071 if &filetype !=# 'java'
|| 1072 throw 'ERROR(InvalidFiletype)'
|| 1073 return
|| 1074 endif
|| 1075
|| 1076
|| 1077 if (has_key(g:jm_vimrc.java_import_cache, a:word))
|| 1078 call s:AddOrSelectImport(get(g:jm_vimrc.java_import_cache, a:word)->mapnew({_, w -> printf('import %s;', w)}))
|| 1079 return
|| 1080 endif
|| 1081
|| 1082
|| 1083 let l:results = printf(
|| 1084 \ '%s --nofilename --nobreak %s',
|| 1085 \ g:jm_vimrc.deps.ag,
|| 1086 \ shellescape(printf('import .+\b%s\b;', a:word)))
|| 1087 \->systemlist()
|| 1088 \->sort()
|| 1089 \->uniq()
|| 1090
|| 1091
|| 1092 if empty(l:results)
|| 1093 let l:results = g:jm_vimrc.deps.JavaClassnameList()
|| 1094 \->filter('v:val =~# a:word')
|| 1095 \->map('"import " .. v:val .. ";"')
|| 1096 endif
|| 1097
|| 1098 call s:AddOrSelectImport(l:results)
|| 1099 endfunction
|| 1100
|| 1101 function! s:AddOrSelectImport(options) abort
|| 1102 if len(a:options) == 1
|| 1103 call s:AddImport(a:options[0])
|| 1104 elseif len(a:options) > 1
|| 1105 call maktaba#ui#selector#Create(a:options)
|| 1106 \.WithMappings({'<cr>': [function("s:AddImport")->get("name"), 'Close', 'Add import']})
|| 1107 \.Show()
|| 1108 endif
|| 1109 endfunction
|| 1110
|| 1111 function! s:AddImport(import) abort
|| 1112 let l:result = search(a:import, 'nw')
|| 1113 if l:result == 0
|| 1114 let l:start = search('^import', 'nw')
|| 1115 if l:start == 0
|| 1116 let l:start = search('^package', 'nw')
|| 1117 call append(l:start, [""])
|| 1118 let l:start += 1
|| 1119 endif
|| 1120 call append(l:start, [a:import])
|| 1121
|| 1122 echom "Adding: " .. a:import
|| 1123 else
|| 1124 echom "Already Present: " .. a:import
|| 1125 endif
|| 1126 endfunction
|| 1127
|| 1128 function! s:AddImportCpp(import) abort
|| 1129 let l:result = search(a:import, 'nw')
|| 1130 if l:result == 0
|| 1131 let l:start = search('^#include', 'nw')
|| 1132 call append(l:start, [a:import])
|| 1133
|| 1134 echom "Adding: " .. a:import
|| 1135 else
|| 1136 echom "Already Present: " .. a:import
|| 1137 endif
|| 1138 endfunction
|| 1139
| 1140
| 1141
| 1142
|+ |- 1143 +--- 40 lines:
1143
|| 1144 let g:jm_vimrc.docs.commands['Javap'] =
|| 1145 \ 'Execute Javap and show output with highlighting'
|| 1146 command! -nargs=? -complete=customlist,<SID>JavapComplete -bang
|| 1147 \ Javap call <SID>Javap(<q-args>, "<bang>" ==# '!')
|| 1148 function! s:Javap(arg, search) abort
|| 1149 if empty($CLASSPATH)
|| 1150 SetupClasspath
|| 1151 endif
|| 1152
|| 1153
|| 1154 let l:cls = empty(a:arg) ? @" : a:arg
|| 1155 let l:cls = substitute(l:cls, '\(;\|<.\+>\)', '', 'ga')
|| 1156
|| 1157 if a:search
|| 1158 let l:results = s:JavapComplete(l:cls, v:none, v:none)
|| 1159 if len(l:results) == 1
|| 1160 let l:cls = l:results[0]
|| 1161 else
|| 1162 call maktaba#ui#selector#Create(l:results)
|| 1163 \.WithMappings({'<cr>': [function("s:JavapOpen")->get("name"), 'Close', 'Open window']})
|| 1164 \.Show()
|| 1165 return
|| 1166 endif
|| 1167 endif
|| 1168
|| 1169 eval g:jm_term
|| 1170 \.Run(join([g:jm_vimrc.deps.javap, l:cls], ' '))
|| 1171 \.Exec('set ft=java')
|| 1172 endfunction
|| 1173
|| 1174 function! s:JavapComplete(arg_lead, cmd_line, cursor_pos) abort
|| 1175 return g:jm_vimrc.deps.JavaClassnameList()
|| 1176 \->filter('v:val =~# a:arg_lead')
|| 1177 endfunction
|| 1178
|| 1179 function! s:JavapOpen(cls) abort
|| 1180 execute 'Javap ' .. a:cls
|| 1181 endfunction
|| 1182
| 1183
| 1184
| 1185
| 1186
|+ |- 1187 +--- 69 lines:
1187
|| 1188 let g:jm_vimrc.docs.commands['MavenSearch'] =
|| 1189 \ 'Search maven, then either add a dependecy or download the jar'
|| 1190 command! -nargs=1 MavenSearch call <SID>MavenSearch(<q-args>)
|| 1191 command! -nargs=1 M MavenSearch <args>
|| 1192 function! s:MavenSearch(query) abort
|| 1193 const l:request = {
|| 1194 \ "page": 0,
|| 1195 \ "size": 20,
|| 1196 \ "searchTerm": a:query,
|| 1197 \ "filter": []
|| 1198 \ }
|| 1199 const l:query_url =
|| 1200 \ 'https://central.sonatype.com/api/internal/browse/components'
|| 1201
|| 1202 const l:query_cmd = join([
|| 1203 \ g:jm_vimrc.deps.curl,
|| 1204 \ '-s',
|| 1205 \ l:query_url,
|| 1206 \ '--json',
|| 1207 \ shellescape(json_encode(l:request))
|| 1208 \ ])
|| 1209
|| 1210 let l:msg = system(l:query_cmd)
|| 1211 let l:resp = json_decode(l:msg)
|| 1212
|| 1213 if l:resp.totalResultCount == 0
|| 1214 echom "None found!"
|| 1215 return
|| 1216 endif
|| 1217 let l:components = l:resp.components
|| 1218 const l:mappings = {
|| 1219 \ '<cr>': [function("s:MInsert")->get("name"), 'Close', 'Insert below'],
|| 1220 \ 'D': [function("s:MDownload")->get("name"), 'Close', 'Insert below'],
|| 1221 \ }
|| 1222 call maktaba#ui#selector#Create(map(l:components, 'v:val.namespace .. ":" .. v:val.name .. ":" .. v:val.latestVersionInfo.version'))
|| 1223 \.WithMappings(l:mappings)
|| 1224 \.Show()
|| 1225 endfunction
|| 1226
|| 1227 function! s:MInsert(msg) abort
|| 1228 let l:spaces = getline('.')->matchstr('^\s*')
|| 1229 call append(line('.'), printf("%simplementation '%s'", l:spaces, a:msg))
|| 1230 endfunction
|| 1231
|| 1232 function! s:MDownload(msg) abort
|| 1233 let [l:package, l:name, l:version] = split(a:msg, ':')
|| 1234 let l:url_package = substitute(l:package, '\.', '/', 'g')
|| 1235 let l:url = printf('https://repo1.maven.org/maven2/%s/%s/%s/',
|| 1236 \ l:url_package,
|| 1237 \ l:name,
|| 1238 \ l:version)
|| 1239 let l:file = printf('%s-%s.jar', l:name, l:version)
|| 1240 let l:file_url = l:url .. l:file
|| 1241 echom l:url .. l:file
|| 1242
|| 1243 const l:cmd = join([
|| 1244 \ g:jm_vimrc.deps.curl,
|| 1245 \ '-o',
|| 1246 \ shellescape(l:file),
|| 1247 \ '-s',
|| 1248 \ shellescape(l:file_url),
|| 1249 \ ])
|| 1250 silent call system(l:cmd)
|| 1251 if v:shell_error
|| 1252 echom 'ERROR: Could not download! ' .. l:file_url
|| 1253 endif
|| 1254 endfunction
|| 1255
| 1256
| 1257
| 1258
| 1259
| 1260
| 1261
| 1262
| 1263
| 1264
| 1265
| 1266
| 1267
| 1268
| 1269
| 1270
| 1271
|+ |- 1272 +--- 69 lines:
1272
|| 1273 function! s:BlazeTargets(fname) abort
|| 1274 let l:query = printf(
|| 1275 \ 'same_pkg_direct_rdeps(%s)',
|| 1276 \ fnamemodify(a:fname, ":p:."),
|| 1277 \ )
|| 1278
|| 1279 let l:command = printf(
|| 1280 \ "%s query '%s'",
|| 1281 \ g:jm_vimrc.deps.blaze,
|| 1282 \ l:query,
|| 1283 \ )
|| 1284 return filter(systemlist(l:command), 'v:val =~# "^//"')
|| 1285 endfunction
|| 1286
|| 1287 function! BlazeGuessCommand(show = v:false) abort
|| 1288 let l:fname = expand('%:p')
|| 1289
|| 1290 let l:target = BlazeTarget()
|| 1291 if l:target ==# "???"
|| 1292 echom "Can't find blaze target!"
|| 1293 return "false"
|| 1294 endif
|| 1295
|| 1296 let l:action = 'build'
|| 1297 if l:fname =~# '\v(_test.cc|Test.java)$' || l:target =~# '\v(_test|Test)$'
|| 1298 let l:action = 'test'
|| 1299 elseif l:fname =~# '\v(main.cc|_bin.cc|Bin.java)$' || l:target =~# '\v(_bin|Bin|main|Main)$'
|| 1300 let l:action = 'run'
|| 1301 elseif l:fname =~# '\v(_bench.cc)$' || l:target =~# '\v(_bench)$'
|| 1302 let l:action = 'run -c opt'
|| 1303 endif
|| 1304
|| 1305 let l:command = printf(
|| 1306 \ "%s %s %s",
|| 1307 \ g:jm_vimrc.deps.blaze,
|| 1308 \ l:action,
|| 1309 \ l:target,
|| 1310 \ )
|| 1311 if a:show
|| 1312 echom 'Using:' l:command
|| 1313 endif
|| 1314 return l:command
|| 1315 endfunction
|| 1316
|| 1317 function! BlazeTarget() abort
|| 1318 return get(s:BlazeTargets(expand('%:p')), 0, "???")
|| 1319 endfunction
|| 1320
|| 1321 function! s:TargetClasspath() abort
|| 1322 let l:target = BlazeTarget()
|| 1323 if l:target ==# "???"
|| 1324 echom "Can't find blaze target!"
|| 1325 return ""
|| 1326 endif
|| 1327
|| 1328 let l:lines = systemlist(printf('blaze print_action "%s"', l:target))
|| 1329 let l:jars = filter(l:lines, {_, v -> v =~# '^\s\+\(outputjar\|classpath\): "[^"]*"'})
|| 1330 \->map({_, v -> matchlist(v, '"\([^"]*\)"')[1]})
|| 1331 return join(l:jars, ':')
|| 1332 endfunction
|| 1333
|| 1334 function! s:CompleteTargets(arg_lead, cmd_line, cursor_pos) abort
|| 1335 if a:arg_lead =~ '^//.*'
|| 1336 return systemlist(printf('%s query ... 2>&1', g:jm_vimrc.deps.blaze))
|| 1337 \->filter('v:val =~# "' .. a:arg_lead .. '"')
|| 1338 endif
|| 1339 endfunction
|| 1340
| 1341
| 1342
| 1343
|+ |- 1344 +--- 16 lines:
1344
|| 1345 let g:jm_vimrc.docs.commands['Touch'] =
|| 1346 \ 'Create files and directories'
|| 1347 command! -nargs=* Touch call s:Touch([<f-args>])
|| 1348 function! s:Touch(paths) abort
|| 1349 for l:path in a:paths
|| 1350 let l:dir = fnamemodify(l:path, ':h')
|| 1351 if l:dir !=# '.' && !isdirectory(l:dir)
|| 1352 call system('mkdir -p ' .. shellescape(l:dir))
|| 1353 endif
|| 1354 if !filereadable(l:path)
|| 1355 call system('touch ' .. shellescape(l:path))
|| 1356 endif
|| 1357 endfor
|| 1358 endfunction
|| 1359
| 1360
| 1361
| 1362
|+ |- 1363 +--- 8 lines:
1363
|| 1364 let g:jm_vimrc.docs.commands['CurrentHLGroup'] =
|| 1365 \ 'Echo name of the highlight group under the cursor'
|| 1366 command! CurrentHLGroup echo s:SyntaxItem()
|| 1367 function! s:SyntaxItem()
|| 1368 return synIDattr(synID(line("."), col("."), 1), "name")
|| 1369 endfunction
|| 1370
| 1371
| 1372
| 1373
| 1374
| 1375
| 1376
|+ |- 1377 +--- 9 lines:
1377
|| 1378 function! s:Async(Fn)
|| 1379 eval timer_start(0, a:Fn)
|| 1380 endfunction
|| 1381
|| 1382 function! s:AsyncExec(...)
|| 1383 eval s:Async({-> execute(join(map(a:000, function('string'))))})
|| 1384 endfunction
|| 1385
| 1386
| 1387
| 1388
|+ |- 1389 +--- 17 lines:
1389
|| 1390 let g:jm_vimrc.docs.commands['ConcealK'] =
|| 1391 \ 'Define conceal rules: eg. ConcealK lambda:λ'
|| 1392 command! -complete=expression -nargs=1 ConcealK call <SID>ConcealK(<q-args>)
|| 1393 function! s:ConcealK(repl_str) abort
|| 1394 let l:repl = {}
|| 1395 let l:i = 0
|| 1396 for [l:keyword, l:replacement] in split(a:repl_str, ' ')->map('v:val->split(":")')
|| 1397 let l:i += 1
|| 1398 execute 'syntax keyword'
|| 1399 \ printf('ConcealK%03d', l:i) l:keyword
|| 1400 \ 'conceal' printf('cchar=%s', l:replacement)
|| 1401 endfor
|| 1402 setlocal conceallevel=1
|| 1403 setlocal concealcursor=ni
|| 1404 endfunction
|| 1405
| 1406
| 1407
| 1408
|+ |- 1409 +--- 5 lines:
1409
|| 1410 let g:jm_vimrc.docs.commands['ReadExecute'] =
|| 1411 \ 'Execute then read the output of that vim command'
|| 1412 command! -nargs=* -complete=command ExecuteRead eval append(line('.'), execute(<q-args>)->split("\n"))
|| 1413
| 1414
| 1415
| 1416
|+ |- 1417 +--- 9 lines:
1417
|| 1418 let g:jm_vimrc.docs.commands['Bdz'] =
|| 1419 \ 'Run buildozer on current target (or :__pkg__ if none exists)'
|| 1420 command! -nargs=* Bdz echom
|| 1421 \ system(printf("fish -c \"buildozer '%s' %s\"",
|| 1422 \ join([<f-args>], ' '),
|| 1423 \ BlazeTarget() != '???' ? BlazeTarget() : ':__pkg__'
|| 1424 \ ))
|| 1425
| 1426
| 1427
| 1428 "format:`cmd`""format: END"
|+ |- 1429 +--- 38 lines:
1429
|| 1430 let g:jm_vimrc.docs.commands['JemFormat'] =
|| 1431 \ 'Format lines between "format:`cmd`" to "format: END"'
|| 1432 command! -nargs=* -complete=customlist,<SID>JemFormatComplete JemFormat eval s:JemFormat[<q-args>]()
|| 1433 let s:JemFormat = {
|| 1434 \ '' : {-> s:JemFormat.format()},
|| 1435 \ 'help' : {-> bss#PP(s:JemFormat, v:true)},
|| 1436 \ }
|| 1437 function! s:JemFormatComplete(arglead, cmdline, curpos) abort
|| 1438 return keys(s:JemFormat)->filter({k, v -> !stridx(v, a:arglead)})
|| 1439 endfunction
|| 1440
|| 1441 function! s:JemFormat.format() abort dict
|| 1442 let command = self.find()
|| 1443 if !empty(command)
|| 1444 silent execute command
|| 1445 endif
|| 1446 endfunction
|| 1447
|| 1448 function! s:JemFormat.find() abort dict
|| 1449 let [_, num, col; _] = getcurpos()
|| 1450 let start_pat = '\v.*for' .. 'mat: `([^`]+)`.*'
|| 1451 let end_pat = '\v.*for' .. 'mat: END.*'
|| 1452 let start_lines = matchbufline(bufnr(), start_pat, 1, num)
|| 1453 let start_line = bss#Last(start_lines)
|| 1454 let end_line = start_line
|| 1455 \->bss#Get('lnum')
|| 1456 \->bss#Apply({l -> matchbufline(bufnr(), end_pat, l, '$')})
|| 1457 \->bss#Apply('bss#Last')
|| 1458 \->bss#Or('$')
|| 1459 if start_line is v:none
|| 1460 return ''
|| 1461 endif
|| 1462 let range = [start_line.lnum + 1, end_line.lnum - 1]->join(',')
|| 1463 let command = substitute(start_line.text, start_pat, '\1', '')
|| 1464 return join([range, command], ' ')
|| 1465 endfunction
|| 1466
| 1467
| 1468
| 1469
| 1470
| 1471
| 1472
| 1473
| 1474
|+ |- 1475 +--- 50 lines:
1475
|| 1476 command! -nargs=1 -complete=file SetupAppendMarkdownBlock
|| 1477 \ nnoremap <buffer> \r :AppendMarkdownBlock <args><cr>
|| 1478 command! -nargs=1 -complete=file -range=% AppendMarkdownBlock
|| 1479 \ eval AppendMarkdownBlock(<q-args>, <line1>, <line2>)
|| 1480 command! -nargs=1 -complete=file AppendMarkdownBlockDebug
|| 1481 \ eval AppendMarkdownBlock(<q-args>, 0, '$', v:true)
|| 1482
|| 1483 function! AppendMarkdownBlock(fname, begin=0, end='$', debug=v:false) abort
|| 1484 let lines = getline(a:begin, a:end)->s:Markdown_lines2codeblock()
|| 1485 if !a:debug
|| 1486 call s:AppendMarkdownBlock_write(a:fname, lines)
|| 1487 else
|| 1488 call s:AppendMarkdownBlock_dump(a:fname, lines)
|| 1489 endif
|| 1490 endfunction
|| 1491
|| 1492
|| 1493
|| 1494
|| 1495 function! s:Markdown_lines2codeblock(lines) abort
|| 1496 let prefix = '```'
|| 1497 let suffix = prefix
|| 1498 return [prefix] + a:lines + [suffix]
|| 1499 endfunction
|| 1500
|| 1501
|| 1502
|| 1503
|| 1504
|| 1505 function! s:AppendMarkdownBlock_write(fname, lines) abort
|| 1506 let prefix = (readfile(a:fname)->bss#Last()->empty())
|| 1507 \ ? [] : [""]
|| 1508 call writefile(prefix + a:lines, a:fname, 'a')
|| 1509 echom "Wrote file" a:fname
|| 1510 endfunction
|| 1511
|| 1512
|| 1513
|| 1514
|| 1515 function! s:AppendMarkdownBlock_dump(fname, lines) abort
|| 1516
|| 1517 echo 'fname:' a:fname
|| 1518 echo 'lines:'
|| 1519 echo
|| 1520 for l in a:lines
|| 1521 echo ' ' .. l
|| 1522 endfor
|| 1523 endfunction
|| 1524
| 1525
| 1526
| 1527
|+ |- 1528 +--- 17 lines:
1528
|| 1529 command! -nargs=? -complete=customlist,s:SetupSlimeTarget_Complete SetupSlimeTarget call s:SetupSlimeTarget(<q-args>)
|| 1530 let s:SlimeTargets = [
|| 1531 \ 'tmux',
|| 1532 \ 'vimterminal',
|| 1533 \ ]
|| 1534 function! s:SetupSlimeTarget(arg) abort
|| 1535 if empty(a:arg)
|| 1536 echom printf('Current slime target: %s', g:slime_target)
|| 1537 else
|| 1538 let g:slime_target = a:arg
|| 1539 endif
|| 1540 endfunction
|| 1541 function! s:SetupSlimeTarget_Complete(arg, ...) abort
|| 1542 return s:SlimeTargets->filter('stridx(v:val, a:arg) == 0')
|| 1543 endfunction
|| 1544
| 1545
| 1546 function! Layout() abort
| 1547 let layout = winlayout()
| 1548 return s:InvertLayout(layout)
| 1549 endfunction
| 1550 function! s:InvertLayout(l, path=[]) abort
| 1551 if len(a:l) != 2
| 1552 throw "ERROR(InvalidArguments): s:InvertLayout expects only 2-element lists"
| 1553 endif
| 1554 let [kind, val] = a:l
| 1555 if kind ==# 'leaf'
| 1556 return {val: join(a:path, '')}
| 1557 elseif kind ==# 'col'
| 1558 return val
| 1559 \->map('s:InvertLayout(v:val, a:path + ["|"])')
| 1560 \->reduce({a, b -> extend(a, b)})
| 1561 elseif kind ==# 'row'
| 1562 return val
| 1563 \->map('s:InvertLayout(v:val, a:path + ["-"])')
| 1564 \->reduce({a, b -> extend(a, b)})
| 1565 endif
| 1566 endfunction
| 1567
| 1568
| 1569
| 1570
| 1571
|+ |- 1572 +--- 22 lines:
1572
|| 1573 command! FindOrMakeJavaTest call s:FindOrMakeJavaTest()
|| 1574 function! s:FindOrMakeJavaTest() abort
|| 1575 let l:path = expand('%:p:h')
|| 1576 let l:name = expand('%:t:r')
|| 1577 let l:extn = expand('%:t:e')
|| 1578 if l:path =~# ".*/src/main/java/.*"
|| 1579 let l:path = substitute(l:path, "src/main/java", "src/test/java", "")
|| 1580 let l:name .= 'Test'
|| 1581 elseif l:path =~# ".*/src/test/java/.*" && l:name =~# ".*Test$"
|| 1582 let l:path = substitute(l:path, "src/test/java", "src/main/java", "")
|| 1583 let l:name = l:name[:-5]
|| 1584 elseif l:path =~# ".*/java/.*"
|| 1585 let l:path = substitute(l:path, "/java/", "/javatests/", "")
|| 1586 let l:name .= 'Test'
|| 1587 elseif l:path =~# ".*/javatests/.*" && l:name =~# ".*Test$"
|| 1588 let l:path = substitute(l:path, "/javatests/", "/java/", "")
|| 1589 let l:name = l:name[:-5]
|| 1590 endif
|| 1591 execute 'edit' $"{l:path}/{l:name}.{l:extn}"
|| 1592 endfunction
|| 1593
| 1594
| 1595
1596
+ - 1597 +-- 5 lines: Notes
1597
| 1598 let s:Wtf = bss#wtf#Initialize()
| 1599 call bss#wtf#AddDict(['mappings', 'm'], g:jm_vimrc.docs.mappings)
| 1600 call bss#wtf#AddDict(['commands', 'c'], g:jm_vimrc.docs.commands)
| 1601
1602
1603
1604
1605
1606 TODO
+ - 1607 +--271 lines: Java Import Cache:
1607
| 1608 let g:jm_vimrc.java_import_list =<< JAVA_IMPORT_LIST_END
| 1609 com.google.auto.common.AnnotationMirrors
| 1610 com.google.auto.common.AnnotationValues
| 1611 com.google.auto.common.BasicAnnotationProcessor
| 1612 com.google.auto.common.MoreElements
| 1613 com.google.auto.common.MoreTypes
| 1614 com.google.common.base.Stopwatch
| 1615 com.google.common.collect.ImmutableList
| 1616 com.google.common.collect.ImmutableMap
| 1617 com.google.common.collect.ImmutableSet
| 1618 com.google.common.collect.ImmutableTable
| 1619 com.google.common.collect.Lists
| 1620 com.google.common.collect.Streams
| 1621 com.google.common.collect.Table
| 1622 com.google.common.collect.Tables
| 1623 com.google.common.math.Stats
| 1624 com.google.common.math.StatsAccumulator
| 1625 com.google.common.util.concurrent.AbstractExecutionThreadService
| 1626 com.google.common.util.concurrent.AbstractFuture
| 1627 com.google.common.util.concurrent.AbstractScheduledService
| 1628 com.google.common.util.concurrent.AbstractTransformFuture
| 1629 com.google.common.util.concurrent.FutureCallback
| 1630 com.google.common.util.concurrent.Futures
| 1631 com.google.common.util.concurrent.ListenableFuture
| 1632 com.google.common.util.concurrent.ListenableFutureTask
| 1633 com.google.common.util.concurrent.ListenableScheduledFuture
| 1634 com.google.common.util.concurrent.ListenerCallQueue
| 1635 com.google.common.util.concurrent.ListeningExecutorService
| 1636 com.google.common.util.concurrent.ListeningScheduledExecutorService
| 1637 com.google.common.util.concurrent.MoreExecutors
| 1638 com.google.common.util.concurrent.SettableFuture
| 1639 com.google.common.util.concurrent.Uninterruptibles
| 1640 com.squareup.javapoet.ClassName
| 1641 com.squareup.javapoet.CodeBlock
| 1642 com.squareup.javapoet.FieldSpec
| 1643 com.squareup.javapoet.JavaFile
| 1644 com.squareup.javapoet.MethodSpec
| 1645 com.squareup.javapoet.ParameterSpec
| 1646 com.squareup.javapoet.ParameterizedTypeName
| 1647 com.squareup.javapoet.TypeName
| 1648 com.squareup.javapoet.TypeSpec
| 1649 dagger.Binds
| 1650 dagger.BindsInstance
| 1651 dagger.Component
| 1652 dagger.MapKey
| 1653 dagger.Module
| 1654 dagger.Provides
| 1655 dagger.multibindings.ClassKey
| 1656 dagger.multibindings.ElementsIntoSet
| 1657 dagger.multibindings.IntKey
| 1658 dagger.multibindings.IntoMap
| 1659 dagger.multibindings.IntoSet
| 1660 dagger.multibindings.LongKey
| 1661 dagger.multibindings.Multibinds
| 1662 dagger.multibindings.StringKey
| 1663 dagger.producers.Produced
| 1664 dagger.producers.Producer
| 1665 dagger.producers.ProducerModule
| 1666 dagger.producers.Producers
| 1667 dagger.producers.Produces
| 1668 dagger.producers.Production
| 1669 dagger.producers.ProductionComponent
| 1670 dagger.producers.ProductionScope
| 1671 dagger.producers.ProductionSubcomponent
| 1672 dagger.producers.monitoring.ProducerMonitor
| 1673 dagger.producers.monitoring.ProducerToken
| 1674 dagger.producers.monitoring.ProductionComponentMonitor
| 1675 java.io.IOException
| 1676 java.lang.reflect.AnnotatedElement
| 1677 java.lang.reflect.Executable
| 1678 java.lang.reflect.Field
| 1679 java.lang.reflect.GenericDeclaration
| 1680 java.lang.reflect.Method
| 1681 java.lang.reflect.Modifier
| 1682 java.lang.reflect.Type
| 1683 java.nio.file.Files
| 1684 java.nio.file.Path
| 1685 java.util.ArrayList
| 1686 java.util.Arrays
| 1687 java.util.Collection
| 1688 java.util.HashMap
| 1689 java.util.HashSet
| 1690 java.util.Iterator
| 1691 java.util.LinkedList
| 1692 java.util.List
| 1693 java.util.Map
| 1694 java.util.NavigableMap
| 1695 java.util.Optional
| 1696 java.util.OrderedMap
| 1697 java.util.Set
| 1698 java.util.TreeMap
| 1699 java.util.TreeSet
| 1700 java.util.concurrent.ConcurrentHashMap
| 1701 java.util.concurrent.CopyOnWriteArrayList
| 1702 java.util.concurrent.ExecutionException
| 1703 java.util.concurrent.Executor
| 1704 java.util.concurrent.ExecutorService
| 1705 java.util.concurrent.Executors
| 1706 java.util.concurrent.Future
| 1707 java.util.concurrent.ThreadPoolExecutor
| 1708 java.util.concurrent.TimeUnit
| 1709 java.util.concurrent.atomic.AtomicInteger
| 1710 java.util.concurrent.atomic.AtomicLong
| 1711 java.util.concurrent.atomic.LongAdder
| 1712 java.util.function.Consumer
| 1713 java.util.function.Function
| 1714 java.util.function.Predicate
| 1715 java.util.function.Supplier
| 1716 java.util.stream.Collector
| 1717 java.util.stream.Collectors
| 1718 java.util.stream.Stream
| 1719 javax.annotation.processing.AbstractProcessor
| 1720 javax.annotation.processing.Completion
| 1721 javax.annotation.processing.Completions
| 1722 javax.annotation.processing.Filer
| 1723 javax.annotation.processing.FilerException
| 1724 javax.annotation.processing.Generated
| 1725 javax.annotation.processing.Messager
| 1726 javax.annotation.processing.ProcessingEnvironment
| 1727 javax.annotation.processing.Processor
| 1728 javax.annotation.processing.RoundEnvironment
| 1729 javax.annotation.processing.SupportedAnnotationTypes
| 1730 javax.annotation.processing.SupportedOptions
| 1731 javax.annotation.processing.SupportedSourceVersion
| 1732 javax.inject.Inject
| 1733 javax.inject.Named
| 1734 javax.inject.Provider
| 1735 javax.inject.Qualifier
| 1736 javax.inject.Singleton
| 1737 javax.lang.model.element.Element
| 1738 javax.lang.model.element.ElementVisitor
| 1739 javax.lang.model.element.ExecutableElement
| 1740 javax.lang.model.element.Modifier
| 1741 javax.lang.model.element.TypeElement
| 1742 javax.lang.model.type.TypeMirror
| 1743 org.apache.commons.lang3.builder.ReflectionToStringBuilder
| 1744 org.apache.commons.lang3.builder.ToStringStyle
| 1745 org.objectweb.asm.ClassReader
| 1746 org.objectweb.asm.ClassVisitor
| 1747 org.objectweb.asm.ClassWriter
| 1748 org.objectweb.asm.FieldVisitor
| 1749 org.objectweb.asm.MethodVisitor
| 1750 org.objectweb.asm.Opcodes
| 1751 org.objectweb.asm.TypePath
| 1752 org.openjdk.jmh.annotations.AuxCounters
| 1753 org.openjdk.jmh.annotations.Benchmark
| 1754 org.openjdk.jmh.annotations.BenchmarkMode
| 1755 org.openjdk.jmh.annotations.CompilerControl
| 1756 org.openjdk.jmh.annotations.Fork
| 1757 org.openjdk.jmh.annotations.Group
| 1758 org.openjdk.jmh.annotations.GroupThreads
| 1759 org.openjdk.jmh.annotations.Level
| 1760 org.openjdk.jmh.annotations.Measurement
| 1761 org.openjdk.jmh.annotations.Mode
| 1762 org.openjdk.jmh.annotations.OperationsPerInvocation
| 1763 org.openjdk.jmh.annotations.OutputTimeUnit
| 1764 org.openjdk.jmh.annotations.Param
| 1765 org.openjdk.jmh.annotations.Scope
| 1766 org.openjdk.jmh.annotations.Setup
| 1767 org.openjdk.jmh.annotations.State
| 1768 org.openjdk.jmh.annotations.TearDown
| 1769 org.openjdk.jmh.annotations.Threads
| 1770 org.openjdk.jmh.annotations.Timeout
| 1771 org.openjdk.jmh.annotations.Warmup
| 1772 org.openjdk.jmh.infra.BenchmarkParams
| 1773 org.openjdk.jmh.infra.Blackhole
| 1774 org.openjdk.jmh.infra.Control
| 1775 org.openjdk.jmh.infra.IterationParams
| 1776 org.openjdk.jmh.infra.ThreadParams
| 1777 org.openjdk.jmh.results.RunResult
| 1778 org.openjdk.jmh.results.format.ResultFormatType
| 1779 org.openjdk.jmh.runner.Runner
| 1780 org.openjdk.jmh.runner.RunnerException
| 1781 org.openjdk.jmh.runner.options.CommandLineOptionException
| 1782 org.openjdk.jmh.runner.options.CommandLineOptions
| 1783 org.openjdk.jmh.runner.options.Options
| 1784 org.openjdk.jmh.runner.options.OptionsBuilder
| 1785 static com.google.common.collect.ImmutableList.toImmutableList
| 1786 static com.google.common.collect.ImmutableSet.toImmutableSet
| 1787 static com.google.common.truth.Truth.assertThat
| 1788 static com.google.common.truth.Truth.assertWithMessage
| 1789 static com.google.common.util.concurrent.MoreExecutors.directExecutor
| 1790 static java.util.concurrent.TimeUnit.DAYS
| 1791 static java.util.concurrent.TimeUnit.HOURS
| 1792 static java.util.concurrent.TimeUnit.MICROSECONDS
| 1793 static java.util.concurrent.TimeUnit.MILLISECONDS
| 1794 static java.util.concurrent.TimeUnit.MINUTES
| 1795 static java.util.concurrent.TimeUnit.NANOSECONDS
| 1796 static java.util.concurrent.TimeUnit.SECONDS
| 1797 static java.util.stream.Collectors.averagingDouble
| 1798 static java.util.stream.Collectors.averagingInt
| 1799 static java.util.stream.Collectors.averagingLong
| 1800 static java.util.stream.Collectors.collectingAndThen
| 1801 static java.util.stream.Collectors.counting
| 1802 static java.util.stream.Collectors.filtering
| 1803 static java.util.stream.Collectors.flatMapping
| 1804 static java.util.stream.Collectors.groupingBy
| 1805 static java.util.stream.Collectors.joining
| 1806 static java.util.stream.Collectors.mapping
| 1807 static java.util.stream.Collectors.maxBy
| 1808 static java.util.stream.Collectors.minBy
| 1809 static java.util.stream.Collectors.partitioningBy
| 1810 static java.util.stream.Collectors.reducing
| 1811 static java.util.stream.Collectors.summarizingDouble
| 1812 static java.util.stream.Collectors.summarizingInt
| 1813 static java.util.stream.Collectors.summarizingLong
| 1814 static java.util.stream.Collectors.summingDouble
| 1815 static java.util.stream.Collectors.summingInt
| 1816 static java.util.stream.Collectors.summingLong
| 1817 static java.util.stream.Collectors.toCollection
| 1818 static java.util.stream.Collectors.toConcurrentMap
| 1819 static java.util.stream.Collectors.toList
| 1820 static java.util.stream.Collectors.toMap
| 1821 static java.util.stream.Collectors.toSet
| 1822 static java.util.stream.Collectors.toUnmodifiableList
| 1823 static java.util.stream.Collectors.toUnmodifiableMap
| 1824 static java.util.stream.Collectors.toUnmodifiableSet
| 1825 java.net.ServerSocket
| 1826 java.net.Socket
| 1827 java.io.OutputStream
| 1828 com.google.common.flogger.FluentLogger
| 1829 static com.google.common.util.concurrent.Futures.immediateFuture
| 1830 java.util.concurrent.atomic.AtomicReference
| 1831 static com.google.common.util.concurrent.Futures.immediateVoidFuture
| 1832 java.util.concurrent.atomic.AtomicMarkableReference
| 1833 java.util.Random
| 1834 java.time.Instant
| 1835 static com.google.common.base.Preconditions.checkArgument
| 1836 static com.google.common.base.Preconditions.checkNotNull
| 1837 static org.mockito.Mockito.mock
| 1838 static org.mockito.Mockito.verify
| 1839 static org.mockito.ArgumentMatchers.any
| 1840 static org.mockito.Mockito.times
| 1841 static org.mockito.AdditionalMatchers.and
| 1842 static org.mockito.ArgumentMatchers.assertArg
| 1843 JAVA_IMPORT_LIST_END
| 1844
| 1845 command! AddJavaImport call AddJavaImport(getline('.'))
| 1846 function! AddJavaImport(content) abort
| 1847 let content = a:content
| 1848 \->substitute('^import ', '', '')
| 1849 \->substitute(';$', '', '')
| 1850 if index(g:jm_vimrc.java_import_list, content) != -1
| 1851 echom "Already present:" content
| 1852 return
| 1853 endif
| 1854 let lines = readfile($MYVIMRC)
| 1855 let index = match(lines, '^JAVA_IMPORT_LIST_END$')
| 1856 call insert(lines, content, index)
| 1857 call writefile(lines, $MYVIMRC)
| 1858 echom "Added:" content
| 1859 endfunction
| 1860
| 1861 function! s:ProcessJavaImportList(import_list) abort
| 1862 let cache = {}
| 1863 for elem in a:import_list
| 1864 let name = slice(elem, strridx(elem, '.') + 1)
| 1865 if has_key(cache, name)
| 1866 call add(cache[name], elem)
| 1867 else
| 1868 let cache[name] = [elem]
| 1869 endif
| 1870 endfor
| 1871 return cache
| 1872 endfunction
| 1873
| 1874 let g:jm_vimrc.java_import_cache =
| 1875 \ s:ProcessJavaImportList(g:jm_vimrc.java_import_list)
| 1876
| 1877
1878
1879
+ - 1880 +--193 lines: C++ Import Cache:
1880
| 1881 let g:jm_vimrc.cc_import_cache = {
| 1882 \ '"absl/flags/flag.h"': ['ABSL_FLAG', 'GetFlag'],
| 1883 \ '"absl/flags/declare.h"': ['ABSL_DECLARE_FLAG'],
| 1884 \ '"absl/flags/parse.h"': ['ParseCommandLine'],
| 1885 \ '"absl/flags/usage.h"': ['ProgramUsageMessage', 'SetProgramUsageMessage'],
| 1886 \ '"absl/strings/str_join.h"': ['StrJoin'],
| 1887 \ '"absl/strings/str_cat.h"': ['StrCat'],
| 1888 \ '"absl/strings/str_replace.h"': ['StrReplaceAll'],
| 1889 \ '"absl/strings/str_split.h"': ['StrSplit'],
| 1890 \ '"absl/status/status.h"': ['Status'],
| 1891 \ '"absl/status/statusor.h"': ['StatusOr'],
| 1892 \ '<opencv2/core.hpp>': [
| 1893 \ 'Mat',
| 1894 \ 'Mat_',
| 1895 \ 'Mat1b', 'Mat2b', 'Mat3b', 'Mat4b',
| 1896 \ 'Mat1i', 'Mat2i', 'Mat3i', 'Mat4i',
| 1897 \ 'Mat1f', 'Mat2f', 'Mat3f', 'Mat4f',
| 1898 \ 'Mat1d', 'Mat2d', 'Mat3d', 'Mat4d',
| 1899 \ 'Matx',
| 1900 \ 'Matx22f', 'Matx33f', 'Matx44f',
| 1901 \ 'Matx21f', 'Matx31f', 'Matx41f',
| 1902 \ 'Matx22d', 'Matx33d', 'Matx44d',
| 1903 \ 'Matx21d', 'Matx31d', 'Matx41d',
| 1904 \ 'Vec',
| 1905 \ 'Vec1b', 'Vec2b', 'Vec3b', 'Vec4b', 'Vec6b',
| 1906 \ 'Vec1i', 'Vec2i', 'Vec3i', 'Vec4i', 'Vec6i',
| 1907 \ 'Vec1f', 'Vec2f', 'Vec3f', 'Vec4f', 'Vec6f',
| 1908 \ 'Vec1d', 'Vec2d', 'Vec3d', 'Vec4d', 'Vec6d',
| 1909 \ 'Scalar_', 'Scalar',
| 1910 \ 'Point_', 'Point2i', 'Point2l', 'Point2f', 'Point2d',
| 1911 \ 'Point3_', 'Point3i', 'Point3l', 'Point3f', 'Point3d',
| 1912 \ 'abs',
| 1913 \ 'exp', 'log',
| 1914 \ 'pow', 'sqrt',
| 1915 \ ],
| 1916 \ '<opencv2/imgcodecs.hpp>': ['imread', 'imwrite'],
| 1917 \ '<opencv2/imgproc.hpp>': ['circle'],
| 1918 \ '<utility>': [
| 1919 \ 'forward', 'declval',
| 1920 \ 'move', 'swap', 'exchange',
| 1921 \ 'integer_sequence', 'make_integer_sequence',
| 1922 \ 'index_sequence', 'make_index_sequence',
| 1923 \ 'pair', 'make_pair',
| 1924 \ ],
| 1925 \ '<memory>': ['unique_ptr', 'make_unique'],
| 1926 \ '<vector>': ['vector'],
| 1927 \ '<tuple>': [
| 1928 \ 'tuple',
| 1929 \ 'tuple_size',
| 1930 \ 'tuple_element',
| 1931 \ 'get',
| 1932 \ ],
| 1933 \ '<type_traits>': [
| 1934 \ 'enable_if', 'conditional',
| 1935 \ 'enable_if_t', 'conditional_t',
| 1936 \ 'integral_constant', 'bool_constant',
| 1937 \ 'true_type', 'false_type',
| 1938 \ 'conjunction', 'disjunction', 'negation',
| 1939 \ 'conjunction_v', 'disjunction_v', 'negation_v',
| 1940 \ 'is_same', 'is_base_of', 'is_convertible',
| 1941 \ 'is_same_v', 'is_base_of_v', 'is_convertible_v',
| 1942 \ ],
| 1943 \ '<array>': ['array'],
| 1944 \ '<valarray>': ['valarray'],
| 1945 \ '<cstddef>': [
| 1946 \ 'size_t', 'ptrdiff_t', 'nullptr_t',
| 1947 \ ],
| 1948 \ '<future>': [
| 1949 \ 'future', 'promise', 'async', 'launch',
| 1950 \ ],
| 1951 \ '<thread>': [
| 1952 \ 'thread', 'this_thread', 'yield', 'get_id', 'sleep_for',
| 1953 \ ],
| 1954 \ '<cstdint>': [
| 1955 \ 'int8_t', 'int16_t', 'int32_t', 'int64_t',
| 1956 \ 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
| 1957 \ ],
| 1958 \ '<cmath>': [
| 1959 \ 'abs',
| 1960 \ 'exp', 'log', 'log2', 'log10',
| 1961 \ 'pow', 'sqrt', 'hypot',
| 1962 \ 'sin', 'cos', 'tan',
| 1963 \ 'asin', 'acos', 'atan',
| 1964 \ 'sinh', 'cosh', 'tanh',
| 1965 \ 'asinh', 'acosh', 'atanh',
| 1966 \ 'ceil', 'floor', 'trunc', 'round',
| 1967 \ ],
| 1968 \ '<string>': [
| 1969 \ 'string',
| 1970 \ 'to_string',
| 1971 \ 'stoi', 'stol', 'stoul', 'stoll', 'stoull',
| 1972 \ 'stof', 'stod', 'stold',
| 1973 \ ],
| 1974 \ '<map>': ['map'],
| 1975 \ '<unordered_map>': ['unordered_map'],
| 1976 \ '<set>': ['set'],
| 1977 \ '<iostream>': [
| 1978 \ 'cout', 'cin', 'cerr',
| 1979 \ 'endl',
| 1980 \ ],
| 1981 \ '<ios>': [
| 1982 \ 'internal', 'left', 'right',
| 1983 \ 'boolalpha', 'showbase', 'showpos',
| 1984 \ 'dec', 'hex', 'oct',
| 1985 \ 'fixed', 'scientific', 'default',
| 1986 \ ],
| 1987 \ '<format>': ['format'],
| 1988 \ '<iomanip>': [
| 1989 \ 'setw',
| 1990 \ 'quoted',
| 1991 \ ],
| 1992 \ '<unordered_set>': ['unordered_set'],
| 1993 \ '<optional>': ['optional'],
| 1994 \ '<complex>': ['complex'],
| 1995 \ '<initializer_list>': ['initializer_list'],
| 1996 \ '<numeric>': [
| 1997 \ 'iota',
| 1998 \ 'accumulate',
| 1999 \ 'reduce',
| 2000 \ 'inner_product',
| 2001 \ 'adjacent_difference',
| 2002 \ 'partial_sum',
| 2003 \ ],
| 2004 \ '<cstdlib>': [
| 2005 \ 'system',
| 2006 \ 'exit',
| 2007 \ 'getenv',
| 2008 \ 'malloc',
| 2009 \ 'free',
| 2010 \ 'aligned_malloc',
| 2011 \ ],
| 2012 \ '<random>': [
| 2013 \ 'random_device',
| 2014 \ 'mt19937',
| 2015 \ 'mt19937_64',
| 2016 \ 'uniform_real_distribution',
| 2017 \ 'uniform_int_distribution',
| 2018 \ 'normal_distribution',
| 2019 \ ],
| 2020 \ '<functional>': [
| 2021 \ 'function',
| 2022 \ 'plus', 'minus', 'multiplies', 'divides',
| 2023 \ 'equal_to', 'not_equal_to',
| 2024 \ 'greater', 'less', 'greater_equal', 'less_equal',
| 2025 \ 'logical_and', 'logical_or', 'logical_not',
| 2026 \ 'bit_end', 'bit_or', 'bit_xor', 'bit_not',
| 2027 \ ],
| 2028 \ '<algorithm>': [
| 2029 \
| 2030 \ 'all_of', 'any_of', 'none_of',
| 2031 \ 'for_each', 'for_each_n',
| 2032 \ 'count', 'count_if',
| 2033 \ 'mismatch',
| 2034 \ 'find', 'find_if', 'find_if_not',
| 2035 \ 'find_end', 'find_first_of', 'adjacent_find',
| 2036 \ 'search', 'search_n',
| 2037 \
| 2038 \ 'copy', 'copy_backward', 'move', 'move_backward', 'copy_n',
| 2039 \ 'fill', 'fill_n', 'transform', 'generate', 'generate_n',
| 2040 \ 'remove', 'remove_if', 'remove_copy', 'remove_copy_if',
| 2041 \ 'replace', 'replace_if', 'replace_copy', 'replace_copy_if',
| 2042 \ 'swap', 'swap_ranges', 'swap_iter',
| 2043 \ 'reverse', 'reverse_copy', 'rotate',
| 2044 \ 'rotate_copy',
| 2045 \ 'shuffle',
| 2046 \ 'max', 'min', 'max_element', 'min_element', 'minmax',
| 2047 \ ],
| 2048 \ '"absl/algorithm/container.h"': [
| 2049 \
| 2050 \ 'c_all_of', 'c_any_of', 'c_none_of',
| 2051 \ 'c_for_each', 'c_for_each_n',
| 2052 \ 'c_count', 'c_count_if',
| 2053 \ 'c_mismatch',
| 2054 \ 'c_find', 'c_find_if', 'c_find_if_not',
| 2055 \ 'c_find_end', 'c_find_first_of', 'c_adjacent_find',
| 2056 \ 'c_search', 'c_search_n',
| 2057 \
| 2058 \ 'c_copy', 'c_copy_backward', 'c_move', 'c_move_backward', 'c_copy_n',
| 2059 \ 'c_fill', 'c_fill_n', 'c_transform', 'c_generate', 'c_generate_n',
| 2060 \ 'c_remove', 'c_remove_if', 'c_remove_copy', 'c_remove_copy_if',
| 2061 \ 'c_replace', 'c_replace_if', 'c_replace_copy', 'c_replace_copy_if',
| 2062 \ 'c_swap', 'c_swap_ranges', 'c_swap_iter',
| 2063 \ 'c_reverse', 'c_reverse_copy', 'c_rotate',
| 2064 \ 'c_rotate_copy',
| 2065 \ 'c_shuffle',
| 2066 \ ],
| 2067 \ '<iterator>': [
| 2068 \ 'istream_iterator',
| 2069 \ 'ostream_iterator',
| 2070 \ ],
| 2071 \ }
| 2072