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 +-- 67 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 else
|   339   let $FZF_DEFAULT_COMMAND = 'ag -g ""'
|   340 endif
|   341 
|   342 let g:html_dynamic_folds = v:true
|   343 
|   344 let g:ycm_auto_trigger = 1
|   345 let g:ycm_disable_signature_help = 1
|   346 let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
|   347 let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
|   348 
|   349 let g:slime_target = "tmux"
|   350 
|   351 " Will disable indent-based markdown code blocks
|   352 let g:bss_markdown_fix = 1
|   353 
|   354 let g:bss_java_fix = 1
|   355 
|   356 let g:markdown_folding = 1
|   357 
|   358 let g:NERDCompactSexyComs = v:true
|   359 let g:NERDCommentEmptyLines = v:true
|   360 let g:NERDDefaultAlign = 'left'
|   361 
|   362 let g:tagbar_sort = v:false
|   363 
|   364 " Use ordinal numbers (2) rather than bufnum (1)
|   365 let g:buftabline_numbers = 2
|   366 let g:buftabline_indicators = v:true
|   367 let g:buftabline_separators = v:false
|   368 
|   369 let g:netre_liststyle=3
|   370 
|   371 let g:tex_flavor='latex'
|   372 
|   373 let g:UltiSnipsExpandTrigger="<tab>"
|   374 let g:UltiSnipsJumpForwardTrigger="<c-j>"
|   375 let g:UltiSnipsJumpBackwardTrigger="<c-z>"
|   376 let g:UltiSnipsEditSplit="vertical"
|   377 
|   378 let g:gitgutter_sign_added = '··'
|   379 let g:gitgutter_sign_modified = '··'
|   380 let g:gitgutter_sign_removed = '·'
|   381 let g:gitgutter_sign_modified_removed = '·'
|   382 " }}} Plugin Settings
    383 
+  -   384 +--153 lines: Keymappings:
 384 " Keymappings: {{{
|   385 "   To understand keys see :h key-notation
|   386 
|   387 " By default, `j` and `k` will move between lines; this means they will skip
|   388 " over multiple lines when lines wrap.
|   389 "
|   390 " Uncomment the 4 lines below so that `j` and `k` move between lines on the
|   391 " screen.
|   392 "nnoremap j gj
|   393 "nnoremap k gk
|   394 "vnoremap j gj
|   395 "vnoremap k gk
|   396 
|   397 " Moving around between windows quickly
|   398 let g:jm_vimrc.docs.mappings['<C-[hjkl]>'] =
|   399       \ 'Move between windows by holding CTRL'
|   400 noremap <C-j> <C-W>j
|   401 noremap <C-k> <C-W>k
|   402 noremap <C-h> <C-W>h
|   403 noremap <C-l> <C-W>l
|   404 
|   405 let g:jm_vimrc.docs.mappings['<C-[←↑↓→]>'] =
|   406       \ 'Move visual selection'
|   407 vnoremap <C-Up> koko
|   408 vnoremap <C-Down> jojo
|   409 vnoremap <C-Left> hoho
|   410 vnoremap <C-Right> lolo
|   411 
|   412 let g:jm_vimrc.docs.mappings['[['] =
|   413       \ 'Enable [[,][,]],[] to operate on non-col-1-{}'
|   414 " From :h object-motions
|   415 nnoremap [[ ?{<CR>w99[{
|   416 nnoremap ][ /}<CR>b99]}
|   417 nnoremap ]] j0[[%/{<CR>
|   418 nnoremap [] k$][%?}<CR>
|   419 
|   420 let g:jm_vimrc.docs.mappings['\q'] =
|   421       \ 'Delete current buffer without changing window layout'
|   422 nnoremap <leader>q :Bdelete<cr>
|   423 
|   424 let g:jm_vimrc.docs.mappings["\\'"] =
|   425       \ 'Open NERDTree (file explorer)'
|   426 nnoremap <leader>' :NERDTreeToggle<cr>
|   427 
|   428 let g:jm_vimrc.docs.mappings['\"'] =
|   429       \ 'Open NERDTree (file explorer) to current file'
|   430 nnoremap <leader>" :NERDTreeFind<cr>
|   431 
|   432 let g:jm_vimrc.docs.mappings['\<Tab>'] =
|   433       \ 'Open Tagbar'
|   434 nnoremap <leader><tab> :TagbarToggle<cr>
|   435 
|   436 let g:jm_vimrc.docs.mappings['<F10>'] =
|   437       \ 'Toggle paste'
|   438 set pastetoggle=<F10>
|   439 
|   440 let g:jm_vimrc.docs.mappings['<F9>'] =
|   441       \ 'Toggle virtualedit=all'
|   442 nnoremap <F9> :let &ve = <C-r>=empty(&ve) ? '"all"' : '""'<cr><cr>
|   443 
|   444 let g:jm_vimrc.docs.mappings['<C-r><C-f>'] =
|   445       \ '[modes:ic] Insert file name root'
|   446 inoremap <C-r><C-f> <C-r>=expand('%:p:t:r')<cr>
|   447 cnoremap <C-r><C-f> <C-r>=expand('%:p:t:r')<cr>
|   448 
|   449 let g:jm_vimrc.docs.mappings['<C-r><C-t>'] =
|   450       \ '[modes:ic] Insert file name root'
|   451 inoremap <C-r><C-t> <C-r>=bss#blaze#BlazeTarget()<cr>
|   452 cnoremap <C-r><C-t> <C-r>=bss#blaze#BlazeTarget()<cr>
|   453 
|   454 let g:jm_vimrc.docs.mappings['<C-p>'] =
|   455       \ 'Fuzzy-search PWD'
|   456 nnoremap <C-p> :Files<cr>
|   457 
|   458 let g:jm_vimrc.docs.mappings['\w'] =
|   459       \ 'Clear search highlights (:nohlsearch)'
|   460 nnoremap <silent> <leader>w :nohlsearch<Bar>:echo<cr>
|   461 
|   462 let g:jm_vimrc.docs.mappings['<F11>'] =
|   463       \ 'Ensure non-syntax toplevel text is spell-checked'
|   464 noremap <F11> :syntax spell toplevel<cr>
|   465 let g:jm_vimrc.docs.mappings['<F12>'] =
|   466       \ 'Toggle spell checking'
|   467 noremap <F12> :setlocal spell! spelllang=en_us<cr>
|   468 
|   469 let g:jm_vimrc.docs.mappings['<Space>l'] =
|   470       \ 'Open Git ("Change [L]ist")'
|   471 nnoremap <leader>l :Git<cr>
|   472 
|   473 let g:jm_vimrc.docs.mappings['<C-w><C-z>'] =
|   474       \ 'Set window height to 10 and fix the height'
|   475 nnoremap <C-w><C-z> :FixHeight 10<cr>
|   476 nnoremap <C-w>z :FixHeight 10<cr>
|   477 
|   478 let g:jm_vimrc.docs.mappings['K'] =
|   479       \ 'Do grep for word under cursor'
|   480 nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
|   481 
|   482 let g:jm_vimrc.docs.mappings['\\'] =
|   483       \ 'Show :tags'
|   484 nnoremap <leader><leader> :tags<cr>
|   485 
|   486 let g:jm_vimrc.docs.mappings['\s'] =
|   487       \ 'Refresh UltSnips snippets'
|   488 nnoremap <leader>s :call UltiSnips#RefreshSnippets()<cr>
|   489 
|   490 let g:jm_vimrc.docs.mappings['\<Space>'] =
|   491       \ 'Open BssHg'
|   492 nnoremap <leader><space> :BssHg<cr>
|   493 
|   494 let g:jm_vimrc.docs.mappings['\a'] =
|   495       \ 'Trigger EasyAlign (See :Wtf ea)'
|   496 xmap <leader>a <Plug>(EasyAlign)
|   497 nmap <leader>a <Plug>(EasyAlign)
|   498 
|   499 let g:jm_vimrc.docs.mappings['\O'] =
|   500       \ 'Run `open %`'
|   501 xmap <leader>O :<C-u>!open %<cr>
|   502 nmap <leader>O :<C-u>!open %<cr>
|   503 
|   504 let g:jm_vimrc.docs.mappings["C-W !"] =
|   505       \ 'Toggle buflisted'
|   506 nnoremap <C-W>l :set buflisted!<cr>
|   507 
|   508 nnoremap <space>c  :YcmCompleter GetType<cr>
|   509 nnoremap <space>cq :YcmCompleter GoToDocumentOutline<cr>
|   510 nnoremap <space>cc :YcmCompleter GoToCallers<cr>
|   511 nnoremap <space>cC :YcmCompleter GoToDefinition<cr>
|   512 nnoremap <space>cf :YcmCompleter FixIt<cr>
|   513 nnoremap <space>cd :YcmCompleter GetDoc<cr>
|   514 nnoremap <space>ct :YcmCompleter GetType<cr>
|   515 
|   516 let g:jm_vimrc.docs.mappings["<space>T"] =
|   517       \ 'Go to java test (and maybe make it)'
|   518 nnoremap <space>T :FindOrMakeJavaTest<cr>
|   519 
|   520 let g:jm_vimrc.docs.mappings['\a[:(]'] =
|   521       \ 'Extra/overriden EasyAlign items'
|   522 let g:easy_align_delimiters = bss#extra#EasyAlignDelimiters()
|   523 
|   524 let g:jm_vimrc.docs.mappings['\[0-9]'] =
|   525       \ 'Switch to buffer (from buftabline)'
|   526 nmap <leader>1 <Plug>BufTabLine.Go(1)
|   527 nmap <leader>2 <Plug>BufTabLine.Go(2)
|   528 nmap <leader>3 <Plug>BufTabLine.Go(3)
|   529 nmap <leader>4 <Plug>BufTabLine.Go(4)
|   530 nmap <leader>5 <Plug>BufTabLine.Go(5)
|   531 nmap <leader>6 <Plug>BufTabLine.Go(6)
|   532 nmap <leader>7 <Plug>BufTabLine.Go(7)
|   533 nmap <leader>8 <Plug>BufTabLine.Go(8)
|   534 nmap <leader>9 <Plug>BufTabLine.Go(9)
|   535 nmap <leader>0 <Plug>BufTabLine.Go(10)
|   536 " }}} Keymappings
    537 
+  -   538 +--228 lines: Commands:
 538 " Commands: {{{
|   539 " Note -bar allows these to be followed by | to chain commands (ie. for autocmds)
|   540 
|   541 " Command :Term ~ Nicer :term API
|   542 " :Term ~ Runs 'shell'
|   543 " :Term [command]... ~ Runs the command in 'shell'
|   544 "
|   545 " This command will reuse the last window, unless it's no longer being used
|   546 " for the terminal buffer. Also, this hides the buffer, in case you leave a
|   547 " terminal window running and don't want to accidentally get stuck in it.
|   548 if !exists('g:jm_term') || !exists('g:jm_terms')
|   549   let g:jm_term = bss#view#TermView()
|   550   let g:jm_terms = {}
|   551 endif
|   552 let g:jm_vimrc.docs.commands['Term'] =
|   553       \ 'Run a terminal command in a reused window'
|   554 command! -nargs=* -complete=shellcmd Term
|   555       \ eval g:jm_term.Run(<q-args>)
|   556 
|   557 let g:jm_vimrc.docs.commands['TermSet'] =
|   558       \ 'Set an option on the term window'
|   559 command! -nargs=* -complete=option TermSet
|   560       \ eval g:jm_term.Exec(printf("setlocal %s", <q-args>))
|   561 
|   562 let g:jm_vimrc.docs.commands['Terms'] =
|   563       \ 'Run a terminal command in a reused named window. Terms [name] [cmd]...'
|   564 command! -nargs=* -complete=shellcmd Terms
|   565       \ eval bss#SetDefault(g:jm_terms, [<f-args>][0], {-> bss#view#TermView()})
|   566       \   .Run([<f-args>][1:]->join(' '))
|   567 
|   568 let g:jm_vimrc.docs.commands['ReplaceR'] =
|   569       \ 'Locally set \r to run :Term with the specified command'
|   570 command! -nargs=+ ReplaceR
|   571       \ nnoremap <buffer> <localleader>r :Term <args><cr>
|   572 
|   573 let g:jm_vimrc.docs.commands['ReplaceRTarget'] =
|   574       \ 'Set \r to bazel target of the current file'
|   575 command! -bar ReplaceRTarget
|   576       \ execute 'ReplaceR' BlazeGuessCommand()
|   577 
|   578 let g:jm_vimrc.docs.commands['StopAllJobs'] =
|   579       \ 'Stop all running jobs'
|   580 command! -bar StopAllJobs eval job_info()->map('job_stop(v:val)')
|   581 
|   582 let g:jm_vimrc.docs.commands['ListAllJobs'] =
|   583       \ 'List all running jobs'
|   584 command! -bar -bang ListAllJobs
|   585       \ call bss#PP(job_info()->filter('<bang>0 || (job_status(v:val) == "run")'))
|   586 
|   587 let g:jm_vimrc.docs.commands['DumpAllJobs'] =
|   588       \ 'List job_infos for all running jobs'
|   589 command! -bar -bang DumpAllJobs
|   590       \ call bss#PP(job_info()->filter('<bang>0 || (job_status(v:val) == "run")')->map('job_info(v:val)'))
|   591 
|   592 let g:jm_vimrc.docs.commands['SetupClasspath'] =
|   593       \ 'Set classpath to jm_vimrc.deps.ClasspathJarList()'
|   594 command! -bar SetupClasspath
|   595       \ let $CLASSPATH = join(g:jm_vimrc.deps.ClasspathJarList(), ':')
|   596 
|   597 let g:jm_vimrc.docs.commands['SetupTargetClasspath'] =
|   598       \ 'Set classpath to blaze target included jars'
|   599 command! -bar SetupTargetClasspath
|   600       \ let $CLASSPATH = s:TargetClasspath()
|   601 
|   602 let g:jm_vimrc.docs.commands['SetupCV'] =
|   603       \ 'Setup $LDFLAGS, $CFLAGS and &path for OpenCV development'
|   604 command! -bar SetupCV
|   605       \ let $LDFLAGS = '-lopencv_core -lopencv_imgcodecs -lopencv_imgproc' |
|   606       \ let $CFLAGS = '-I/usr/include/opencv4' |
|   607       \ let &path ..= ',/usr/include/opencv4,/usr/include/c++/10/'
|   608 
|   609 let g:jm_vimrc.docs.commands['FixHeight'] =
|   610       \ 'Resize window and fix its height'
|   611 command! -nargs=1 FixHeight
|   612       \ resize <args> | set winfixheight
|   613 
|   614 let g:jm_vimrc.docs.commands['SetupTermRainbow'] =
|   615       \ 'Add Rainbow-coloring to terminals'
|   616 command! -bar SetupTermRainbow
|   617       \ autocmd TerminalOpen * RainbowLoad
|   618 
|   619 let g:jm_vimrc.docs.commands['SetupAutoread'] =
|   620       \ 'Enable autoread and add checktime autocmd'
|   621 command! -bar SetupAutoread
|   622       \ set autoread | autocmd FocusGained,BufEnter * checktime
|   623 
|   624 let g:jm_vimrc.docs.commands['RemoveTrailingWhitespace'] =
|   625       \ 'Removes all trailing whitespace from the selected lines'
|   626 command! -range=% RemoveTrailingWhitespace
|   627       \ <line1>,<line2>s/\s\+$//
|   628 
|   629 let g:jm_vimrc.docs.commands['SetupMatchHex'] =
|   630       \ 'Match hex numbers'
|   631 command! -bar SetupMatchHex
|   632       \ match GruvboxAqua /\<0x0*\zs[1-9a-f]\x*\>/
|   633 
|   634 let g:jm_vimrc.docs.commands['SetupMatchNum'] =
|   635       \ 'Match decimal numbers'
|   636 command! -bar SetupMatchNum
|   637       \ match GruvboxAqua /\<\(0x\)\?0*\zs[1-9a-f]\x*\>/
|   638 
|   639 let g:jm_vimrc.docs.commands['RefreshSnippets'] =
|   640       \ 'Refresh ultisnips'
|   641 command! -bar RefreshSnippets
|   642       \ call UltiSnips#RefreshSnippets()
|   643 
|   644 let g:jm_vimrc.docs.commands['Dis'] =
|   645       \ 'Setup terminal for viewing objdump output ($ objdump -d ... | vim +Dis -)'
|   646 command! -bar Dis
|   647       \ setlocal ft=dis buftype=nofile
|   648 
|   649 let g:jm_vimrc.docs.commands['Center'] =
|   650       \ 'Block alignment-preserving :center'
|   651 call bss#draw#block#RegisterCommands()
|   652 
|   653 let g:jm_vimrc.docs.commands['ToggleFoldOpenSearch'] =
|   654       \ 'Toggle search on foldopen option'
|   655 command! ToggleFoldOpenSearch
|   656       \ if stridx(&foldopen, "search") == -1 |
|   657       \   set foldopen+=search |
|   658       \   echo "ENABLED foldopen search" |
|   659       \ else |
|   660       \   set foldopen-=search |
|   661       \   echo "DISABLED foldopen search" |
|   662       \ endif
|   663 
|   664 let g:jm_vimrc.docs.commands['SetupMath'] =
|   665       \ 'Set up abbreviations for math symbols'
|   666 command! SetupMath
|   667       \ execute 'iabbrev <buffer> nn ∩' |
|   668       \ execute 'iabbrev <buffer> uu ∪' |
|   669       \ execute 'iabbrev <buffer> in ∈' |
|   670       \ execute 'iabbrev <buffer> ni ∉' |
|   671       \ execute 'iabbrev <buffer> ss ⊂' |
|   672       \ execute 'iabbrev <buffer> se ⊆' |
|   673       \ execute 'iabbrev <buffer> ns ⊄' |
|   674       \ execute 'iabbrev <buffer> AN ∧' |
|   675       \ execute 'iabbrev <buffer> OR ∨' |
|   676       \ execute 'iabbrev <buffer> es ∅' |
|   677       \ execute 'iabbrev <buffer> => ⇒' |
|   678       \ execute 'iabbrev <buffer> == ⇔' |
|   679       \ execute 'iabbrev <buffer> != ≠' |
|   680       \ execute 'iabbrev <buffer> co ∘' |
|   681       \ execute 'iabbrev <buffer> FA ∀' |
|   682       \ execute 'iabbrev <buffer> TE ∃' |
|   683       \ execute 'iabbrev <buffer> \|> ↦'
|   684 
|   685 let g:jm_vimrc.docs.commands['PyHelp'] =
|   686       \ 'Look-up help for python expression (: PyHelp <pkg> <cls>)'
|   687 command! -nargs=+ -bang PyHelp
|   688       \ call py3eval((<bang>0) ? printf('help(%s)', <q-args>) : printf('help(__import__("%s").%s)', <f-args>))
|   689 
|   690 let g:jm_vimrc.docs.commands['MakeOrSetup'] =
|   691       \ 'Run blaze, make, or create a Makefile with included commands (using ; as separator)'
|   692 command! -nargs=+ MakeOrSetup call s:MakeOrSetup(<q-args>)
|   693 function! s:MakeOrSetup(cmds) abort
|   694   if filereadable('Makefile')
|   695     Term make
|   696   elseif filereadable('WORKSPACE')
|   697     execute 'Term blaze build' BlazeTarget()
|   698   elseif filereadable('gradlew')
|   699     Term ./gradlew test --rerun
|   700   else
|   701     let l:cmds = substitute(a:cmds, '%', expand('%'), 'g')
|   702     let l:lines = split(l:cmds, ';')->map('trim(v:val)')
|   703     let l:cursor = bss#cursor#SaveWithBuf()
|   704     try
|   705       redir > Makefile
|   706       silent echo '.PHONY: all'
|   707       silent echo 'all:'
|   708       for l:cmd in l:lines
|   709         silent echo ' ' .. l:cmd
|   710       endfor
|   711       redir END
|   712       silent edit Makefile
|   713       Term make
|   714     finally
|   715       call l:cursor.Restore()
|   716     endtry
|   717   endif
|   718 endfunction
|   719 
|   720 let g:jm_vimrc.docs.commands['SetupYcmClasspath'] =
|   721       \ 'Create .ycm_extra_conf.py with CLASSPATH'
|   722 command! -bang SetupYcmClasspath
|   723       \ call s:SetupYcmClasspath($CLASSPATH)
|   724 function! s:SetupYcmClasspath(classpath) abort
|   725   let l:classpath = split(a:classpath, ':')
|   726   let l:lines = s:GenerateYcm(l:classpath)
|   727   if filereadable('.ycm_extra_conf.py')
|   728     throw 'ERROR(FileExists): .ycm_extra_conf.py already exists!'
|   729   else
|   730     call writefile(l:lines, '.ycm_extra_conf.py')
|   731     YcmRestartServer
|   732   endif
|   733 endfunction
|   734 function! s:GenerateYcm(classpath) abort
|   735   let l:path = a:classpath
|   736         \->map('string(v:val)')
|   737         \->join(", ")
|   738   let l:lines =<< eval trim END
|   739     def Settings(**kwargs):
|   740         if kwargs["language"] == "java":
|   741             return {{
|   742                 "ls": {{
|   743                   "java.project.referencedLibraries": [{l:path}]
|   744                 }}
|   745             }}
|   746   END
|   747   return l:lines
|   748 endfunction
|   749 
|   750 let g:jm_vimrc.docs.commands['SetupOcamlformat'] =
|   751       \ 'Create a basic .ocamlformat'
|   752 command! SetupOcamlformat call s:SetupOcamlformat()
|   753 function! s:SetupOcamlformat() abort
|   754   if !filereadable('.ocamlformat')
|   755     call writefile(['profile = default'], '.ocamlformat')
|   756   endif
|   757 endfunction
|   758 
|   759 " The Silver Searcher
|   760 if executable('ag')
|   761     " Use ag over grep
|   762     set grepprg=ag\ --nogroup\ --nocolor\ --ignore=tags\ --vimgrep
|   763     set grepformat^=%f:%l:%c:%m
|   764 endif
|   765 " }}} Commands
    766 
+  -   767 +--295 lines: FT-Specific Settings:
 767 " FT-Specific Settings: {{{
|   768 
|   769 " Autocommands are split into filetype `augroup`s, each is separated by
|   770 " filetype. This solves the problem of sourcing the vimrc multiple times
|   771 " causing multiple duplicated autocommands to be set. An augroup is only run
|   772 " once**.
|   773 "
|   774 " These keymappings depend on the filetype, when :filetype on is enabled (as
|   775 " it is earlier in this config), when vim first loads a buffer, it will
|   776 " automatically detect the filetype and set the 'filetype' option (buffer)
|   777 " locally. After this happens, any `FileType` type autocommands are triggered
|   778 "
|   779 " NOTES:
|   780 " ** An augroup doesn't provide this functionality by itself. When you
|   781 " redefine it, it will 'add onto' the original one, in order to clear one, you
|   782 " can add `autocommand!` or `au!` to it (or another with the same name). This
|   783 " is used to make sure that only one version of the autocommand hooks is set
|   784 " per buffer.
|   785 augroup ft_latex
|   786     autocmd!
|   787     autocmd FileType tex setlocal nocursorline
|   788     autocmd FileType tex setlocal tabstop=4 shiftwidth=4
|   789     autocmd FileType tex nnoremap <buffer> <localleader>r
|   790           \ :execute 'Term fish -c "mkt ' .. expand('%') .. '"'<cr>
|   791 augroup END
|   792 
|   793 augroup ft_dot
|   794     autocmd!
|   795     autocmd FileType dot setlocal tabstop=2 shiftwidth=2
|   796     autocmd FileType dot nnoremap <buffer> <localleader>r
|   797           \ :execute 'Term dot -T svg -O' expand('%') <cr>
|   798 augroup END
|   799 
|   800 augroup ft_c
|   801     autocmd!
|   802     autocmd FileType c setlocal tabstop=2 shiftwidth=2
|   803     autocmd FileType c setlocal foldmethod=syntax
|   804     autocmd FileType c nnoremap <buffer> <localleader>r
|   805           \ :Term make<CR>
|   806     autocmd FileType c nnoremap <buffer> <localleader>R
|   807           \ :MakeOrSetup gcc -Wall -O3 -o a.out %; ./a.out; rm a.out<cr>
|   808 augroup END
|   809 
|   810 
|   811 augroup ft_cc
|   812     autocmd!
|   813     autocmd FileType cpp setlocal tabstop=2 shiftwidth=2
|   814     autocmd FileType cpp setlocal foldmethod=syntax
|   815     autocmd FileType cpp nnoremap <buffer> <localleader>t
|   816           \ :term <C-r>=BlazeGuessCommand()<CR>
|   817     autocmd FileType cpp nnoremap <buffer> <localleader>r
|   818           \ :MakeOrSetup
|   819           \   clang++-12 -std=c++17 $(CFLAGS) -o build % $(LDFLAGS);
|   820           \   ./build<CR>
|   821     autocmd FileType cpp nnoremap <buffer> <space>f
|   822           \ :FormatCode<CR>
|   823     autocmd FileType cpp
|   824           \ if exists('g:jm_setup_cpp_cv') |
|   825           \   SetupCV |
|   826           \ endif
|   827     autocmd FileType cpp
|   828           \ if expand('%:p') =~ '/home/jmend/pg' |
|   829           \   silent ReplaceRTarget |
|   830           \ endif
|   831 augroup END
|   832 
|   833 augroup ft_gdb
|   834     autocmd!
|   835     autocmd FileType gdb nnoremap <buffer> <localleader>r
|   836           \ :execute 'Term gdb -q -x' expand('%')<cr>
|   837 augroup END
|   838 
|   839 augroup ft_python
|   840     autocmd!
|   841     autocmd FileType python command! RunPython
|   842           \ execute "Term" g:jm_vimrc.deps.python expand('%')
|   843     autocmd FileType python command! RunPythonTests
|   844           \ execute "Term" g:jm_vimrc.deps.python "-m pytest" expand('%')
|   845     autocmd FileType python command! RunPythonTypechecks
|   846           \ execute "Term" g:jm_vimrc.deps.python "-m mypy --ignore-missing-imports --follow-imports=skip " expand("%")
|   847     autocmd FileType python command! RunPythonMPL
|   848           \ StopAllJobs | eval timer_start(0, {-> execute('RunPython')})
|   849     autocmd FileType python command! ReplaceRMPL
|   850           \ nnoremap <buffer> <localleader>r :RunPythonMPL<cr>
|   851     autocmd FileType python nnoremap <buffer> <localleader>r
|   852           \ :RunPython<cr>
|   853     autocmd FileType python nnoremap <buffer> <localleader>R
|   854           \ :RunPythonTests<cr>
|   855     autocmd FileType python nnoremap <buffer> <localleader>t
|   856           \ :RunPythonTypechecks<cr>
|   857     autocmd FileType python nnoremap <buffer> <space>f
|   858           \ :FormatCode<CR>
|   859 
|   860     autocmd BufNewFile .ycm_extra_conf.py call setline('.', [
|   861           \   'def Settings(**kwargs):',
|   862           \   '    if kwargs["language"] == "java":',
|   863           \   '        return {',
|   864           \   '            "ls": {',
|   865           \   '                "java.project.referencedLibraries": ["~/.jars/*.jar"]',
|   866           \   '            }',
|   867           \   '        }',
|   868           \ ])
|   869 
|   870 
|   871 augroup END
|   872 
|   873 augroup ft_scheme
|   874     autocmd!
|   875     autocmd FileType scheme setlocal colorcolumn=79
|   876     autocmd FileType scheme let g:lisp_rainbow = v:true
|   877     autocmd FileType scheme nnoremap <buffer> <localleader>r
|   878           \ :w<CR> :Term mit-scheme --load % <CR>
|   879 augroup END
|   880 
|   881 augroup ft_java
|   882     autocmd!
|   883     autocmd FileType java
|   884           \ setlocal tabstop=2 softtabstop=2 tabstop=2 shiftwidth=2 smarttab
|   885     autocmd FileType java
|   886           \ setlocal foldmethod=marker foldmarker={,}
|   887     autocmd FileType java nnoremap <space>f :FormatCode<cr>
|   888     autocmd FileType java nnoremap <space>F :set bt=nowrite <bar> FormatCode<cr>
|   889     autocmd FileType java vnoremap <space>f :FormatLines<cr>
|   890     autocmd FileType java nnoremap <silent> <buffer> <localleader>r
|   891           \ :MakeOrSetup java %<cr>
|   892     autocmd FileType java nnoremap <silent> <buffer> <localleader>R
|   893           \ :Term ./gradlew run<cr>
|   894     autocmd FileType java let b:surround_99 = "{@code \r}"
|   895     autocmd FileType java nnoremap <silent> <buffer> gd
|   896           \ :YcmCompleter GoToDefinition<cr>
|   897     autocmd FileType java nnoremap <silent> <buffer> gD
|   898           \ :YcmCompleter GoToReferences<cr>
|   899 augroup END
|   900 
|   901 augroup ft_kotlin
|   902     autocmd!
|   903     autocmd FileType kotlin
|   904           \ setlocal tabstop=2 softtabstop=2 tabstop=2 shiftwidth=2 smarttab
|   905 
|   906     autocmd FileType kotlin nnoremap <silent> <buffer> <localleader>r
|   907           \ :MakeOrSetup
|   908           \   kotlinc . -include-runtime -d a.jar;
|   909           \   java -jar a.jar<CR>
|   910     autocmd FileType kotlin nnoremap <silent> <buffer> <localleader>R
|   911           \ :Term ./gradlew run<cr>
|   912     autocmd FileType kotlin nnoremap <space>f :FormatCode<cr>
|   913     autocmd FileType kotlin vnoremap <space>f :FormatLines<cr>
|   914     autocmd FileType kotlin nnoremap <silent> <buffer> gd
|   915           \ :YcmCompleter GoToDefinition<cr>
|   916     autocmd FileType kotlin nnoremap <silent> <buffer> gD
|   917           \ :YcmCompleter GoToReferences<cr>
|   918 augroup END
|   919 
|   920 augroup ft_jar
|   921   autocmd!
|   922   autocmd FileType jar
|   923         \ call zip#Browse(expand("<amatch>"))
|   924   autocmd FileType jar
|   925         \ setlocal buflisted
|   926 augroup END
|   927 
|   928 augroup ft_class
|   929   autocmd!
|   930   autocmd BufReadCmd *.class
|   931         \ call bss#java#javap#Browse(expand("<amatch>"))
|   932 augroup END
|   933 
|   934 augroup ft_javascript
|   935     autocmd!
|   936     autocmd FileType javascript
|   937           \ setlocal tabstop=2 softtabstop=2 tabstop=2 smarttab
|   938     autocmd FileType javascript nnoremap <buffer> <localleader>r
|   939           \ :execute "Term node " .. expand('%')<cr>
|   940     autocmd FileType javascript nnoremap <buffer> <localleader>R
|   941           \ :Term webpack<CR>
|   942     autocmd FileType javascript nnoremap <buffer> <space>f
|   943           \ :FormatCode<CR>
|   944 augroup END
|   945 
|   946 augroup ft_markdown
|   947     autocmd!
|   948     autocmd FileType markdown set textwidth=72 smartindent autoindent
|   949     autocmd FileType markdown set cinwords+=:
|   950 
|   951     autocmd FileType markdown nnoremap <buffer> ]h :<c-u>call search('\v^#+ ', 'Wz')<cr>
|   952     autocmd FileType markdown nnoremap <buffer> [h :<c-u>call search('\v^#+ ', 'bWz')<cr>
|   953     "autocmd FileType markdown nnoremap <buffer> <leader>r
|   954                 "\ :Term pandoc %:p -s --highlight-style kate --pdf-engine=xelatex -o gen/%:t:r.pdf<cr>
|   955 
|   956     autocmd FileType markdown nnoremap <buffer> <space>l :<c-u>lvimgrep /\v^#+ / %<cr>
|   957 
|   958     autocmd FileType markdown
|   959           \ command! GoToSection call bss#md#GoToSection()
|   960 
|   961     autocmd FileType markdown nnoremap <buffer> <localleader>r
|   962           \ :GoToSection<cr>
|   963 
|   964     autocmd FileType markdown nnoremap <buffer> <localleader>R
|   965           \ :call bss#md#GoToRandomSection()<cr>
|   966           \ :normal zt0<cr>
|   967 
|   968     autocmd FileType markdown command! SetupRPandoc nnoremap <buffer> <localleader>r
|   969           \ :call execute(printf(
|   970           \     "Term pandoc %s -s --highlight-style kate --pdf-engine=xelatex -o %s.pdf",
|   971           \     expand('%:p'),
|   972           \     expand('%:t:r'),
|   973           \   ))<cr>
|   974 
|   975     autocmd FileType markdown command! JmMdQuotesAsComments match GruvboxFg3 /^\s*>.*/
|   976 
|   977     if !exists('g:bss_markdown_fix') || !g:bss_markdown_fix
|   978       " Disable indent-based code blocks, this enables arbitrarily deep
|   979       " indentation of lists
|   980       autocmd FileType markdown syntax clear markdownCodeBlock
|   981       autocmd FileType markdown syntax region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\).*$" end="^\s*\z1\ze\s*$" keepend
|   982       autocmd FileType markdown syntax region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\).*$" end="^\s*\z1\ze\s*$" keepend
|   983 
|   984       " Fix up the colors
|   985       autocmd FileType markdown highlight link markdownH1 GruvboxRedBold
|   986       autocmd FileType markdown highlight link markdownH2 GruvboxBlueBold
|   987       autocmd FileType markdown highlight link markdownH3 GruvboxGreenBold
|   988       autocmd FileType markdown highlight link markdownH4 GruvboxPurpleBold
|   989 
|   990       " Ensure bold/italics are highlighted
|   991       autocmd FileType markdown highlight link markdownBold GruvboxFg4
|   992       autocmd FileType markdown highlight link markdownBoldDelimiter GruvboxFg4
|   993       autocmd FileType markdown highlight link markdownItalic GruvboxFg2
|   994       autocmd FileType markdown highlight link markdownItalicDelimiter GruvboxFg2
|   995     endif
|   996 augroup END
|   997 
|   998 augroup ft_vim
|   999     autocmd!
|  1000     autocmd FileType vim setlocal foldmethod=marker shiftwidth=2
|  1001     autocmd FileType vim nnoremap <buffer> <localleader>r
|  1002           \ :source %<cr>
|  1003     autocmd FileType vim nnoremap K :help <C-r><C-w><CR>
|  1004 augroup END
|  1005 
|  1006 augroup ft_fish
|  1007     autocmd!
|  1008     autocmd FileType fish setlocal tabstop=4 shiftwidth=4 smartindent
|  1009     autocmd FileType fish nnoremap <buffer> <space>f
|  1010           \ :0,$!fish_indent<cr>
|  1011     autocmd FileType fish setlocal omnifunc=bss#fish#Complete
|  1012 augroup END
|  1013 
|  1014 augroup ft_make
|  1015     autocmd!
|  1016     autocmd FileType make nnoremap <buffer> <localleader>r
|  1017           \ :Term make<cr>
|  1018 augroup END
|  1019 
|  1020 augroup ft_ocaml
|  1021     autocmd!
|  1022     autocmd FileType ocaml
|  1023           \ setlocal tabstop=2 softtabstop=2 tabstop=2 smarttab
|  1024     autocmd FileType ocaml nnoremap <space>f :FormatCode<cr>
|  1025     autocmd FileType ocaml vnoremap <space>f :FormatLines<cr>
|  1026     if filereadable('Makefile')
|  1027       autocmd FileType ocaml nnoremap <silent> <buffer> <localleader>r
|  1028             \ :Term make<cr>
|  1029     elseif filereadable('dune-project')
|  1030       autocmd FileType ocaml nnoremap <silent> <buffer> <localleader>r
|  1031             \ :Term dune build<cr>
|  1032     else
|  1033       autocmd FileType ocaml nnoremap <silent> <buffer> <localleader>r
|  1034             \ :execute 'Term ocaml' expand("%")<cr>
|  1035     endif
|  1036     if isdirectory('/usr/bin/ocaml')
|  1037       autocmd FileType ocaml set path+=/usr/lib/ocaml
|  1038     endif
|  1039 augroup END
|  1040 
|  1041 augroup ft_coq
|  1042     autocmd!
|  1043     autocmd FileType coq
|  1044           \ setlocal tabstop=2 softtabstop=2 tabstop=2 smarttab smartindent
|  1045     if filereadable('Makefile')
|  1046       autocmd FileType coq nnoremap <silent> <buffer> <localleader>r
|  1047             \ :Term make<cr>
|  1048     else
|  1049       autocmd FileType coq nnoremap <silent> <buffer> <localleader>r
|  1050             \ :execute 'Term coqc' expand("%")
|  1051             \ <bar> execute 'TermSet ft=coq'<cr>
|  1052     endif
|  1053 augroup END
|  1054 
|  1055 " Use quickfix window when using :make
|  1056 augroup cfg_quickfix_fix
|  1057     autocmd QuickFixCmdPost [^l]* nested cwindow
|  1058     autocmd QuickFixCmdPost    l* nested lwindow
|  1059 augroup end
|  1060 
|  1061 " }}} FT-Specific Settings
   1062 
+  -  1063 +--554 lines: Misc:
1063 " Misc: {{{
|  1064 
|  1065 " :FindImport {Classname}
|  1066 "   Attempt to find and a Java import statement for the {Classname}
|  1067 "     1. Try the `g:jm_vimrc.java_import_cache`
|  1068 "     2. Search the CWD using `ag` for an `import .*\.{ClassName};`
|  1069 "     3. Finally, search `g:jm_vimrc.deps.JavaClassnameList()`
|  1070 "   Alternatively, for C++ do only:
|  1071 "     1. Try the `g:jm_vimrc.cc_import_cache`
|+ |- 1072 +--- 73 lines:
1072 " {{{
|| 1073 let g:jm_vimrc.docs.commands['FindImport'] =
|| 1074       \ 'Given a name, find the corresponding import and add an import statment'
|| 1075 nnoremap <space>t :call <SID>FindImport(expand('<cword>'))<CR>
|| 1076 command -nargs=1 FindImport call <SID>FindImport(<q-args>)
|| 1077 function! s:FindImport(word) abort
|| 1078 
|| 1079   if &filetype ==# 'cpp'
|| 1080     if !bss#imp#TryAddImportFromCache(g:jm_vimrc.cc_import_cache, a:word, 'bss#imp#AddImportCpp')
|| 1081       echo "FindImport: `" .. a:word .. "` not found!"
|| 1082     endif
|| 1083     return
|| 1084   endif
|| 1085 
|| 1086   if &filetype ==# 'kotlin'
|| 1087     " First try the kotlin import cache
|| 1088     if bss#imp#TryAddImportFromCache(g:jm_vimrc.kotlin_import_cache, a:word, 'bss#imp#AddImportKotlin')
|| 1089       return
|| 1090     endif
|| 1091 
|| 1092     if bss#imp#TryAddImportFromCache(g:jm_vimrc.java_import_cache, a:word, 'bss#imp#AddImportKotlin')
|| 1093       return
|| 1094     endif
|| 1095 
|| 1096     " Next, find an import statement in the current directory
|| 1097     let l:results = printf(
|| 1098             \ '%s --nofilename --nobreak %s',
|| 1099             \ g:jm_vimrc.deps.ag,
|| 1100             \ shellescape(printf('import .+\b%s\b', a:word)))
|| 1101             \->systemlist()
|| 1102             \->sort()
|| 1103             \->uniq()
|| 1104 
|| 1105     " Finally, fallback to classname list
|| 1106     if empty(l:results)
|| 1107       let l:results = g:jm_vimrc.deps.JavaClassnameList()
|| 1108             \->filter('v:val =~# a:word')
|| 1109             \->map('"import " .. v:val')
|| 1110     endif
|| 1111 
|| 1112     call bss#imp#AddOrSelectImport(l:results, 'bss#imp#AddImportJvm')
|| 1113     return
|| 1114   endif
|| 1115 
|| 1116   if &filetype !=# 'java'
|| 1117     throw 'ERROR(InvalidFiletype)'
|| 1118     return
|| 1119   endif
|| 1120 
|| 1121   " First try the g:jm_vimrc.java_import_cache
|| 1122   if bss#imp#TryAddImportFromCache(g:jm_vimrc.java_import_cache, a:word, 'bss#imp#AddImportJava')
|| 1123     return
|| 1124   endif
|| 1125 
|| 1126   " Next find an import statement in the current directory
|| 1127   let l:results = printf(
|| 1128           \ '%s --nofilename --nobreak %s',
|| 1129           \ g:jm_vimrc.deps.ag,
|| 1130           \ shellescape(printf('import .+\b%s\b;', a:word)))
|| 1131           \->systemlist()
|| 1132           \->sort()
|| 1133           \->uniq()
|| 1134 
|| 1135   " Finally, fallback to classname list
|| 1136   if empty(l:results)
|| 1137     let l:results = g:jm_vimrc.deps.JavaClassnameList()
|| 1138           \->filter('v:val =~# a:word')
|| 1139           \->map('"import " .. v:val .. ";"')
|| 1140   endif
|| 1141 
|| 1142   call bss#imp#AddOrSelectImport(l:results, 'bss#imp#AddImportJvm')
|| 1143 endfunction
|| 1144 " }}}
|  1145 
|  1146 " :Javap {qualified-classname}
|  1147 "   Run `javap` against the provided classname
|+ |- 1148 +--- 40 lines:
1148 " {{{
|| 1149 let g:jm_vimrc.docs.commands['Javap'] =
|| 1150       \ 'Execute Javap and show output with highlighting'
|| 1151 command! -nargs=? -complete=customlist,<SID>JavapComplete -bang
|| 1152         \ Javap call <SID>Javap(<q-args>, "<bang>" ==# '!')
|| 1153 function! s:Javap(arg, search) abort
|| 1154   if empty($CLASSPATH)
|| 1155     SetupClasspath
|| 1156   endif
|| 1157 
|| 1158   " Note: Vim Syntax highlighting doesn't like `\->substitute(...)`
|| 1159   let l:cls = empty(a:arg) ? @" : a:arg
|| 1160   let l:cls = substitute(l:cls, '\(;\|<.\+>\)', '', 'ga')
|| 1161 
|| 1162   if a:search
|| 1163     let l:results = s:JavapComplete(l:cls, v:none, v:none)
|| 1164     if len(l:results) == 1
|| 1165       let l:cls = l:results[0]
|| 1166     else
|| 1167       call maktaba#ui#selector#Create(l:results)
|| 1168             \.WithMappings({'<cr>': [function("s:JavapOpen")->get("name"), 'Close', 'Open window']})
|| 1169             \.Show()
|| 1170       return
|| 1171     endif
|| 1172   endif
|| 1173 
|| 1174   eval g:jm_term
|| 1175         \.Run(join([g:jm_vimrc.deps.javap, l:cls], ' '))
|| 1176         \.Exec('set ft=java')
|| 1177 endfunction
|| 1178 
|| 1179 function! s:JavapComplete(arg_lead, cmd_line, cursor_pos) abort
|| 1180   return g:jm_vimrc.deps.JavaClassnameList()
|| 1181         \->filter('v:val =~# a:arg_lead')
|| 1182 endfunction
|| 1183 
|| 1184 function! s:JavapOpen(cls) abort
|| 1185   execute 'Javap ' .. a:cls
|| 1186 endfunction
|| 1187 " }}}
|  1188 
|  1189 " :MavenSearch {query}
|  1190 " :M {query}
|  1191 "   Run a maven query, and show results in a selector window
|+ |- 1192 +--- 73 lines:
1192 " {{{
|| 1193 let g:jm_vimrc.docs.commands['MavenSearch'] =
|| 1194       \ 'Search maven, then either add a dependecy or download the jar'
|| 1195 command! -nargs=1 MavenSearch call <SID>MavenSearch(<q-args>)
|| 1196 command! -nargs=1 M MavenSearch <args>
|| 1197 function! s:MavenSearch(query) abort
|| 1198   const l:request = {
|| 1199         \   "page": 0,
|| 1200         \   "size": 20,
|| 1201         \   "searchTerm": a:query,
|| 1202         \   "filter": []
|| 1203         \ }
|| 1204   const l:query_url =
|| 1205         \ 'https://central.sonatype.com/api/internal/browse/components'
|| 1206 
|| 1207   const l:query_cmd = join([
|| 1208         \   g:jm_vimrc.deps.curl,
|| 1209         \   '-s',
|| 1210         \   l:query_url,
|| 1211         \   '--json',
|| 1212         \   shellescape(json_encode(l:request))
|| 1213         \ ])
|| 1214 
|| 1215   let l:msg = system(l:query_cmd)
|| 1216   let l:resp = json_decode(l:msg)
|| 1217 
|| 1218   if l:resp.totalResultCount == 0
|| 1219     echom "None found!"
|| 1220     return
|| 1221   endif
|| 1222   let l:components = l:resp.components
|| 1223   const l:mappings = {
|| 1224         \   '<cr>': [function("s:MInsert")->get("name"), 'Close', 'Insert below'],
|| 1225         \   'D': [function("s:MDownload")->get("name"), 'Close', 'Insert below'],
|| 1226         \ }
|| 1227   call maktaba#ui#selector#Create(map(l:components, 'v:val.namespace .. ":" .. v:val.name .. ":" ..  v:val.latestVersionInfo.version'))
|| 1228         \.WithMappings(l:mappings)
|| 1229         \.Show()
|| 1230 endfunction
|| 1231 
|| 1232 function! s:MInsert(msg) abort
|| 1233   let l:spaces = getline('.')->matchstr('^\s*')
|| 1234   if &filetype ==# 'kotlin'
|| 1235     call append(line('.'), printf('%simplementation("%s")', l:spaces, a:msg))
|| 1236   else
|| 1237     call append(line('.'), printf("%simplementation '%s'", l:spaces, a:msg))
|| 1238   endif
|| 1239 endfunction
|| 1240 
|| 1241 function! s:MDownload(msg) abort
|| 1242   let [l:package, l:name, l:version] = split(a:msg, ':')
|| 1243   let l:url_package = substitute(l:package, '\.', '/', 'g')
|| 1244   let l:url = printf('https://repo1.maven.org/maven2/%s/%s/%s/',
|| 1245         \  l:url_package,
|| 1246         \  l:name,
|| 1247         \  l:version)
|| 1248   let l:file = printf('%s-%s.jar', l:name, l:version)
|| 1249   let l:file_url = l:url .. l:file
|| 1250   echom l:url .. l:file
|| 1251 
|| 1252   const l:cmd = join([
|| 1253         \   g:jm_vimrc.deps.curl,
|| 1254         \   '-o',
|| 1255         \   shellescape(l:file),
|| 1256         \   '-s',
|| 1257         \   shellescape(l:file_url),
|| 1258         \ ])
|| 1259   silent call system(l:cmd)
|| 1260   if v:shell_error
|| 1261     echom 'ERROR: Could not download! ' .. l:file_url
|| 1262   endif
|| 1263 endfunction
|| 1264 " }}}
|  1265 
|  1266 " Bazel/Blaze helper functions
|  1267 "
|  1268 "   s:BlazeTargets({fname})
|  1269 "     Return the targets that depend on {fname} directly
|  1270 "
|  1271 "   BlazeTarget()
|  1272 "     Returns the first target for the current file
|  1273 "
|  1274 "   s:TargetClasspath()
|  1275 "     Returns the classpath for BlazeTarget()
|  1276 "
|  1277 "   s:CompleteTargets({arg_lead}, {cmd_line}, {cursor_pos})
|  1278 "     A -complete=customlist compatible function that simply filters the
|  1279 "     commandline against all targets
|  1280 "
|+ |- 1281 +--- 69 lines:
1281 " {{{
|| 1282 function! s:BlazeTargets(fname) abort
|| 1283   let l:query = printf(
|| 1284         \   'same_pkg_direct_rdeps(%s)',
|| 1285         \   fnamemodify(a:fname, ":p:."),
|| 1286         \ )
|| 1287 
|| 1288   let l:command = printf(
|| 1289         \   "%s query '%s'",
|| 1290         \   g:jm_vimrc.deps.blaze,
|| 1291         \   l:query,
|| 1292         \ )
|| 1293   return filter(systemlist(l:command), 'v:val =~# "^//"')
|| 1294 endfunction
|| 1295 
|| 1296 function! BlazeGuessCommand(show = v:false) abort
|| 1297   let l:fname = expand('%:p')
|| 1298 
|| 1299   let l:target = BlazeTarget()
|| 1300   if l:target ==# "???"
|| 1301     echom "Can't find blaze target!"
|| 1302     return "false"
|| 1303   endif
|| 1304 
|| 1305   let l:action = 'build'
|| 1306   if l:fname =~# '\v(_test.cc|Test.java)$' || l:target =~# '\v(_test|Test)$'
|| 1307     let l:action = 'test'
|| 1308   elseif l:fname =~# '\v(main.cc|_bin.cc|Bin.java)$' || l:target =~# '\v(_bin|Bin|main|Main)$'
|| 1309     let l:action = 'run'
|| 1310   elseif l:fname =~# '\v(_bench.cc)$' || l:target =~# '\v(_bench)$'
|| 1311     let l:action = 'run -c opt'
|| 1312   endif
|| 1313 
|| 1314   let l:command = printf(
|| 1315         \   "%s %s %s",
|| 1316         \   g:jm_vimrc.deps.blaze,
|| 1317         \   l:action,
|| 1318         \   l:target,
|| 1319         \ )
|| 1320   if a:show
|| 1321     echom 'Using:' l:command
|| 1322   endif
|| 1323   return l:command
|| 1324 endfunction
|| 1325 
|| 1326 function! BlazeTarget() abort
|| 1327   return get(s:BlazeTargets(expand('%:p')), 0, "???")
|| 1328 endfunction
|| 1329 
|| 1330 function! s:TargetClasspath() abort
|| 1331   let l:target = BlazeTarget()
|| 1332   if l:target ==# "???"
|| 1333     echom "Can't find blaze target!"
|| 1334     return ""
|| 1335   endif
|| 1336 
|| 1337   let l:lines = systemlist(printf('blaze print_action "%s"', l:target))
|| 1338   let l:jars = filter(l:lines, {_, v -> v =~# '^\s\+\(outputjar\|classpath\): "[^"]*"'})
|| 1339         \->map({_, v -> matchlist(v, '"\([^"]*\)"')[1]})
|| 1340   return join(l:jars, ':')
|| 1341 endfunction
|| 1342 
|| 1343 function! s:CompleteTargets(arg_lead, cmd_line, cursor_pos) abort
|| 1344   if a:arg_lead =~ '^//.*'
|| 1345     return systemlist(printf('%s query ... 2>&1', g:jm_vimrc.deps.blaze))
|| 1346           \->filter('v:val =~# "' .. a:arg_lead .. '"')
|| 1347   endif
|| 1348 endfunction
|| 1349 " }}}
|  1350 
|  1351 " :Touch {path}...
|  1352 "   Like `$ touch`, but also create directories if necessary
|  1353 "
|  1354 " :Touch
|  1355 "   Touches the file of the current buffer
|+ |- 1356 +--- 19 lines:
1356 " {{{
|| 1357 let g:jm_vimrc.docs.commands['Touch'] =
|| 1358       \ 'Create files and directories'
|| 1359 command! -nargs=* Touch call s:Touch([<f-args>])
|| 1360 function! s:Touch(paths) abort
|| 1361   if empty(a:paths)
|| 1362     return s:Touch([expand('%:p')])
|| 1363   endif
|| 1364   for l:path in a:paths
|| 1365     let l:dir = fnamemodify(l:path, ':h')
|| 1366     if l:dir !=# '.' && !isdirectory(l:dir)
|| 1367       call system('mkdir -p ' .. shellescape(l:dir))
|| 1368     endif
|| 1369     if !filereadable(l:path)
|| 1370       call system('touch ' .. shellescape(l:path))
|| 1371     endif
|| 1372   endfor
|| 1373 endfunction
|| 1374 " }}}
|  1375 
|  1376 " :CurrentHLGroup
|  1377 "   Print the highlight Group under cursor
|+ |- 1378 +---  8 lines:
1378 " {{{
|| 1379 let g:jm_vimrc.docs.commands['CurrentHLGroup'] =
|| 1380       \ 'Echo name of the highlight group under the cursor'
|| 1381 command! CurrentHLGroup echo s:SyntaxItem()
|| 1382 function! s:SyntaxItem()
|| 1383   return synIDattr(synID(line("."), col("."), 1), "name")
|| 1384 endfunction
|| 1385 " }}}
|  1386 
|  1387 " AsyncExec(fn)
|  1388 "   Call fn() async
|  1389 "
|  1390 " AsyncExec(...)
|  1391 "   Join string arguments and exec async
|+ |- 1392 +---  9 lines:
1392 " {{{
|| 1393 function! s:Async(Fn)
|| 1394   eval timer_start(0, a:Fn)
|| 1395 endfunction
|| 1396 
|| 1397 function! s:AsyncExec(...)
|| 1398   eval s:Async({-> execute(join(map(a:000, function('string'))))})
|| 1399 endfunction
|| 1400 " }}}
|  1401 
|  1402 " ConcealK
|  1403 "   Define conceal rules: eg. ConcealK lambda:λ
|+ |- 1404 +--- 17 lines:
1404 " {{{
|| 1405 let g:jm_vimrc.docs.commands['ConcealK'] =
|| 1406       \ 'Define conceal rules: eg. ConcealK lambda:λ'
|| 1407 command! -complete=expression -nargs=1 ConcealK call <SID>ConcealK(<q-args>)
|| 1408 function! s:ConcealK(repl_str) abort
|| 1409   let l:repl = {}
|| 1410   let l:i = 0
|| 1411   for [l:keyword, l:replacement] in split(a:repl_str, ' ')->map('v:val->split(":")')
|| 1412     let l:i += 1
|| 1413     execute 'syntax keyword'
|| 1414           \ printf('ConcealK%03d', l:i) l:keyword
|| 1415           \ 'conceal' printf('cchar=%s', l:replacement)
|| 1416   endfor
|| 1417   setlocal conceallevel=1
|| 1418   setlocal concealcursor=ni
|| 1419 endfunction
|| 1420 " }}}
|  1421 
|  1422 " ReadExecute
|  1423 "   Execute then read the output of that vim command
|+ |- 1424 +---  5 lines:
1424 " {{{
|| 1425 let g:jm_vimrc.docs.commands['ReadExecute'] =
|| 1426       \ 'Execute then read the output of that vim command'
|| 1427 command! -nargs=* -complete=command ExecuteRead eval append(line('.'), execute(<q-args>)->split("\n"))
|| 1428 " }}}
|  1429 
|  1430 " Bdz
|  1431 "   Run buildozer on current target (or :__pkg__ if none exists)
|+ |- 1432 +---  9 lines:
1432 " {{{
|| 1433 let g:jm_vimrc.docs.commands['Bdz'] =
|| 1434       \ 'Run buildozer on current target (or :__pkg__ if none exists)'
|| 1435 command! -nargs=* Bdz echom
|| 1436       \ system(printf("fish -c \"buildozer '%s' %s\"",
|| 1437       \   join([<f-args>], ' '),
|| 1438       \   BlazeTarget() != '???' ? BlazeTarget() : ':__pkg__'
|| 1439       \ ))
|| 1440 " }}}
|  1441 
|  1442 " JemFormat
|  1443 "   Format lines between "format:`cmd`" to "format: END"
|+ |- 1444 +--- 38 lines:
1444 " {{{
|| 1445 let g:jm_vimrc.docs.commands['JemFormat'] =
|| 1446       \ 'Format lines between "format:`cmd`" to "format: END"'
|| 1447 command! -nargs=* -complete=customlist,<SID>JemFormatComplete JemFormat eval s:JemFormat[<q-args>]()
|| 1448 let s:JemFormat = {
|| 1449       \   ''     : {-> s:JemFormat.format()},
|| 1450       \   'help' : {-> bss#PP(s:JemFormat, v:true)},
|| 1451       \ }
|| 1452 function! s:JemFormatComplete(arglead, cmdline, curpos) abort
|| 1453   return keys(s:JemFormat)->filter({k, v -> !stridx(v, a:arglead)})
|| 1454 endfunction
|| 1455 
|| 1456 function! s:JemFormat.format() abort dict
|| 1457   let command = self.find()
|| 1458   if !empty(command)
|| 1459     silent execute command
|| 1460   endif
|| 1461 endfunction
|| 1462 
|| 1463 function! s:JemFormat.find() abort dict
|| 1464   let [_, num, col; _] = getcurpos()
|| 1465   let start_pat   = '\v.*for' .. 'mat: `([^`]+)`.*'
|| 1466   let end_pat     = '\v.*for' .. 'mat: END.*'
|| 1467   let start_lines = matchbufline(bufnr(), start_pat, 1, num)
|| 1468   let start_line  = bss#Last(start_lines)
|| 1469   let end_line    = start_line
|| 1470         \->bss#Get('lnum')
|| 1471         \->bss#Apply({l -> matchbufline(bufnr(), end_pat, l, '$')})
|| 1472         \->bss#Apply('bss#Last')
|| 1473         \->bss#Or('$')
|| 1474   if start_line is v:none
|| 1475     return ''
|| 1476   endif
|| 1477   let range   = [start_line.lnum + 1, end_line.lnum - 1]->join(',')
|| 1478   let command = substitute(start_line.text, start_pat, '\1', '')
|| 1479   return join([range, command], ' ')
|| 1480 endfunction
|| 1481 " }}}
|  1482 
|  1483 " AppendMarkdownBlock <fname>
|  1484 "   Append the current buffer's lines to the file <fname>.
|  1485 "   Adds an empty line if the last line in <fname> is non-empty.
|  1486 "
|  1487 " SetupAppendMarkdownBlock <fname>
|  1488 "   Setup \r nmap in the current buffer
|  1489 " 
|+ |- 1490 +--- 50 lines:
1490 " {{{
|| 1491 command! -nargs=1 -complete=file SetupAppendMarkdownBlock
|| 1492       \ nnoremap <buffer> \r :AppendMarkdownBlock <args><cr>
|| 1493 command! -nargs=1 -complete=file -range=% AppendMarkdownBlock
|| 1494       \ eval AppendMarkdownBlock(<q-args>, <line1>, <line2>)
|| 1495 command! -nargs=1 -complete=file AppendMarkdownBlockDebug
|| 1496       \ eval AppendMarkdownBlock(<q-args>, 0, '$', v:true)
|| 1497 
|| 1498 function! AppendMarkdownBlock(fname, begin=0, end='$', debug=v:false) abort
|| 1499   let lines = getline(a:begin, a:end)->s:Markdown_lines2codeblock()
|| 1500   if !a:debug
|| 1501     call s:AppendMarkdownBlock_write(a:fname, lines)
|| 1502   else
|| 1503     call s:AppendMarkdownBlock_dump(a:fname, lines)
|| 1504   endif
|| 1505 endfunction
|| 1506 
|| 1507 ""
|| 1508 " Convert a list of lines to a list of codeblock lines.
|| 1509 "
|| 1510 function! s:Markdown_lines2codeblock(lines) abort
|| 1511   let prefix = '```'
|| 1512   let suffix = prefix
|| 1513   return [prefix] + a:lines + [suffix]
|| 1514 endfunction
|| 1515 
|| 1516 
|| 1517 ""
|| 1518 " Add a block to a markdown file.
|| 1519 "
|| 1520 function! s:AppendMarkdownBlock_write(fname, lines) abort
|| 1521   let prefix = (readfile(a:fname)->bss#Last()->empty())
|| 1522         \ ? [] : [""]
|| 1523   call writefile(prefix + a:lines, a:fname, 'a')
|| 1524   echom "Wrote file" a:fname
|| 1525 endfunction
|| 1526 
|| 1527 ""
|| 1528 " Dump debug information.
|| 1529 "
|| 1530 function! s:AppendMarkdownBlock_dump(fname, lines) abort
|| 1531   " Dump debug output
|| 1532   echo 'fname:' a:fname
|| 1533   echo 'lines:'
|| 1534   echo
|| 1535   for l in a:lines
|| 1536     echo '  ' .. l
|| 1537   endfor
|| 1538 endfunction
|| 1539 " }}}
|  1540 
|  1541 " SetupSlimeTarget
|  1542 "   Wrapper for setting the g:slime_target
|+ |- 1543 +--- 17 lines:
1543 " {{{
|| 1544 command! -nargs=? -complete=customlist,s:SetupSlimeTarget_Complete SetupSlimeTarget call s:SetupSlimeTarget(<q-args>)
|| 1545 let s:SlimeTargets = [
|| 1546       \   'tmux',
|| 1547       \   'vimterminal',
|| 1548       \ ]
|| 1549 function! s:SetupSlimeTarget(arg) abort
|| 1550   if empty(a:arg)
|| 1551     echom printf('Current slime target: %s', g:slime_target)
|| 1552   else
|| 1553     let g:slime_target = a:arg
|| 1554   endif
|| 1555 endfunction
|| 1556 function! s:SetupSlimeTarget_Complete(arg, ...) abort
|| 1557   return s:SlimeTargets->filter('stridx(v:val, a:arg) == 0')
|| 1558 endfunction
|| 1559 " }}}
|  1560 
|  1561 function! Layout() abort
|  1562   let layout = winlayout()
|  1563   return s:InvertLayout(layout)
|  1564 endfunction
|  1565 function! s:InvertLayout(l, path=[]) abort
|  1566   if len(a:l) != 2
|  1567     throw "ERROR(InvalidArguments): s:InvertLayout expects only 2-element lists"
|  1568   endif
|  1569   let [kind, val] = a:l
|  1570   if kind ==# 'leaf'
|  1571     return {val: join(a:path, '')}
|  1572   elseif kind ==# 'col'
|  1573     return val
|  1574           \->map('s:InvertLayout(v:val, a:path + ["|"])')
|  1575           \->reduce({a, b -> extend(a, b)})
|  1576   elseif kind ==# 'row'
|  1577     return val
|  1578           \->map('s:InvertLayout(v:val, a:path + ["-"])')
|  1579           \->reduce({a, b -> extend(a, b)})
|  1580   endif
|  1581 endfunction
|  1582 
|  1583 
|  1584 " FindOrMakeJavaTest
|  1585 "   Navigate to the associated Java test of the current file, creating one if
|  1586 "   none exists.
|+ |- 1587 +--- 28 lines:
1587 " {{{
|| 1588 command! FindOrMakeJavaTest call s:FindOrMakeJavaTest()
|| 1589 function! s:FindOrMakeJavaTest() abort
|| 1590   let l:path = expand('%:p:h')
|| 1591   let l:name = expand('%:t:r')
|| 1592   let l:extn = expand('%:t:e')
|| 1593   if l:path =~# ".*/src/main/java/.*"
|| 1594     let l:path = substitute(l:path, "src/main/java", "src/test/java", "")
|| 1595     let l:name .= 'Test'
|| 1596   elseif l:path =~# ".*/src/test/java/.*" && l:name =~# ".*Test$"
|| 1597     let l:path = substitute(l:path, "src/test/java", "src/main/java", "")
|| 1598     let l:name = l:name[:-5]
|| 1599   elseif l:path =~# ".*/java/.*"
|| 1600     let l:path = substitute(l:path, "/java/", "/javatests/", "")
|| 1601     let l:name .= 'Test'
|| 1602   elseif l:path =~# ".*/javatests/.*" && l:name =~# ".*Test$"
|| 1603     let l:path = substitute(l:path, "/javatests/", "/java/", "")
|| 1604     let l:name = l:name[:-5]
|| 1605   elseif l:path =~# ".*/src/main/kotlin/.*"
|| 1606     let l:path = substitute(l:path, "src/main/kotlin", "src/test/kotlin", "")
|| 1607     let l:name .= 'Test'
|| 1608   elseif l:path =~# ".*/src/test/kotlin/.*" && l:name =~# ".*Test$"
|| 1609     let l:path = substitute(l:path, "src/test/kotlin", "src/main/kotlin", "")
|| 1610     let l:name = l:name[:-5]
|| 1611   endif
|| 1612   execute 'edit' $"{l:path}/{l:name}.{l:extn}"
|| 1613 endfunction
|| 1614 " }}}
|  1615 
|  1616 " }}} Misc
   1617 
+  -  1618 +--  5 lines: Notes
1618 " Notes {{{
|  1619 let s:Wtf = bss#wtf#Initialize()
|  1620 call bss#wtf#AddDict(['mappings', 'm'], g:jm_vimrc.docs.mappings)
|  1621 call bss#wtf#AddDict(['commands', 'c'], g:jm_vimrc.docs.commands)
|  1622 " }}} Notes
   1623 
+  -  1624 +--442 lines: Java/Kotlin Import Cache:
1624 " Java/Kotlin Import Cache: {{{
|  1625 "
|  1626 " Defines the import cache used for Java/Kotlin import search, if an attempt to
|  1627 " resolve the import for a key in this map, the value specified will be
|  1628 " imported before trying any other method to find the import.
|  1629 let g:jm_vimrc.java_import_list =<< JAVA_IMPORT_LIST_END
|  1630 com.google.auto.common.AnnotationMirrors
|  1631 com.google.auto.common.AnnotationValues
|  1632 com.google.auto.common.BasicAnnotationProcessor
|  1633 com.google.auto.common.MoreElements
|  1634 com.google.auto.common.MoreTypes
|  1635 com.google.common.base.Stopwatch
|  1636 com.google.common.collect.ImmutableList
|  1637 com.google.common.collect.ImmutableMap
|  1638 com.google.common.collect.ImmutableSet
|  1639 com.google.common.collect.ImmutableTable
|  1640 com.google.common.collect.Lists
|  1641 com.google.common.collect.Streams
|  1642 com.google.common.collect.Table
|  1643 com.google.common.collect.Tables
|  1644 com.google.common.flogger.FluentLogger
|  1645 com.google.common.math.Stats
|  1646 com.google.common.math.StatsAccumulator
|  1647 com.google.common.util.concurrent.AbstractExecutionThreadService
|  1648 com.google.common.util.concurrent.AbstractFuture
|  1649 com.google.common.util.concurrent.AbstractScheduledService
|  1650 com.google.common.util.concurrent.AbstractTransformFuture
|  1651 com.google.common.util.concurrent.FutureCallback
|  1652 com.google.common.util.concurrent.Futures
|  1653 com.google.common.util.concurrent.ListenableFuture
|  1654 com.google.common.util.concurrent.ListenableFutureTask
|  1655 com.google.common.util.concurrent.ListenableScheduledFuture
|  1656 com.google.common.util.concurrent.ListenerCallQueue
|  1657 com.google.common.util.concurrent.ListeningExecutorService
|  1658 com.google.common.util.concurrent.ListeningScheduledExecutorService
|  1659 com.google.common.util.concurrent.MoreExecutors
|  1660 com.google.common.util.concurrent.SettableFuture
|  1661 com.google.common.util.concurrent.Uninterruptibles
|  1662 com.squareup.javapoet.ClassName
|  1663 com.squareup.javapoet.CodeBlock
|  1664 com.squareup.javapoet.FieldSpec
|  1665 com.squareup.javapoet.JavaFile
|  1666 com.squareup.javapoet.MethodSpec
|  1667 com.squareup.javapoet.ParameterSpec
|  1668 com.squareup.javapoet.ParameterizedTypeName
|  1669 com.squareup.javapoet.TypeName
|  1670 com.squareup.javapoet.TypeSpec
|  1671 com.sun.jdi.VMDisconnectedException
|  1672 com.sun.jdi.VirtualMachine
|  1673 com.sun.jdi.VirtualMachineManager
|  1674 com.sun.jdi.event.EventSet
|  1675 dagger.Binds
|  1676 dagger.BindsInstance
|  1677 dagger.Component
|  1678 dagger.MapKey
|  1679 dagger.Module
|  1680 dagger.Provides
|  1681 dagger.multibindings.ClassKey
|  1682 dagger.multibindings.ElementsIntoSet
|  1683 dagger.multibindings.IntKey
|  1684 dagger.multibindings.IntoMap
|  1685 dagger.multibindings.IntoSet
|  1686 dagger.multibindings.LongKey
|  1687 dagger.multibindings.Multibinds
|  1688 dagger.multibindings.StringKey
|  1689 dagger.producers.Produced
|  1690 dagger.producers.Producer
|  1691 dagger.producers.ProducerModule
|  1692 dagger.producers.Producers
|  1693 dagger.producers.Produces
|  1694 dagger.producers.Production
|  1695 dagger.producers.ProductionComponent
|  1696 dagger.producers.ProductionScope
|  1697 dagger.producers.ProductionSubcomponent
|  1698 dagger.producers.monitoring.ProducerMonitor
|  1699 dagger.producers.monitoring.ProducerToken
|  1700 dagger.producers.monitoring.ProductionComponentMonitor
|  1701 java.io.IOException
|  1702 java.io.OutputStream
|  1703 java.lang.reflect.AnnotatedElement
|  1704 java.lang.reflect.Executable
|  1705 java.lang.reflect.Field
|  1706 java.lang.reflect.GenericDeclaration
|  1707 java.lang.reflect.Method
|  1708 java.lang.reflect.Modifier
|  1709 java.lang.reflect.Type
|  1710 java.net.ServerSocket
|  1711 java.net.Socket
|  1712 java.nio.file.Files
|  1713 java.nio.file.Path
|  1714 java.time.Instant
|  1715 java.util.ArrayList
|  1716 java.util.Arrays
|  1717 java.util.Collection
|  1718 java.util.HashMap
|  1719 java.util.HashSet
|  1720 java.util.Iterator
|  1721 java.util.LinkedList
|  1722 java.util.List
|  1723 java.util.Map
|  1724 java.util.NavigableMap
|  1725 java.util.Optional
|  1726 java.util.OrderedMap
|  1727 java.util.Random
|  1728 java.util.Set
|  1729 java.util.TreeMap
|  1730 java.util.TreeSet
|  1731 java.util.concurrent.CancellationException
|  1732 java.util.concurrent.ConcurrentHashMap
|  1733 java.util.concurrent.CopyOnWriteArrayList
|  1734 java.util.concurrent.ExecutionException
|  1735 java.util.concurrent.Executor
|  1736 java.util.concurrent.ExecutorService
|  1737 java.util.concurrent.Executors
|  1738 java.util.concurrent.Future
|  1739 java.util.concurrent.ThreadPoolExecutor
|  1740 java.util.concurrent.TimeUnit
|  1741 java.util.concurrent.atomic.AtomicBoolean
|  1742 java.util.concurrent.atomic.AtomicInteger
|  1743 java.util.concurrent.atomic.AtomicLong
|  1744 java.util.concurrent.atomic.AtomicMarkableReference
|  1745 java.util.concurrent.atomic.AtomicReference
|  1746 java.util.concurrent.atomic.LongAdder
|  1747 java.util.function.Consumer
|  1748 java.util.function.Function
|  1749 java.util.function.Predicate
|  1750 java.util.function.Supplier
|  1751 java.util.stream.Collector
|  1752 java.util.stream.Collectors
|  1753 java.util.stream.Stream
|  1754 javax.annotation.processing.AbstractProcessor
|  1755 javax.annotation.processing.Completion
|  1756 javax.annotation.processing.Completions
|  1757 javax.annotation.processing.Filer
|  1758 javax.annotation.processing.FilerException
|  1759 javax.annotation.processing.Generated
|  1760 javax.annotation.processing.Messager
|  1761 javax.annotation.processing.ProcessingEnvironment
|  1762 javax.annotation.processing.Processor
|  1763 javax.annotation.processing.RoundEnvironment
|  1764 javax.annotation.processing.SupportedAnnotationTypes
|  1765 javax.annotation.processing.SupportedOptions
|  1766 javax.annotation.processing.SupportedSourceVersion
|  1767 javax.inject.Inject
|  1768 javax.inject.Named
|  1769 javax.inject.Provider
|  1770 javax.inject.Qualifier
|  1771 javax.inject.Singleton
|  1772 javax.lang.model.element.Element
|  1773 javax.lang.model.element.ElementVisitor
|  1774 javax.lang.model.element.ExecutableElement
|  1775 javax.lang.model.element.Modifier
|  1776 javax.lang.model.element.TypeElement
|  1777 javax.lang.model.type.TypeMirror
|  1778 org.apache.commons.lang3.builder.ReflectionToStringBuilder
|  1779 org.apache.commons.lang3.builder.ToStringStyle
|  1780 org.jline.builtins.Completers.TreeCompleter
|  1781 org.jline.builtins.Completers.TreeCompleter.node
|  1782 org.jline.reader.LineReader
|  1783 org.jline.reader.LineReaderBuilder
|  1784 org.jline.terminal.Attributes
|  1785 org.jline.terminal.Cursor
|  1786 org.jline.terminal.KeyEvent
|  1787 org.jline.terminal.KeyParser
|  1788 org.jline.terminal.MouseEvent
|  1789 org.jline.terminal.Size
|  1790 org.jline.terminal.Terminal
|  1791 org.jline.terminal.TerminalBuilder
|  1792 org.jline.utils.AttributedCharSequence
|  1793 org.jline.utils.AttributedString
|  1794 org.jline.utils.AttributedStringBuilder
|  1795 org.jline.utils.AttributedStyle
|  1796 org.jline.utils.ColorPalette
|  1797 org.jline.utils.Colors
|  1798 org.jline.utils.InfoCmp.Capability
|  1799 org.jline.utils.NonBlockingReader
|  1800 org.objectweb.asm.ClassReader
|  1801 org.objectweb.asm.ClassVisitor
|  1802 org.objectweb.asm.ClassWriter
|  1803 org.objectweb.asm.FieldVisitor
|  1804 org.objectweb.asm.MethodVisitor
|  1805 org.objectweb.asm.Opcodes
|  1806 org.objectweb.asm.TypePath
|  1807 org.openjdk.jmh.annotations.AuxCounters
|  1808 org.openjdk.jmh.annotations.Benchmark
|  1809 org.openjdk.jmh.annotations.BenchmarkMode
|  1810 org.openjdk.jmh.annotations.CompilerControl
|  1811 org.openjdk.jmh.annotations.Fork
|  1812 org.openjdk.jmh.annotations.Group
|  1813 org.openjdk.jmh.annotations.GroupThreads
|  1814 org.openjdk.jmh.annotations.Level
|  1815 org.openjdk.jmh.annotations.Measurement
|  1816 org.openjdk.jmh.annotations.Mode
|  1817 org.openjdk.jmh.annotations.OperationsPerInvocation
|  1818 org.openjdk.jmh.annotations.OutputTimeUnit
|  1819 org.openjdk.jmh.annotations.Param
|  1820 org.openjdk.jmh.annotations.Scope
|  1821 org.openjdk.jmh.annotations.Setup
|  1822 org.openjdk.jmh.annotations.State
|  1823 org.openjdk.jmh.annotations.TearDown
|  1824 org.openjdk.jmh.annotations.Threads
|  1825 org.openjdk.jmh.annotations.Timeout
|  1826 org.openjdk.jmh.annotations.Warmup
|  1827 org.openjdk.jmh.infra.BenchmarkParams
|  1828 org.openjdk.jmh.infra.Blackhole
|  1829 org.openjdk.jmh.infra.Control
|  1830 org.openjdk.jmh.infra.IterationParams
|  1831 org.openjdk.jmh.infra.ThreadParams
|  1832 org.openjdk.jmh.results.RunResult
|  1833 org.openjdk.jmh.results.format.ResultFormatType
|  1834 org.openjdk.jmh.runner.Runner
|  1835 org.openjdk.jmh.runner.RunnerException
|  1836 org.openjdk.jmh.runner.options.CommandLineOptionException
|  1837 org.openjdk.jmh.runner.options.CommandLineOptions
|  1838 org.openjdk.jmh.runner.options.Options
|  1839 org.openjdk.jmh.runner.options.OptionsBuilder
|  1840 static com.google.common.base.Preconditions.checkArgument
|  1841 static com.google.common.base.Preconditions.checkNotNull
|  1842 static com.google.common.collect.ImmutableList.toImmutableList
|  1843 static com.google.common.collect.ImmutableSet.toImmutableSet
|  1844 static com.google.common.truth.Truth.assertThat
|  1845 static com.google.common.truth.Truth.assertWithMessage
|  1846 static com.google.common.util.concurrent.Futures.immediateFuture
|  1847 static com.google.common.util.concurrent.Futures.immediateVoidFuture
|  1848 static com.google.common.util.concurrent.MoreExecutors.directExecutor
|  1849 static java.util.concurrent.TimeUnit.DAYS
|  1850 static java.util.concurrent.TimeUnit.HOURS
|  1851 static java.util.concurrent.TimeUnit.MICROSECONDS
|  1852 static java.util.concurrent.TimeUnit.MILLISECONDS
|  1853 static java.util.concurrent.TimeUnit.MINUTES
|  1854 static java.util.concurrent.TimeUnit.NANOSECONDS
|  1855 static java.util.concurrent.TimeUnit.SECONDS
|  1856 static java.util.stream.Collectors.averagingDouble
|  1857 static java.util.stream.Collectors.averagingInt
|  1858 static java.util.stream.Collectors.averagingLong
|  1859 static java.util.stream.Collectors.collectingAndThen
|  1860 static java.util.stream.Collectors.counting
|  1861 static java.util.stream.Collectors.filtering
|  1862 static java.util.stream.Collectors.flatMapping
|  1863 static java.util.stream.Collectors.groupingBy
|  1864 static java.util.stream.Collectors.joining
|  1865 static java.util.stream.Collectors.mapping
|  1866 static java.util.stream.Collectors.maxBy
|  1867 static java.util.stream.Collectors.minBy
|  1868 static java.util.stream.Collectors.partitioningBy
|  1869 static java.util.stream.Collectors.reducing
|  1870 static java.util.stream.Collectors.summarizingDouble
|  1871 static java.util.stream.Collectors.summarizingInt
|  1872 static java.util.stream.Collectors.summarizingLong
|  1873 static java.util.stream.Collectors.summingDouble
|  1874 static java.util.stream.Collectors.summingInt
|  1875 static java.util.stream.Collectors.summingLong
|  1876 static java.util.stream.Collectors.toCollection
|  1877 static java.util.stream.Collectors.toConcurrentMap
|  1878 static java.util.stream.Collectors.toList
|  1879 static java.util.stream.Collectors.toMap
|  1880 static java.util.stream.Collectors.toSet
|  1881 static java.util.stream.Collectors.toUnmodifiableList
|  1882 static java.util.stream.Collectors.toUnmodifiableMap
|  1883 static java.util.stream.Collectors.toUnmodifiableSet
|  1884 static org.mockito.AdditionalMatchers.and
|  1885 static org.mockito.ArgumentMatchers.any
|  1886 static org.mockito.ArgumentMatchers.assertArg
|  1887 static org.mockito.Mockito.mock
|  1888 static org.mockito.Mockito.times
|  1889 static org.mockito.Mockito.verify
|  1890 JAVA_IMPORT_LIST_END
|  1891 
|  1892 let g:jm_vimrc.kotlin_import_list =<< KOTLIN_IMPORT_LIST_END
|  1893 kotlin.annotation.AnnotationRetention.BINARY
|  1894 kotlin.annotation.Retention
|  1895 kotlin.concurrent.Volatile
|  1896 kotlin.concurrent.thread
|  1897 kotlin.concurrent.withLock
|  1898 kotlin.coroutines.AbstractCoroutineContextElement
|  1899 kotlin.coroutines.AbstractCoroutineContextKey
|  1900 kotlin.coroutines.Continuation
|  1901 kotlin.coroutines.ContinuationInterceptor
|  1902 kotlin.coroutines.CoroutineContext
|  1903 kotlin.coroutines.EmptyCoroutineContext
|  1904 kotlin.coroutines.RestrictsSuspension
|  1905 kotlin.coroutines.coroutineContext
|  1906 kotlin.coroutines.createCoroutine
|  1907 kotlin.coroutines.getPolymorphicElement
|  1908 kotlin.coroutines.minusPolymorphicKey
|  1909 kotlin.coroutines.resume
|  1910 kotlin.coroutines.resumeWithException
|  1911 kotlin.coroutines.startCoroutine
|  1912 kotlin.coroutines.suspendCoroutine
|  1913 kotlin.reflect.KClass
|  1914 kotlin.reflect.KFunction
|  1915 kotlin.reflect.KProperty
|  1916 kotlin.reflect.full.memberProperties
|  1917 kotlin.system.measureNanoTime
|  1918 kotlin.system.measureTimeMillis
|  1919 kotlin.test.AfterTest
|  1920 kotlin.test.BeforeTest
|  1921 kotlin.test.Test
|  1922 kotlin.test.assertContains
|  1923 kotlin.test.assertEquals
|  1924 kotlin.test.assertFails
|  1925 kotlin.test.assertFailsWith
|  1926 kotlin.test.assertFalse
|  1927 kotlin.test.assertNotEquals
|  1928 kotlin.test.assertNotNull
|  1929 kotlin.test.assertNull
|  1930 kotlin.test.assertSame
|  1931 kotlin.test.assertTrue
|  1932 kotlin.test.fail
|  1933 kotlin.time.Clock
|  1934 kotlin.time.Duration
|  1935 kotlin.time.Duration.Companion.INFINITE
|  1936 kotlin.time.Duration.Companion.ZERO
|  1937 kotlin.time.Duration.Companion.days
|  1938 kotlin.time.Duration.Companion.hours
|  1939 kotlin.time.Duration.Companion.microseconds
|  1940 kotlin.time.Duration.Companion.milliseconds
|  1941 kotlin.time.Duration.Companion.minutes
|  1942 kotlin.time.Duration.Companion.nanoseconds
|  1943 kotlin.time.Duration.Companion.seconds
|  1944 kotlin.time.DurationUnit
|  1945 kotlin.time.DurationUnit.DAYS
|  1946 kotlin.time.DurationUnit.HOURS
|  1947 kotlin.time.DurationUnit.MICROSECONDS
|  1948 kotlin.time.DurationUnit.MILLISECONDS
|  1949 kotlin.time.DurationUnit.MINUTES
|  1950 kotlin.time.DurationUnit.NANOSECONDS
|  1951 kotlin.time.DurationUnit.SECONDS
|  1952 kotlin.time.Instant
|  1953 kotlin.time.TimeMark
|  1954 kotlin.time.TimeSource
|  1955 kotlin.time.TimedValue
|  1956 kotlin.time.measureTime
|  1957 kotlin.time.measureTimedValue
|  1958 kotlin.time.toDuration
|  1959 kotlin.time.toDurationUnit
|  1960 kotlin.time.toJSDate
|  1961 kotlin.time.toJavaDuration
|  1962 kotlin.time.toKotlinDuration
|  1963 kotlin.time.toKotlinInstant
|  1964 kotlin.time.toTimeUnit
|  1965 kotlinx.coroutines.CompletableDeferred
|  1966 kotlinx.coroutines.CompletableJob
|  1967 kotlinx.coroutines.CoroutineDispatcher
|  1968 kotlinx.coroutines.CoroutineExceptionHandler
|  1969 kotlinx.coroutines.CoroutineName
|  1970 kotlinx.coroutines.CoroutineScope
|  1971 kotlinx.coroutines.CoroutineStart
|  1972 kotlinx.coroutines.CoroutineStart.ATOMIC
|  1973 kotlinx.coroutines.CoroutineStart.DEFAULT
|  1974 kotlinx.coroutines.CoroutineStart.LAZY
|  1975 kotlinx.coroutines.CoroutineStart.UNDISPATCHED
|  1976 kotlinx.coroutines.Deferred
|  1977 kotlinx.coroutines.DelicateCoroutinesApi
|  1978 kotlinx.coroutines.Dispatchers
|  1979 kotlinx.coroutines.Dispatchers.IO
|  1980 kotlinx.coroutines.Dispatchers.Main
|  1981 kotlinx.coroutines.Dispatchers.Unconfined
|  1982 kotlinx.coroutines.ExecutorCoroutineDispatcher
|  1983 kotlinx.coroutines.ExperimentalCoroutinesApi
|  1984 kotlinx.coroutines.GlobalScope
|  1985 kotlinx.coroutines.Job
|  1986 kotlinx.coroutines.NonCancellable
|  1987 kotlinx.coroutines.SupervisorJob
|  1988 kotlinx.coroutines.asCoroutineDispatcher
|  1989 kotlinx.coroutines.asExecutor
|  1990 kotlinx.coroutines.async
|  1991 kotlinx.coroutines.awaitAll
|  1992 kotlinx.coroutines.cancelAndJoin
|  1993 kotlinx.coroutines.channels.Channel
|  1994 kotlinx.coroutines.channels.ReceiveChannel
|  1995 kotlinx.coroutines.channels.SendChannel
|  1996 kotlinx.coroutines.channels.produce
|  1997 kotlinx.coroutines.coroutineScope
|  1998 kotlinx.coroutines.delay
|  1999 kotlinx.coroutines.ensureActive
|  2000 kotlinx.coroutines.flow.Flow
|  2001 kotlinx.coroutines.flow.MutableSharedFlow
|  2002 kotlinx.coroutines.flow.MutableStateFlow
|  2003 kotlinx.coroutines.flow.SharedFlow
|  2004 kotlinx.coroutines.flow.SharingStarted
|  2005 kotlinx.coroutines.flow.SharingStarted.Eagerly
|  2006 kotlinx.coroutines.flow.SharingStarted.Lazily
|  2007 kotlinx.coroutines.flow.SharingStarted.WhileSubscribed
|  2008 kotlinx.coroutines.flow.StateFlow
|  2009 kotlinx.coroutines.flow.asFlow
|  2010 kotlinx.coroutines.flow.asSharedFlow
|  2011 kotlinx.coroutines.flow.asStateFlow
|  2012 kotlinx.coroutines.flow.channelFlow
|  2013 kotlinx.coroutines.flow.emptyFlow
|  2014 kotlinx.coroutines.flow.flow
|  2015 kotlinx.coroutines.flow.flowOf
|  2016 kotlinx.coroutines.flow.flowOn
|  2017 kotlinx.coroutines.flow.map
|  2018 kotlinx.coroutines.flow.runningReduce
|  2019 kotlinx.coroutines.flow.shareIn
|  2020 kotlinx.coroutines.flow.stateIn
|  2021 kotlinx.coroutines.guava.asDeferred
|  2022 kotlinx.coroutines.guava.asListenableFuture
|  2023 kotlinx.coroutines.guava.await
|  2024 kotlinx.coroutines.guava.future
|  2025 kotlinx.coroutines.isActive
|  2026 kotlinx.coroutines.job
|  2027 kotlinx.coroutines.launch
|  2028 kotlinx.coroutines.limitedParallelism
|  2029 kotlinx.coroutines.runBlocking
|  2030 kotlinx.coroutines.supervisorScope
|  2031 kotlinx.coroutines.sync.Mutex
|  2032 kotlinx.coroutines.sync.Semaphore
|  2033 kotlinx.coroutines.sync.withLock
|  2034 kotlinx.coroutines.sync.withPermit
|  2035 kotlinx.coroutines.test.StandardTestDispatcher
|  2036 kotlinx.coroutines.test.TestCoroutineScheduler
|  2037 kotlinx.coroutines.test.TestScope
|  2038 kotlinx.coroutines.test.advanceTimeBy
|  2039 kotlinx.coroutines.test.advanceUntilIdle
|  2040 kotlinx.coroutines.test.currentTime
|  2041 kotlinx.coroutines.test.runCurrent
|  2042 kotlinx.coroutines.test.runTest
|  2043 kotlinx.coroutines.withContext
|  2044 kotlinx.coroutines.withTimeout
|  2045 kotlinx.coroutines.withTimeoutOrNull
|  2046 kotlinx.coroutines.yield
|  2047 KOTLIN_IMPORT_LIST_END
|  2048 
|  2049 ""
|  2050 " Sets up the AddJavaImport and AddKotlinImport commands.
|  2051 "
|  2052 " These need to be defined in a separate file since they reload the vimrc.
|  2053 " Otherwise, an error is thrown due to redefinition of an executing function.
|  2054 "
|  2055 call bss#imp#SetupCommands({
|  2056       \   'AddJavaImport': 'JAVA_IMPORT_LIST_END',
|  2057       \   'AddKotlinImport': 'KOTLIN_IMPORT_LIST_END',
|  2058       \ })
|  2059 
|  2060 let g:jm_vimrc.java_import_cache =
|  2061       \ bss#imp#BuildJvmImportCache(g:jm_vimrc.java_import_list)
|  2062 
|  2063 let g:jm_vimrc.kotlin_import_cache =
|  2064       \ bss#imp#BuildJvmImportCache(g:jm_vimrc.kotlin_import_list)
|  2065 " }}} Java Kotlin Import Cache
   2066 
+  -  2067 +--193 lines: C++ Import Cache:
2067 " C++ Import Cache: {{{
|  2068 let g:jm_vimrc.cc_import_cache = bss#imp#BuildCppImportCache({
|  2069       \   '"absl/flags/flag.h"': ['ABSL_FLAG', 'GetFlag'],
|  2070       \   '"absl/flags/declare.h"': ['ABSL_DECLARE_FLAG'],
|  2071       \   '"absl/flags/parse.h"': ['ParseCommandLine'],
|  2072       \   '"absl/flags/usage.h"': ['ProgramUsageMessage', 'SetProgramUsageMessage'],
|  2073       \   '"absl/strings/str_join.h"': ['StrJoin'],
|  2074       \   '"absl/strings/str_cat.h"': ['StrCat'],
|  2075       \   '"absl/strings/str_replace.h"': ['StrReplaceAll'],
|  2076       \   '"absl/strings/str_split.h"': ['StrSplit'],
|  2077       \   '"absl/status/status.h"': ['Status'],
|  2078       \   '"absl/status/statusor.h"': ['StatusOr'],
|  2079       \   '<opencv2/core.hpp>': [
|  2080       \     'Mat',
|  2081       \     'Mat_',
|  2082       \     'Mat1b', 'Mat2b', 'Mat3b', 'Mat4b',
|  2083       \     'Mat1i', 'Mat2i', 'Mat3i', 'Mat4i',
|  2084       \     'Mat1f', 'Mat2f', 'Mat3f', 'Mat4f',
|  2085       \     'Mat1d', 'Mat2d', 'Mat3d', 'Mat4d',
|  2086       \     'Matx',
|  2087       \     'Matx22f', 'Matx33f', 'Matx44f',
|  2088       \     'Matx21f', 'Matx31f', 'Matx41f',
|  2089       \     'Matx22d', 'Matx33d', 'Matx44d',
|  2090       \     'Matx21d', 'Matx31d', 'Matx41d',
|  2091       \     'Vec',
|  2092       \     'Vec1b', 'Vec2b', 'Vec3b', 'Vec4b', 'Vec6b',
|  2093       \     'Vec1i', 'Vec2i', 'Vec3i', 'Vec4i', 'Vec6i',
|  2094       \     'Vec1f', 'Vec2f', 'Vec3f', 'Vec4f', 'Vec6f',
|  2095       \     'Vec1d', 'Vec2d', 'Vec3d', 'Vec4d', 'Vec6d',
|  2096       \     'Scalar_', 'Scalar',
|  2097       \     'Point_', 'Point2i', 'Point2l', 'Point2f', 'Point2d',
|  2098       \     'Point3_', 'Point3i', 'Point3l', 'Point3f', 'Point3d',
|  2099       \     'abs',
|  2100       \     'exp', 'log',
|  2101       \     'pow', 'sqrt',
|  2102       \   ],
|  2103       \   '<opencv2/imgcodecs.hpp>': ['imread', 'imwrite'],
|  2104       \   '<opencv2/imgproc.hpp>': ['circle'],
|  2105       \   '<utility>': [
|  2106       \     'forward', 'declval',
|  2107       \     'move', 'swap', 'exchange',
|  2108       \     'integer_sequence', 'make_integer_sequence',
|  2109       \     'index_sequence', 'make_index_sequence',
|  2110       \     'pair', 'make_pair',
|  2111       \   ],
|  2112       \   '<memory>': ['unique_ptr', 'make_unique'],
|  2113       \   '<vector>': ['vector'],
|  2114       \   '<tuple>': [
|  2115       \     'tuple',
|  2116       \     'tuple_size',
|  2117       \     'tuple_element',
|  2118       \     'get',
|  2119       \   ],
|  2120       \   '<type_traits>': [
|  2121       \     'enable_if', 'conditional',
|  2122       \     'enable_if_t', 'conditional_t',
|  2123       \     'integral_constant', 'bool_constant',
|  2124       \     'true_type', 'false_type',
|  2125       \     'conjunction', 'disjunction', 'negation',
|  2126       \     'conjunction_v', 'disjunction_v', 'negation_v',
|  2127       \     'is_same', 'is_base_of', 'is_convertible',
|  2128       \     'is_same_v', 'is_base_of_v', 'is_convertible_v',
|  2129       \   ],
|  2130       \   '<array>': ['array'],
|  2131       \   '<valarray>': ['valarray'],
|  2132       \   '<cstddef>': [
|  2133       \     'size_t', 'ptrdiff_t', 'nullptr_t',
|  2134       \   ],
|  2135       \   '<future>': [
|  2136       \     'future', 'promise', 'async', 'launch',
|  2137       \   ],
|  2138       \   '<thread>': [
|  2139       \     'thread', 'this_thread', 'yield', 'get_id', 'sleep_for',
|  2140       \   ],
|  2141       \   '<cstdint>': [
|  2142       \     'int8_t', 'int16_t', 'int32_t', 'int64_t',
|  2143       \     'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
|  2144       \   ],
|  2145       \   '<cmath>': [
|  2146       \     'abs',
|  2147       \     'exp', 'log', 'log2', 'log10',
|  2148       \     'pow', 'sqrt', 'hypot',
|  2149       \     'sin', 'cos', 'tan',
|  2150       \     'asin', 'acos', 'atan',
|  2151       \     'sinh', 'cosh', 'tanh',
|  2152       \     'asinh', 'acosh', 'atanh',
|  2153       \     'ceil', 'floor', 'trunc', 'round',
|  2154       \   ],
|  2155       \   '<string>': [
|  2156       \     'string',
|  2157       \     'to_string',
|  2158       \     'stoi', 'stol', 'stoul', 'stoll', 'stoull',
|  2159       \     'stof', 'stod', 'stold',
|  2160       \   ],
|  2161       \   '<map>': ['map'],
|  2162       \   '<unordered_map>': ['unordered_map'],
|  2163       \   '<set>': ['set'],
|  2164       \   '<iostream>': [
|  2165       \     'cout', 'cin', 'cerr',
|  2166       \     'endl',
|  2167       \   ],
|  2168       \   '<ios>': [
|  2169       \     'internal', 'left', 'right',
|  2170       \     'boolalpha', 'showbase', 'showpos',
|  2171       \     'dec', 'hex', 'oct',
|  2172       \     'fixed', 'scientific', 'default',
|  2173       \   ],
|  2174       \   '<format>': ['format'],
|  2175       \   '<iomanip>': [
|  2176       \     'setw',
|  2177       \     'quoted',
|  2178       \   ],
|  2179       \   '<unordered_set>': ['unordered_set'],
|  2180       \   '<optional>': ['optional'],
|  2181       \   '<complex>': ['complex'],
|  2182       \   '<initializer_list>': ['initializer_list'],
|  2183       \   '<numeric>': [
|  2184       \     'iota',
|  2185       \     'accumulate',
|  2186       \     'reduce',
|  2187       \     'inner_product',
|  2188       \     'adjacent_difference',
|  2189       \     'partial_sum',
|  2190       \   ],
|  2191       \   '<cstdlib>': [
|  2192       \     'system',
|  2193       \     'exit',
|  2194       \     'getenv',
|  2195       \     'malloc',
|  2196       \     'free',
|  2197       \     'aligned_malloc',
|  2198       \   ],
|  2199       \   '<random>': [
|  2200       \     'random_device',
|  2201       \     'mt19937',
|  2202       \     'mt19937_64',
|  2203       \     'uniform_real_distribution',
|  2204       \     'uniform_int_distribution',
|  2205       \     'normal_distribution',
|  2206       \   ],
|  2207       \   '<functional>': [
|  2208       \     'function',
|  2209       \     'plus', 'minus', 'multiplies', 'divides',
|  2210       \     'equal_to', 'not_equal_to',
|  2211       \     'greater', 'less', 'greater_equal', 'less_equal',
|  2212       \     'logical_and', 'logical_or', 'logical_not',
|  2213       \     'bit_end', 'bit_or', 'bit_xor', 'bit_not',
|  2214       \   ],
|  2215       \   '<algorithm>': [
|  2216       \
|  2217       \     'all_of', 'any_of', 'none_of',
|  2218       \     'for_each', 'for_each_n',
|  2219       \     'count', 'count_if',
|  2220       \     'mismatch',
|  2221       \     'find', 'find_if', 'find_if_not',
|  2222       \     'find_end', 'find_first_of', 'adjacent_find',
|  2223       \     'search', 'search_n',
|  2224       \
|  2225       \     'copy', 'copy_backward', 'move', 'move_backward', 'copy_n',
|  2226       \     'fill', 'fill_n', 'transform', 'generate', 'generate_n',
|  2227       \     'remove', 'remove_if', 'remove_copy', 'remove_copy_if',
|  2228       \     'replace', 'replace_if', 'replace_copy', 'replace_copy_if',
|  2229       \     'swap', 'swap_ranges', 'swap_iter',
|  2230       \     'reverse', 'reverse_copy', 'rotate',
|  2231       \     'rotate_copy',
|  2232       \     'shuffle',
|  2233       \     'max', 'min', 'max_element', 'min_element', 'minmax',
|  2234       \   ],
|  2235       \   '"absl/algorithm/container.h"': [
|  2236       \
|  2237       \     'c_all_of', 'c_any_of', 'c_none_of',
|  2238       \     'c_for_each', 'c_for_each_n',
|  2239       \     'c_count', 'c_count_if',
|  2240       \     'c_mismatch',
|  2241       \     'c_find', 'c_find_if', 'c_find_if_not',
|  2242       \     'c_find_end', 'c_find_first_of', 'c_adjacent_find',
|  2243       \     'c_search', 'c_search_n',
|  2244       \
|  2245       \     'c_copy', 'c_copy_backward', 'c_move', 'c_move_backward', 'c_copy_n',
|  2246       \     'c_fill', 'c_fill_n', 'c_transform', 'c_generate', 'c_generate_n',
|  2247       \     'c_remove', 'c_remove_if', 'c_remove_copy', 'c_remove_copy_if',
|  2248       \     'c_replace', 'c_replace_if', 'c_replace_copy', 'c_replace_copy_if',
|  2249       \     'c_swap', 'c_swap_ranges', 'c_swap_iter',
|  2250       \     'c_reverse', 'c_reverse_copy', 'c_rotate',
|  2251       \     'c_rotate_copy',
|  2252       \     'c_shuffle',
|  2253       \   ],
|  2254       \   '<iterator>': [
|  2255       \     'istream_iterator',
|  2256       \     'ostream_iterator',
|  2257       \   ],
|  2258       \ })
|  2259 " }}} C++ Import Cache