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