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