1 " Copyright (c) 2026 Julian Mendoza;
      2 "
      3 " MIT License
      4 "
      5 " Permission is hereby granted, free of charge, to any person obtaining a copy
      6 " of this software and associated documentation files (the "Software"), to deal
      7 " in the Software without restriction, including without limitation the rights
      8 " to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      9 " copies of the Software, and to permit persons to whom the Software is
     10 " furnished to do so, subject to the following conditions:
     11 "
     12 " The above copyright notice and this permission notice shall be included in all
     13 " copies or substantial portions of the Software.
     14 "
     15 " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 " IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 " FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     18 " AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19 " LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     20 " OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     21 " SOFTWARE.
     22 
     23 ""
     24 " jmend's vimrc!
     25 "
     26 " Self Link: jmend.io/vimrc
     27 "
     28 " Installing Required Plugins:
     29 "   1. Install vim-plug: https://github.com/junegunn/vim-plug
     30 "   2. Run :PlugInstall
     31 "   3. Restart vim
     32 "
     33 " Self-Documentation:
     34 "   :Wtf commands ~ Show commands set in this vimrc
     35 "   :Wtf mappings ~ Show mappings set in this vimrc
     36 "   :Wtf <tab>    ~ Show other documentation available
     37 "                   (Mostly misc. stuff I find useful to remember)
     38 
     39 " Required here for vim9+
     40 set nocompatible
     41 
     42 " Command Prefix:
     43 "   <leader>      : used for global mappings
     44 "   <localleader> : used for buffer-local mappings
     45 let mapleader = '\'
     46 let maplocalleader = '\'
     47 
+  -    48 +-- 46 lines: System Dependencies:
  48 " System Dependencies: {{{
|    49 let g:jm_vimrc = {}
|    50 
|    51 " Will store documentation
|    52 " Accessible with the :Wtf command
|    53 let g:jm_vimrc.docs = {}
|    54 
|    55 " Map from defined commands to description
|    56 " See :Wtf commands
|    57 let g:jm_vimrc.docs.commands = {}
|    58 
|    59 " Map from defined mappings to description
|    60 " See :Wtf mappings
|    61 let g:jm_vimrc.docs.mappings = {}
|    62 
|    63 " A variety of dependencies on the system
|    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 " Whether this computer is a mac
|    75 let g:jm_vimrc.is_mac = system('uname -s') =~# 'Darwin'
|    76 
|    77 " Whether python is supported
|    78 let g:jm_vimrc.has_python = has('python3')
|    79 
|    80 " Some system dependencies
|    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 "let g:jm_vimrc.deps.google_java_executable = 'google-java-format --skip-javadoc-formatting'
|    84 let g:jm_vimrc.deps.google_java_executable = 'google-java-format'
|    85 let g:jm_vimrc.deps.ktfmt_executable = [
|    86       \   'java',
|    87       \   '-jar',
|    88       \   ((g:jm_vimrc.is_mac)
|    89       \     ? '/Users/jmend/.classpath/ktfmt-0.62-with-dependencies.jar'
|    90       \     : '/home/jmend/.classpath/ktfmt-0.62-with-dependencies.jar')
|    91       \ ]
|    92 let g:jm_vimrc.deps.buildozer   = 'fish -c buildozer'
|    93 " }}}
     94 
+  -    95 +-- 30 lines: Playground:
  95 " Playground: {{{
|    96 let s:pg_items = (g:jm_vimrc.is_mac)
|    97       \ ? #{
|    98       \     b:  'Files ~/Playground/basis',
|    99       \     co: 'Files ~/Playground',
|   100       \     cg: 'Files ~/Playground/third_party/guava',
|   101       \     cj: 'Files ~/Playground/jdk/src/java.base/share/classes',
|   102       \     ck: 'Files ~/Playground/third_party/kotlin',
|   103       \     cK: 'Files ~/Playground/third_party/kotlinx.coroutines',
|   104       \     cO: 'Files /opt/homebrew/lib/ocaml/',
|   105       \     pg: 'Files ~/Playground',
|   106       \     n:  'Files ~/Playground/jmendio/n',
|   107       \     v:  'edit ~/.vimrc',
|   108       \   }
|   109       \ : #{
|   110       \     b:  'Files ~/code/basis',
|   111       \     co: 'Files ~/code',
|   112       \     cg: 'Files ~/code/guava/guava/src',
|   113       \     cj: 'Files ~/code/jdk/src/java.base/share/classes',
|   114       \     ck: 'Files ~/code/kotlin',
|   115       \     cK: 'Files ~/code/kotlinx.coroutines',
|   116       \     cO: 'Files /usr/lib/ocaml',
|   117       \     n:  'Files ~/jmendio/n',
|   118       \     v:  'edit ~/.vimrc',
|   119       \   }
|   120 for [key, path] in items(s:pg_items)
|   121   execute printf('nnoremap <leader>e%s :%s<cr>', key, path)
|   122   let g:jm_vimrc.docs.mappings['\e' .. key] = 'Run :' .. path
|   123 endfor
|   124 " }}} Playground
    125 
+  -   126 +-- 88 lines: Plugins (vim-plug):
 126 " Plugins (vim-plug): {{{
|   127 call plug#begin('~/.vim/bundle')
|   128 
|   129 "" Plugins:
|   130 Plug 'morhetz/gruvbox'
|   131 Plug 'tpope/vim-surround'
|   132 Plug 'scrooloose/nerdtree'
|   133 Plug 'godlygeek/tabular'
|   134 if g:jm_vimrc.has_python
|   135   Plug 'SirVer/ultisnips'
|   136   Plug 'Valloric/YouCompleteMe'
|   137 endif
|   138 Plug 'honza/vim-snippets'
|   139 Plug 'junegunn/fzf', {'do': {-> fzf#install()}}
|   140 Plug 'junegunn/fzf.vim'
|   141 Plug 'junegunn/vim-easy-align'
|   142 Plug 'tpope/vim-fugitive'
|   143 Plug 'moll/vim-bbye'
|   144 Plug 'scrooloose/nerdcommenter' " \c<Space> \cc
|   145 Plug 'jiangmiao/auto-pairs'
|   146 Plug 'tpope/vim-repeat'
|   147 Plug 'triglav/vim-visual-increment'
|   148 Plug 'tmhedberg/SimpylFold'
|   149 Plug 'majutsushi/tagbar'
|   150 Plug 'pangloss/vim-javascript'
|   151 Plug 'justinmk/vim-syntax-extra'
|   152 Plug 'jpalardy/vim-slime'
|   153 Plug 'itchyny/lightline.vim'
|   154 Plug 'ap/vim-buftabline'
|   155 Plug 'airblade/vim-gitgutter'
|   156 Plug 'google/vim-maktaba'
|   157 Plug 'google/vim-codefmt'
|   158 Plug 'google/vim-glaive'
|   159 Plug 'frazrepo/vim-rainbow'
|   160 Plug 'AndrewRadev/splitjoin.vim' " gS gJ
|   161 Plug 'AndrewRadev/linediff.vim'
|   162 Plug 'shiracamus/vim-syntax-x86-objdump-d'
|   163 if isdirectory('$OCAML_OCP_INDENT')
|   164   Plug $OCAML_OCP_INDENT
|   165 endif
|   166 if exists("$BASIS")
|   167   Plug $BASIS, { 'rtp': 'vim' }
|   168 else
|   169   Plug 'jmend736/basis', { 'rtp': 'vim' }
|   170 endif
|   171 
|   172 "" Old Plugins:
|   173 " Plug 'vim-scripts/DrawIt'
|   174 " Plug 'cohama/lexima.vim'
|   175 " Plug 'mattn/emmet-vim'
|   176 " Plug 'sheerun/vim-polyglot'
|   177 " Plug 'fatih/vim-go'
|   178 " Plug 'davidhalter/jedi-vim'
|   179 " Plug 'ervandew/supertab'
|   180 " Plug 'w0rp/ale'
|   181 " Plug 'neoclide/coc.nvim', {'branch': 'release'}
|   182 " http://eclim.org
|   183 " Plug 'bazelbuild/vim-ft-bzl'
|   184 " -> https://github.com/bazelbuild/vim-ft-bzl/commit/941fb142f604c254029c2a0852ea7578f08de91a
|   185 " Plug 'nelstrom/vim-markdown-folding'
|   186 " Plug 'romainl/vim-devdocs'
|   187 
|   188 "" Plugins to check out:
|   189 " Plug 'liuchengxu/vista.vim'
|   190 " Plug 'natebosch/vim-lsc'
|   191 " Plug 'chrisbra/NrrwRgn'
|   192 " Plug 'justinmk/vim-sneak'
|   193 " Plug 'romainl/vim-qf'
|   194 " Plug 'romainl/vim-qlist'
|   195 " Plug 'mbbill/undotree'
|   196 " Plug 'wellle/targets.vim'
|   197 call plug#end()
|   198 
|   199 if !exists('g:loaded_plug')
|   200   echoerr "ERROR: vim-plug is REQUIRED https://github.com/junegunn/vim-plug OR :InstallPlug"
|   201   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)
|   202   finish
|   203 endif
|   204 
|   205 
|   206 call glaive#Install()
|   207 
|   208 Glaive codefmt
|   209       \ google_java_executable=`g:jm_vimrc.deps.google_java_executable`
|   210       \ clang_format_style='Google'
|   211       \ ktfmt_executable=`g:jm_vimrc.deps.ktfmt_executable`
|   212 
|   213 " }}} Plugins (Vundle)
    214 
+  -   215 +--105 lines: General Options:
 215 " General Options: {{{
|   216 filetype plugin indent on
|   217 
|   218 set t_Co=256        " Number of colors
|   219 set t_ut=           " Use current background color for clearing
|   220 
|   221 set scrolloff=0     " Minimal number of screen lines to keep above/below cursor
|   222 
|   223 set shell=/bin/bash " Sets the shell to use
|   224 
|   225 set hidden          " Whether to allow modified buffers to be hidden
|   226 
|   227 set tabstop=2       " Number of spaces that a read <Tab> counts for
|   228 set softtabstop=2   " Number of spaces an inserted <Tab> counts for
|   229 set shiftwidth=2    " Sets what >> and << ops do
|   230 set expandtab       " Replace tabs with spaces when editing
|   231 set smarttab        " More reasonable tab actions
|   232 
|   233 set autoindent      " Copy indent from current line when starting a new line
|   234 set smartindent     " Adds indents after {, or 'cinwords'
|   235 
|   236                     " Reasonable backspace functionality
|   237 set backspace=indent,eol,start
|   238 
|   239 set list            " Replace certain characters visually
|   240 set listchars=tab:\>\ ,trail:·,extends:,precedes:|   241 
|   242 set number           " Show line number at cursor,
|   243 set numberwidth=4    " with a column width of 3,
|   244 set relativenumber   " and numbers relative to cursor elsewhere
|   245 set noruler          " Show line/col number (hidden by lightline)
|   246 set showcmd          " Show currently entered command below status
|   247                      " Define status line (hidden by lightline)
|   248 set statusline=%f\ %=L:%l/%L\ %c\ (%p%%)
|   249 
|   250 set wildmenu         " Tab completion for : command
|   251 set wildmode=longest,list,full
|   252 
|   253 set hlsearch         " Highlight search results
|   254 set incsearch        " Highlight while searching
|   255 set foldopen-=search " Whether to open folds when searching
|   256                      " Also see :ToggleFoldOpenSearch
|   257 set foldlevel=999    " Start with all folds open
|   258 
|   259 " Ignore case, unless you use uppercase characters
|   260 set ignorecase
|   261 set smartcase
|   262 
|   263 " Other
|   264 set fileencodings=utf-8
|   265 set tags=tags
|   266 set tags+=/usr/include/**/tags
|   267 set printoptions=number:y,duplex:long,paper:letter
|   268 if g:jm_vimrc.is_mac
|   269   set clipboard=unnamed
|   270 else
|   271   set clipboard=unnamedplus
|   272 endif
|   273 set errorbells
|   274 set laststatus=2
|   275 set cursorline
|   276 set sessionoptions=
|   277       \blank,
|   278       \curdir,
|   279       \folds,
|   280       \help,
|   281       \localoptions,
|   282       \options,
|   283       \tabpages,
|   284       \winsize,
|   285       \terminal
|   286 
|   287 set directory=~/.swaps//
|   288 
|   289 " Some mathematical digraphs
|   290 digraphs el 8712 " Element in
|   291 digraphs in 8712 " Element in
|   292 digraphs ni 8713 " element not in
|   293 digraphs es 8709 " Empty Set
|   294 digraphs ss 8834 " Subset
|   295 digraphs se 8838 " Subset equals
|   296 digraphs ns 8836 " Not subset
|   297 digraphs nS 8840 " Not subset equals
|   298 digraphs nn 8745 " Intersection
|   299 digraphs uu 8746 " Union
|   300 digraphs un 8746 " Union
|   301 digraphs co 8728 " Composition
|   302 digraphs \|> 8614 " Maps to
|   303 digraphs tl 8598 " Diagonal arrow top-left
|   304 digraphs tr 8599 " Diagonal arrow top-right
|   305 digraphs br 8600 " Diagonal arrow bot-right
|   306 digraphs bl 8601 " Diagonal arrow bot-left
|   307 digraphs -u 8593 " Up arrow
|   308 digraphs -d 8595 " down arrow
|   309 digraphs c. 183  " center dot
|   310 digraphs .. 183  " center dot
|   311 digraphs T- 8866  " Turnstile (right) |-
|   312 digraphs -T 8867  " Turnstile (left) -|
|   313 digraphs =v 8659  " Downwards double arrow
|   314 
|   315 " Themes
|   316 colorscheme gruvbox
|   317 syntax enable
|   318 set bg=dark
|   319 " }}} General Settings
    320 
+  -   321 +-- 67 lines: Plugin Settings:
 321 " Plugin Settings: {{{
|   322 
|   323 let g:lightline = {
|   324       \   'active': {
|   325       \     'left': [['mode', 'paste'], ['filename', 'modified']],
|   326       \     'right': [['winlayout', 'winid_bufnr', 'lineinfo'], ['percent', 'foldlevel'], ['readonly']]
|   327       \   },
|   328       \   'inactive': {
|   329       \     'left': [['filename', 'modified']],
|   330       \     'right': [['winlayout', 'winid_bufnr', 'lineinfo'], ['readonly']]
|   331       \   },
|   332       \   'component_type': {
|   333       \     'readonly': 'error',
|   334       \   },
|   335       \   'component': {
|   336       \     'winid_bufnr': '[%{winnr()}/%{win_getid()}(%{Layout()[win_getid()]})]{%{bufnr()}}',
|   337       \     'foldlevel': '%{(&foldenable) ? &foldlevel : "-"}f',
|   338       \   },
|   339       \ }
|   340 
|   341 if !g:jm_vimrc.is_mac
|   342   let $FZF_DEFAULT_COMMAND = 'ag -l'
|   343 else
|   344   let $FZF_DEFAULT_COMMAND = 'ag -g ""'
|   345 endif
|   346 
|   347 let g:html_dynamic_folds = v:true
|   348 
|   349 let g:ycm_auto_trigger = 1
|   350 let g:ycm_disable_signature_help = 1
|   351 let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
|   352 let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
|   353 
|   354 let g:slime_target = "tmux"
|   355 
|   356 " Will disable indent-based markdown code blocks
|   357 let g:bss_markdown_fix = 1
|   358 
|   359 let g:bss_java_fix = 1
|   360 
|   361 let g:markdown_folding = 1
|   362 
|   363 let g:NERDCompactSexyComs = v:true
|   364 let g:NERDCommentEmptyLines = v:true
|   365 let g:NERDDefaultAlign = 'left'
|   366 
|   367 let g:tagbar_sort = v:false
|   368 
|   369 " Use ordinal numbers (2) rather than bufnum (1)
|   370 let g:buftabline_numbers = 2
|   371 let g:buftabline_indicators = v:true
|   372 let g:buftabline_separators = v:false
|   373 
|   374 let g:netre_liststyle=3
|   375 
|   376 let g:tex_flavor='latex'
|   377 
|   378 let g:UltiSnipsExpandTrigger="<tab>"
|   379 let g:UltiSnipsJumpForwardTrigger="<c-j>"
|   380 let g:UltiSnipsJumpBackwardTrigger="<c-z>"
|   381 let g:UltiSnipsEditSplit="vertical"
|   382 
|   383 let g:gitgutter_sign_added = '··'
|   384 let g:gitgutter_sign_modified = '··'
|   385 let g:gitgutter_sign_removed = '·'
|   386 let g:gitgutter_sign_modified_removed = '·'
|   387 " }}} Plugin Settings
    388 
+  -   389 +--153 lines: Keymappings:
 389 " Keymappings: {{{
|   390 "   To understand keys see :h key-notation
|   391 
|   392 " By default, `j` and `k` will move between lines; this means they will skip
|   393 " over multiple lines when lines wrap.
|   394 "
|   395 " Uncomment the 4 lines below so that `j` and `k` move between lines on the
|   396 " screen.
|   397 "nnoremap j gj
|   398 "nnoremap k gk
|   399 "vnoremap j gj
|   400 "vnoremap k gk
|   401 
|   402 " Moving around between windows quickly
|   403 let g:jm_vimrc.docs.mappings['<C-[hjkl]>'] =
|   404       \ 'Move between windows by holding CTRL'
|   405 noremap <C-j> <C-W>j
|   406 noremap <C-k> <C-W>k
|   407 noremap <C-h> <C-W>h
|   408 noremap <C-l> <C-W>l
|   409 
|   410 let g:jm_vimrc.docs.mappings['<C-[←↑↓→]>'] =
|   411       \ 'Move visual selection'
|   412 vnoremap <C-Up> koko
|   413 vnoremap <C-Down> jojo
|   414 vnoremap <C-Left> hoho
|   415 vnoremap <C-Right> lolo
|   416 
|   417 let g:jm_vimrc.docs.mappings['[['] =
|   418       \ 'Enable [[,][,]],[] to operate on non-col-1-{}'
|   419 " From :h object-motions
|   420 nnoremap [[ ?{<CR>w99[{
|   421 nnoremap ][ /}<CR>b99]}
|   422 nnoremap ]] j0[[%/{<CR>
|   423 nnoremap [] k$][%?}<CR>
|   424 
|   425 let g:jm_vimrc.docs.mappings['\q'] =
|   426       \ 'Delete current buffer without changing window layout'
|   427 nnoremap <leader>q :Bdelete<cr>
|   428 
|   429 let g:jm_vimrc.docs.mappings["\\'"] =
|   430       \ 'Open NERDTree (file explorer)'
|   431 nnoremap <leader>' :NERDTreeToggle<cr>
|   432 
|   433 let g:jm_vimrc.docs.mappings['\"'] =
|   434       \ 'Open NERDTree (file explorer) to current file'
|   435 nnoremap <leader>" :NERDTreeFind<cr>
|   436 
|   437 let g:jm_vimrc.docs.mappings['\<Tab>'] =
|   438       \ 'Open Tagbar'
|   439 nnoremap <leader><tab> :TagbarToggle<cr>
|   440 
|   441 let g:jm_vimrc.docs.mappings['<F10>'] =
|   442       \ 'Toggle paste'
|   443 set pastetoggle=<F10>
|   444 
|   445 let g:jm_vimrc.docs.mappings['<F9>'] =
|   446       \ 'Toggle virtualedit=all'
|   447 nnoremap <F9> :let &ve = <C-r>=empty(&ve) ? '"all"' : '""'<cr><cr>
|   448 
|   449 let g:jm_vimrc.docs.mappings['<C-r><C-f>'] =
|   450       \ '[modes:ic] Insert file name root'
|   451 inoremap <C-r><C-f> <C-r>=expand('%:p:t:r')<cr>
|   452 cnoremap <C-r><C-f> <C-r>=expand('%:p:t:r')<cr>
|   453 
|   454 let g:jm_vimrc.docs.mappings['<C-r><C-t>'] =
|   455       \ '[modes:ic] Insert file name root'
|   456 inoremap <C-r><C-t> <C-r>=bss#blaze#BlazeTarget()<cr>
|   457 cnoremap <C-r><C-t> <C-r>=bss#blaze#BlazeTarget()<cr>
|   458 
|   459 let g:jm_vimrc.docs.mappings['<C-p>'] =
|   460       \ 'Fuzzy-search PWD'
|   461 nnoremap <C-p> :Files<cr>
|   462 
|   463 let g:jm_vimrc.docs.mappings['\w'] =
|   464       \ 'Clear search highlights (:nohlsearch)'
|   465 nnoremap <silent> <leader>w :nohlsearch<Bar>:echo<cr>
|   466 
|   467 let g:jm_vimrc.docs.mappings['<F11>'] =
|   468       \ 'Ensure non-syntax toplevel text is spell-checked'
|   469 noremap <F11> :syntax spell toplevel<cr>
|   470 let g:jm_vimrc.docs.mappings['<F12>'] =
|   471       \ 'Toggle spell checking'
|   472 noremap <F12> :setlocal spell! spelllang=en_us<cr>
|   473 
|   474 let g:jm_vimrc.docs.mappings['<Space>l'] =
|   475       \ 'Open Git ("Change [L]ist")'
|   476 nnoremap <leader>l :Git<cr>
|   477 
|   478 let g:jm_vimrc.docs.mappings['<C-w><C-z>'] =
|   479       \ 'Set window height to 10 and fix the height'
|   480 nnoremap <C-w><C-z> :FixHeight 10<cr>
|   481 nnoremap <C-w>z :FixHeight 10<cr>
|   482 
|   483 let g:jm_vimrc.docs.mappings['K'] =
|   484       \ 'Do grep for word under cursor'
|   485 nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
|   486 
|   487 let g:jm_vimrc.docs.mappings['\\'] =
|   488       \ 'Show :tags'
|   489 nnoremap <leader><leader> :tags<cr>
|   490 
|   491 let g:jm_vimrc.docs.mappings['\s'] =
|   492       \ 'Refresh UltSnips snippets'
|   493 nnoremap <leader>s :call UltiSnips#RefreshSnippets()<cr>
|   494 
|   495 let g:jm_vimrc.docs.mappings['\<Space>'] =
|   496       \ 'Open BssHg'
|   497 nnoremap <leader><space> :BssHg<cr>
|   498 
|   499 let g:jm_vimrc.docs.mappings['\a'] =
|   500       \ 'Trigger EasyAlign (See :Wtf ea)'
|   501 xmap <leader>a <Plug>(EasyAlign)
|   502 nmap <leader>a <Plug>(EasyAlign)
|   503 
|   504 let g:jm_vimrc.docs.mappings['\O'] =
|   505       \ 'Run `open %`'
|   506 xmap <leader>O :<C-u>!open %<cr>
|   507 nmap <leader>O :<C-u>!open %<cr>
|   508 
|   509 let g:jm_vimrc.docs.mappings["C-W !"] =
|   510       \ 'Toggle buflisted'
|   511 nnoremap <C-W>l :set buflisted!<cr>
|   512 
|   513 nnoremap <space>c  :YcmCompleter GetType<cr>
|   514 nnoremap <space>cq :YcmCompleter GoToDocumentOutline<cr>
|   515 nnoremap <space>cc :YcmCompleter GoToCallers<cr>
|   516 nnoremap <space>cC :YcmCompleter GoToDefinition<cr>
|   517 nnoremap <space>cf :YcmCompleter FixIt<cr>
|   518 nnoremap <space>cd :YcmCompleter GetDoc<cr>
|   519 nnoremap <space>ct :YcmCompleter GetType<cr>
|   520 
|   521 let g:jm_vimrc.docs.mappings["<space>T"] =
|   522       \ 'Go to java test (and maybe make it)'
|   523 nnoremap <space>T :FindOrMakeJavaTest<cr>
|   524 
|   525 let g:jm_vimrc.docs.mappings['\a[:(]'] =
|   526       \ 'Extra/overriden EasyAlign items'
|   527 let g:easy_align_delimiters = bss#extra#EasyAlignDelimiters()
|   528 
|   529 let g:jm_vimrc.docs.mappings['\[0-9]'] =
|   530       \ 'Switch to buffer (from buftabline)'
|   531 nmap <leader>1 <Plug>BufTabLine.Go(1)
|   532 nmap <leader>2 <Plug>BufTabLine.Go(2)
|   533 nmap <leader>3 <Plug>BufTabLine.Go(3)
|   534 nmap <leader>4 <Plug>BufTabLine.Go(4)
|   535 nmap <leader>5 <Plug>BufTabLine.Go(5)
|   536 nmap <leader>6 <Plug>BufTabLine.Go(6)
|   537 nmap <leader>7 <Plug>BufTabLine.Go(7)
|   538 nmap <leader>8 <Plug>BufTabLine.Go(8)
|   539 nmap <leader>9 <Plug>BufTabLine.Go(9)
|   540 nmap <leader>0 <Plug>BufTabLine.Go(10)
|   541 " }}} Keymappings
    542 
+  -   543 +--248 lines: Commands:
 543 " Commands: {{{
|   544 " Note -bar allows these to be followed by | to chain commands (ie. for autocmds)
|   545 
|   546 " Command :Term ~ Nicer :term API
|   547 " :Term ~ Runs 'shell'
|   548 " :Term [command]... ~ Runs the command in 'shell'
|   549 "
|   550 " This command will reuse the last window, unless it's no longer being used
|   551 " for the terminal buffer. Also, this hides the buffer, in case you leave a
|   552 " terminal window running and don't want to accidentally get stuck in it.
|   553 if !exists('g:jm_term') || !exists('g:jm_terms')
|   554   let g:jm_term = bss#view#TermView()
|   555   let g:jm_terms = {}
|   556 endif
|   557 let g:jm_vimrc.docs.commands['Term'] =
|   558       \ 'Run a terminal command in a reused window'
|   559 command! -nargs=* -complete=shellcmd Term
|   560       \ eval g:jm_term.Run(<q-args>)
|   561 
|   562 let g:jm_vimrc.docs.commands['TermSet'] =
|   563       \ 'Set an option on the term window'
|   564 command! -nargs=* -complete=option TermSet
|   565       \ eval g:jm_term.Exec(printf("setlocal %s", <q-args>))
|   566 
|   567 let g:jm_vimrc.docs.commands['Terms'] =
|   568       \ 'Run a terminal command in a reused named window. Terms [name] [cmd]...'
|   569 command! -nargs=* -complete=shellcmd Terms
|   570       \ eval bss#SetDefault(g:jm_terms, [<f-args>][0], {-> bss#view#TermView()})
|   571       \   .Run([<f-args>][1:]->join(' '))
|   572 
|   573 let g:jm_vimrc.docs.commands['ReplaceR'] =
|   574       \ 'Locally set \r to run :Term with the specified command'
|   575 command! -nargs=+ ReplaceR
|   576       \ nnoremap <buffer> <localleader>r :Term <args><cr>
|   577 
|   578 let g:jm_vimrc.docs.commands['ReplaceRTarget'] =
|   579       \ 'Set \r to bazel target of the current file'
|   580 command! -bar ReplaceRTarget
|   581       \ execute 'ReplaceR' BlazeGuessCommand()
|   582 
|   583 let g:jm_vimrc.docs.commands['StopAllJobs'] =
|   584       \ 'Stop all running jobs'
|   585 command! -bar StopAllJobs eval job_info()->map('job_stop(v:val)')
|   586 
|   587 let g:jm_vimrc.docs.commands['ListAllJobs'] =
|   588       \ 'List all running jobs'
|   589 command! -bar -bang ListAllJobs
|   590       \ call bss#PP(job_info()->filter('<bang>0 || (job_status(v:val) == "run")'))
|   591 
|   592 let g:jm_vimrc.docs.commands['DumpAllJobs'] =
|   593       \ 'List job_infos for all running jobs'
|   594 command! -bar -bang DumpAllJobs
|   595       \ call bss#PP(job_info()->filter('<bang>0 || (job_status(v:val) == "run")')->map('job_info(v:val)'))
|   596 
|   597 let g:jm_vimrc.docs.commands['SetupClasspath'] =
|   598       \ 'Set classpath to jm_vimrc.deps.ClasspathJarList()'
|   599 command! -bar SetupClasspath
|   600       \ let $CLASSPATH = join(g:jm_vimrc.deps.ClasspathJarList(), ':')
|   601 
|   602 let g:jm_vimrc.docs.commands['SetupTargetClasspath'] =
|   603       \ 'Set classpath to blaze target included jars'
|   604 command! -bar SetupTargetClasspath
|   605       \ let $CLASSPATH = s:TargetClasspath()
|   606 
|   607 let g:jm_vimrc.docs.commands['SetupCV'] =
|   608       \ 'Setup $LDFLAGS, $CFLAGS and &path for OpenCV development'
|   609 command! -bar SetupCV
|   610       \ let $LDFLAGS = '-lopencv_core -lopencv_imgcodecs -lopencv_imgproc' |
|   611       \ let $CFLAGS = '-I/usr/include/opencv4' |
|   612       \ let &path ..= ',/usr/include/opencv4,/usr/include/c++/10/'
|   613 
|   614 let g:jm_vimrc.docs.commands['FixHeight'] =
|   615       \ 'Resize window and fix its height'
|   616 command! -nargs=1 FixHeight
|   617       \ resize <args> | set winfixheight
|   618 
|   619 let g:jm_vimrc.docs.commands['SetupTermRainbow'] =
|   620       \ 'Add Rainbow-coloring to terminals'
|   621 command! -bar SetupTermRainbow
|   622       \ autocmd TerminalOpen * RainbowLoad
|   623 
|   624 let g:jm_vimrc.docs.commands['SetupAutoread'] =
|   625       \ 'Enable autoread and add checktime autocmd'
|   626 command! -bar SetupAutoread
|   627       \ set autoread | autocmd FocusGained,BufEnter * checktime
|   628 
|   629 let g:jm_vimrc.docs.commands['RemoveTrailingWhitespace'] =
|   630       \ 'Removes all trailing whitespace from the selected lines'
|   631 command! -range=% RemoveTrailingWhitespace
|   632       \ <line1>,<line2>s/\s\+$//
|   633 
|   634 let g:jm_vimrc.docs.commands['SetupMatchHex'] =
|   635       \ 'Match hex numbers'
|   636 command! -bar SetupMatchHex
|   637       \ match GruvboxAqua /\<0x0*\zs[1-9a-f]\x*\>/
|   638 
|   639 let g:jm_vimrc.docs.commands['SetupMatchNum'] =
|   640       \ 'Match decimal numbers'
|   641 command! -bar SetupMatchNum
|   642       \ match GruvboxAqua /\<\(0x\)\?0*\zs[1-9a-f]\x*\>/
|   643 
|   644 let g:jm_vimrc.docs.commands['RefreshSnippets'] =
|   645       \ 'Refresh ultisnips'
|   646 command! -bar RefreshSnippets
|   647       \ call UltiSnips#RefreshSnippets()
|   648 
|   649 let g:jm_vimrc.docs.commands['Dis'] =
|   650       \ 'Setup terminal for viewing objdump output ($ objdump -d ... | vim +Dis -)'
|   651 command! -bar Dis
|   652       \ setlocal ft=dis buftype=nofile
|   653 
|   654 let g:jm_vimrc.docs.commands['Center'] =
|   655       \ 'Block alignment-preserving :center'
|   656 call bss#draw#block#RegisterCommands()
|   657 
|   658 let g:jm_vimrc.docs.commands['ToggleFoldOpenSearch'] =
|   659       \ 'Toggle search on foldopen option'
|   660 command! ToggleFoldOpenSearch
|   661       \ if stridx(&foldopen, "search") == -1 |
|   662       \   set foldopen+=search |
|   663       \   echo "ENABLED foldopen search" |
|   664       \ else |
|   665       \   set foldopen-=search |
|   666       \   echo "DISABLED foldopen search" |
|   667       \ endif
|   668 
|   669 let g:jm_vimrc.docs.commands['PyHelp'] =
|   670       \ 'Look-up help for python expression (: PyHelp <pkg> <cls>)'
|   671 command! -nargs=+ -bang PyHelp
|   672       \ call py3eval((<bang>0) ? printf('help(%s)', <q-args>) : printf('help(__import__("%s").%s)', <f-args>))
|   673 
|   674 let g:jm_vimrc.docs.commands['MakeOrSetup'] =
|   675       \ 'Run blaze, make, or create a Makefile with included commands (using ; as separator)'
|   676 command! -nargs=+ MakeOrSetup call s:MakeOrSetup(<q-args>)
|   677 function! s:MakeOrSetup(cmds) abort
|   678   if filereadable('Makefile')
|   679     Term make
|   680   elseif filereadable('WORKSPACE')
|   681     execute 'Term blaze build' BlazeTarget()
|   682   elseif filereadable('gradlew')
|   683     Term ./gradlew test --rerun
|   684   elseif a:cmds =~# 'g:\w*$' && exists(a:cmds)
|   685     let l:ext = eval(a:cmds)
|   686     call s:MakeOrSetupExt(l:ext)
|   687     Term make
|   688   else
|   689     let l:cmds = substitute(a:cmds, '%', expand('%'), 'g')
|   690     let l:lines = split(l:cmds, ';')->map('trim(v:val)')
|   691     let l:cursor = bss#cursor#SaveWithBuf()
|   692     try
|   693       redir > Makefile
|   694       silent echo '.PHONY: all'
|   695       silent echo 'all:'
|   696       for l:cmd in l:lines
|   697         silent echo ' ' .. l:cmd
|   698       endfor
|   699       redir END
|   700       silent edit Makefile
|   701       Term make
|   702     finally
|   703       call l:cursor.Restore()
|   704     endtry
|   705   endif
|   706 endfunction
|   707 
|   708 ""
|   709 " Creates a makefile from a description dict.
|   710 "
|   711 " The {makefile} argument will be a list of dicts or strings:
|   712 "
|   713 "   {'target': ['command_1', ...]}
|   714 "   {'target: input': ['command_1', ...]}
|   715 "   'target: input'
|   716 "
|   717 function! s:MakeOrSetupExt(makefile) abort
|   718   let l:lines = []
|   719   let l:Exp = {str -> substitute(str, '%', expand('%'), 'g')}
|   720   let l:FixTarget = {str -> (stridx(str, ':') == -1) ? str .. ':' : str}
|   721   let l:FixCommand = {str -> "\t" .. str}
|   722   for l:rule in a:makefile
|   723     if type(l:rule) is v:t_string
|   724       eval lines->add(l:FixTarget(l:rule))
|   725       eval lines->add('')
|   726     elseif type(l:rule) is v:t_dict
|   727       for [l:target, l:commands] in items(l:rule)
|   728         eval lines->add(l:FixTarget(l:Exp(l:target)))
|   729         eval lines->extend(l:commands->mapnew({_, v -> l:FixCommand(l:Exp(v))}))
|   730         eval lines->add('')
|   731       endfor
|   732     endif
|   733   endfor
|   734   call writefile(l:lines, 'Makefile')
|   735 endfunction
|   736 
|   737 let g:jm_vimrc.docs.commands['SetupYcmClasspath'] =
|   738       \ 'Create .ycm_extra_conf.py with CLASSPATH'
|   739 command! -bang SetupYcmClasspath
|   740       \ call s:SetupYcmClasspath($CLASSPATH)
|   741 function! s:SetupYcmClasspath(classpath) abort
|   742   let l:classpath = split(a:classpath, ':')
|   743   let l:lines = s:GenerateYcm(l:classpath)
|   744   if filereadable('.ycm_extra_conf.py')
|   745     throw 'ERROR(FileExists): .ycm_extra_conf.py already exists!'
|   746   else
|   747     call writefile(l:lines, '.ycm_extra_conf.py')
|   748     YcmRestartServer
|   749   endif
|   750 endfunction
|   751 function! s:GenerateYcm(classpath) abort
|   752   let l:path = a:classpath
|   753         \->map('string(v:val)')
|   754         \->join(", ")
|   755   let l:lines =<< eval trim END
|   756     def Settings(**kwargs):
|   757         if kwargs["language"] == "java":
|   758             return {{
|   759                 "ls": {{
|   760                   "java.project.referencedLibraries": [{l:path}]
|   761                 }}
|   762             }}
|   763   END
|   764   return l:lines
|   765 endfunction
|   766 
|   767 let g:jm_vimrc.docs.commands['SetupOcamlformat'] =
|   768       \ 'Create a basic .ocamlformat'
|   769 command! SetupOcamlformat call s:SetupOcamlformat()
|   770 function! s:SetupOcamlformat() abort
|   771   if !filereadable('.ocamlformat')
|   772     call writefile(['profile = default'], '.ocamlformat')
|   773   endif
|   774 endfunction
|   775 
|   776 let g:jm_vimrc.docs.commands['Make'] =
|   777       \ 'Run make on :Term'
|   778 command! -nargs=* -complete=customlist,MakeComplete Make :Term make <args>
|   779 function! MakeComplete(arg, cmd, cur) abort
|   780   return systemlist('fish -c ''make -qp | string match -r -g "^(\w+):"''')
|   781         \->filter('v:val =~# a:arg')
|   782 endfunction
|   783 
|   784 " The Silver Searcher
|   785 if executable('ag')
|   786     " Use ag over grep
|   787     set grepprg=ag\ --nogroup\ --nocolor\ --ignore=tags\ --vimgrep
|   788     set grepformat^=%f:%l:%c:%m
|   789 endif
|   790 " }}} Commands
    791 
+  -   792 +--313 lines: FT-Specific Settings:
 792 " FT-Specific Settings: {{{
|   793 
|   794 " Autocommands are split into filetype `augroup`s, each is separated by
|   795 " filetype. This solves the problem of sourcing the vimrc multiple times
|   796 " causing multiple duplicated autocommands to be set. An augroup is only run
|   797 " once**.
|   798 "
|   799 " These keymappings depend on the filetype, when :filetype on is enabled (as
|   800 " it is earlier in this config), when vim first loads a buffer, it will
|   801 " automatically detect the filetype and set the 'filetype' option (buffer)
|   802 " locally. After this happens, any `FileType` type autocommands are triggered
|   803 "
|   804 " NOTES:
|   805 " ** An augroup doesn't provide this functionality by itself. When you
|   806 " redefine it, it will 'add onto' the original one, in order to clear one, you
|   807 " can add `autocommand!` or `au!` to it (or another with the same name). This
|   808 " is used to make sure that only one version of the autocommand hooks is set
|   809 " per buffer.
|   810 augroup ft_latex
|   811     autocmd!
|   812     autocmd FileType tex setlocal nocursorline
|   813     autocmd FileType tex setlocal tabstop=4 shiftwidth=4
|   814     autocmd FileType tex nnoremap <buffer> <localleader>r
|   815           \ :execute 'Term fish -c "mkt ' .. expand('%') .. '"'<cr>
|   816 augroup END
|   817 
|   818 augroup ft_dot
|   819     autocmd!
|   820     autocmd FileType dot setlocal tabstop=2 shiftwidth=2
|   821     autocmd FileType dot nnoremap <buffer> <localleader>r
|   822           \ :execute 'Term dot -T svg -O' expand('%') <cr>
|   823 augroup END
|   824 
|   825 augroup ft_c
|   826     autocmd!
|   827     autocmd FileType c setlocal tabstop=2 shiftwidth=2
|   828     autocmd FileType c setlocal foldmethod=syntax
|   829     autocmd FileType c nnoremap <buffer> <localleader>r
|   830           \ :Term make<CR>
|   831     autocmd FileType c nnoremap <buffer> <localleader>R
|   832           \ :MakeOrSetup gcc -Wall -O3 -o a.out %; ./a.out; rm a.out<cr>
|   833 augroup END
|   834 
|   835 
|   836 augroup ft_cc
|   837     autocmd!
|   838     autocmd FileType cpp setlocal tabstop=2 shiftwidth=2
|   839     autocmd FileType cpp setlocal foldmethod=syntax
|   840     autocmd FileType cpp nnoremap <buffer> <localleader>t
|   841           \ :term <C-r>=BlazeGuessCommand()<CR>
|   842     autocmd FileType cpp nnoremap <buffer> <localleader>r
|   843           \ :MakeOrSetup
|   844           \   clang++ -std=c++20 $(CFLAGS) -o build % $(LDFLAGS);
|   845           \   ./build<CR>
|   846     autocmd FileType cpp nnoremap <buffer> <space>f
|   847           \ :FormatCode<CR>
|   848     autocmd FileType cpp
|   849           \ if exists('g:jm_setup_cpp_cv') |
|   850           \   SetupCV |
|   851           \ endif
|   852     autocmd FileType cpp
|   853           \ if expand('%:p') =~ '/home/jmend/pg' |
|   854           \   silent ReplaceRTarget |
|   855           \ endif
|   856 augroup END
|   857 
|   858 augroup ft_gdb
|   859     autocmd!
|   860     autocmd FileType gdb nnoremap <buffer> <localleader>r
|   861           \ :execute 'Term gdb -q -x' expand('%')<cr>
|   862 augroup END
|   863 
|   864 augroup ft_python
|   865     autocmd!
|   866     autocmd FileType python command! RunPython
|   867           \ execute "Term" g:jm_vimrc.deps.python expand('%')
|   868     autocmd FileType python command! RunPythonTests
|   869           \ execute "Term" g:jm_vimrc.deps.python "-m pytest" expand('%')
|   870     autocmd FileType python command! RunPythonTypechecks
|   871           \ execute "Term" g:jm_vimrc.deps.python "-m mypy --ignore-missing-imports --follow-imports=skip " expand("%")
|   872     autocmd FileType python command! RunPythonMPL
|   873           \ StopAllJobs | eval timer_start(0, {-> execute('RunPython')})
|   874     autocmd FileType python command! ReplaceRMPL
|   875           \ nnoremap <buffer> <localleader>r :RunPythonMPL<cr>
|   876     autocmd FileType python nnoremap <buffer> <localleader>r
|   877           \ :RunPython<cr>
|   878     autocmd FileType python nnoremap <buffer> <localleader>R
|   879           \ :RunPythonTests<cr>
|   880     autocmd FileType python nnoremap <buffer> <localleader>t
|   881           \ :RunPythonTypechecks<cr>
|   882     autocmd FileType python nnoremap <buffer> <space>f
|   883           \ :FormatCode<CR>
|   884 
|   885     autocmd BufNewFile .ycm_extra_conf.py call setline('.', [
|   886           \   'def Settings(**kwargs):',
|   887           \   '    if kwargs["language"] == "java":',
|   888           \   '        return {',
|   889           \   '            "ls": {',
|   890           \   '                "java.project.referencedLibraries": ["~/.jars/*.jar"]',
|   891           \   '            }',
|   892           \   '        }',
|   893           \   '    if kwargs["language"] == "cfamily":',
|   894           \   '        return {',
|   895           \   '            "flags": [',
|   896           \   '                "-std=c++20",',
|   897           \   '                "-Wall",',
|   898           \   '            ]',
|   899           \   '        }',
|   900           \ ])
|   901 
|   902 
|   903 augroup END
|   904 
|   905 augroup ft_scheme
|   906     autocmd!
|   907     autocmd FileType scheme setlocal colorcolumn=79
|   908     autocmd FileType scheme let g:lisp_rainbow = v:true
|   909     autocmd FileType scheme nnoremap <buffer> <localleader>r
|   910           \ :w<CR> :Term mit-scheme --load % <CR>
|   911 augroup END
|   912 
|   913 augroup ft_java
|   914     autocmd!
|   915     autocmd FileType java
|   916           \ setlocal tabstop=2 softtabstop=2 tabstop=2 shiftwidth=2 smarttab
|   917     autocmd FileType java
|   918           \ setlocal foldmethod=marker foldmarker={,}
|   919     autocmd FileType java nnoremap <space>f :FormatCode<cr>
|   920     autocmd FileType java nnoremap <space>F :set bt=nowrite <bar> FormatCode<cr>
|   921     autocmd FileType java vnoremap <space>f :FormatLines<cr>
|   922     autocmd FileType java nnoremap <silent> <buffer> <localleader>r
|   923           \ :MakeOrSetup java %<cr>
|   924     autocmd FileType java nnoremap <silent> <buffer> <localleader>R
|   925           \ :Term ./gradlew run<cr>
|   926     autocmd FileType java let b:surround_99 = "{@code \r}"
|   927     autocmd FileType java nnoremap <silent> <buffer> gd
|   928           \ :YcmCompleter GoToDefinition<cr>
|   929     autocmd FileType java nnoremap <silent> <buffer> gD
|   930           \ :YcmCompleter GoToReferences<cr>
|   931 augroup END
|   932 
|   933 augroup ft_kotlin
|   934     autocmd!
|   935     autocmd FileType kotlin
|   936           \ setlocal tabstop=2 softtabstop=2 tabstop=2 shiftwidth=2 smarttab
|   937 
|   938     autocmd FileType kotlin let g:KotlinMakefileTemplate = [
|   939           \   'PHONY: all',
|   940           \   {'all: a.jar': ['java -jar a.jar']},
|   941           \   {'a.jar: %': ['kotlinc -include-runtime -d a.jar $<']},
|   942           \ ]
|   943 
|   944     autocmd FileType kotlin nnoremap <silent> <buffer> <localleader>r
|   945           \ :MakeOrSetup g:KotlinMakefileTemplate<cr>
|   946     autocmd FileType kotlin nnoremap <silent> <buffer> <localleader>R
|   947           \ :Term ./gradlew run<cr>
|   948     autocmd FileType kotlin nnoremap <space>f :FormatCode<cr>
|   949     autocmd FileType kotlin vnoremap <space>f :FormatLines<cr>
|   950     autocmd FileType kotlin nnoremap <silent> <buffer> gd
|   951           \ :YcmCompleter GoToDefinition<cr>
|   952     autocmd FileType kotlin nnoremap <silent> <buffer> gD
|   953           \ :YcmCompleter GoToReferences<cr>
|   954 augroup END
|   955 
|   956 augroup ft_jar
|   957   autocmd!
|   958   autocmd FileType jar
|   959         \ call zip#Browse(expand("<amatch>"))
|   960   autocmd FileType jar
|   961         \ setlocal buflisted
|   962 augroup END
|   963 
|   964 augroup ft_class
|   965   autocmd!
|   966   autocmd BufReadCmd *.class
|   967         \ call bss#java#javap#Browse(expand("<amatch>"))
|   968 augroup END
|   969 
|   970 augroup ft_javascript
|   971     autocmd!
|   972     autocmd FileType javascript
|   973           \ setlocal tabstop=2 softtabstop=2 tabstop=2 smarttab
|   974     autocmd FileType javascript nnoremap <buffer> <localleader>r
|   975           \ :execute "Term node " .. expand('%')<cr>
|   976     autocmd FileType javascript nnoremap <buffer> <localleader>R
|   977           \ :Term webpack<CR>
|   978     autocmd FileType javascript nnoremap <buffer> <space>f
|   979           \ :FormatCode<CR>
|   980 augroup END
|   981 
|   982 augroup ft_markdown
|   983     autocmd!
|   984     autocmd FileType markdown set textwidth=72 smartindent autoindent
|   985     autocmd FileType markdown set cinwords+=:
|   986 
|   987     autocmd FileType markdown nnoremap <buffer> ]h :<c-u>call search('\v^#+ ', 'Wz')<cr>
|   988     autocmd FileType markdown nnoremap <buffer> [h :<c-u>call search('\v^#+ ', 'bWz')<cr>
|   989     "autocmd FileType markdown nnoremap <buffer> <leader>r
|   990                 "\ :Term pandoc %:p -s --highlight-style kate --pdf-engine=xelatex -o gen/%:t:r.pdf<cr>
|   991 
|   992     autocmd FileType markdown nnoremap <buffer> <space>l :<c-u>lvimgrep /\v^#+ / %<cr>
|   993 
|   994     autocmd FileType markdown
|   995           \ command! GoToSection call bss#md#GoToSection()
|   996 
|   997     autocmd FileType markdown nnoremap <buffer> <localleader>r
|   998           \ :GoToSection<cr>
|   999 
|  1000     autocmd FileType markdown nnoremap <buffer> <localleader>R
|  1001           \ :call bss#md#GoToRandomSection()<cr>
|  1002           \ :normal zt0<cr>
|  1003 
|  1004     autocmd FileType markdown command! SetupRPandoc nnoremap <buffer> <localleader>r
|  1005           \ :call execute(printf(
|  1006           \     "Term pandoc %s -s --highlight-style kate --pdf-engine=xelatex -o %s.pdf",
|  1007           \     expand('%:p'),
|  1008           \     expand('%:t:r'),
|  1009           \   ))<cr>
|  1010 
|  1011     autocmd FileType markdown command! JmMdQuotesAsComments match GruvboxFg3 /^\s*>.*/
|  1012 
|  1013     if !exists('g:bss_markdown_fix') || !g:bss_markdown_fix
|  1014       " Disable indent-based code blocks, this enables arbitrarily deep
|  1015       " indentation of lists
|  1016       autocmd FileType markdown syntax clear markdownCodeBlock
|  1017       autocmd FileType markdown syntax region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\).*$" end="^\s*\z1\ze\s*$" keepend
|  1018       autocmd FileType markdown syntax region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\).*$" end="^\s*\z1\ze\s*$" keepend
|  1019 
|  1020       " Fix up the colors
|  1021       autocmd FileType markdown highlight link markdownH1 GruvboxRedBold
|  1022       autocmd FileType markdown highlight link markdownH2 GruvboxBlueBold
|  1023       autocmd FileType markdown highlight link markdownH3 GruvboxGreenBold
|  1024       autocmd FileType markdown highlight link markdownH4 GruvboxPurpleBold
|  1025 
|  1026       " Ensure bold/italics are highlighted
|  1027       autocmd FileType markdown highlight link markdownBold GruvboxFg4
|  1028       autocmd FileType markdown highlight link markdownBoldDelimiter GruvboxFg4
|  1029       autocmd FileType markdown highlight link markdownItalic GruvboxFg2
|  1030       autocmd FileType markdown highlight link markdownItalicDelimiter GruvboxFg2
|  1031     endif
|  1032 augroup END
|  1033 
|  1034 augroup ft_vim
|  1035     autocmd!
|  1036     autocmd FileType vim setlocal foldmethod=marker shiftwidth=2
|  1037     autocmd FileType vim nnoremap <buffer> <localleader>r
|  1038           \ :source %<cr>
|  1039     autocmd FileType vim nnoremap K :help <C-r><C-w><CR>
|  1040 augroup END
|  1041 
|  1042 augroup ft_fish
|  1043     autocmd!
|  1044     autocmd FileType fish setlocal tabstop=4 shiftwidth=4 smartindent
|  1045     autocmd FileType fish nnoremap <buffer> <space>f
|  1046           \ :0,$!fish_indent<cr>
|  1047     autocmd FileType fish setlocal omnifunc=bss#fish#Complete
|  1048 augroup END
|  1049 
|  1050 augroup ft_make
|  1051     autocmd!
|  1052     autocmd FileType make nnoremap <buffer> <localleader>r
|  1053           \ :Term make<cr>
|  1054 augroup END
|  1055 
|  1056 augroup ft_ocaml
|  1057     autocmd!
|  1058     autocmd FileType ocaml
|  1059           \ setlocal tabstop=2 softtabstop=2 tabstop=2 smarttab
|  1060     autocmd FileType ocaml nnoremap <space>f :FormatCode<cr>
|  1061     autocmd FileType ocaml vnoremap <space>f :FormatLines<cr>
|  1062     if filereadable('Makefile')
|  1063       autocmd FileType ocaml nnoremap <silent> <buffer> <localleader>r
|  1064             \ :Term make<cr>
|  1065     elseif filereadable('dune-project')
|  1066       autocmd FileType ocaml nnoremap <silent> <buffer> <localleader>r
|  1067             \ :Term dune build<cr>
|  1068     else
|  1069       autocmd FileType ocaml nnoremap <silent> <buffer> <localleader>r
|  1070             \ :execute 'Term ocaml' expand("%")<cr>
|  1071     endif
|  1072     if isdirectory('/usr/bin/ocaml')
|  1073       autocmd FileType ocaml set path+=/usr/lib/ocaml
|  1074     endif
|  1075 augroup END
|  1076 
|  1077 augroup ft_coq
|  1078     autocmd!
|  1079     autocmd FileType coq
|  1080           \ setlocal tabstop=2 softtabstop=2 tabstop=2 smarttab smartindent
|  1081     if filereadable('Makefile')
|  1082       autocmd FileType coq nnoremap <silent> <buffer> <localleader>r
|  1083             \ :Term make<cr>
|  1084     else
|  1085       autocmd FileType coq nnoremap <silent> <buffer> <localleader>r
|  1086             \ :execute 'Term coqc' expand("%")
|  1087             \ <bar> execute 'TermSet ft=coq'<cr>
|  1088     endif
|  1089 augroup END
|  1090 
|  1091 " Restore view when switching buffers
|  1092 augroup cfg_bufview
|  1093   autocmd!
|  1094   autocmd BufLeave * let b:winview = winsaveview()
|  1095   autocmd BufEnter * if exists('b:winview') | call winrestview(b:winview) | endif
|  1096 augroup END
|  1097 
|  1098 " Use quickfix window when using :make
|  1099 augroup cfg_quickfix_fix
|  1100     autocmd QuickFixCmdPost [^l]* nested cwindow
|  1101     autocmd QuickFixCmdPost    l* nested lwindow
|  1102 augroup end
|  1103 
|  1104 " }}} FT-Specific Settings
   1105 
+  -  1106 +--554 lines: Misc:
1106 " Misc: {{{
|  1107 
|  1108 " :FindImport {Classname}
|  1109 "   Attempt to find and a Java import statement for the {Classname}
|  1110 "     1. Try the `g:jm_vimrc.java_import_cache`
|  1111 "     2. Search the CWD using `ag` for an `import .*\.{ClassName};`
|  1112 "     3. Finally, search `g:jm_vimrc.deps.JavaClassnameList()`
|  1113 "   Alternatively, for C++ do only:
|  1114 "     1. Try the `g:jm_vimrc.cc_import_cache`
|+ |- 1115 +--- 73 lines:
1115 " {{{
|| 1116 let g:jm_vimrc.docs.commands['FindImport'] =
|| 1117       \ 'Given a name, find the corresponding import and add an import statment'
|| 1118 nnoremap <space>t :call <SID>FindImport(expand('<cword>'))<CR>
|| 1119 command -nargs=1 FindImport call <SID>FindImport(<q-args>)
|| 1120 function! s:FindImport(word) abort
|| 1121 
|| 1122   if &filetype ==# 'cpp'
|| 1123     if !bss#imp#TryAddImportFromCache(g:jm_vimrc.cc_import_cache, a:word, 'bss#imp#AddImportCpp')
|| 1124       echo "FindImport: `" .. a:word .. "` not found!"
|| 1125     endif
|| 1126     return
|| 1127   endif
|| 1128 
|| 1129   if &filetype ==# 'kotlin'
|| 1130     " First try the kotlin import cache
|| 1131     if bss#imp#TryAddImportFromCache(g:jm_vimrc.kotlin_import_cache, a:word, 'bss#imp#AddImportKotlin')
|| 1132       return
|| 1133     endif
|| 1134 
|| 1135     if bss#imp#TryAddImportFromCache(g:jm_vimrc.java_import_cache, a:word, 'bss#imp#AddImportKotlin')
|| 1136       return
|| 1137     endif
|| 1138 
|| 1139     " Next, find an import statement in the current directory
|| 1140     let l:results = printf(
|| 1141             \ '%s --nofilename --nobreak %s',
|| 1142             \ g:jm_vimrc.deps.ag,
|| 1143             \ shellescape(printf('import (\w|\.)+\b%s\b', a:word)))
|| 1144             \->systemlist()
|| 1145             \->sort()
|| 1146             \->uniq()
|| 1147 
|| 1148     " Finally, fallback to classname list
|| 1149     if empty(l:results)
|| 1150       let l:results = g:jm_vimrc.deps.JavaClassnameList()
|| 1151             \->filter('v:val =~# a:word')
|| 1152             \->map('"import " .. v:val')
|| 1153     endif
|| 1154 
|| 1155     call bss#imp#AddOrSelectImport(l:results, 'bss#imp#AddImportJvm')
|| 1156     return
|| 1157   endif
|| 1158 
|| 1159   if &filetype !=# 'java'
|| 1160     throw 'ERROR(InvalidFiletype)'
|| 1161     return
|| 1162   endif
|| 1163 
|| 1164   " First try the g:jm_vimrc.java_import_cache
|| 1165   if bss#imp#TryAddImportFromCache(g:jm_vimrc.java_import_cache, a:word, 'bss#imp#AddImportJava')
|| 1166     return
|| 1167   endif
|| 1168 
|| 1169   " Next find an import statement in the current directory
|| 1170   let l:results = printf(
|| 1171           \ '%s --nofilename --nobreak %s',
|| 1172           \ g:jm_vimrc.deps.ag,
|| 1173           \ shellescape(printf('import .+\b%s\b;', a:word)))
|| 1174           \->systemlist()
|| 1175           \->sort()
|| 1176           \->uniq()
|| 1177 
|| 1178   " Finally, fallback to classname list
|| 1179   if empty(l:results)
|| 1180     let l:results = g:jm_vimrc.deps.JavaClassnameList()
|| 1181           \->filter('v:val =~# a:word')
|| 1182           \->map('"import " .. v:val .. ";"')
|| 1183   endif
|| 1184 
|| 1185   call bss#imp#AddOrSelectImport(l:results, 'bss#imp#AddImportJvm')
|| 1186 endfunction
|| 1187 " }}}
|  1188 
|  1189 " :Javap {qualified-classname}
|  1190 "   Run `javap` against the provided classname
|+ |- 1191 +--- 40 lines:
1191 " {{{
|| 1192 let g:jm_vimrc.docs.commands['Javap'] =
|| 1193       \ 'Execute Javap and show output with highlighting'
|| 1194 command! -nargs=? -complete=customlist,<SID>JavapComplete -bang
|| 1195         \ Javap call <SID>Javap(<q-args>, "<bang>" ==# '!')
|| 1196 function! s:Javap(arg, search) abort
|| 1197   if empty($CLASSPATH)
|| 1198     SetupClasspath
|| 1199   endif
|| 1200 
|| 1201   " Note: Vim Syntax highlighting doesn't like `\->substitute(...)`
|| 1202   let l:cls = empty(a:arg) ? @" : a:arg
|| 1203   let l:cls = substitute(l:cls, '\(;\|<.\+>\)', '', 'ga')
|| 1204 
|| 1205   if a:search
|| 1206     let l:results = s:JavapComplete(l:cls, v:none, v:none)
|| 1207     if len(l:results) == 1
|| 1208       let l:cls = l:results[0]
|| 1209     else
|| 1210       call maktaba#ui#selector#Create(l:results)
|| 1211             \.WithMappings({'<cr>': [function("s:JavapOpen")->get("name"), 'Close', 'Open window']})
|| 1212             \.Show()
|| 1213       return
|| 1214     endif
|| 1215   endif
|| 1216 
|| 1217   eval g:jm_term
|| 1218         \.Run(join([g:jm_vimrc.deps.javap, l:cls], ' '))
|| 1219         \.Exec('set ft=java')
|| 1220 endfunction
|| 1221 
|| 1222 function! s:JavapComplete(arg_lead, cmd_line, cursor_pos) abort
|| 1223   return g:jm_vimrc.deps.JavaClassnameList()
|| 1224         \->filter('v:val =~# a:arg_lead')
|| 1225 endfunction
|| 1226 
|| 1227 function! s:JavapOpen(cls) abort
|| 1228   execute 'Javap ' .. a:cls
|| 1229 endfunction
|| 1230 " }}}
|  1231 
|  1232 " :MavenSearch {query}
|  1233 " :M {query}
|  1234 "   Run a maven query, and show results in a selector window
|+ |- 1235 +--- 73 lines:
1235 " {{{
|| 1236 let g:jm_vimrc.docs.commands['MavenSearch'] =
|| 1237       \ 'Search maven, then either add a dependecy or download the jar'
|| 1238 command! -nargs=1 MavenSearch call <SID>MavenSearch(<q-args>)
|| 1239 command! -nargs=1 M MavenSearch <args>
|| 1240 function! s:MavenSearch(query) abort
|| 1241   const l:request = {
|| 1242         \   "page": 0,
|| 1243         \   "size": 20,
|| 1244         \   "searchTerm": a:query,
|| 1245         \   "filter": []
|| 1246         \ }
|| 1247   const l:query_url =
|| 1248         \ 'https://central.sonatype.com/api/internal/browse/components'
|| 1249 
|| 1250   const l:query_cmd = join([
|| 1251         \   g:jm_vimrc.deps.curl,
|| 1252         \   '-s',
|| 1253         \   l:query_url,
|| 1254         \   '--json',
|| 1255         \   shellescape(json_encode(l:request))
|| 1256         \ ])
|| 1257 
|| 1258   let l:msg = system(l:query_cmd)
|| 1259   let l:resp = json_decode(l:msg)
|| 1260 
|| 1261   if l:resp.totalResultCount == 0
|| 1262     echom "None found!"
|| 1263     return
|| 1264   endif
|| 1265   let l:components = l:resp.components
|| 1266   const l:mappings = {
|| 1267         \   '<cr>': [function("s:MInsert")->get("name"), 'Close', 'Insert below'],
|| 1268         \   'D': [function("s:MDownload")->get("name"), 'Close', 'Insert below'],
|| 1269         \ }
|| 1270   call maktaba#ui#selector#Create(map(l:components, 'v:val.namespace .. ":" .. v:val.name .. ":" ..  v:val.latestVersionInfo.version'))
|| 1271         \.WithMappings(l:mappings)
|| 1272         \.Show()
|| 1273 endfunction
|| 1274 
|| 1275 function! s:MInsert(msg) abort
|| 1276   let l:spaces = getline('.')->matchstr('^\s*')
|| 1277   if &filetype ==# 'kotlin'
|| 1278     call append(line('.'), printf('%simplementation("%s")', l:spaces, a:msg))
|| 1279   else
|| 1280     call append(line('.'), printf("%simplementation '%s'", l:spaces, a:msg))
|| 1281   endif
|| 1282 endfunction
|| 1283 
|| 1284 function! s:MDownload(msg) abort
|| 1285   let [l:package, l:name, l:version] = split(a:msg, ':')
|| 1286   let l:url_package = substitute(l:package, '\.', '/', 'g')
|| 1287   let l:url = printf('https://repo1.maven.org/maven2/%s/%s/%s/',
|| 1288         \  l:url_package,
|| 1289         \  l:name,
|| 1290         \  l:version)
|| 1291   let l:file = printf('%s-%s.jar', l:name, l:version)
|| 1292   let l:file_url = l:url .. l:file
|| 1293   echom l:url .. l:file
|| 1294 
|| 1295   const l:cmd = join([
|| 1296         \   g:jm_vimrc.deps.curl,
|| 1297         \   '-o',
|| 1298         \   shellescape(l:file),
|| 1299         \   '-s',
|| 1300         \   shellescape(l:file_url),
|| 1301         \ ])
|| 1302   silent call system(l:cmd)
|| 1303   if v:shell_error
|| 1304     echom 'ERROR: Could not download! ' .. l:file_url
|| 1305   endif
|| 1306 endfunction
|| 1307 " }}}
|  1308 
|  1309 " Bazel/Blaze helper functions
|  1310 "
|  1311 "   s:BlazeTargets({fname})
|  1312 "     Return the targets that depend on {fname} directly
|  1313 "
|  1314 "   BlazeTarget()
|  1315 "     Returns the first target for the current file
|  1316 "
|  1317 "   s:TargetClasspath()
|  1318 "     Returns the classpath for BlazeTarget()
|  1319 "
|  1320 "   s:CompleteTargets({arg_lead}, {cmd_line}, {cursor_pos})
|  1321 "     A -complete=customlist compatible function that simply filters the
|  1322 "     commandline against all targets
|  1323 "
|+ |- 1324 +--- 69 lines:
1324 " {{{
|| 1325 function! s:BlazeTargets(fname) abort
|| 1326   let l:query = printf(
|| 1327         \   'same_pkg_direct_rdeps(%s)',
|| 1328         \   fnamemodify(a:fname, ":p:."),
|| 1329         \ )
|| 1330 
|| 1331   let l:command = printf(
|| 1332         \   "%s query '%s'",
|| 1333         \   g:jm_vimrc.deps.blaze,
|| 1334         \   l:query,
|| 1335         \ )
|| 1336   return filter(systemlist(l:command), 'v:val =~# "^//"')
|| 1337 endfunction
|| 1338 
|| 1339 function! BlazeGuessCommand(show = v:false) abort
|| 1340   let l:fname = expand('%:p')
|| 1341 
|| 1342   let l:target = BlazeTarget()
|| 1343   if l:target ==# "???"
|| 1344     echom "Can't find blaze target!"
|| 1345     return "false"
|| 1346   endif
|| 1347 
|| 1348   let l:action = 'build'
|| 1349   if l:fname =~# '\v(_test.cc|Test.java)$' || l:target =~# '\v(_test|Test)$'
|| 1350     let l:action = 'test'
|| 1351   elseif l:fname =~# '\v(main.cc|_bin.cc|Bin.java)$' || l:target =~# '\v(_bin|Bin|main|Main)$'
|| 1352     let l:action = 'run'
|| 1353   elseif l:fname =~# '\v(_bench.cc)$' || l:target =~# '\v(_bench)$'
|| 1354     let l:action = 'run -c opt'
|| 1355   endif
|| 1356 
|| 1357   let l:command = printf(
|| 1358         \   "%s %s %s",
|| 1359         \   g:jm_vimrc.deps.blaze,
|| 1360         \   l:action,
|| 1361         \   l:target,
|| 1362         \ )
|| 1363   if a:show
|| 1364     echom 'Using:' l:command
|| 1365   endif
|| 1366   return l:command
|| 1367 endfunction
|| 1368 
|| 1369 function! BlazeTarget() abort
|| 1370   return get(s:BlazeTargets(expand('%:p')), 0, "???")
|| 1371 endfunction
|| 1372 
|| 1373 function! s:TargetClasspath() abort
|| 1374   let l:target = BlazeTarget()
|| 1375   if l:target ==# "???"
|| 1376     echom "Can't find blaze target!"
|| 1377     return ""
|| 1378   endif
|| 1379 
|| 1380   let l:lines = systemlist(printf('blaze print_action "%s"', l:target))
|| 1381   let l:jars = filter(l:lines, {_, v -> v =~# '^\s\+\(outputjar\|classpath\): "[^"]*"'})
|| 1382         \->map({_, v -> matchlist(v, '"\([^"]*\)"')[1]})
|| 1383   return join(l:jars, ':')
|| 1384 endfunction
|| 1385 
|| 1386 function! s:CompleteTargets(arg_lead, cmd_line, cursor_pos) abort
|| 1387   if a:arg_lead =~ '^//.*'
|| 1388     return systemlist(printf('%s query ... 2>&1', g:jm_vimrc.deps.blaze))
|| 1389           \->filter('v:val =~# "' .. a:arg_lead .. '"')
|| 1390   endif
|| 1391 endfunction
|| 1392 " }}}
|  1393 
|  1394 " :Touch {path}...
|  1395 "   Like `$ touch`, but also create directories if necessary
|  1396 "
|  1397 " :Touch
|  1398 "   Touches the file of the current buffer
|+ |- 1399 +--- 19 lines:
1399 " {{{
|| 1400 let g:jm_vimrc.docs.commands['Touch'] =
|| 1401       \ 'Create files and directories'
|| 1402 command! -nargs=* Touch call s:Touch([<f-args>])
|| 1403 function! s:Touch(paths) abort
|| 1404   if empty(a:paths)
|| 1405     return s:Touch([expand('%:p')])
|| 1406   endif
|| 1407   for l:path in a:paths
|| 1408     let l:dir = fnamemodify(l:path, ':h')
|| 1409     if l:dir !=# '.' && !isdirectory(l:dir)
|| 1410       call system('mkdir -p ' .. shellescape(l:dir))
|| 1411     endif
|| 1412     if !filereadable(l:path)
|| 1413       call system('touch ' .. shellescape(l:path))
|| 1414     endif
|| 1415   endfor
|| 1416 endfunction
|| 1417 " }}}
|  1418 
|  1419 " :CurrentHLGroup
|  1420 "   Print the highlight Group under cursor
|+ |- 1421 +---  8 lines:
1421 " {{{
|| 1422 let g:jm_vimrc.docs.commands['CurrentHLGroup'] =
|| 1423       \ 'Echo name of the highlight group under the cursor'
|| 1424 command! CurrentHLGroup echo s:SyntaxItem()
|| 1425 function! s:SyntaxItem()
|| 1426   return synIDattr(synID(line("."), col("."), 1), "name")
|| 1427 endfunction
|| 1428 " }}}
|  1429 
|  1430 " AsyncExec(fn)
|  1431 "   Call fn() async
|  1432 "
|  1433 " AsyncExec(...)
|  1434 "   Join string arguments and exec async
|+ |- 1435 +---  9 lines:
1435 " {{{
|| 1436 function! s:Async(Fn)
|| 1437   eval timer_start(0, a:Fn)
|| 1438 endfunction
|| 1439 
|| 1440 function! s:AsyncExec(...)
|| 1441   eval s:Async({-> execute(join(map(a:000, function('string'))))})
|| 1442 endfunction
|| 1443 " }}}
|  1444 
|  1445 " ConcealK
|  1446 "   Define conceal rules: eg. ConcealK lambda:λ
|+ |- 1447 +--- 17 lines:
1447 " {{{
|| 1448 let g:jm_vimrc.docs.commands['ConcealK'] =
|| 1449       \ 'Define conceal rules: eg. ConcealK lambda:λ'
|| 1450 command! -complete=expression -nargs=1 ConcealK call <SID>ConcealK(<q-args>)
|| 1451 function! s:ConcealK(repl_str) abort
|| 1452   let l:repl = {}
|| 1453   let l:i = 0
|| 1454   for [l:keyword, l:replacement] in split(a:repl_str, ' ')->map('v:val->split(":")')
|| 1455     let l:i += 1
|| 1456     execute 'syntax keyword'
|| 1457           \ printf('ConcealK%03d', l:i) l:keyword
|| 1458           \ 'conceal' printf('cchar=%s', l:replacement)
|| 1459   endfor
|| 1460   setlocal conceallevel=1
|| 1461   setlocal concealcursor=ni
|| 1462 endfunction
|| 1463 " }}}
|  1464 
|  1465 " ReadExecute
|  1466 "   Execute then read the output of that vim command
|+ |- 1467 +---  5 lines:
1467 " {{{
|| 1468 let g:jm_vimrc.docs.commands['ReadExecute'] =
|| 1469       \ 'Execute then read the output of that vim command'
|| 1470 command! -nargs=* -complete=command ExecuteRead eval append(line('.'), execute(<q-args>)->split("\n"))
|| 1471 " }}}
|  1472 
|  1473 " Bdz
|  1474 "   Run buildozer on current target (or :__pkg__ if none exists)
|+ |- 1475 +---  9 lines:
1475 " {{{
|| 1476 let g:jm_vimrc.docs.commands['Bdz'] =
|| 1477       \ 'Run buildozer on current target (or :__pkg__ if none exists)'
|| 1478 command! -nargs=* Bdz echom
|| 1479       \ system(printf("fish -c \"buildozer '%s' %s\"",
|| 1480       \   join([<f-args>], ' '),
|| 1481       \   BlazeTarget() != '???' ? BlazeTarget() : ':__pkg__'
|| 1482       \ ))
|| 1483 " }}}
|  1484 
|  1485 " JemFormat
|  1486 "   Format lines between "format:`cmd`" to "format: END"
|+ |- 1487 +--- 38 lines:
1487 " {{{
|| 1488 let g:jm_vimrc.docs.commands['JemFormat'] =
|| 1489       \ 'Format lines between "format:`cmd`" to "format: END"'
|| 1490 command! -nargs=* -complete=customlist,<SID>JemFormatComplete JemFormat eval s:JemFormat[<q-args>]()
|| 1491 let s:JemFormat = {
|| 1492       \   ''     : {-> s:JemFormat.format()},
|| 1493       \   'help' : {-> bss#PP(s:JemFormat, v:true)},
|| 1494       \ }
|| 1495 function! s:JemFormatComplete(arglead, cmdline, curpos) abort
|| 1496   return keys(s:JemFormat)->filter({k, v -> !stridx(v, a:arglead)})
|| 1497 endfunction
|| 1498 
|| 1499 function! s:JemFormat.format() abort dict
|| 1500   let command = self.find()
|| 1501   if !empty(command)
|| 1502     silent execute command
|| 1503   endif
|| 1504 endfunction
|| 1505 
|| 1506 function! s:JemFormat.find() abort dict
|| 1507   let [_, num, col; _] = getcurpos()
|| 1508   let start_pat   = '\v.*for' .. 'mat: `([^`]+)`.*'
|| 1509   let end_pat     = '\v.*for' .. 'mat: END.*'
|| 1510   let start_lines = matchbufline(bufnr(), start_pat, 1, num)
|| 1511   let start_line  = bss#Last(start_lines)
|| 1512   let end_line    = start_line
|| 1513         \->bss#Get('lnum')
|| 1514         \->bss#Apply({l -> matchbufline(bufnr(), end_pat, l, '$')})
|| 1515         \->bss#Apply('bss#Last')
|| 1516         \->bss#Or('$')
|| 1517   if start_line is v:none
|| 1518     return ''
|| 1519   endif
|| 1520   let range   = [start_line.lnum + 1, end_line.lnum - 1]->join(',')
|| 1521   let command = substitute(start_line.text, start_pat, '\1', '')
|| 1522   return join([range, command], ' ')
|| 1523 endfunction
|| 1524 " }}}
|  1525 
|  1526 " AppendMarkdownBlock <fname>
|  1527 "   Append the current buffer's lines to the file <fname>.
|  1528 "   Adds an empty line if the last line in <fname> is non-empty.
|  1529 "
|  1530 " SetupAppendMarkdownBlock <fname>
|  1531 "   Setup \r nmap in the current buffer
|  1532 " 
|+ |- 1533 +--- 50 lines:
1533 " {{{
|| 1534 command! -nargs=1 -complete=file SetupAppendMarkdownBlock
|| 1535       \ nnoremap <buffer> \r :AppendMarkdownBlock <args><cr>
|| 1536 command! -nargs=1 -complete=file -range=% AppendMarkdownBlock
|| 1537       \ eval AppendMarkdownBlock(<q-args>, <line1>, <line2>)
|| 1538 command! -nargs=1 -complete=file AppendMarkdownBlockDebug
|| 1539       \ eval AppendMarkdownBlock(<q-args>, 0, '$', v:true)
|| 1540 
|| 1541 function! AppendMarkdownBlock(fname, begin=0, end='$', debug=v:false) abort
|| 1542   let lines = getline(a:begin, a:end)->s:Markdown_lines2codeblock()
|| 1543   if !a:debug
|| 1544     call s:AppendMarkdownBlock_write(a:fname, lines)
|| 1545   else
|| 1546     call s:AppendMarkdownBlock_dump(a:fname, lines)
|| 1547   endif
|| 1548 endfunction
|| 1549 
|| 1550 ""
|| 1551 " Convert a list of lines to a list of codeblock lines.
|| 1552 "
|| 1553 function! s:Markdown_lines2codeblock(lines) abort
|| 1554   let prefix = '```'
|| 1555   let suffix = prefix
|| 1556   return [prefix] + a:lines + [suffix]
|| 1557 endfunction
|| 1558 
|| 1559 
|| 1560 ""
|| 1561 " Add a block to a markdown file.
|| 1562 "
|| 1563 function! s:AppendMarkdownBlock_write(fname, lines) abort
|| 1564   let prefix = (readfile(a:fname)->bss#Last()->empty())
|| 1565         \ ? [] : [""]
|| 1566   call writefile(prefix + a:lines, a:fname, 'a')
|| 1567   echom "Wrote file" a:fname
|| 1568 endfunction
|| 1569 
|| 1570 ""
|| 1571 " Dump debug information.
|| 1572 "
|| 1573 function! s:AppendMarkdownBlock_dump(fname, lines) abort
|| 1574   " Dump debug output
|| 1575   echo 'fname:' a:fname
|| 1576   echo 'lines:'
|| 1577   echo
|| 1578   for l in a:lines
|| 1579     echo '  ' .. l
|| 1580   endfor
|| 1581 endfunction
|| 1582 " }}}
|  1583 
|  1584 " SetupSlimeTarget
|  1585 "   Wrapper for setting the g:slime_target
|+ |- 1586 +--- 17 lines:
1586 " {{{
|| 1587 command! -nargs=? -complete=customlist,s:SetupSlimeTarget_Complete SetupSlimeTarget call s:SetupSlimeTarget(<q-args>)
|| 1588 let s:SlimeTargets = [
|| 1589       \   'tmux',
|| 1590       \   'vimterminal',
|| 1591       \ ]
|| 1592 function! s:SetupSlimeTarget(arg) abort
|| 1593   if empty(a:arg)
|| 1594     echom printf('Current slime target: %s', g:slime_target)
|| 1595   else
|| 1596     let g:slime_target = a:arg
|| 1597   endif
|| 1598 endfunction
|| 1599 function! s:SetupSlimeTarget_Complete(arg, ...) abort
|| 1600   return s:SlimeTargets->filter('stridx(v:val, a:arg) == 0')
|| 1601 endfunction
|| 1602 " }}}
|  1603 
|  1604 function! Layout() abort
|  1605   let layout = winlayout()
|  1606   return s:InvertLayout(layout)
|  1607 endfunction
|  1608 function! s:InvertLayout(l, path=[]) abort
|  1609   if len(a:l) != 2
|  1610     throw "ERROR(InvalidArguments): s:InvertLayout expects only 2-element lists"
|  1611   endif
|  1612   let [kind, val] = a:l
|  1613   if kind ==# 'leaf'
|  1614     return {val: join(a:path, '')}
|  1615   elseif kind ==# 'col'
|  1616     return val
|  1617           \->map('s:InvertLayout(v:val, a:path + ["|"])')
|  1618           \->reduce({a, b -> extend(a, b)})
|  1619   elseif kind ==# 'row'
|  1620     return val
|  1621           \->map('s:InvertLayout(v:val, a:path + ["-"])')
|  1622           \->reduce({a, b -> extend(a, b)})
|  1623   endif
|  1624 endfunction
|  1625 
|  1626 
|  1627 " FindOrMakeJavaTest
|  1628 "   Navigate to the associated Java test of the current file, creating one if
|  1629 "   none exists.
|+ |- 1630 +--- 28 lines:
1630 " {{{
|| 1631 command! FindOrMakeJavaTest call s:FindOrMakeJavaTest()
|| 1632 function! s:FindOrMakeJavaTest() abort
|| 1633   let l:path = expand('%:p:h')
|| 1634   let l:name = expand('%:t:r')
|| 1635   let l:extn = expand('%:t:e')
|| 1636   if l:path =~# ".*/src/main/java/.*"
|| 1637     let l:path = substitute(l:path, "src/main/java", "src/test/java", "")
|| 1638     let l:name .= 'Test'
|| 1639   elseif l:path =~# ".*/src/test/java/.*" && l:name =~# ".*Test$"
|| 1640     let l:path = substitute(l:path, "src/test/java", "src/main/java", "")
|| 1641     let l:name = l:name[:-5]
|| 1642   elseif l:path =~# ".*/java/.*"
|| 1643     let l:path = substitute(l:path, "/java/", "/javatests/", "")
|| 1644     let l:name .= 'Test'
|| 1645   elseif l:path =~# ".*/javatests/.*" && l:name =~# ".*Test$"
|| 1646     let l:path = substitute(l:path, "/javatests/", "/java/", "")
|| 1647     let l:name = l:name[:-5]
|| 1648   elseif l:path =~# ".*/src/main/kotlin/.*"
|| 1649     let l:path = substitute(l:path, "src/main/kotlin", "src/test/kotlin", "")
|| 1650     let l:name .= 'Test'
|| 1651   elseif l:path =~# ".*/src/test/kotlin/.*" && l:name =~# ".*Test$"
|| 1652     let l:path = substitute(l:path, "src/test/kotlin", "src/main/kotlin", "")
|| 1653     let l:name = l:name[:-5]
|| 1654   endif
|| 1655   execute 'edit' $"{l:path}/{l:name}.{l:extn}"
|| 1656 endfunction
|| 1657 " }}}
|  1658 
|  1659 " }}} Misc
   1660 
+  -  1661 +--  5 lines: Notes
1661 " Notes {{{
|  1662 let s:Wtf = bss#wtf#Initialize()
|  1663 call bss#wtf#AddDict(['mappings', 'm'], g:jm_vimrc.docs.mappings)
|  1664 call bss#wtf#AddDict(['commands', 'c'], g:jm_vimrc.docs.commands)
|  1665 " }}} Notes
   1666 
+  -  1667 +--522 lines: Java/Kotlin Import Cache:
1667 " Java/Kotlin Import Cache: {{{
|  1668 "
|  1669 " Defines the import cache used for Java/Kotlin import search, if an attempt to
|  1670 " resolve the import for a key in this map, the value specified will be
|  1671 " imported before trying any other method to find the import.
|  1672 let g:jm_vimrc.java_import_list =<< JAVA_IMPORT_LIST_END
|  1673 com.google.auto.common.AnnotationMirrors
|  1674 com.google.auto.common.AnnotationValues
|  1675 com.google.auto.common.BasicAnnotationProcessor
|  1676 com.google.auto.common.MoreElements
|  1677 com.google.auto.common.MoreTypes
|  1678 com.google.common.base.Stopwatch
|  1679 com.google.common.collect.ImmutableList
|  1680 com.google.common.collect.ImmutableMap
|  1681 com.google.common.collect.ImmutableSet
|  1682 com.google.common.collect.ImmutableTable
|  1683 com.google.common.collect.Lists
|  1684 com.google.common.collect.Streams
|  1685 com.google.common.collect.Table
|  1686 com.google.common.collect.Tables
|  1687 com.google.common.flogger.FluentLogger
|  1688 com.google.common.math.Stats
|  1689 com.google.common.math.StatsAccumulator
|  1690 com.google.common.util.concurrent.AbstractExecutionThreadService
|  1691 com.google.common.util.concurrent.AbstractFuture
|  1692 com.google.common.util.concurrent.AbstractScheduledService
|  1693 com.google.common.util.concurrent.AbstractTransformFuture
|  1694 com.google.common.util.concurrent.FutureCallback
|  1695 com.google.common.util.concurrent.Futures
|  1696 com.google.common.util.concurrent.ListenableFuture
|  1697 com.google.common.util.concurrent.ListenableFutureTask
|  1698 com.google.common.util.concurrent.ListenableScheduledFuture
|  1699 com.google.common.util.concurrent.ListenerCallQueue
|  1700 com.google.common.util.concurrent.ListeningExecutorService
|  1701 com.google.common.util.concurrent.ListeningScheduledExecutorService
|  1702 com.google.common.util.concurrent.MoreExecutors
|  1703 com.google.common.util.concurrent.SettableFuture
|  1704 com.google.common.util.concurrent.Uninterruptibles
|  1705 com.google.gson.Gson
|  1706 com.google.gson.annotations.SerializedName
|  1707 com.squareup.javapoet.ClassName
|  1708 com.squareup.javapoet.CodeBlock
|  1709 com.squareup.javapoet.FieldSpec
|  1710 com.squareup.javapoet.JavaFile
|  1711 com.squareup.javapoet.MethodSpec
|  1712 com.squareup.javapoet.ParameterSpec
|  1713 com.squareup.javapoet.ParameterizedTypeName
|  1714 com.squareup.javapoet.TypeName
|  1715 com.squareup.javapoet.TypeSpec
|  1716 com.sun.jdi.VMDisconnectedException
|  1717 com.sun.jdi.VirtualMachine
|  1718 com.sun.jdi.VirtualMachineManager
|  1719 com.sun.jdi.event.EventSet
|  1720 dagger.Binds
|  1721 dagger.BindsInstance
|  1722 dagger.Component
|  1723 dagger.MapKey
|  1724 dagger.Module
|  1725 dagger.Provides
|  1726 dagger.multibindings.ClassKey
|  1727 dagger.multibindings.ElementsIntoSet
|  1728 dagger.multibindings.IntKey
|  1729 dagger.multibindings.IntoMap
|  1730 dagger.multibindings.IntoSet
|  1731 dagger.multibindings.LongKey
|  1732 dagger.multibindings.Multibinds
|  1733 dagger.multibindings.StringKey
|  1734 dagger.producers.Produced
|  1735 dagger.producers.Producer
|  1736 dagger.producers.ProducerModule
|  1737 dagger.producers.Producers
|  1738 dagger.producers.Produces
|  1739 dagger.producers.Production
|  1740 dagger.producers.ProductionComponent
|  1741 dagger.producers.ProductionScope
|  1742 dagger.producers.ProductionSubcomponent
|  1743 dagger.producers.monitoring.ProducerMonitor
|  1744 dagger.producers.monitoring.ProducerToken
|  1745 dagger.producers.monitoring.ProductionComponentMonitor
|  1746 java.io.File
|  1747 java.io.IOException
|  1748 java.io.OutputStream
|  1749 java.lang.reflect.AnnotatedElement
|  1750 java.lang.reflect.Executable
|  1751 java.lang.reflect.Field
|  1752 java.lang.reflect.GenericDeclaration
|  1753 java.lang.reflect.Method
|  1754 java.lang.reflect.Modifier
|  1755 java.lang.reflect.Type
|  1756 java.net.ServerSocket
|  1757 java.net.Socket
|  1758 java.nio.file.Files
|  1759 java.nio.file.Path
|  1760 java.time.Instant
|  1761 java.util.ArrayList
|  1762 java.util.Arrays
|  1763 java.util.Collection
|  1764 java.util.HashMap
|  1765 java.util.HashSet
|  1766 java.util.Iterator
|  1767 java.util.LinkedList
|  1768 java.util.List
|  1769 java.util.Map
|  1770 java.util.NavigableMap
|  1771 java.util.Optional
|  1772 java.util.OrderedMap
|  1773 java.util.Random
|  1774 java.util.Set
|  1775 java.util.TreeMap
|  1776 java.util.TreeSet
|  1777 java.util.concurrent.CancellationException
|  1778 java.util.concurrent.ConcurrentHashMap
|  1779 java.util.concurrent.CopyOnWriteArrayList
|  1780 java.util.concurrent.ExecutionException
|  1781 java.util.concurrent.Executor
|  1782 java.util.concurrent.ExecutorService
|  1783 java.util.concurrent.Executors
|  1784 java.util.concurrent.Future
|  1785 java.util.concurrent.ThreadPoolExecutor
|  1786 java.util.concurrent.TimeUnit
|  1787 java.util.concurrent.atomic.AtomicBoolean
|  1788 java.util.concurrent.atomic.AtomicInteger
|  1789 java.util.concurrent.atomic.AtomicLong
|  1790 java.util.concurrent.atomic.AtomicMarkableReference
|  1791 java.util.concurrent.atomic.AtomicReference
|  1792 java.util.concurrent.atomic.LongAdder
|  1793 java.util.function.Consumer
|  1794 java.util.function.Function
|  1795 java.util.function.Predicate
|  1796 java.util.function.Supplier
|  1797 java.util.jar.JarEntry
|  1798 java.util.jar.JarFile
|  1799 java.util.stream.Collector
|  1800 java.util.stream.Collectors
|  1801 java.util.stream.Stream
|  1802 javax.annotation.processing.AbstractProcessor
|  1803 javax.annotation.processing.Completion
|  1804 javax.annotation.processing.Completions
|  1805 javax.annotation.processing.Filer
|  1806 javax.annotation.processing.FilerException
|  1807 javax.annotation.processing.Generated
|  1808 javax.annotation.processing.Messager
|  1809 javax.annotation.processing.ProcessingEnvironment
|  1810 javax.annotation.processing.Processor
|  1811 javax.annotation.processing.RoundEnvironment
|  1812 javax.annotation.processing.SupportedAnnotationTypes
|  1813 javax.annotation.processing.SupportedOptions
|  1814 javax.annotation.processing.SupportedSourceVersion
|  1815 javax.inject.Inject
|  1816 javax.inject.Named
|  1817 javax.inject.Provider
|  1818 javax.inject.Qualifier
|  1819 javax.inject.Scope
|  1820 javax.inject.Singleton
|  1821 javax.lang.model.element.Element
|  1822 javax.lang.model.element.ElementVisitor
|  1823 javax.lang.model.element.ExecutableElement
|  1824 javax.lang.model.element.Modifier
|  1825 javax.lang.model.element.TypeElement
|  1826 javax.lang.model.type.TypeMirror
|  1827 org.apache.commons.lang3.builder.ReflectionToStringBuilder
|  1828 org.apache.commons.lang3.builder.ToStringStyle
|  1829 org.jline.builtins.Completers.AnyCompleter
|  1830 org.jline.builtins.Completers.DirectoriesCompleter
|  1831 org.jline.builtins.Completers.FileNameCompleter
|  1832 org.jline.builtins.Completers.FilesCompleter
|  1833 org.jline.builtins.Completers.OptionCompleter
|  1834 org.jline.builtins.Completers.RegexCompleter
|  1835 org.jline.builtins.Completers.TreeCompleter
|  1836 org.jline.builtins.Completers.TreeCompleter.node
|  1837 org.jline.reader.Completer
|  1838 org.jline.reader.LineReader
|  1839 org.jline.reader.LineReaderBuilder
|  1840 org.jline.reader.impl.completer.StringsCompleter
|  1841 org.jline.terminal.Attributes
|  1842 org.jline.terminal.Cursor
|  1843 org.jline.terminal.KeyEvent
|  1844 org.jline.terminal.KeyParser
|  1845 org.jline.terminal.MouseEvent
|  1846 org.jline.terminal.Size
|  1847 org.jline.terminal.Terminal
|  1848 org.jline.terminal.TerminalBuilder
|  1849 org.jline.utils.AttributedCharSequence
|  1850 org.jline.utils.AttributedString
|  1851 org.jline.utils.AttributedStringBuilder
|  1852 org.jline.utils.AttributedStyle
|  1853 org.jline.utils.ColorPalette
|  1854 org.jline.utils.Colors
|  1855 org.jline.utils.InfoCmp.Capability
|  1856 org.jline.utils.NonBlockingReader
|  1857 org.objectweb.asm.ClassReader
|  1858 org.objectweb.asm.ClassVisitor
|  1859 org.objectweb.asm.ClassWriter
|  1860 org.objectweb.asm.FieldVisitor
|  1861 org.objectweb.asm.MethodVisitor
|  1862 org.objectweb.asm.Opcodes
|  1863 org.objectweb.asm.Type
|  1864 org.objectweb.asm.TypePath
|  1865 org.objectweb.asm.tree.ClassNode
|  1866 org.objectweb.asm.tree.FieldNode
|  1867 org.objectweb.asm.tree.InsnList
|  1868 org.objectweb.asm.tree.InsnNode
|  1869 org.objectweb.asm.tree.MethodInsnNode
|  1870 org.objectweb.asm.tree.MethodNode
|  1871 org.objectweb.asm.tree.ParameterNode
|  1872 org.openjdk.jmh.annotations.AuxCounters
|  1873 org.openjdk.jmh.annotations.Benchmark
|  1874 org.openjdk.jmh.annotations.BenchmarkMode
|  1875 org.openjdk.jmh.annotations.CompilerControl
|  1876 org.openjdk.jmh.annotations.Fork
|  1877 org.openjdk.jmh.annotations.Group
|  1878 org.openjdk.jmh.annotations.GroupThreads
|  1879 org.openjdk.jmh.annotations.Level
|  1880 org.openjdk.jmh.annotations.Measurement
|  1881 org.openjdk.jmh.annotations.Mode
|  1882 org.openjdk.jmh.annotations.OperationsPerInvocation
|  1883 org.openjdk.jmh.annotations.OutputTimeUnit
|  1884 org.openjdk.jmh.annotations.Param
|  1885 org.openjdk.jmh.annotations.Scope
|  1886 org.openjdk.jmh.annotations.Setup
|  1887 org.openjdk.jmh.annotations.State
|  1888 org.openjdk.jmh.annotations.TearDown
|  1889 org.openjdk.jmh.annotations.Threads
|  1890 org.openjdk.jmh.annotations.Timeout
|  1891 org.openjdk.jmh.annotations.Warmup
|  1892 org.openjdk.jmh.infra.BenchmarkParams
|  1893 org.openjdk.jmh.infra.Blackhole
|  1894 org.openjdk.jmh.infra.Control
|  1895 org.openjdk.jmh.infra.IterationParams
|  1896 org.openjdk.jmh.infra.ThreadParams
|  1897 org.openjdk.jmh.results.RunResult
|  1898 org.openjdk.jmh.results.format.ResultFormatType
|  1899 org.openjdk.jmh.runner.Runner
|  1900 org.openjdk.jmh.runner.RunnerException
|  1901 org.openjdk.jmh.runner.options.CommandLineOptionException
|  1902 org.openjdk.jmh.runner.options.CommandLineOptions
|  1903 org.openjdk.jmh.runner.options.Options
|  1904 org.openjdk.jmh.runner.options.OptionsBuilder
|  1905 static com.google.common.base.Preconditions.checkArgument
|  1906 static com.google.common.base.Preconditions.checkNotNull
|  1907 static com.google.common.collect.ImmutableList.toImmutableList
|  1908 static com.google.common.collect.ImmutableSet.toImmutableSet
|  1909 static com.google.common.truth.Truth.assertThat
|  1910 static com.google.common.truth.Truth.assertWithMessage
|  1911 static com.google.common.util.concurrent.Futures.immediateFuture
|  1912 static com.google.common.util.concurrent.Futures.immediateVoidFuture
|  1913 static com.google.common.util.concurrent.MoreExecutors.directExecutor
|  1914 static java.util.concurrent.TimeUnit.DAYS
|  1915 static java.util.concurrent.TimeUnit.HOURS
|  1916 static java.util.concurrent.TimeUnit.MICROSECONDS
|  1917 static java.util.concurrent.TimeUnit.MILLISECONDS
|  1918 static java.util.concurrent.TimeUnit.MINUTES
|  1919 static java.util.concurrent.TimeUnit.NANOSECONDS
|  1920 static java.util.concurrent.TimeUnit.SECONDS
|  1921 static java.util.stream.Collectors.averagingDouble
|  1922 static java.util.stream.Collectors.averagingInt
|  1923 static java.util.stream.Collectors.averagingLong
|  1924 static java.util.stream.Collectors.collectingAndThen
|  1925 static java.util.stream.Collectors.counting
|  1926 static java.util.stream.Collectors.filtering
|  1927 static java.util.stream.Collectors.flatMapping
|  1928 static java.util.stream.Collectors.groupingBy
|  1929 static java.util.stream.Collectors.joining
|  1930 static java.util.stream.Collectors.mapping
|  1931 static java.util.stream.Collectors.maxBy
|  1932 static java.util.stream.Collectors.minBy
|  1933 static java.util.stream.Collectors.partitioningBy
|  1934 static java.util.stream.Collectors.reducing
|  1935 static java.util.stream.Collectors.summarizingDouble
|  1936 static java.util.stream.Collectors.summarizingInt
|  1937 static java.util.stream.Collectors.summarizingLong
|  1938 static java.util.stream.Collectors.summingDouble
|  1939 static java.util.stream.Collectors.summingInt
|  1940 static java.util.stream.Collectors.summingLong
|  1941 static java.util.stream.Collectors.toCollection
|  1942 static java.util.stream.Collectors.toConcurrentMap
|  1943 static java.util.stream.Collectors.toList
|  1944 static java.util.stream.Collectors.toMap
|  1945 static java.util.stream.Collectors.toSet
|  1946 static java.util.stream.Collectors.toUnmodifiableList
|  1947 static java.util.stream.Collectors.toUnmodifiableMap
|  1948 static java.util.stream.Collectors.toUnmodifiableSet
|  1949 static org.mockito.AdditionalMatchers.and
|  1950 static org.mockito.ArgumentMatchers.any
|  1951 static org.mockito.ArgumentMatchers.assertArg
|  1952 static org.mockito.Mockito.mock
|  1953 static org.mockito.Mockito.times
|  1954 static org.mockito.Mockito.verify
|  1955 JAVA_IMPORT_LIST_END
|  1956 
|  1957 let g:jm_vimrc.kotlin_import_list =<< KOTLIN_IMPORT_LIST_END
|  1958 kotlin.annotation.AnnotationRetention
|  1959 kotlin.annotation.AnnotationRetention.BINARY
|  1960 kotlin.annotation.AnnotationRetention.RUNTIME
|  1961 kotlin.annotation.AnnotationRetention.SOURCE
|  1962 kotlin.annotation.Retention
|  1963 kotlin.concurrent.Volatile
|  1964 kotlin.concurrent.thread
|  1965 kotlin.concurrent.withLock
|  1966 kotlin.coroutines.AbstractCoroutineContextElement
|  1967 kotlin.coroutines.AbstractCoroutineContextKey
|  1968 kotlin.coroutines.Continuation
|  1969 kotlin.coroutines.ContinuationInterceptor
|  1970 kotlin.coroutines.CoroutineContext
|  1971 kotlin.coroutines.EmptyCoroutineContext
|  1972 kotlin.coroutines.RestrictsSuspension
|  1973 kotlin.coroutines.coroutineContext
|  1974 kotlin.coroutines.createCoroutine
|  1975 kotlin.coroutines.getPolymorphicElement
|  1976 kotlin.coroutines.minusPolymorphicKey
|  1977 kotlin.coroutines.resume
|  1978 kotlin.coroutines.resumeWithException
|  1979 kotlin.coroutines.startCoroutine
|  1980 kotlin.coroutines.suspendCoroutine
|  1981 kotlin.math.sin
|  1982 kotlin.math.sqrt
|  1983 kotlin.reflect.KClass
|  1984 kotlin.reflect.KFunction
|  1985 kotlin.reflect.KProperty
|  1986 kotlin.reflect.full.memberProperties
|  1987 kotlin.streams.asSequence
|  1988 kotlin.streams.asStream
|  1989 kotlin.streams.toList
|  1990 kotlin.system.measureNanoTime
|  1991 kotlin.system.measureTimeMillis
|  1992 kotlin.test.AfterTest
|  1993 kotlin.test.BeforeTest
|  1994 kotlin.test.Test
|  1995 kotlin.test.assertContains
|  1996 kotlin.test.assertEquals
|  1997 kotlin.test.assertFails
|  1998 kotlin.test.assertFailsWith
|  1999 kotlin.test.assertFalse
|  2000 kotlin.test.assertNotEquals
|  2001 kotlin.test.assertNotNull
|  2002 kotlin.test.assertNull
|  2003 kotlin.test.assertSame
|  2004 kotlin.test.assertTrue
|  2005 kotlin.test.fail
|  2006 kotlin.time.Clock
|  2007 kotlin.time.Duration
|  2008 kotlin.time.Duration.Companion.INFINITE
|  2009 kotlin.time.Duration.Companion.ZERO
|  2010 kotlin.time.Duration.Companion.days
|  2011 kotlin.time.Duration.Companion.hours
|  2012 kotlin.time.Duration.Companion.microseconds
|  2013 kotlin.time.Duration.Companion.milliseconds
|  2014 kotlin.time.Duration.Companion.minutes
|  2015 kotlin.time.Duration.Companion.nanoseconds
|  2016 kotlin.time.Duration.Companion.seconds
|  2017 kotlin.time.DurationUnit
|  2018 kotlin.time.DurationUnit.DAYS
|  2019 kotlin.time.DurationUnit.HOURS
|  2020 kotlin.time.DurationUnit.MICROSECONDS
|  2021 kotlin.time.DurationUnit.MILLISECONDS
|  2022 kotlin.time.DurationUnit.MINUTES
|  2023 kotlin.time.DurationUnit.NANOSECONDS
|  2024 kotlin.time.DurationUnit.SECONDS
|  2025 kotlin.time.Instant
|  2026 kotlin.time.TimeMark
|  2027 kotlin.time.TimeSource
|  2028 kotlin.time.TimedValue
|  2029 kotlin.time.measureTime
|  2030 kotlin.time.measureTimedValue
|  2031 kotlin.time.toDuration
|  2032 kotlin.time.toDurationUnit
|  2033 kotlin.time.toJSDate
|  2034 kotlin.time.toJavaDuration
|  2035 kotlin.time.toKotlinDuration
|  2036 kotlin.time.toKotlinInstant
|  2037 kotlin.time.toTimeUnit
|  2038 kotlinx.coroutines.CompletableDeferred
|  2039 kotlinx.coroutines.CompletableJob
|  2040 kotlinx.coroutines.CoroutineDispatcher
|  2041 kotlinx.coroutines.CoroutineExceptionHandler
|  2042 kotlinx.coroutines.CoroutineName
|  2043 kotlinx.coroutines.CoroutineScope
|  2044 kotlinx.coroutines.CoroutineStart
|  2045 kotlinx.coroutines.CoroutineStart.ATOMIC
|  2046 kotlinx.coroutines.CoroutineStart.DEFAULT
|  2047 kotlinx.coroutines.CoroutineStart.LAZY
|  2048 kotlinx.coroutines.CoroutineStart.UNDISPATCHED
|  2049 kotlinx.coroutines.Deferred
|  2050 kotlinx.coroutines.DelicateCoroutinesApi
|  2051 kotlinx.coroutines.Dispatchers
|  2052 kotlinx.coroutines.Dispatchers.IO
|  2053 kotlinx.coroutines.Dispatchers.Main
|  2054 kotlinx.coroutines.Dispatchers.Unconfined
|  2055 kotlinx.coroutines.ExecutorCoroutineDispatcher
|  2056 kotlinx.coroutines.ExperimentalCoroutinesApi
|  2057 kotlinx.coroutines.GlobalScope
|  2058 kotlinx.coroutines.Job
|  2059 kotlinx.coroutines.NonCancellable
|  2060 kotlinx.coroutines.SupervisorJob
|  2061 kotlinx.coroutines.asCoroutineDispatcher
|  2062 kotlinx.coroutines.asExecutor
|  2063 kotlinx.coroutines.async
|  2064 kotlinx.coroutines.awaitAll
|  2065 kotlinx.coroutines.cancelAndJoin
|  2066 kotlinx.coroutines.channels.BufferOverflow
|  2067 kotlinx.coroutines.channels.Channel
|  2068 kotlinx.coroutines.channels.ReceiveChannel
|  2069 kotlinx.coroutines.channels.SendChannel
|  2070 kotlinx.coroutines.channels.produce
|  2071 kotlinx.coroutines.coroutineScope
|  2072 kotlinx.coroutines.delay
|  2073 kotlinx.coroutines.ensureActive
|  2074 kotlinx.coroutines.flow.Flow
|  2075 kotlinx.coroutines.flow.MutableSharedFlow
|  2076 kotlinx.coroutines.flow.MutableStateFlow
|  2077 kotlinx.coroutines.flow.SharedFlow
|  2078 kotlinx.coroutines.flow.SharingStarted
|  2079 kotlinx.coroutines.flow.SharingStarted.Eagerly
|  2080 kotlinx.coroutines.flow.SharingStarted.Lazily
|  2081 kotlinx.coroutines.flow.SharingStarted.WhileSubscribed
|  2082 kotlinx.coroutines.flow.StateFlow
|  2083 kotlinx.coroutines.flow.asFlow
|  2084 kotlinx.coroutines.flow.asSharedFlow
|  2085 kotlinx.coroutines.flow.asStateFlow
|  2086 kotlinx.coroutines.flow.buffer
|  2087 kotlinx.coroutines.flow.cancellable
|  2088 kotlinx.coroutines.flow.catch
|  2089 kotlinx.coroutines.flow.channelFlow
|  2090 kotlinx.coroutines.flow.chunked
|  2091 kotlinx.coroutines.flow.combine
|  2092 kotlinx.coroutines.flow.combineTransform
|  2093 kotlinx.coroutines.flow.conflate
|  2094 kotlinx.coroutines.flow.count
|  2095 kotlinx.coroutines.flow.debounce
|  2096 kotlinx.coroutines.flow.distinctUntilChanged
|  2097 kotlinx.coroutines.flow.distinctUntilChangedBy
|  2098 kotlinx.coroutines.flow.drop
|  2099 kotlinx.coroutines.flow.dropWhile
|  2100 kotlinx.coroutines.flow.emptyFlow
|  2101 kotlinx.coroutines.flow.filter
|  2102 kotlinx.coroutines.flow.filterIsInstance
|  2103 kotlinx.coroutines.flow.filterNot
|  2104 kotlinx.coroutines.flow.filterNotNull
|  2105 kotlinx.coroutines.flow.first
|  2106 kotlinx.coroutines.flow.flatMapConcat
|  2107 kotlinx.coroutines.flow.flatMapLatest
|  2108 kotlinx.coroutines.flow.flatMapMerge
|  2109 kotlinx.coroutines.flow.flattenConcat
|  2110 kotlinx.coroutines.flow.flattenMerge
|  2111 kotlinx.coroutines.flow.flow
|  2112 kotlinx.coroutines.flow.flowOf
|  2113 kotlinx.coroutines.flow.flowOn
|  2114 kotlinx.coroutines.flow.last
|  2115 kotlinx.coroutines.flow.map
|  2116 kotlinx.coroutines.flow.mapLatest
|  2117 kotlinx.coroutines.flow.mapNotNull
|  2118 kotlinx.coroutines.flow.merge
|  2119 kotlinx.coroutines.flow.onCompletion
|  2120 kotlinx.coroutines.flow.onEach
|  2121 kotlinx.coroutines.flow.onEmpty
|  2122 kotlinx.coroutines.flow.onStart
|  2123 kotlinx.coroutines.flow.onSubscription
|  2124 kotlinx.coroutines.flow.retry
|  2125 kotlinx.coroutines.flow.retryWhen
|  2126 kotlinx.coroutines.flow.runningFold
|  2127 kotlinx.coroutines.flow.runningReduce
|  2128 kotlinx.coroutines.flow.sample
|  2129 kotlinx.coroutines.flow.scan
|  2130 kotlinx.coroutines.flow.shareIn
|  2131 kotlinx.coroutines.flow.stateIn
|  2132 kotlinx.coroutines.flow.take
|  2133 kotlinx.coroutines.flow.takeWhile
|  2134 kotlinx.coroutines.flow.timeout
|  2135 kotlinx.coroutines.flow.toList
|  2136 kotlinx.coroutines.flow.toSet
|  2137 kotlinx.coroutines.flow.transform
|  2138 kotlinx.coroutines.flow.transformLatest
|  2139 kotlinx.coroutines.flow.transformWhile
|  2140 kotlinx.coroutines.flow.update
|  2141 kotlinx.coroutines.flow.withIndex
|  2142 kotlinx.coroutines.flow.zip
|  2143 kotlinx.coroutines.guava.asDeferred
|  2144 kotlinx.coroutines.guava.asListenableFuture
|  2145 kotlinx.coroutines.guava.await
|  2146 kotlinx.coroutines.guava.future
|  2147 kotlinx.coroutines.isActive
|  2148 kotlinx.coroutines.job
|  2149 kotlinx.coroutines.launch
|  2150 kotlinx.coroutines.limitedParallelism
|  2151 kotlinx.coroutines.runBlocking
|  2152 kotlinx.coroutines.runInterruptible
|  2153 kotlinx.coroutines.supervisorScope
|  2154 kotlinx.coroutines.sync.Mutex
|  2155 kotlinx.coroutines.sync.Semaphore
|  2156 kotlinx.coroutines.sync.withLock
|  2157 kotlinx.coroutines.sync.withPermit
|  2158 kotlinx.coroutines.test.StandardTestDispatcher
|  2159 kotlinx.coroutines.test.TestCoroutineScheduler
|  2160 kotlinx.coroutines.test.TestScope
|  2161 kotlinx.coroutines.test.advanceTimeBy
|  2162 kotlinx.coroutines.test.advanceUntilIdle
|  2163 kotlinx.coroutines.test.currentTime
|  2164 kotlinx.coroutines.test.runCurrent
|  2165 kotlinx.coroutines.test.runTest
|  2166 kotlinx.coroutines.withContext
|  2167 kotlinx.coroutines.withTimeout
|  2168 kotlinx.coroutines.withTimeoutOrNull
|  2169 kotlinx.coroutines.yield
|  2170 KOTLIN_IMPORT_LIST_END
|  2171 
|  2172 ""
|  2173 " Sets up the AddJavaImport and AddKotlinImport commands.
|  2174 "
|  2175 " These need to be defined in a separate file since they reload the vimrc.
|  2176 " Otherwise, an error is thrown due to redefinition of an executing function.
|  2177 "
|  2178 call bss#imp#SetupCommands({
|  2179       \   'AddJavaImport': 'JAVA_IMPORT_LIST_END',
|  2180       \   'AddKotlinImport': 'KOTLIN_IMPORT_LIST_END',
|  2181       \ })
|  2182 
|  2183 let g:jm_vimrc.java_import_cache =
|  2184       \ bss#imp#BuildJvmImportCache(g:jm_vimrc.java_import_list)
|  2185 
|  2186 let g:jm_vimrc.kotlin_import_cache =
|  2187       \ bss#imp#BuildJvmImportCache(g:jm_vimrc.kotlin_import_list)
|  2188 " }}} Java Kotlin Import Cache
   2189 
+  -  2190 +--193 lines: C++ Import Cache:
2190 " C++ Import Cache: {{{
|  2191 let g:jm_vimrc.cc_import_cache = bss#imp#BuildCppImportCache({
|  2192       \   '"absl/flags/flag.h"': ['ABSL_FLAG', 'GetFlag'],
|  2193       \   '"absl/flags/declare.h"': ['ABSL_DECLARE_FLAG'],
|  2194       \   '"absl/flags/parse.h"': ['ParseCommandLine'],
|  2195       \   '"absl/flags/usage.h"': ['ProgramUsageMessage', 'SetProgramUsageMessage'],
|  2196       \   '"absl/strings/str_join.h"': ['StrJoin'],
|  2197       \   '"absl/strings/str_cat.h"': ['StrCat'],
|  2198       \   '"absl/strings/str_replace.h"': ['StrReplaceAll'],
|  2199       \   '"absl/strings/str_split.h"': ['StrSplit'],
|  2200       \   '"absl/status/status.h"': ['Status'],
|  2201       \   '"absl/status/statusor.h"': ['StatusOr'],
|  2202       \   '<opencv2/core.hpp>': [
|  2203       \     'Mat',
|  2204       \     'Mat_',
|  2205       \     'Mat1b', 'Mat2b', 'Mat3b', 'Mat4b',
|  2206       \     'Mat1i', 'Mat2i', 'Mat3i', 'Mat4i',
|  2207       \     'Mat1f', 'Mat2f', 'Mat3f', 'Mat4f',
|  2208       \     'Mat1d', 'Mat2d', 'Mat3d', 'Mat4d',
|  2209       \     'Matx',
|  2210       \     'Matx22f', 'Matx33f', 'Matx44f',
|  2211       \     'Matx21f', 'Matx31f', 'Matx41f',
|  2212       \     'Matx22d', 'Matx33d', 'Matx44d',
|  2213       \     'Matx21d', 'Matx31d', 'Matx41d',
|  2214       \     'Vec',
|  2215       \     'Vec1b', 'Vec2b', 'Vec3b', 'Vec4b', 'Vec6b',
|  2216       \     'Vec1i', 'Vec2i', 'Vec3i', 'Vec4i', 'Vec6i',
|  2217       \     'Vec1f', 'Vec2f', 'Vec3f', 'Vec4f', 'Vec6f',
|  2218       \     'Vec1d', 'Vec2d', 'Vec3d', 'Vec4d', 'Vec6d',
|  2219       \     'Scalar_', 'Scalar',
|  2220       \     'Point_', 'Point2i', 'Point2l', 'Point2f', 'Point2d',
|  2221       \     'Point3_', 'Point3i', 'Point3l', 'Point3f', 'Point3d',
|  2222       \     'abs',
|  2223       \     'exp', 'log',
|  2224       \     'pow', 'sqrt',
|  2225       \   ],
|  2226       \   '<opencv2/imgcodecs.hpp>': ['imread', 'imwrite'],
|  2227       \   '<opencv2/imgproc.hpp>': ['circle'],
|  2228       \   '<utility>': [
|  2229       \     'forward', 'declval',
|  2230       \     'move', 'swap', 'exchange',
|  2231       \     'integer_sequence', 'make_integer_sequence',
|  2232       \     'index_sequence', 'make_index_sequence',
|  2233       \     'pair', 'make_pair',
|  2234       \   ],
|  2235       \   '<memory>': ['unique_ptr', 'make_unique'],
|  2236       \   '<vector>': ['vector'],
|  2237       \   '<tuple>': [
|  2238       \     'tuple',
|  2239       \     'tuple_size',
|  2240       \     'tuple_element',
|  2241       \     'get',
|  2242       \   ],
|  2243       \   '<type_traits>': [
|  2244       \     'enable_if', 'conditional',
|  2245       \     'enable_if_t', 'conditional_t',
|  2246       \     'integral_constant', 'bool_constant',
|  2247       \     'true_type', 'false_type',
|  2248       \     'conjunction', 'disjunction', 'negation',
|  2249       \     'conjunction_v', 'disjunction_v', 'negation_v',
|  2250       \     'is_same', 'is_base_of', 'is_convertible',
|  2251       \     'is_same_v', 'is_base_of_v', 'is_convertible_v',
|  2252       \   ],
|  2253       \   '<array>': ['array'],
|  2254       \   '<valarray>': ['valarray'],
|  2255       \   '<cstddef>': [
|  2256       \     'size_t', 'ptrdiff_t', 'nullptr_t',
|  2257       \   ],
|  2258       \   '<future>': [
|  2259       \     'future', 'promise', 'async', 'launch',
|  2260       \   ],
|  2261       \   '<thread>': [
|  2262       \     'thread', 'this_thread', 'yield', 'get_id', 'sleep_for',
|  2263       \   ],
|  2264       \   '<cstdint>': [
|  2265       \     'int8_t', 'int16_t', 'int32_t', 'int64_t',
|  2266       \     'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
|  2267       \   ],
|  2268       \   '<cmath>': [
|  2269       \     'abs',
|  2270       \     'exp', 'log', 'log2', 'log10',
|  2271       \     'pow', 'sqrt', 'hypot',
|  2272       \     'sin', 'cos', 'tan',
|  2273       \     'asin', 'acos', 'atan',
|  2274       \     'sinh', 'cosh', 'tanh',
|  2275       \     'asinh', 'acosh', 'atanh',
|  2276       \     'ceil', 'floor', 'trunc', 'round',
|  2277       \   ],
|  2278       \   '<string>': [
|  2279       \     'string',
|  2280       \     'to_string',
|  2281       \     'stoi', 'stol', 'stoul', 'stoll', 'stoull',
|  2282       \     'stof', 'stod', 'stold',
|  2283       \   ],
|  2284       \   '<map>': ['map'],
|  2285       \   '<unordered_map>': ['unordered_map'],
|  2286       \   '<set>': ['set'],
|  2287       \   '<iostream>': [
|  2288       \     'cout', 'cin', 'cerr',
|  2289       \     'endl',
|  2290       \   ],
|  2291       \   '<ios>': [
|  2292       \     'internal', 'left', 'right',
|  2293       \     'boolalpha', 'showbase', 'showpos',
|  2294       \     'dec', 'hex', 'oct',
|  2295       \     'fixed', 'scientific', 'default',
|  2296       \   ],
|  2297       \   '<format>': ['format'],
|  2298       \   '<iomanip>': [
|  2299       \     'setw',
|  2300       \     'quoted',
|  2301       \   ],
|  2302       \   '<unordered_set>': ['unordered_set'],
|  2303       \   '<optional>': ['optional'],
|  2304       \   '<complex>': ['complex'],
|  2305       \   '<initializer_list>': ['initializer_list'],
|  2306       \   '<numeric>': [
|  2307       \     'iota',
|  2308       \     'accumulate',
|  2309       \     'reduce',
|  2310       \     'inner_product',
|  2311       \     'adjacent_difference',
|  2312       \     'partial_sum',
|  2313       \   ],
|  2314       \   '<cstdlib>': [
|  2315       \     'system',
|  2316       \     'exit',
|  2317       \     'getenv',
|  2318       \     'malloc',
|  2319       \     'free',
|  2320       \     'aligned_malloc',
|  2321       \   ],
|  2322       \   '<random>': [
|  2323       \     'random_device',
|  2324       \     'mt19937',
|  2325       \     'mt19937_64',
|  2326       \     'uniform_real_distribution',
|  2327       \     'uniform_int_distribution',
|  2328       \     'normal_distribution',
|  2329       \   ],
|  2330       \   '<functional>': [
|  2331       \     'function',
|  2332       \     'plus', 'minus', 'multiplies', 'divides',
|  2333       \     'equal_to', 'not_equal_to',
|  2334       \     'greater', 'less', 'greater_equal', 'less_equal',
|  2335       \     'logical_and', 'logical_or', 'logical_not',
|  2336       \     'bit_end', 'bit_or', 'bit_xor', 'bit_not',
|  2337       \   ],
|  2338       \   '<algorithm>': [
|  2339       \
|  2340       \     'all_of', 'any_of', 'none_of',
|  2341       \     'for_each', 'for_each_n',
|  2342       \     'count', 'count_if',
|  2343       \     'mismatch',
|  2344       \     'find', 'find_if', 'find_if_not',
|  2345       \     'find_end', 'find_first_of', 'adjacent_find',
|  2346       \     'search', 'search_n',
|  2347       \
|  2348       \     'copy', 'copy_backward', 'move', 'move_backward', 'copy_n',
|  2349       \     'fill', 'fill_n', 'transform', 'generate', 'generate_n',
|  2350       \     'remove', 'remove_if', 'remove_copy', 'remove_copy_if',
|  2351       \     'replace', 'replace_if', 'replace_copy', 'replace_copy_if',
|  2352       \     'swap', 'swap_ranges', 'swap_iter',
|  2353       \     'reverse', 'reverse_copy', 'rotate',
|  2354       \     'rotate_copy',
|  2355       \     'shuffle',
|  2356       \     'max', 'min', 'max_element', 'min_element', 'minmax',
|  2357       \   ],
|  2358       \   '"absl/algorithm/container.h"': [
|  2359       \
|  2360       \     'c_all_of', 'c_any_of', 'c_none_of',
|  2361       \     'c_for_each', 'c_for_each_n',
|  2362       \     'c_count', 'c_count_if',
|  2363       \     'c_mismatch',
|  2364       \     'c_find', 'c_find_if', 'c_find_if_not',
|  2365       \     'c_find_end', 'c_find_first_of', 'c_adjacent_find',
|  2366       \     'c_search', 'c_search_n',
|  2367       \
|  2368       \     'c_copy', 'c_copy_backward', 'c_move', 'c_move_backward', 'c_copy_n',
|  2369       \     'c_fill', 'c_fill_n', 'c_transform', 'c_generate', 'c_generate_n',
|  2370       \     'c_remove', 'c_remove_if', 'c_remove_copy', 'c_remove_copy_if',
|  2371       \     'c_replace', 'c_replace_if', 'c_replace_copy', 'c_replace_copy_if',
|  2372       \     'c_swap', 'c_swap_ranges', 'c_swap_iter',
|  2373       \     'c_reverse', 'c_reverse_copy', 'c_rotate',
|  2374       \     'c_rotate_copy',
|  2375       \     'c_shuffle',
|  2376       \   ],
|  2377       \   '<iterator>': [
|  2378       \     'istream_iterator',
|  2379       \     'ostream_iterator',
|  2380       \   ],
|  2381       \ })
|  2382 " }}} C++ Import Cache