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