~gpanders/dotfiles

91685fa83910ffd3d6d65667d4bc322b309cd7ff — Greg Anders a month ago 616635c
[vim] Remove infrequently used plugins to improve startup time
10 files changed, 0 insertions(+), 222 deletions(-)

M .vim/after/ftplugin/python.vim
D .vim/after/plugin/abolish.vim
D .vim/after/plugin/characterize.vim
D .vim/after/plugin/endwise.vim
D .vim/after/plugin/mundo.vim
D .vim/after/plugin/projectionist.vim
D .vim/after/plugin/projectionist/cargo.vim
D .vim/after/plugin/projectionist/cmake.vim
D .vim/after/plugin/projectionist/compile_commands.vim
M .vim/plugin/minpac.vim
M .vim/after/ftplugin/python.vim => .vim/after/ftplugin/python.vim +0 -10
@@ 40,13 40,3 @@ endif
if !empty(&l:formatprg)
    let b:undo_ftplugin .= '|setl fp<'
endif

if executable('isort')
    function! s:isort(line1, line2)
        let view = winsaveview()
        exe a:line1 . ',' . a:line2 . '!isort -y -'
        call winrestview(view)
    endfunction
    command! -buffer -nargs=0 -range=% -bar Isort call <SID>isort(<line1>, <line2>)
    let b:undo_ftplugin .= '|delc Isort'
endif

D .vim/after/plugin/abolish.vim => .vim/after/plugin/abolish.vim +0 -6
@@ 1,6 0,0 @@
if !get(g:, 'loaded_abolish')
  finish
endif

Abolish aglo algo
Abolish emualtor emulator

D .vim/after/plugin/characterize.vim => .vim/after/plugin/characterize.vim +0 -5
@@ 1,5 0,0 @@
if !get(g:, 'loaded_characterize')
    finish
endif

nmap gA <Plug>(characterize)

D .vim/after/plugin/endwise.vim => .vim/after/plugin/endwise.vim +0 -6
@@ 1,6 0,0 @@
if !get(g:, 'loaded_endwise')
    finish
endif

" Use <CR> to make a selection in popup menu
inoremap <silent> <expr> <CR> pumvisible() ? "\<C-Y>" : "\<C-]><C-G>u\<CR>\<C-R>=EndwiseDiscretionary()\<CR>"

D .vim/after/plugin/mundo.vim => .vim/after/plugin/mundo.vim +0 -5
@@ 1,5 0,0 @@
if !get(g:, 'loaded_mundo')
    finish
endif

nnoremap <Bslash>U :<C-U>MundoToggle<CR>

D .vim/after/plugin/projectionist.vim => .vim/after/plugin/projectionist.vim +0 -39
@@ 1,39 0,0 @@
if !get(g:, 'loaded_projectionist', 0)
  finish
endif

if !exists('g:projectionist_transformations')
  let g:projectionist_transformations = {}
endif

function! g:projectionist_transformations.date(input, o) abort
  return strftime('%Y-%m-%d')
endfunction

function! s:activate()
  " Binary (on/off) settings
  for opt in ['expandtab', 'readonly', 'modifiable', 'spell']
    for [root, value] in projectionist#query(opt)
      execute 'setlocal' (!value ? 'no' : '') . opt
    endfor
  endfor

  " Single value settings
  for opt in ['filetype', 'textwidth', 'shiftwidth', 'softtabstop', 'tabstop']
    for [root, value] in projectionist#query(opt)
      execute 'setlocal' opt . '=' . value
    endfor
  endfor

  " List settings
  for opt in ['suffixes', 'wildignore', 'tags']
    for [root, value] in projectionist#query(opt)
      if type(value) ==# type([])
        let value = join(value, ',')
      endif
      execute 'setlocal' opt . '^=' . value
    endfor
  endfor
endfunction

autocmd User ProjectionistActivate call s:activate()

D .vim/after/plugin/projectionist/cargo.vim => .vim/after/plugin/projectionist/cargo.vim +0 -11
@@ 1,11 0,0 @@
if !get(g:, 'loaded_projectionist', 0)
  finish
endif

let g:projectionist_heuristics = get(g:, 'projectionist_heuristics', {})

call extend(g:projectionist_heuristics, {
      \ 'Cargo.toml&src/': {
      \   'src/*.rs': {'type': 'src'},
      \   'Cargo.toml': {'type': 'toml' }
      \ }})

D .vim/after/plugin/projectionist/cmake.vim => .vim/after/plugin/projectionist/cmake.vim +0 -43
@@ 1,43 0,0 @@
if !get(g:, 'loaded_projectionist', 0)
  finish
endif

let g:projectionist_heuristics = get(g:, 'projectionist_heuristics', {})

call extend(g:projectionist_heuristics, {
      \ 'CMakeLists.txt&build/|CMakeLists.txt&src/': {
      \   '*': {
      \     'make': 'cmake -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .',
      \     'dispatch': '-dir=build make',
      \   },
      \   'CMakeLists.txt': { 'type': 'list' },
      \   'src/*.cc': {
      \     'type': 'src',
      \     'alternate': ['include/{}.h', 'src/{}.h', 'test/test_{}.cc'],
      \   },
      \   'src/*.cpp': {
      \     'type': 'src',
      \     'alternate': ['include/{}.h', 'src/{}.h', 'test/test_{}.cpp'],
      \   },
      \   'src/*.h': {
      \     'type': 'include',
      \     'alternate': ['src/{}.cc', 'src/{}.cpp', 'test/test_{}.cc', 'test/test_{}.cpp'],
      \     'template': [
      \       '#ifndef _{project|basename|snakecase|uppercase}_{snakecase|uppercase}_H_',
      \       '#define _{project|basename|snakecase|uppercase}_{snakecase|uppercase}_H_',
      \       '',
      \       '#endif  //_{project|basename|snakecase|uppercase}_{snakecase|uppercase}_H_',
      \     ],
      \   },
      \   'include/*.h': {
      \     'type': 'include',
      \     'alternate': ['src/{}.cc', 'src/{}.cpp', 'test/test_{}.cc', 'test/test_{}.cpp'],
      \     'template': [
      \       '#ifndef _{project|basename|snakecase|uppercase}_{uppercase}_H_',
      \       '#define _{project|basename|snakecase|uppercase}_{uppercase}_H_',
      \       '',
      \       '#endif  //_{project|basename|snakecase|uppercase}_{uppercase}_H_',
      \     ],
      \   },
      \   'README.md': { 'type': 'doc' },
      \ }})

D .vim/after/plugin/projectionist/compile_commands.vim => .vim/after/plugin/projectionist/compile_commands.vim +0 -88
@@ 1,88 0,0 @@
if !get(g:, 'loaded_projectionist', 0)
  finish
endif

let g:projectionist_heuristics = get(g:, 'projectionist_heuristics', {})

call extend(g:projectionist_heuristics, {
      \ 'compile_commands.json': {
      \   'src/*.cpp': {
      \     'type': 'src',
      \     'alternate': ['src/{}.h', 'include/{}.h'],
      \   },
      \   'src/*.cc': {
      \     'type': 'src',
      \     'alternate': ['src/{}.h', 'include/{}.h'],
      \   },
      \   'src/*.h': {
      \     'type': 'include',
      \     'alternate': ['src/{}.cpp', 'src/{}.cc'],
      \   },
      \   'include/*.h': {
      \     'type': 'include',
      \     'alternate': ['src/{}.cpp', 'src/{}.cc'],
      \   }
      \ }})

let s:paths = {}

let s:async = (has('nvim') || has('job')) && executable('jq')

function! s:parse_compile_commands(root)
  if s:async
    call async#run([
          \ 'jq',
          \ '-c',
          \ '[[.[].command?, .[].arguments[]?] | join(" ") | match("-(?:I|isystem )(\\S+)"; "g") | .captures[0].string] | unique',
          \ a:root . '/compile_commands.json'
          \ ], {paths -> s:set_path(a:root, eval(get(paths, 0, '[]')))})
  else
    let compile_commands = projectionist#json_parse(readfile(a:root . '/compile_commands.json'))
    let cmds = []
    for item in compile_commands
      if has_key(item, 'arguments')
        let cmd = join(item.arguments)
      elseif has_key(item, 'command')
        let cmd = item.command
      else
        continue
      endif
      let cmds += [cmd]
    endfor
    " Add every match of -I<dir> or -isystem <dir> to paths
    let paths = []
    call substitute(join(cmds),
          \ '\C\-\%(I\|isystem \)\(\f\+\)', '\=add(paths, submatch(1))', 'g')

    let paths = uniq(sort(paths))
    call s:set_path(a:root, paths)
  endif
endfunction

function! s:set_path(root, ...)
  if a:0
    let paths = a:1
    let s:paths[a:root] = filter(map(paths, "fnamemodify(v:val, ':p')"), 'isdirectory(v:val)')
  endif
  for dir in s:paths[a:root]
    if stridx(',' . &l:path . ',', ',' . escape(dir, ', ') . ',') < 0
      let &l:path = escape(dir, ', ') . ',' . &path
    endif
  endfor
endfunction

function! s:activate() abort
  let root = projectionist#path()
  if ProjectionistHas('compile_commands.json', root)
    if !has_key(s:paths, root)
      call s:parse_compile_commands(root)
    else
      call s:set_path(root)
    endif
  endif
endfunction

autocmd User ProjectionistActivate
      \ if &ft ==# 'c' || &ft ==# 'cpp' |
      \   call s:activate() |
      \ endif

M .vim/plugin/minpac.vim => .vim/plugin/minpac.vim +0 -9
@@ 41,9 41,6 @@ function! s:PackInit() abort
    " Asynchronous task runner
    call minpac#add('tpope/vim-dispatch')

    " Project management plugin
    call minpac#add('tpope/vim-projectionist')

    " Readline style bindings througout Vim
    call minpac#add('tpope/vim-rsi')



@@ 59,9 56,6 @@ function! s:PackInit() abort
    " Session management
    call minpac#add('tpope/vim-obsession')

    " Automatically close blocks
    call minpac#add('tpope/vim-endwise')

    " Better directory browser
    call minpac#add('justinmk/vim-dirvish')



@@ 83,9 77,6 @@ function! s:PackInit() abort
    " Automatically disable search highlighting
    call minpac#add('romainl/vim-cool')

    " Visualize undo tree
    call minpac#add('simnalamburt/vim-mundo')

    " Preview replacements when :substituting
    call minpac#add('markonm/traces.vim')