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