dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Compare Notes Search Review guide perf: defer safe plugins to improve startup time 6de78558d6984bdf105c28d223d9b09dc876d061
Oliver Jan Krylow <oliver@bugabinga.net > · 6 May 2026
unsigned
Browse files Compare with HEAD
Deferred plugins are user-interaction driven and don't need to load at startup:
- diff, fuzzy_find, bookmarks, jump2d, key_preview
- move, navigation, patterns, search_and_replace
- fun, splitjoin, winbar, notify
Plugins kept eager (required early or have autocmds):
- autotag, colorizer, devicons, file_explorer, format
- surround, textobjects, suppress_warnings, autopairs
Also fixes d2.lua to gracefully handle missing d2 binary:
- Lazy detection on first use instead of blocking startup
- Shows warning message when d2 not found
- Bail early in render/validate if binary missing
Changed files (2) 83 83 defer
'bugabinga.inlay' 84 84 defer
'bugabinga.d2' 103 91 require 'bugabinga.autotag' 104 92 require 'bugabinga.colorizer' 105 93 require 'bugabinga.devicons' 106 - require 'bugabinga.diff' 94 + defer
'bugabinga.diff' 107 95 require 'bugabinga.file_explorer' 108 96 require 'bugabinga.format' 109 - require 'bugabinga.fuzzy_find' 110 - require 'bugabinga.bookmarks' 111 - require 'bugabinga.jump2d' 112 - require 'bugabinga.key_preview' 113 - require 'bugabinga.move' 114 - require 'bugabinga.navigation' 115 - require 'bugabinga.patterns' 116 - require 'bugabinga.search_and_replace' 117 - require 'bugabinga.fun' 118 - require 'bugabinga.splitjoin' 97 + defer
'bugabinga.fuzzy_find' 98 + defer
'bugabinga.bookmarks' 99 + defer
'bugabinga.jump2d' 100 + defer
'bugabinga.key_preview' 101 + defer
'bugabinga.move' 102 + defer
'bugabinga.navigation' 103 + defer
'bugabinga.patterns' 104 + defer
'bugabinga.search_and_replace' 105 + defer
'bugabinga.fun' 106 + defer
'bugabinga.splitjoin' 119 107 require 'bugabinga.surround' 120 108 require 'bugabinga.textobjects' 121 - require 'bugabinga.winbar' 109 + defer
'bugabinga.winbar' 122 110 require 'bugabinga.suppress_warnings' 123 111 require 'bugabinga.autopairs' 124 - require 'bugabinga.notify' 112 + defer
'bugabinga.notify' 126 114 require 'bugabinga.incubator' neovim/lua/bugabinga/d2.lua Modified 9 9 local PREVIEW_AUGRP
= 'd2_preview_autosave' 10 10 local preview_winnr
= nil 12 - local d2_binary
= vim.system({
'd2' ,
'--version' }, {
text =
true }):wait().code
== 0 12 + local d2_binary
= nil 13 + local d2_checked
= false 15 + local function check_d2_binary ()
16 + if d2_checked
then return d2_binary
end 19 + for _, name
in ipairs ({
'd2' ,
'd2.exe' })
do 20 + local result
= vim.system({ name,
'--version' }, {
text =
true }):wait()
21 + if result.code
== 0 then 28 + '[bugabinga/d2] `d2` not found. Install from https://github.com/terrastruct/d2' ,
16 34 local preview_bufnr = function ()
17 35 return vim.fn.bufnr(PREVIEW_BUF_NAME)
31 49 local render = function (bufnr)
50 + if not check_d2_binary()
then return nil end 32 51 local input_file
= vim.fn.tempname()
.. '.d2' 33 52 local output_file
= vim.fn.tempname()
.. '.txt' 34 53 local lines
= vim.api.nvim_buf_get_lines(bufnr,
0 ,
- 1 ,
false )
147 166 local validate = function (args)
167 + if not check_d2_binary()
then return end 148 168 local bufnr
= (args
and args.bufnr)
or vim.api.nvim_get_current_buf()
149 169 local file
= vim.api.nvim_buf_get_name(bufnr)
150 - if not d2_binary
then 151 - vim.notify(
'd2 binary not found' , vim.log.levels.ERROR)
154 170 if file
== '' then