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