repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk

a78fd9add09bb4fb15e09b4b549b1cddaf0e704a

Oliver Krylow <o.krylow@isp-insoft.de> ·

unsigned

Browse filesCompare with HEAD

Changed files (118)

+3332 / −2911 text lines · all files grouped into 32 bars · 3 binary (striped old/new sizes in 64-byte units, not churn) · lines and sizes scale separately

Diff layout

env.nu

Deleted
deleted file mode 100644

+0 / −48 text lines

1# GLOBAL VARIABLES
2
3$env.WIN32 = ( $nu.os-info.name =~ "windows" )
4$env.NURC_DIR = ( $nu.config-path | path expand | path dirname )
5$env.DOTFILES = ( $env.NURC_DIR | path join ".." | path expand )
6$env.WORKSPACE = if $env.WIN32 { "W:/" } else { "~/Workspace" | path expand }
7$env.NOTES = if $env.WIN32 { "N:/" } else { "~/Notes" | path expand }
8
9if ($env | get -i TERM_PROGRAM) == WezTerm {
10 $env.TERM = "wezterm"
11 if not $env.WIN32 {
12 $env.TERMCAP = ~./termcap/w/wezterm
13 }
14}
16# theme for ls and other programs, that use LS_COLORS
17$env.LS_COLORS = (try { vivid generate alabaster_dark | into string } catch {""})
19# Specifies how environment variables are:
20# - converted from a string to a value on Nushell startup (from_string)
21# - converted from a value back to a string when running external commands (to_string)
22# Note: The conversions happen *after* config.nu is loaded
23$env.ENV_CONVERSIONS = {
24 "PATH": {
25 from_string: { |s| $s | split row (char esep) }
26 to_string: { |v| $v | str join (char esep) }
27 }
28 "Path": {
29 from_string: { |s| $s | split row (char esep) }
30 to_string: { |v| $v | str join (char esep) }
31 }
32}
34# Directories to search for scripts when calling source or use
35$env.NU_LIB_DIRS = [
36 ($nu.config-path | path dirname | path join 'modules'),
37 ($nu.config-path | path dirname | path join 'completions')
38]
40if $env.WIN32 {
41 # TODO: insert scoop cargo path here
42 # $env.CARGO_HOME = ( '~/.cargo' | path expand )
43 $env.Path = ( $env.Path | prepend '' )
44} else {
45 $env.CARGO_HOME = ( '~/.cargo' | path expand )
46 $env.PATH = ( $env.PATH | prepend ( $env.CARGO_HOME | path join 'bin') )
47 $env.PATH = ( $env.PATH | prepend ( '~/.local/bin'| path expand ) )
48}

lua/bugabinga/plugins/heirline.lua

Deleted
deleted file mode 100644

+0 / −680 text lines

1---@diagnostic disable: param-type-mismatch
2local icon = require 'std.icon'
3local auto = require 'std.auto'
4local ignored = require 'std.ignored'
5
6local NEW_FILE = '~untitled~'
7
8return {
9 {
10 'rebelot/heirline.nvim',
11 tag = 'v1.0.3',
12 event = 'BufEnter',
13 dependencies = {
14 'nvim-tree/nvim-web-devicons',
15 'lewis6991/gitsigns.nvim',
16 },
17 config = function ()
18 local heirline = require 'heirline'
19 local conditions = require 'heirline.conditions'
20 local utils = require 'heirline.utils'
22 local nugu = require 'bugabinga.nugu.palette'
23 heirline.load_colors( nugu )
25 auto 'reload_heirline_colors' {
26 description = 'Reload dark/light nugu colors for Heirline',
27 events = 'ColorScheme',
28 command = function () utils.on_colorscheme( nugu ) end,
29 }
31 local vi_mode = {
32 init = function ( self )
33 self.mode = vim.fn.mode( 1 ) -- :h mode()
34 end,
36 static = {
37 mode_names = {
38 n = icon.normal,
39 no = icon.normal .. '?',
40 nov = icon.normal .. '?',
41 noV = icon.normal .. '?',
42 ['no\22'] = icon.normal .. '?',
43 niI = icon.normal .. 'i',
44 niR = icon.normal .. 'r',
45 niV = icon.normal .. 'v',
46 nt = icon.normal .. 't',
47 v = icon.visual,
48 vs = icon.visual .. 's',
49 V = icon.visual .. '_',
50 Vs = icon.visual .. 's',
51 ['\22'] = '^' .. icon.visual,
52 ['\22s'] = '^' .. icon.visual,
53 s = icon.select,
54 S = icon.select .. '_',
55 ['\19'] = '^' .. icon.select,
56 i = icon.insert,
57 ic = icon.insert .. 'c',
58 ix = icon.insert .. 'x',
59 R = icon.replace,
60 Rc = icon.replace .. 'c',
61 Rx = icon.replace .. 'x',
62 Rv = icon.replace .. 'v',
63 Rvc = icon.replace .. 'v',
64 Rvx = icon.replace .. 'v',
65 c = icon.command,
66 cv = icon.command .. 'x',
67 r = icon.pending,
68 rm = icon.pending .. 'm',
69 ['r?'] = icon.pending .. '?',
70 ['!'] = icon.exclaim,
71 t = icon.terminal,
72 },
73 mode_colors = {
74 n = 'ui_normal',
75 i = 'ui_accent',
76 v = 'ui_important_global',
77 V = 'ui_important_global',
78 ['\22'] = 'ui_important_global',
79 c = 'ui_important_global',
80 s = 'ui_important_global',
81 S = 'ui_important_global',
82 ['\19'] = 'ui_important_global',
83 R = 'ui_important_global',
84 r = 'ui_important_global',
85 ['!'] = 'ui_important_global',
86 t = 'ui_important_global',
87 },
88 },
90 provider = function ( self )
91 local mode_name = self.mode_names[self.mode]
92 return ' ' .. icon.vim .. ' %3(' .. mode_name .. '%) '
93 end,
95 hl = function ( self )
96 local mode = self.mode:sub( 1, 1 ) -- get only the first mode character
97 return { fg = self.mode_colors[mode], bold = true, }
98 end,
100 update = {
101 'ModeChanged',
102 pattern = '*:*',
103 callback = vim.schedule_wrap( function () vim.cmd.redrawstatus() end ),
104 },
105 }
107 local file_icon = {
108 init = function ( self )
109 local filename = self.filename
110 local extension = vim.fn.fnamemodify( filename, ':e' )
111 self.icon = require 'nvim-web-devicons'.get_icon_color( filename, extension, { default = true, } )
112 end,
113 provider = function ( self )
114 return self.icon and (self.icon .. ' ')
115 end,
116 hl = 'DefaultIcon',
117 }
119 local file_name = {
120 init = function ( self )
121 self.lfilename = vim.fs.normalize( vim.fn.fnamemodify( self.filename, ':.' ) )
122 if self.lfilename == '' then self.lfilename = NEW_FILE end
123 end,
125 flexible = 2,
127 {
128 provider = function ( self )
129 return self.lfilename
130 end,
131 },
132 {
133 provider = function ( self )
134 return vim.fs.normalize( vim.fn.pathshorten( self.lfilename ) )
135 end,
136 },
137 }
139 local file_flags = {
140 {
141 condition = function ()
142 return vim.bo.modified
143 end,
144 provider = string.format( ' %s ', icon.modified ),
145 hl = 'Comment',
146 },
147 {
148 condition = function ()
149 return not vim.bo.modifiable or vim.bo.readonly
150 end,
151 provider = string.format( ' %s ', icon.lock ),
152 hl = 'ErrorMsg',
153 },
154 }
156 local file_name_block = {
157 init = function ( self )
158 self.filename = vim.fs.normalize( vim.api.nvim_buf_get_name( 0 ) )
159 end,
161 file_icon,
162 { provider = ' ', },
163 file_name,
164 file_flags,
165 { provider = '%<', }, -- this means that the statusline is cut here when there's not enough space
166 }
168 local file_type = {
169 provider = function ()
170 return icon.file .. ' ' .. string.upper( vim.bo.filetype )
171 end,
172 }
174 local file_encoding = {
175 provider = function ()
176 local enc = (vim.bo.fenc ~= '' and vim.bo.fenc) or vim.o.enc -- :h 'enc'
177 return enc ~= 'utf-8' and enc:upper()
178 end,
179 }
181 local file_format = {
182 static = {
183 dos = icon.newline .. icon.carriage_return,
184 unix = icon.newline,
185 mac = icon.carriage_return,
186 },
187 provider = function ( self )
188 local fileformat = vim.bo.fileformat
189 return self[fileformat]
190 end,
191 }
193 local file_size = {
194 provider = function ()
195 -- stackoverflow, compute human readable file size
196 -- i want to see vim opening a 1EiB file 󰱯
197 local suffix = { 'b', 'k', 'M', 'G', 'T', 'P', 'E', }
198 local fsize = vim.fn.getfsize( vim.api.nvim_buf_get_name( 0 ) )
199 fsize = (fsize < 0 and 0) or fsize
200 if fsize < 1024 then
201 return fsize .. suffix[1]
202 end
203 local i = math.floor( (math.log( fsize ) / math.log( 1024 )) )
204 return string.format( '%.2g%s', fsize / math.pow( 1024, i ), suffix[i + 1] )
205 end,
206 }
208 local file_last_modified = {
209 provider = function ()
210 local ftime = vim.fn.getftime( vim.api.nvim_buf_get_name( 0 ) )
211 if ftime > 0 then
212 local timeago = require 'std.timeago'
213 return timeago.format( ftime )
214 end
215 end,
216 }
218 local lsp_active = {
219 condition = conditions.lsp_attached,
220 -- FIXME: updates from parent components do not seem to update children,
221 -- if those have their own updates?
222 update = { 'LspAttach', 'LspDetach', 'BufEnter', 'BufLeave', },
224 provider = function ()
225 local names = {}
226 for _, client in pairs( vim.lsp.get_clients { bufnr = 0, } ) do
227 table.insert( names, client.name )
228 end
229 return icon.lsp .. ' ' .. table.concat( names, ' ' )
230 end,
231 }
233 local diagnostic_enabled = {
234 init = function ( self )
235 self.icon = vim.diagnostic.is_disabled() and icon.toggle_off or icon.toggle_on
236 end,
237 provider = function ( self )
238 return icon.diagnostic .. ' ' .. self.icon
239 end,
240 }
242 local diagnostic = {
243 condition = conditions.has_diagnostics,
245 static = {
246 error_icon = icon.error,
247 warn_icon = icon.warn,
248 info_icon = icon.info,
249 hint_icon = icon.hint,
250 },
252 init = function ( self )
253 self.errors = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.ERROR, } )
254 self.warnings = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.WARN, } )
255 self.hints = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.HINT, } )
256 self.info = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.INFO, } )
257 end,
259 update = { 'DiagnosticChanged', 'BufEnter', },
261 {
262 provider = function ( self )
263 -- 0 is just another output, we can decide to print it or not!
264 return self.errors > 0 and (self.error_icon .. ' ' .. self.errors .. ' ')
265 end,
266 hl = 'DiagnosticError',
267 },
268 {
269 provider = function ( self )
270 return self.warnings > 0 and (self.warn_icon .. ' ' .. self.warnings .. ' ')
271 end,
272 hl = 'DiagnosticWarn',
273 },
274 {
275 provider = function ( self )
276 return self.info > 0 and (self.info_icon .. ' ' .. self.info .. ' ')
277 end,
278 hl = 'DiagnosticInfo',
279 },
280 {
281 provider = function ( self )
282 return self.hints > 0 and (self.hint_icon .. ' ' .. self.hints)
283 end,
284 hl = 'DiagnosticHint',
285 },
286 }
288 local is_svn_repo = function ()
289 local svn_dir = vim.fs.find( '.svn', {
290 upward = true,
291 stop = vim.uv.os_homedir(),
292 path = vim.fs.dirname( vim.api.nvim_buf_get_name( 0 ) ),
293 type = 'directory',
294 } )
296 return not vim.tbl_isempty( svn_dir )
297 end
299 local svn_get_relative_url = function ()
300 -- FIXME: replace with vim.system
301 local job = require 'plenary.job'
302 local relative_url = { '[ERR]', }
304 job:new {
305 command = 'svn',
306 args = { 'info', '--show-item', 'relative-url', '--no-newline', },
307 on_exit = function ( current_job, exit_code )
308 if exit_code == 0 then relative_url = current_job:result() end
309 end,
310 }:sync()
312 return relative_url[1]
313 end
315 local svn = {
316 condition = is_svn_repo,
318 update = 'BufEnter',
320 init = function ( self )
321 self.relative_url = svn_get_relative_url()
322 end,
324 {
325 provider = function ( self )
326 return icon.subversion .. ' ' .. icon.branch .. ' ' .. self.relative_url
327 end,
328 },
330 }
332 local git = {
333 condition = conditions.is_git_repo,
335 init = function ( self )
336 self.status_dict = vim.b.gitsigns_status_dict
337 end,
339 {
340 provider = function ( self )
341 return icon.git .. ' ' .. icon.branch .. ' ' .. self.status_dict.head .. ' '
342 end,
343 },
344 {
345 provider = function ( self )
346 local count = self.status_dict.added or 0
347 return count > 0 and (icon.diff_add .. ' ' .. count .. ' ')
348 end,
349 hl = 'DiffAdd',
350 },
351 {
352 provider = function ( self )
353 local count = self.status_dict.removed or 0
354 return count > 0 and (icon.diff_remove .. ' ' .. count .. ' ')
355 end,
356 hl = 'DiffDelete',
357 },
358 {
359 provider = function ( self )
360 local count = self.status_dict.changed or 0
361 return count > 0 and (icon.diff_change .. ' ' .. count .. ' ')
362 end,
363 hl = 'DiffChange',
364 },
365 }
367 local work_dir = {
368 init = function ( self )
369 self.icon = (vim.fn.haslocaldir( 0 ) == 1 and icon['local'] or '') .. ' ' .. icon.global .. ' '
370 self.cwd = vim.fs.normalize( vim.uv.cwd() ):gsub( vim.fs.normalize( vim.uv.os_homedir() ), '~' )
371 end,
373 flexible = 1,
375 {
376 provider = function ( self )
377 return self.icon .. self.cwd
378 end,
379 },
380 {
381 provider = function ( self )
382 local cwd = vim.fn.pathshorten( self.cwd )
383 return self.icon .. cwd
384 end,
385 },
386 {
387 provider = '',
388 },
389 }
391 local help_file_name = {
392 condition = function ()
393 return vim.bo.filetype == 'help'
394 end,
395 provider = function ()
396 local filename = vim.api.nvim_buf_get_name( 0 )
397 return vim.fn.fnamemodify( filename, ':t' )
398 end,
399 hl = 'Question',
400 }
402 local terminal_name = {
403 provider = function ()
404 local name, _ = vim.api.nvim_buf_get_name( 0 ):gsub( '.*:', '' )
405 local basename = vim.fs.basename( name )
406 return icon.terminal .. ' ' .. (basename or 'noname')
407 end,
408 hl = 'Bold',
409 }
411 local togglers = {
412 provider = function ()
413 local togglers = require 'bugabinga.options.togglers'
414 return tostring( togglers )
415 end,
416 }
418 local macro_recording = {
419 condition = function ()
420 return vim.fn.reg_recording() ~= '' and vim.o.cmdheight == 0
421 end,
422 provider = icon.macro .. ' ',
423 hl = 'PreProc',
424 utils.surround( { '░▒▓ ', ' ▓▒░', }, nil, {
425 provider = function ()
426 return vim.fn.reg_recording()
427 end,
428 hl = 'Bold',
429 } ),
430 update = {
431 'RecordingEnter',
432 'RecordingLeave',
433 },
434 }
436 local lazy = {
437 condition = function ()
438 local ok, lazy_status = pcall( require, 'lazy.status' )
439 return ok and lazy_status.has_updates()
440 end,
441 update = { 'User', pattern = 'LazyUpdate', },
442 provider = function () return ' ' .. icon.lazy .. ' ' .. require 'lazy.status'.updates() .. ' ' end,
443 on_click = {
444 callback = function () require 'lazy'.update() end,
445 name = 'update_plugins',
446 },
447 }
449 local align = { provider = '%=', }
450 local space = { provider = ' ', }
452 local default_statusline = {
453 vi_mode, macro_recording, align,
454 work_dir, space, git, svn, align,
455 diagnostic_enabled, space, diagnostic, space, lsp_active, align,
456 togglers, align,
457 lazy, space, file_encoding, space, file_format, space, file_type, space, file_size, space, file_last_modified,
458 }
460 local special_statusline = {
461 condition = function ()
462 return conditions.buffer_matches {
463 buftype = ignored.buftypes,
464 filetype = ignored.filetypes,
465 }
466 end,
468 file_type,
469 space,
470 help_file_name,
471 align,
472 }
474 local terminal_statusline = {
476 condition = function ()
477 return conditions.buffer_matches { buftype = { 'terminal', }, }
478 end,
480 { condition = conditions.is_active, vi_mode, space, },
481 file_type,
482 space,
483 terminal_name,
484 align,
485 }
487 local inactive_statusline = {
488 condition = conditions.is_not_active,
489 file_type,
490 space,
491 file_name,
492 align,
493 }
495 local statuslines = {
496 hl = function ()
497 if conditions.is_active() then
498 return 'StatusLine'
499 else
500 return 'StatusLineNC'
501 end
502 end,
504 fallthrough = false,
506 special_statusline,
507 terminal_statusline,
508 inactive_statusline,
509 default_statusline,
510 }
512 local winbars = {
513 hl = function ()
514 if conditions.is_active() then
515 return 'Winbar'
516 else
517 return 'WinbarNC'
518 end
519 end,
521 fallthrough = false,
523 {
524 condition = function ()
525 return conditions.buffer_matches { buftype = { 'terminal', }, }
526 end,
528 file_type,
529 space,
530 terminal_name,
531 },
533 file_name_block,
534 }
536 local tabline_buffer_number = {
537 provider = function ( self )
538 return '(' .. tostring( self.bufnr ) .. ')'
539 end,
540 hl = function ( self )
541 if self.is_active then
542 return { fg = utils.get_highlight 'TabLineSel'.fg, }
543 elseif not vim.api.nvim_buf_is_loaded( self.bufnr ) then
544 return { fg = utils.get_highlight 'StatusLineNc'.fg, }
545 else
546 return { fg = utils.get_highlight 'TabLine'.fg, }
547 end
548 end,
549 }
551 local tabline_file_name = {
552 provider = function ( self )
553 local name = self.file_name
554 return name == '' and NEW_FILE or vim.fs.normalize( vim.fn.fnamemodify( name, ':t' ) )
555 end,
556 hl = function ( self ) return { bold = self.is_active or self.is_visible, italic = true, } end,
557 }
559 local tabline_file_flags = {
560 {
561 condition = function ( self ) return vim.api.nvim_get_option_value( 'modified', { buf = self.bufnr, } ) end,
562 provider = icon.modified .. ' ',
563 },
564 {
565 condition = function ( self )
566 return not vim.api.nvim_get_option_value( 'modifiable', { buf = self.bufnr, } ) or
567 vim.api.nvim_get_option_value( 'readonly', { buf = self.bufnr, } )
568 end,
569 provider = function ( self )
570 if vim.api.nvim_get_option_value( 'buftype', { buf = self.bufnr, } ) == 'terminal' then
571 return icon.terminal
572 else
573 return icon.lock
574 end
575 end,
576 },
577 hl = 'Bold',
578 }
580 local tabline_file_name_block = {
581 init = function ( self )
582 self.file_name = vim.api.nvim_buf_get_name( self.bufnr )
583 end,
585 hl = function ( self )
586 if self.is_active then
587 return 'TabLineSel'
588 elseif not vim.api.nvim_buf_is_loaded( self.bufnr ) then
589 return { fg = utils.get_highlight 'StatusLineNc'.fg, }
590 else
591 return 'TabLine'
592 end
593 end,
595 on_click = {
596 callback = function ( _, minwid, _, button )
597 if button == 'm' then --m = middle click
598 vim.schedule( function ()
599 vim.api.nvim_buf_delete( minwid, { force = false, } )
600 vim.cmd.redrawtabline()
601 end )
602 else
603 vim.api.nvim_win_set_buf( 0, minwid )
604 end
605 end,
606 minwid = function ( self ) return self.bufnr end,
607 name = 'heirline_tabline_buffer_callback',
608 },
610 file_icon,
611 { provider = ' ', },
612 tabline_file_name,
613 tabline_buffer_number,
614 tabline_file_flags,
615 }
617 local tabline_buffer_block = utils.surround(
618 {
619 ' ' .. icon.slant_left,
620 icon.slant_right .. ' ',
621 },
622 function ( self )
623 if self.is_active then
624 return utils.get_highlight 'TabLine'.bg
625 else
626 return utils.get_highlight 'TabLineFill'.bg
627 end
628 end,
629 { tabline_file_name_block, }
630 )
632 local buffer_line = utils.make_buflist(
633 tabline_buffer_block,
634 { provider = icon.arrow_left .. ' ', hl = 'TabLine', },
635 { provider = ' ' .. icon.arrow_right, hl = 'TabLine', }
636 )
638 local tabpage = {
639 provider = function ( self )
640 return '%' .. self.tabnr .. 'T ' .. self.tabpage .. ' %T'
641 end,
642 hl = function ( self )
643 if self.is_active then
644 return 'TabLineSel'
645 else
646 return 'TabLine'
647 end
648 end,
649 }
651 local tab_pages = {
652 { provider = '%=', },
653 utils.make_tablist( tabpage ),
654 }
656 local tabline = { buffer_line, tab_pages, }
658 -- local statuscolumn = {}
660 heirline.setup {
661 statusline = statuslines,
662 winbar = winbars,
663 tabline = tabline,
664 -- statuscolumn = statuscolumn,
666 opts = {
667 colors = nugu,
668 disable_winbar_cb = function ( args )
669 return conditions.buffer_matches(
670 {
671 buftype = ignored.buftypes,
672 filetype = ignored.filetypes,
673 },
674 args.buf )
675 end,
676 },
677 }
678 end,
679 },
680}

neovim/.editorconfig

Modified

+8 / −2 text lines

1# see https://github.com/CppCXY/EmmyLuaCodeStyle
2[*.lua]
1root = true
3[*]
4spell = true
5
6[*.lua]
7diagnostic = true
8
9# see https://github.com/CppCXY/EmmyLuaCodeStyle
410# optional space/tab
511indent_style = space
612# if indent_style is space, this is valid

neovim/.lazy.specs.lua

Added
new file mode 100644

+22 / −0 text lines

1return {
2 {
3 'WhoIsSethDaniel/mason-tool-installer.nvim',
4 opts = {
5 ensure_installed = {
6 'gitleaks',
7 'mdslw',
8 'vint',
9 },
10 },
11 },
12 {
13 'stevearc/conform.nvim',
14 opts = {
15 formatters = {
16 mdslw = {
17 prepend_args = { '--features', 'retain-whitespace', },
18 },
19 },
20 },
21 },
22}

neovim/.lsp.settings.lua

Added
new file mode 100644

+8 / −0 text lines

1return {
2 LuaLS = {
3 Lua = {
4 diagnostics = { globals = { 'vim', 'prequire', }, },
5 runtime = { version = 'LuaJIT', },
6 },
7 },
8}

neovim/.luarc.jsonc

Deleted
deleted file mode 100644

+0 / −21 text lines

1{
2 "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
3 "diagnostics": {
4 "globals": [
5 "vim"
6 ],
7 "neededFileStatus": {
8 "codestyle-check": "Any"
9 }
10 },
11 "workspace": {
12 "checkThirdParty": false
13 },
14 "runtime": {
15 "version": "LuaJIT",
16 "pathStrict": true,
17 "special": {
18 "want": "require"
19 }
20 }
21}

neovim/.save.actions.lua

Added
new file mode 100644

+1 / −0 text lines

1return { 'Format', }

neovim/README.md

Modified

+27 / −12 text lines

1212: standard lib. can only depend on itself and neovim apis.
1414lua/bugabinga
15: config modules. in aggregation, defines all of the config. can depend on itself, std and plugins.
15: config modules, that in aggregation, define all of the configuration and may
16only depend on itself, std and plugins.
1718lua/bugabinga/plugins
1819: third party plugins and their config glue integrating it into the config.
3031I am the bone of my code, bugs are my body and exceptions are my blood.
3132I have created over a thousand bugs, unknown to testers, nor known to debuggers.
32Have withstood pain to create many programs, yet those hands will never hold a working program.
33Have withstood pain to create many programs, yet those hands will never hold a
34working program.
3335So as I pray, Unlimited Bug Works.
3537~ Shirou Emiya
37---------
3939# todo
41* which-key and lazy loaded keys are not clean yet
42* telescope find filter binary files (spell files)
4341* navic highlights do not fit winbar
44* write plugin to parse lsp settings,plugin options and neovim settings locally and apply them ( can we repurpose editorconfig support in neovim for that?)
4542* does status bar fail to display if lsp fails to load?
4643* pandoc with lua filters for diagrams for generating documents and previewing --> https://github.com/tex/vimpreviewpandoc
4744* use gen.ai to generate docs
45* command for toggling case conventions
46* Move to treesitter main branch
47* check out `vim.snippet`
48* use `vim.base64` in wezterm plugin
49* Bug:
50 LuaLS is getting crazy diagnosing non-stop...
51* integrate language tool?
52* ]s [s to jump to spelling mistakes
4853* learn marks and refactor mark.lua
54* try Termdebug with gdb
55* adapt config to respect `vim.g.nerdfont` (std.constants?)
4956* use ltex-ls for markdown, code comments and commit messages
50* create a floating window that shows plugins, that have commands, as reminder
57* learn from
58 <https://github.com/stevearc/dotfiles/blob/master/.config/nvim/plugin/exrc.lua>
59 and maybe adapt `std.localrc`
5160* setup DAP
52* add nu-check to nvim-lint
53* create facade over vim.api.nvim_create_user_command
54* create skeleton-plugin for default file content based on file type
55* add support for Java multi line string in autopairs
5661* nvim spell for camel case words
62* add nu-check to nvim-lint
63* create skeleton-plugin for default file content based on file type
64 (BufNewFile?)
65* make lsp config extensible, so that plugin configs can hook into it (e.g.
66 on_attach)
67* split parts of config into plugins
68* add support for Java multi line string in autopairs
69* pandoc with lua filters for diagrams for generating documents and previewing
70 --> https://github.com/tex/vimpreviewpandoc
71 outside of vim?

neovim/ftplugin/lua.lua

Modified

+28 / −0 text lines

66end
77vim.opt_local.suffixesadd:prepend '.lua'
88vim.opt_local.conceallevel = 1
9
10local map = require 'std.map'
12map.normal {
13 description = 'Wrap word under cursor with require call',
14 keys = '<leader>rq',
15 category = 'refactor',
16 -- surround word with '
17 -- insert `require`
18 -- move 3 words
19 command = "ebi'<esc>ea'<esc>bbirequire <esc>www",
20 buffer = true,
21 remap = true,
22}
24--TODO: add dbg.print, require, prequire
25prequire 'nvim-surround'.buffer_setup {
26 surrounds = {
27 ['P'] = {
28 add = { 'vim.print(', ')', },
29 find = 'vim%.print%b()',
30 delete = '^(vim%.print%()().-(%))()$',
31 change = {
32 target = '^(vim%.print%()().-(%))()$',
33 },
34 },
35 },
36}

neovim/ftplugin/oil.lua

Added
new file mode 100644

+1 / −0 text lines

1vim.opt_local.syntax = 'on'

neovim/init.lua

Modified

+35 / −8 text lines

1414vim.cmd.colorscheme 'nugu'
16---create special global, that serves as a more graceful alternative to `require`
17prequire = require 'std.prequire'
1619local ok, loaded
1821-- set general neovim editor settings
1922ok, loaded = pcall( require, 'bugabinga.options' )
20if not ok then vim.print( 'error while loading options', loaded ) end
23if not ok then
24 vim.print( 'error while loading options', loaded )
25end
27-- extends default editorconfig options
28ok, loaded = pcall( require, 'bugabinga.editorconfig' )
29if not ok then
30 vim.print( 'error while loading editorconfig extensions', loaded )
31end
2233-- install plugin manager and declare plugins to use
2334ok, loaded = pcall( require, 'bugabinga.lazy' )
24if not ok then vim.print( 'error while loading lazy', loaded ) end
35if not ok then
36 vim.print( 'error while loading lazy', loaded )
37end
2639-- configures the vim diagnostic subsystem
2740ok, loaded = pcall( require, 'bugabinga.diagnostic' )
28if not ok then vim.print( 'error while loading diagnostic', loaded ) end
41if not ok then
42 vim.print( 'error while loading diagnostic', loaded )
43end
30-- Defines `TrimTrailingWhitespace` command
31ok, loaded = pcall( require, 'bugabinga.trim' )
32if not ok then vim.print( 'error while loading trim', loaded ) end
45-- project local save actions
46ok, loaded = pcall( require, 'bugabinga.save_actions' )
47if not ok then
48 vim.print( 'error while loading save_actions', loaded )
49end
3451-- visualize marks in signcolumn
3552ok, loaded = pcall( require, 'bugabinga.mark' )
36if not ok then vim.print( 'error while loading mark', loaded ) end
53if not ok then
54 vim.print( 'error while loading mark', loaded )
55end
57-- configure builtin terminal
58ok, loaded = pcall( require, 'bugabinga.terminal' )
59if not ok then
60 vim.print( 'error while loading terminal', loaded )
61end
3863-- setup lsp clients
3964ok, loaded = pcall( require, 'bugabinga.lsp' )
40if not ok then vim.print( 'error while loading lsp', loaded ) end
65if not ok then
66 vim.print( 'error while loading lsp', loaded )
67end

neovim/justfile

Modified

+1 / −1 text lines

77# Reproduce some neovim issue
88repro:
9 nvim -u repro.lua
9 nvim -u repro.lua
1111# update nvim plugins
1212update:

neovim/lazy-lock.json

Modified

+54 / −4 text lines

11{
22 "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
3 "LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" },
34 "actions-preview.nvim": { "branch": "master", "commit": "5072b1b1065a6b22bdd46b5c21780a91d6a08071" },
5 "auto-dark-mode.nvim": { "branch": "master", "commit": "e328dc463d238cb7d690fb4daf068eba732a5a14" },
46 "better-escape.nvim": { "branch": "master", "commit": "7e86edafb8c7e73699e0320f225464a298b96d12" },
7 "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
8 "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
9 "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
10 "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
11 "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
512 "colorizer.nvim": { "branch": "master", "commit": "107719885290366c893e1c1c58b7474cbeabfef6" },
13 "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
614 "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
715 "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
8 "fidget.nvim": { "branch": "main", "commit": "4e854f3299e21d1c18279add340428a97520fc44" },
16 "fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
917 "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
1018 "gen.nvim": { "branch": "main", "commit": "87fbe811155b90eea58622614809705b966009ad" },
1119 "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
1725 "mason-tool-installer.nvim": { "branch": "main", "commit": "1212fb6082b7177dde17ea65e429e027835aeb40" },
1826 "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
1927 "mini.align": { "branch": "main", "commit": "f845218c5fea89e49074e48270dc5e1b9511a0f9" },
28 "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
29 "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
30 "heirline.nvim": { "branch": "master", "commit": "03cff30d7e7d3ba6fdc00925f015822f79cef908" },
31 "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
32 "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
33 "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
34 "lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" },
35 "mason-tool-installer.nvim": { "branch": "main", "commit": "6c15772d5e4a01d0b2ad3ad6df23cf38517c4ad2" },
36 "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
2037 "mini.bracketed": { "branch": "main", "commit": "65c7dfb51e832de9e279e5d5b0741e7af6755ab5" },
21 "mini.starter": { "branch": "main", "commit": "ce222a5b6de50a9963c1eb62aa16ec6d5efca7ee" },
2238 "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
2339 "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
2440 "neogen": { "branch": "main", "commit": "0daffcec249bf42275e322361fe55b89a05ff278" },
2541 "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" },
2642 "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
2743 "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
44 "neorg": { "branch": "main", "commit": "7c5464722a4e8240efd9ecd7bef85d38f94c1ab5" },
45 "neotest": { "branch": "master", "commit": "f03a78cef74db5638e4312e18b767294a90de8da" },
46 "neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" },
47 "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" },
48 "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
49 "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
50 "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
51 "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
52 "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
53 "nvim-dap-virtual-text": { "branch": "master", "commit": "3e8e207513e6ef520894950acd76b79902714103" },
2854 "nvim-genghis": { "branch": "main", "commit": "8613fc1b43db6cc761733b3630eabff9e86296f7" },
2955 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
3056 "nvim-jdtls": { "branch": "master", "commit": "a4746791876166dc146eae573a1b49d24a6652e7" },
3157 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
58 "nvim-lint": { "branch": "master", "commit": "3317b73ec3eb76cd8ca83e05880c07c83e368c1e" },
3259 "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" },
3360 "nvim-navbuddy": { "branch": "master", "commit": "f34237e8a41ebc6e2716af2ebf49854d8c5289c8" },
3461 "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
4673 "persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" },
4774 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
4875 "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
76 "nvim-nio": { "branch": "master", "commit": "5a3a06e5df34f1b4fc1500622b10620c49c60da6" },
77 "nvim-spectre": { "branch": "master", "commit": "2b012554a2536465243c0dff3605b5927c49ed23" },
78 "nvim-surround": { "branch": "main", "commit": "84a26afce16cffa7e3322cfa80a42cddf60616eb" },
79 "nvim-tree.lua": { "branch": "master", "commit": "ddd1d6eb21c45433bdc65cc8015f2457998f2bf2" },
80 "nvim-treesitter": { "branch": "master", "commit": "e9321bb914b3a5a88b7dff5392f0f5f8d83bee67" },
81 "nvim-treesitter-endwise": { "branch": "master", "commit": "60e8c288e011403f248b5f6478dde12bed8a6c55" },
82 "nvim-treesitter-textobjects": { "branch": "master", "commit": "2aa454e4037424c678a8ff033951a5be39e54b9c" },
83 "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
84 "nvim-ts-context-commentstring": { "branch": "main", "commit": "734ebad31c81c6198dfe102aa23280937c937c42" },
85 "nvim-web-devicons": { "branch": "master", "commit": "fd4abfc5237246670977972c6f518186b621a32d" },
86 "nvim-window": { "branch": "main", "commit": "fad0dc96de265b0bdcb21d1071329e5ab1deb4af" },
87 "oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
88 "overseer.nvim": { "branch": "master", "commit": "b04b0b105c07b4f02b3073ea3a98d6eca90bf152" },
89 "pair-ls.nvim": { "branch": "master", "commit": "e7a8f55f54a6a1956b782ddefba79dc6bb308d1d" },
90 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
91 "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
92 "qf_helper.nvim": { "branch": "master", "commit": "91dad029c11d1c39b0d1276eda52616f651072be" },
93 "resession.nvim": { "branch": "master", "commit": "dc8825439c619030925543a444c4186a2487c200" },
4994 "schemastore.nvim": { "branch": "main", "commit": "80d701841487f72bf9d3fa56b25146b95e190502" },
5095 "specs.nvim": { "branch": "main", "commit": "e929006d3f6bb8e43f03e13ac364c67236eb5299" },
5196 "speedtyper.nvim": { "branch": "main", "commit": "2d158eed4c753995b0501a3a7a72464fbb213e3d" },
5297 "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
5398 "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
99 "suda.vim": { "branch": "master", "commit": "66727b416837836712975e748bc8a19fb6cf4ec3" },
100 "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
54101 "telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
55 "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
56102 "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" },
57103 "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
58104 "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" },
59105 "toggleterm.nvim": { "branch": "main", "commit": "193786e0371e3286d3bc9aa0079da1cd41beaa62" },
106 "tint.nvim": { "branch": "master", "commit": "862835626941d263466754b9c8e2ce2cb004f5ac" },
107 "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" },
60108 "tree-sitter-nu": { "branch": "main", "commit": "c5b7816043992b1cdc1462a889bc74dc08576fa6" },
61109 "treesj": { "branch": "main", "commit": "60e27280030f9cd8dfb6ceb335922c6ff76682cc" },
62110 "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
111 "venn.nvim": { "branch": "main", "commit": "e4d68341a73dd56c64955058821a58295fb337b1" },
112 "vim-vscode-snippets": { "branch": "master", "commit": "812e60d1c648f889328761ec71daff09d1eb3177" },
63113 "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" },
64114 "which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" },
65115 "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" }
66}No final newline
116}

neovim/lua/bugabinga/const.lua

Added
new file mode 100644

+5 / −0 text lines

1--- constant 'global' values
2return {
3 win32 = vim.loop.os_uname().sysname:match 'Win',
4 wsl2 = vim.loop.os_uname().release:match 'WSL2',
5}

neovim/lua/bugabinga/editorconfig.lua

Added
new file mode 100644

+38 / −0 text lines

1local editorconfig = require 'editorconfig'
2
3-- extends the parsing of '.editorconfig' files, if present, with some neovim options, that i care about.
4-- theoretically, this could also be achieved by enabling the 'exrc' feature in neovim or by using my 'localrc' module.
5-- however, i prefer editorconfig in this case, because:
6-- 1. it is its intended use case
7-- 2. it does not require a manual step (`vim.secure.read`)
8-- 3. there is no chance of random code execution by third parties
9-- 4. there is a miniscule chance to share those options with others in the future
10--
11-- NOTE: editorconfig options are not re-evaluated, when loading a session
13local tobool = function ( str )
14 -- intentionally strict
15 return str == 'true'
16end
18local expose_option = function ( option_name, parser )
19 editorconfig.properties[option_name] = function ( _, value )
20 vim.opt_local[option_name] = parser( value )
21 end
22end
24-- even those options are the same as my togglers, the code is not shared for the
25-- small off chance, that this ever gets shared as a neovim plugin
26expose_option( 'spell', tobool )
27expose_option( 'number', tobool )
28expose_option( 'cursorline', tobool )
29expose_option( 'virtualedit', tostring )
31editorconfig.properties.diagnostic = function ( bufnr, value )
32 local option = tobool( value )
33 if option then
34 vim.diagnostic.enable( bufnr )
35 else
36 vim.diagnostic.disable( bufnr )
37 end
38end

neovim/lua/bugabinga/lazy.lua

Modified

+46 / −15 text lines

1919local lazy = require 'lazy'
2020local icon = require 'std.icon'
22lazy.setup( 'bugabinga.plugins', {
22local overrides = require 'std.localrc' ( '.lazy.specs.lua', 'table' )
23--- a couple of vim events, that collectively represent "a file has been opened".
24--- this is useful for plugins that want to be lazy loaded, when some file is shown in a buffer/window
25vim.g.FILE_LOADED_EVENTS = { 'BufRead', 'BufNew', 'SessionLoadPost', }
27lazy.setup {
28 spec = { { import = 'bugabinga.plugins', }, overrides, },
2329 defaults = {
2430 lazy = true,
2531 -- version = '*',
32 -- useful to globally disable plugins
33 -- cond = function ( plugin_spec )
34 -- return plugin_spec.name:find 'oil'
35 -- end,
2636 },
2737 install = {
2838 missing = true,
4050 task = icon.terminal,
4151 ft = icon.file,
4252 },
53 custom_keys = {
54 ['<localleader>l'] = {
55 function ( plugin )
56 require 'lazy.util'.float_term( { 'gitui', }, {
57 cwd = plugin.dir,
58 } )
59 end,
60 desc = 'Open gitui',
61 },
63 ['<localleader>t'] = {
64 function ( plugin )
65 require 'lazy.util'.float_term( nil, {
66 cwd = plugin.dir,
67 } )
68 end,
69 desc = 'Open terminal in plugin dir',
70 },
71 },
4372 },
44 custom_keys = {
45 ['<localleader>l'] = function ( plugin )
46 require 'lazy.util'.float_term( 'gitui', {
47 cwd = plugin.dir,
48 } )
49 end,
50 ['<localleader>t'] = function ( plugin )
51 require 'lazy.util'.float_term( nil, {
52 cwd = plugin.dir,
53 } )
54 end,
55 },
73 diff = { cmd = 'diffview.nvim', },
5674 change_detection = { notify = false, },
5775 performance = {
5876 rtp = {
86104 patterns = { 'bugabinga', },
87105 path = win32 and 'W:/' or '~/Workspace',
88106 },
89} )
107}
91109local map = require 'std.map'
108126lazy_cmds:each( function ( cmd )
109127 map.normal {
110 name = cmd[1] .. ' plugins',
128 description = cmd[1],
111129 category = 'plugins',
112130 keys = base_key .. cmd[2],
113131 command = cmd[3],
114132 }
115133end )
135local auto = require 'std.auto'
137auto 'display_startup_time' {
138 description = 'Display startup time on starter screen',
139 events = 'User',
140 pattern = 'LazyVimStarted',
141 once = true,
142 command = vim.schedule_wrap( function ()
143 local startuptime = lazy.stats().startuptime
144 vim.notify( 'neovim started in ' .. startuptime .. 'ms' )
145 end ),
146}

neovim/lua/bugabinga/lsp/clients/bash.lua

Deleted
deleted file mode 100644

+0 / −22 text lines

1local project = require 'std.project'
2
3return {
4 name = 'bash-lsp',
5 command = { 'bash-language-server', 'start', },
6 filetypes = { 'sh', },
7 root_dir = project.find_vcs_project_root,
8 single_file_support = true,
9 workspaces = false,
10 settings = {
11 bashIde = {
12 -- Glob pattern for finding and parsing shell script files in the workspace.
13 -- Used by the background analysis features across files.
15 -- Prevent recursive scanning which will cause issues when opening a file
16 -- directly in the home directory (e.g. ~/foo.sh).
17 --
18 -- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)".
19 globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)',
20 },
21 },
22}

neovim/lua/bugabinga/lsp/clients/init.lua

Modified

+0 / −1 text lines

33 require 'bugabinga.lsp.clients.lua',
44 require 'bugabinga.lsp.clients.json',
55 require 'bugabinga.lsp.clients.asm',
6 require 'bugabinga.lsp.clients.bash',
76 require 'bugabinga.lsp.clients.c',
87 require 'bugabinga.lsp.clients.graphviz',
98 require 'bugabinga.lsp.clients.markdown',

neovim/lua/bugabinga/lsp/clients/java.lua

Modified

+19 / −15 text lines

4646 --FIXME: refactor this!
4747 vim.list_extend( bundles,
4848 vim.split(
49 --TODO: jdtls seemingly cannot get bindle info out of this jar
50 --
51 -- Contains: Failed to get bundleInfo for bundle from /home/oli/.local/share/nvim/mason/packages/java-test/extension/server/com.microsoft.java.test.runner-jar-with-dependencies.jar
52 -- "
4953 vim.fn.glob( java_debug_path .. '/extension/server/com.microsoft.java.debug.plugin-*.jar' ), '\n' ) )
5054 vim.list_extend( bundles, vim.split( vim.fn.glob( java_test_path .. '/extension/server/*.jar' ), '\n' ) )
5155 return bundles
110114 vim.notify 'missing jdk paths in java settings for lsp'
111115 end
113 return { jdk11, jdk17, jdk21 }
117 return { jdk11, jdk17, jdk21, }
114118end
116120local java_settings = {
117 signatureHelp = { enabled = true },
121 signatureHelp = { enabled = true, },
118122 sources = {
119 autobuild = { enabeld = true },
120 signatureHelp = { enabled = true },
121 saveActions = { origanizeImports = true },
123 autobuild = { enabeld = true, },
124 signatureHelp = { enabled = true, },
125 saveActions = { origanizeImports = true, },
122126 organizeImports = {
123127 starThreshold = 9999,
124128 staticStarThreshold = 9999,
127131 toString = {
128132 template = '${object.className}{${member.name()}=${member.value()}, ${otherMembers}}',
129133 },
130 hashCodeEquals = { useJava7Objects = true },
134 hashCodeEquals = { useJava7Objects = true, },
131135 useBlocks = true,
132136 },
133 eclipse = { downloadSources = true },
137 eclipse = { downloadSources = true, },
134138 },
135139 configuration = {
136140 updateBuildConfiguration = 'interactive',
137141 runtimes = find_jdks(),
138142 },
139 maven = { downloadSources = true },
140 implementationsCodeLens = { enabled = true },
141 referencesCodeLens = { enabled = true },
142 references = { includeDecompiledSources = true },
143 inlayHints = { parameterNames = { enabled = 'all' } },
143 maven = { downloadSources = true, },
144 implementationsCodeLens = { enabled = true, },
145 referencesCodeLens = { enabled = true, },
146 references = { includeDecompiledSources = true, },
147 inlayHints = { parameterNames = { enabled = 'all', }, },
144148 format = {
145149 enabled = true,
146150 -- TODO: set these here with my preferred settings
166170local on_attach = function ()
167171 local jdtls = require 'jdtls'
168172 vim.lsp.codelens.refresh()
169 jdtls.setup_dap { hotcodereplace = 'auto' }
173 jdtls.setup_dap { hotcodereplace = 'auto', }
170174 require 'jdtls.dap'.setup_dap_main_class_configs()
171175 require 'jdtls.setup'.add_commands()
249253 root_dir = project.find_java_project_root,
250254 single_file_support = true,
251255 workspaces = true,
252 settings = { java = java_settings },
256 settings = { java = java_settings, },
253257 on_attach = on_attach,
254258 init_options = {
255259 bundles = get_bundles(),
256260 extendedClientCapabilities = get_extended_capabilites(),
257 }
261 },

neovim/lua/bugabinga/lsp/clients/lua.lua

Modified

+2 / −3 text lines

77 root_dir = project.find_lua_project_root,
88 single_file_support = true,
99 workspaces = true,
10 before_init = require 'neodev.lsp'.before_init,
10 before_init = prequire 'neodev.lsp'.before_init,
1111 settings = {
1212 Lua = {
1313 addonManager = { enable = false, },
14 completion = { callSnippet = 'Disable', postfix = '.', },
15 diagnostics = { globals = { 'vim', }, workspaceRate = 50, },
14 completion = { callSnippet = 'Replace', },
1615 hint = { enable = true, setType = true, },
1716 telemetry = { enable = false, },
1817 window = { progressBar = true, statusBar = true, },

neovim/lua/bugabinga/lsp/init.lua

Modified

+88 / −66 text lines

1require 'bugabinga.lsp.lightbulb'
2
3local debug = require 'std.debug'
1local debug = require 'std.dbg'
2local icon = require 'std.icon'
43local defer = require 'std.defer'
54local map = require 'std.map'
65local auto = require 'std.auto'
76local ui = require 'bugabinga.ui'
87local table = require 'std.table'
98local ignored = require 'std.ignored'
10local user_command = vim.api.nvim_create_user_command
9local user_command = require 'std.user_command'
1110local lsp_client_configs = require 'bugabinga.lsp.clients'
11local localrc = require 'std.localrc'
1213local _ = {}
14local token_update = function ( lsp_client )
15require 'bugabinga.lsp.lightbulb'
17local token_update = function ( lsp_client )
1518 local token = lsp_client.data.token
1619 local buffer = lsp_client.buffer
1720 local client_id = lsp_client.data.client_id
2730 --* closures that capture something
2831end
30local expand_path = function ( path )
33local expand_path = function ( path )
3134 if vim.fn.executable( path ) == 1 then
3235 return vim.fn.exepath( path )
3336 else
3538 end
3639end
38local expand_command = function ( command )
41local expand_command = function ( command )
3942 vim.validate { command = { command, { 'string', 'table', }, }, }
4144 if type( command ) == 'table' then
4649 return expand_path( command )
4750end
49local lsp_start = function ( file_type_event )
52local lsp_start = function ( file_type_event )
5053 debug.print 'trying to start lsp'
5154 local match = file_type_event.match
112115 return
113116 end
115 -- TODO: LspStart
116 -- TODO: LspStop
117 -- TODO: stop lsp on vim idle/ficus lost?
118 -- FIXME: lsp detach errors
118 --NOTE: this is super kool but has the limitation, that only lsp clients
119 -- configured via my special lsp module are affected.
120 local project_local_lsp_settings = localrc( '.lsp.settings.lua', 'table' ) or {}
120122 for _, config in ipairs( potential_client_configs ) do
121123 local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
122124 local capabilities = vim.lsp.protocol.make_client_capabilities()
123125 capabilities = table.extend( 'force', capabilities, config.capabilities )
127 local settings = config.settings
128 local settings_override = project_local_lsp_settings[config.name]
129 if settings_override then
130 debug.print( 'overriding settings with project local settings', settings, settings_override )
131 settings = vim.tbl_deep_extend( 'force', settings, settings_override )
132 end
125134 debug.print( 'starting command:', config.command )
127136 local start_config = {
133142 -- workspace_folders = { config.root_dir(buffer_path) }, -- TODO: i think workspaces can only ever be declared per project. i cannot think of a generic way to calculate those, like with root_dir. maybe a toml/ini file in root_dir sets these?
134143 capabilities = capabilities,
135144 -- handlers = vim.lsp.handlers,
136 settings = config.settings,
145 settings = settings,
137146 -- commands = nil, -- what is this?
138147 init_options = config.init_options,
139148 name = config.name,
192201local old_omnifunc
193202local old_tagfunc
195local keybinds = {}
196local add = function ( client_id, keybind )
204local keybinds = {}
205local add = function ( client_id, keybind_remover )
206 vim.validate {
207 client_id = { client_id, 'number', },
208 keybind_remover = { keybind_remover, 'function', },
209 }
197210 if not table.contains( keybinds, client_id ) then
198211 keybinds[client_id] = {}
199212 end
200 table.insert( keybinds[client_id], keybind )
213 table.insert( keybinds[client_id], keybind_remover )
201214end
203local lsp_attach = function ( args )
216local lsp_attach = function ( args )
204217 local bufnr = args.buf
205 local client = vim.lsp.get_client_by_id( args.data.client_id )
218 local client_id = args.data.client_id
219 local client = vim.lsp.get_client_by_id( client_id )
206220 if not client then return end
208222 debug.print( client.server_capabilities )
232246 local navbuddy_ok, navbuddy = pcall( require, 'nvim-navbuddy' )
233247 if navbuddy_ok then
234248 navbuddy.attach( client, bufnr )
249 map.normal {
250 description = 'Open overview of symbols in current buffer',
251 category = 'lsp',
252 keys = '<leader>lo',
253 command = function () navbuddy.open( bufnr ) end,
254 buffer = bufnr,
255 }
235256 else
236257 vim.notify 'nvim-navbuddy not found. could not attach to lsp client.'
237258 end
260281 end
262283 if client.server_capabilities.inlayHintProvider then
263 add( map.normal {
284 add( client_id, map.normal {
264285 description = 'Toggle inlay hints',
265286 category = 'lsp',
266287 buffer = bufnr,
267288 keys = '<leader>ti',
268289 command = function ()
269 vim.lsp.inlay_hint( bufnr, nil )
290 vim.lsp.inlay_hint.enable( bufnr, nil )
270291 end,
271292 } )
272293 end
274 add( map.normal {
295 add( client_id, map.normal {
275296 description = 'Show hover documentation above cursor.',
276297 category = 'lsp',
277298 buffer = bufnr,
279300 command = vim.lsp.buf.hover,
280301 } )
282 add( map.normal {
303 add( client_id, map.normal {
283304 description = 'Show signature help under cursor.',
284305 category = 'lsp',
285306 buffer = bufnr,
286 keys = '<leader>ls',
307 keys = { 'H', '<leader>ls', },
287308 command = vim.lsp.buf.signature_help,
288309 } )
290 add( map.normal {
311 add( client_id, map.normal {
291312 description = 'Show available code actions on current line.',
292313 category = 'lsp',
293314 buffer = bufnr,
295316 command = vim.lsp.buf.code_action,
296317 } )
298 add( map.normal {
319 add( client_id, map.normal {
299320 description = 'Goto to definition of symbol under cursor.',
300321 category = 'lsp',
301322 buffer = bufnr,
303324 command = vim.lsp.buf.definition,
304325 } )
306 add( map.normal {
327 add( client_id, map.normal {
307328 description = 'Show implementations of symbol under cursor.',
308329 category = 'lsp',
309330 buffer = bufnr,
311332 command = vim.lsp.buf.implementation,
312333 } )
314 add( map.normal {
335 add( client_id, map.normal {
315336 description = 'Show incoming calls of symbol under cursor.',
316337 category = 'lsp',
317338 buffer = bufnr,
319340 command = vim.lsp.buf.incoming_calls,
320341 } )
322 add( map.normal {
343 add( client_id, map.normal {
323344 description = 'Show outgoing calls of symbol under cursor.',
324345 category = 'lsp',
325346 buffer = bufnr,
327348 command = vim.lsp.buf.outgoing_calls,
328349 } )
330 add( map.normal {
351 add( client_id, map.normal {
331352 description = 'Show references of symbol under cursor.',
332353 category = 'lsp',
333354 buffer = bufnr,
334 keys = '<leader>lr',
355 keys = '<leader>ln',
335356 command = vim.lsp.buf.references,
336357 } )
338 add( map.normal {
359 add( client_id, map.normal {
339360 description = 'Rename symbol under cursor.',
340361 category = 'lsp',
341362 buffer = bufnr,
342 keys = { '<f2>', '<leader>ln', },
363 keys = { '<f2>', '<leader>lr', },
343364 command = vim.lsp.buf.rename,
344365 } )
345366end
347local lsp_detach = function ( args )
368local lsp_detach = function ( args )
348369 debug.print( 'DETACH LSP', args )
350371 local bufnr = args.buf
429450 ui.show_tree( active_clients )
430451end
432user_command( 'LspInfo', lsp_info, {
433 nargs = '?',
434 complete = function () return { 'all', } end,
435 desc = 'Shows basic information about running LSP clients.',
436} )
453user_command.LspInfo
454'Shows basic information about running LSP clients.'
455 { nargs = '?', complete = function () return { 'all', } end, } (
456 lsp_info
457 )
438user_command( 'LspInfoExtended', lsp_info_extended, {
439 nargs = '?',
440 complete = function () return { 'all', } end,
441 desc = 'Shows detailed information about running LSP clients.',
442} )
459user_command.LspInfoExtended
460'Shows detailed information about running LSP clients.'
461 { nargs = '?', complete = function () return { 'all', } end, } (
462 lsp_info_extended
463 )
444-- TODO: lsp restart, lsp exit
465-- TODO: LspStart
466-- TODO: LspStop
467-- TODO: LspRestart ? Maybe good after changing project local settings?
446-- TODO: move to std.icons.lua
447469local completion_icons = {
448 Class = ' ',
449 Color = ' ',
450 Constant = ' ',
451 Constructor = ' ',
452 Enum = ' ',
453 EnumMember = ' ',
454 Field = '󰄶 ',
455 File = ' ',
456 Folder = ' ',
457 Function = ' ',
458 Interface = '󰜰',
459 Keyword = '󰌆 ',
460 Method = 'ƒ ',
461 Module = '󰏗 ',
462 Property = ' ',
463 Snippet = '󰘍 ',
464 Struct = ' ',
465 Text = ' ',
466 Unit = ' ',
467 Value = '󰎠 ',
468 Variable = ' ',
470 Class = icon.class,
471 Color = icon.color,
472 Constant = icon.constant,
473 Constructor = icon.constructor,
474 Enum = icon.enum,
475 EnumMember = icon.enum_member,
476 Field = icon.field,
477 File = icon.file,
478 Folder = icon.folder,
479 Function = icon['function'],
480 Interface = icon.interface,
481 Keyword = icon.keyword,
482 Method = icon.method,
483 Module = icon.module,
484 Property = icon.property,
485 Snippet = icon.snippet,
486 Struct = icon.struct,
487 Text = icon.text,
488 Unit = icon.unit,
489 Value = icon.value,
490 Variable = icon.variable,
471493local completion_kinds = vim.lsp.protocol.CompletionItemKind

neovim/lua/bugabinga/nugu/init.lua

Modified

+73 / −72 text lines

4242vim.g.terminal_color_14 = ui_important_global -- aqua
4343vim.g.terminal_color_15 = ui_normal -- white
4546local set_group_properties = function ( self, properties )
46 vim.validate {
47 properties = { properties, 'table', },
48 -- • fg (or foreground): color name or "#RRGGBB", see note.
49 ['properties.fg'] = { properties.fg, 'string', true, },
50 -- • bg (or background): color name or "#RRGGBB", see note.
51 ['properties.bg'] = { properties.bg, 'string', true, },
52 -- • sp (or special): color name or "#RRGGBB"
53 ['properties.sp'] = { properties.sp, 'string', true, },
54 -- • blend: integer between 0 and 100
55 ['properties.blend'] = { properties.blend, 'number', true, },
56 -- • bold: boolean
57 ['properties.bold'] = { properties.bold, 'boolean', true, },
58 -- • standout: boolean
59 ['properties.standout'] = { properties.standout, 'boolean', true, },
60 -- • underline: boolean
61 ['properties.underline'] = { properties.underline, 'boolean', true, },
62 -- • undercurl: boolean
63 ['properties.undercurl'] = { properties.undercurl, 'boolean', true, },
64 -- • underdotted: boolean
65 ['properties.underdotted'] = { properties.underdotted, 'boolean', true, },
66 -- • underdashed: boolean
67 ['properties.underdashed'] = { properties.underdashed, 'boolean', true, },
68 -- • strikethrough: boolean
69 ['properties.strikethrough'] = { properties.strikethrough, 'boolean', true, },
70 -- • italic: boolean
71 ['properties.italic'] = { properties.italic, 'boolean', true, },
72 -- • reverse: boolean
73 ['properties.reverse'] = { properties.reverse, 'boolean', true, },
74 -- • nocombine: boolean
75 ['properties.nocombine'] = { properties.nocombine, 'boolean', true, },
76 -- • default: Don't override existing definition |:hi-default|
77 ['properties.default'] = { properties.default, 'boolean', true, },
78 -- • ctermfg: Sets foreground of cterm color |ctermfg|
79 ['properties.ctermfg'] = { properties.ctermfg, 'string', true, },
80 -- • ctermbg: Sets background of cterm color |ctermbg|
81 ['properties.ctermbg'] = { properties.ctermbg, 'string', true, },
82 -- • cterm: cterm attribute map, like |highlight-args|. If not set, cterm attributes will match those from the attribute map documented above.
83 ['properties.cterm'] = { properties.cterm, 'table', true, },
84 -- • force: if true force update the highlight group when it exists.
85 ['properties.force'] = { properties.force, 'boolean', true, },
86 }
87 -- vim.print( 'SET GROUP PROPERTIES', self, properties )
88 for key, value in pairs( properties ) do
89 self[key] = value
90 end
47 vim.validate {
48 properties = { properties, 'table', },
49 -- • fg (or foreground): color name or "#RRGGBB", see note.
50 ['properties.fg'] = { properties.fg, 'string', true, },
51 -- • bg (or background): color name or "#RRGGBB", see note.
52 ['properties.bg'] = { properties.bg, 'string', true, },
53 -- • sp (or special): color name or "#RRGGBB"
54 ['properties.sp'] = { properties.sp, 'string', true, },
55 -- • blend: integer between 0 and 100
56 ['properties.blend'] = { properties.blend, 'number', true, },
57 -- • bold: boolean
58 ['properties.bold'] = { properties.bold, 'boolean', true, },
59 -- • standout: boolean
60 ['properties.standout'] = { properties.standout, 'boolean', true, },
61 -- • underline: boolean
62 ['properties.underline'] = { properties.underline, 'boolean', true, },
63 -- • undercurl: boolean
64 ['properties.undercurl'] = { properties.undercurl, 'boolean', true, },
65 -- • underdotted: boolean
66 ['properties.underdotted'] = { properties.underdotted, 'boolean', true, },
67 -- • underdashed: boolean
68 ['properties.underdashed'] = { properties.underdashed, 'boolean', true, },
69 -- • strikethrough: boolean
70 ['properties.strikethrough'] = { properties.strikethrough, 'boolean', true, },
71 -- • italic: boolean
72 ['properties.italic'] = { properties.italic, 'boolean', true, },
73 -- • reverse: boolean
74 ['properties.reverse'] = { properties.reverse, 'boolean', true, },
75 -- • nocombine: boolean
76 ['properties.nocombine'] = { properties.nocombine, 'boolean', true, },
77 -- • default: Don't override existing definition |:hi-default|
78 ['properties.default'] = { properties.default, 'boolean', true, },
79 -- • ctermfg: Sets foreground of cterm color |ctermfg|
80 ['properties.ctermfg'] = { properties.ctermfg, 'string', true, },
81 -- • ctermbg: Sets background of cterm color |ctermbg|
82 ['properties.ctermbg'] = { properties.ctermbg, 'string', true, },
83 -- • cterm: cterm attribute map, like |highlight-args|. If not set, cterm attributes will match those from the attribute map documented above.
84 ['properties.cterm'] = { properties.cterm, 'table', true, },
85 -- • force: if true force update the highlight group when it exists.
86 ['properties.force'] = { properties.force, 'boolean', true, },
87 }
88 -- vim.print( 'SET GROUP PROPERTIES', self, properties )
89 for key, value in pairs( properties ) do
90 self[key] = value
91 end
9192end
9394local new_group = function ()
94 return setmetatable( {}, {
95 __call = set_group_properties,
96 } )
95 return setmetatable( {}, {
96 __call = set_group_properties,
97 } )
9798end
99100local add_group = function ( self, key )
100 if not self.groups[key] then
101 self.groups[key] = new_group()
102 end
103 return self.groups[key]
101 if not self.groups[key] then
102 self.groups[key] = new_group()
103 end
104 return self.groups[key]
104105end
106107local link_group = function ( self, key, value )
107 -- vim.print( 'linking group', self, key, value )
108 local group = add_group( self, key )
109 for name, link_group in pairs( self.groups ) do
110 if link_group == value then
111 -- vim.print( 'found group to link ' .. name .. ' to ' .. key )
112 group.link = name
113 return group
114 end
115 end
108 -- vim.print( 'linking group', self, key, value )
109 local group = add_group( self, key )
110 for name, link_group in pairs( self.groups ) do
111 if link_group == value then
112 -- vim.print( 'found group to link ' .. name .. ' to ' .. key )
113 group.link = name
114 return group
115 end
116 end
116117end
118119local _ = setmetatable( { groups = {}, }, {
119 __index = add_group,
120 __newindex = link_group,
120 __index = add_group,
121 __newindex = link_group,
121122} )
123124_.Debug { fg = ui_normal, bg = debug, bold = true, }
124125_.Normal { fg = content_normal, bg = content_backdrop, }
125_.NotifyBackground { bg = ui_backdrop, }
126126_.Comment { fg = content_important_global, }
127_.NotifyBackground { bg = ui_backdrop, }
127128_.LineNr { fg = ui_minor, bg = content_backdrop, }
128129_.CursorLineNr { fg = ui_focus, bg = ui_backdrop, }
129130_.Search { bg = content_unfocus, }
204205_.Define = _.PreProc
205206_.Macro = _.PreProc
206207_.PreCondit = _.PreProc
208_.Parameter { fg = content_focus, }
208210_.Type = _.Statement
209211_.StorageClass = _.Statement
276278_['@function'] = _.Function
277279_['@function.builtin'] = _.Special
278280_['@function.macro'] = _.Macro
279_['@parameter'] = _.Identifier
281_['@parameter'] = _.Parameter
280282_['@method'] = _.Function
281283_['@field'] = _.Identifier
282284_['@property'] = _.Identifier
293295_['@type.definition'] = _.Typedef
294296_['@storageclass'] = _.StorageClass
295297_['@structure'] = _.Structure
296_['@namespace'] = _.Identifier
298_['@namespace'] = _.PreProc
297299_['@include'] = _.Include
298300_['@preproc'] = _.PreProc
299301_['@debug'] = _.Debug
518520_.IblWhitespace = _.Whitespace
519521_.IblScope { fg = ui_focus, bg = _.Normal.bg, }
521_.Hlargs { fg = content_important_local, }
523524_.MiniStarterCurrent { fg = ui_normal, bg = ui_accent, }
524525_.MiniStarterFooter = _.Keyword
533534--TODO: Oil highlights
535536return function ()
536 preview.setup()
537 local namespace = 0
538 for name, group in pairs( _.groups ) do
539 vim.api.nvim_set_hl( namespace, name, group )
540 end
537 preview.setup()
538 local namespace = 0
539 for name, group in pairs( _.groups ) do
540 vim.api.nvim_set_hl( namespace, name, group )
541 end
541542end

neovim/lua/bugabinga/options/behaviour.lua

Modified

+8 / −6 text lines

1local debug = require 'std.debug'
1local debug = require 'std.dbg'
22local auto = require 'std.auto'
44-- How many milliseconds must pass before neovim decides I was "idle"
3434-- try to guess indentation based on context
3535vim.opt.smartindent = true
36-- Keep indentation of new lines in line with previuos lines
36-- Keep indentation of new lines in line with previous lines
3737vim.opt.autoindent = true
3838vim.opt.copyindent = true
5858require 'bugabinga.health'.add_dependency
6060 name = 'Nushell',
61 name_of_executable = 'nu'
61 name_of_executable = 'nu',
6464-- highlight all search matches
8080require 'bugabinga.health'.add_dependency
8282 name = 'Ripgrep',
83 name_of_executable = 'rg'
83 name_of_executable = 'rg',
8686-- ask me to force failed commands
8989auto 'load_project_if_available' {
9090 description = 'Loads the project root dir as cwd, if it can be determined from a file path.',
91 events = { 'FileType' },
91 events = { 'FileType', },
9292 pattern = '*',
9393 command = function ( event )
9494 local project = require 'std.project'
100100 if table.contains( ignored.filetypes, filetype ) then return end
101101 local buftype = vim.api.nvim_buf_get_option( buffer, 'buftype' )
102102 if table.contains( ignored.buftypes, buftype ) then return end
103 local root = vim.fs.normalize( project.find_root_by_filetype( file, filetype ) )
103 local project_root = project.find_root_by_filetype( file, filetype )
104 if not project_root then return end
105 local root = vim.fs.normalize( project_root )
104106 local cwd = vim.fs.normalize( vim.uv.cwd() )
105107 if root and cwd ~= root then
106108 vim.uv.chdir( root )

neovim/lua/bugabinga/options/commands.lua

Added
new file mode 100644

+12 / −0 text lines

1local light_up = require 'std.light_up'
2local user_command = require 'std.user_command'
3
4local light_up_current_buffer = function ()
5 local group_names = light_up.get_vim_highlight_groups()
6 light_up.buffer( 0, group_names )
7end
8
9user_command.LightUp
10'Highlight hl-group names in current buffer' (
11 light_up_current_buffer
12 )

neovim/lua/bugabinga/options/file.lua

Modified

+8 / −0 text lines

2525-- enable persistent undo. save undo history across neovim instances
2626vim.opt.undofile = true
28vim.filetype.add {
29 extension = {
30 norg = 'norg',
31 },
32 pattern = {
33 ['.*/%.vscode/.*%.json'] = 'json5', -- These json files frequently have comments
34 },
35}

neovim/lua/bugabinga/options/init.lua

Modified

+1 / −0 text lines

55require 'bugabinga.options.file'
66require 'bugabinga.options.keymaps'
77require 'bugabinga.options.spelling'
8require 'bugabinga.options.commands'
910-- disable some runtime providers that i will not use.
1011-- keeps checkhealth clean

neovim/lua/bugabinga/options/keymaps.lua

Modified

+17 / −57 text lines

11local map = require 'std.map'
2local const = require 'bugabinga.const'
23local togglers = require 'bugabinga.options.togglers'
45-- set <SPACE> as leader key
1819 local current_buffer = 0
1920 local current_line = vim.api.nvim_win_get_cursor( current_buffer )[1]
2021 local strict_indexing = false
21 local newline = { '' }
22 local newline = { '', }
2223 vim.api.nvim_buf_set_lines( current_buffer, current_line, current_line, strict_indexing, newline )
2324 end,
3132 local current_buffer = 0
3233 local current_line = vim.api.nvim_win_get_cursor( current_buffer )[1] - 1
3334 local strict_indexing = false
34 local newline = { '' }
35 local newline = { '', }
3637 vim.api.nvim_buf_set_lines( current_buffer, current_line, current_line, strict_indexing, newline )
3738 end,
7980 command = '<nop>',
82-- system clipboard copy and paste
83map.normal.visual {
84 description = 'system clipboard motion',
85 category = 'editing',
86 keys = '<c-s-v>',
87 command = '"+',
88}
90map.insert {
91 description = 'Cycle through autocomplete popup',
92 category = 'editing',
93 keys = '<tab>',
94 options = { expr = true },
95 command = function () return vim.fn.pumvisible() == 1 and '<C-n>' or '<tab>' end,
96}
98--TODO make global
99local win32 = vim.loop.os_uname().sysname:match 'Win'
100local wsl2 = vim.loop.os_uname().release:match 'WSL2'
10283local function open_link_under_cursor()
10384 ---@diagnostic disable-next-line: missing-parameter
10485 local file_under_cursor = vim.fn.expand '<cfile>'
10788 if file_under_cursor and file_under_cursor:match '%a+://.+' then
10889 vim.system(
10990 ---@diagnostic disable-next-line: assign-type-mismatch
110 (win32 or wsl2) and { 'cmd.exe', '/C', 'start', 'msedge', file_under_cursor }
111 or { 'firefox', file_under_cursor },
112 { text = true },
91 (const.win32 or const.wsl2) and { 'cmd.exe', '/C', 'start', 'msedge', file_under_cursor, }
92 or { 'firefox', file_under_cursor, },
93 { text = true, },
11394 function ( completed )
11495 if completed.code == 0 then
115 vim.schedule( function () vim.notify( 'Opened ' .. file_under_cursor ) end )
96 vim.schedule( function ()
97 vim.notify( 'Opened ' .. file_under_cursor )
98 end )
11699 else
117100 error( 'Failed to open ' .. file_under_cursor .. ' because: ' .. completed.stderr )
118101 end
130113 command = open_link_under_cursor,
133map.normal {
134 description = 'Grep search for word under cursor',
135 category = 'search',
136 keys = 'gw',
137 command = '<cmd>grep <cword> . <cr>',
138}
140116map.normal {
141117 description = 'Dismiss current search highlight',
142118 category = 'search',
143119 keys = '<esc><esc>',
144 command = function () vim.cmd [[ nohlsearch ]] end,
120 command = function ()
121 vim.cmd [[ nohlsearch ]]
122 end,
147125map.normal {
149127 category = 'ui',
150128 keys = '<leader>tt',
151129 command = function ()
130 ---@diagnostic disable-next-line: undefined-field
152131 if vim.opt.background:get() == 'dark' then
153132 vim.opt.background = 'light'
154133 else
155134 vim.opt.background = 'dark'
156135 end
136---@diagnostic disable-next-line: undefined-field
157137 vim.notify( 'Toggled background to ' .. vim.opt.background:get() .. '.' )
158138 end,
179159 command = vim.cmd.redo,
182map.normal {
183 description = 'Run save actions',
184 category = 'edit',
185 keys = '<c-s>',
186 command = function ()
187 -- trim
188 vim.cmd 'TrimTrailingWhitespace'
190 -- format
191 vim.lsp.buf.format { async = false }
193 -- TODO: run makeprg
194 -- vim.cmd [[silent make]]
196 -- save
197 vim.cmd [[wa]]
199 -- workaround for neovim bug:https://github.com/neovim/neovim/issues/25370
200 vim.api.nvim_feedkeys( 'zz', 'n', true )
201 end,
202}
204162for _, toggler in ipairs( togglers ) do
205163 local option_name = toggler.options[1].name
206164 local first_char = string.sub( option_name, 1, 1 )
209167 description = 'Toggle ' .. option_name .. ' option',
210168 category = 'options',
211169 keys = '<leader>to' .. first_char,
212 command = function () toggler:toggle() end,
170 command = function ()
171 toggler:toggle()
172 end,
213173 }
214174end

neovim/lua/bugabinga/options/ui.lua

Modified

+67 / −81 text lines

33local ignored = require 'std.ignored'
55auto 'highlight_yanked_text' {
6 description = 'briefly highlight yanked text',
7 events = 'TextYankPost',
8 pattern = '*',
9 command = function () vim.highlight.on_yank() end,
6 description = 'briefly highlight yanked text',
7 events = 'TextYankPost',
8 pattern = '*',
9 command = function () vim.highlight.on_yank() end,
1212auto 'disable_columns_in_special_buffers' {
13 description = 'Hide columns in buffers, that do not show source code.',
14 events = { 'FileType' },
15 pattern = ignored.filetypes,
16 command = function ()
17 vim.opt_local.colorcolumn = {}
18 vim.opt_local.signcolumn = 'no'
19 vim.opt_local.foldcolumn = '0'
20 vim.opt_local.number = false
21 end,
13 description = 'Hide columns in buffers, that do not show source code.',
14 events = { 'FileType', },
15 pattern = ignored.filetypes,
16 command = function ()
17 vim.opt_local.colorcolumn = {}
18 vim.opt_local.signcolumn = 'no'
19 vim.opt_local.foldcolumn = '0'
20 vim.opt_local.number = false
21 end,
24-- TODO: this should probably live in nugu?
26-- local hl_to_mode = {
27-- n = { bg = 'black' },
28-- i = { bg = 'blue' },
29-- v = { bg = 'green' },
30-- }
31--
32-- auto 'change_cursor_highlight_based_on_mode' {
33-- description = 'Changes the highlight of the cursor based on the current mode.',
34-- events = 'ModeChanged',
35-- command = function ()
36-- local current_mode = vim.fn.mode()
37-- local hl = hl_to_mode[current_mode]
38-- vim.notify( 'changing Cursor highlight for mode ' .. current_mode .. ' to ' .. vim.inspect( hl ) )
39-- if hl then
40-- vim.api.nvim_set_hl( 0, 'Cursor', hl )
41-- end
42-- end,
43-- }
4524-- show trailing whitespace
4625vim.opt.list = true
4726vim.opt.listchars = {
48 space = icon.space,
49 -- eol = icon.eol,
50 tab = icon.tab .. ' ',
51 trail = icon.trail,
52 extends = icon.extends,
53 precedes = icon.precedes,
54 nbsp = icon.nbsp,
27 -- space = icon.space,
28 -- eol = icon.eol,
29 -- tab = icon.tab .. icon.middle_ellipsis,
30 tab = ' ',
31 trail = icon.trail,
32 extends = icon.extends,
33 precedes = icon.precedes,
34 nbsp = icon.nbsp,
57-- force english messages
37-- force English messages
5838vim.cmd [[ language mes en_US.utf8 ]]
6040-- do not spam the cmdline with every little input
6242vim.opt.wildmode = 'list:longest'
6444-- virtually break lines on border
65vim.opt.wrap = true
6746-- always display the signcolumn to avoid jitter
6847vim.opt.signcolumn = 'yes:1'
7655-- hide weird symbol at end of buffer
7756vim.opt.fillchars = {
78 eob = ' ',
79 lastline = ' ',
80 diff = '╱',
81 wbr = ' ',
57 eob = ' ',
58 lastline = ' ',
59 diff = '╱',
60 wbr = ' ',
83 horiz = '─',
84 horizup = '┴',
85 horizdown = '┬',
86 vert = '│',
87 vertleft = '┤',
88 vertright = '├',
89 verthoriz = '┼',
62 horiz = '─',
63 horizup = '┴',
64 horizdown = '┬',
65 vert = '│',
66 vertleft = '┤',
67 vertright = '├',
68 verthoriz = '┼',
9271-- better have no syntax highlighting than regex based, treesitter will take over later
93vim.cmd.syntax 'off'
72vim.opt.syntax = 'off'
9574-- hide output of insert completion popup in status
9675vim.opt.shortmess:append 'c'
9978-- truncate messages at end
10079vim.opt.shortmess:append 't'
102-- show cmd window to prevent jitter ui
81-- show cmd window to prevent jitter UI
10382vim.opt.cmdheight = 1
105-- do not conceal special characters by default. filestypes can enable this on demand.
84-- do not conceal special characters by default. ftplugin can enable this on demand.
10685vim.opt.conceallevel = 0
10887-- I do not care for folding
10988vim.opt.foldenable = false
11190-- show visual indicators for lines too long
112vim.opt.colorcolumn = { '80', '120', '140' }
91vim.opt.colorcolumn = { '80', '120', '140', }
11493-- highlight the current line
11594vim.opt.cursorline = false
126105-- hide the mode indicator in status
127106vim.opt.showmode = false
129-- always show tabs, to avoid jitter ui
108-- always show tabs, to avoid jitter UI
130109vim.opt.showtabline = 2
132-- Use true colors
133vim.opt.termguicolors = true
134vim.opt.lazyredraw = false
111local is_tty = os.getenv 'XDG_SESSION_TYPE' == 'tty' and os.getenv 'SSH_TTY' == ''
112if is_tty then
113 vim.opt.termguicolors = false
114 vim.g.nerdfont = false
115 vim.opt.lazyredraw = true
116else
117 vim.opt.termguicolors = true
118 vim.g.nerdfont = true
119 vim.opt.lazyredraw = false
120end
136122-- scroll by screen lines if buffer is wrapped
137123vim.opt.smoothscroll = true
148134-- neovide only options
149135if vim.g.neovide then
150 -- vim.g.neovide_floating_blur_amount_x = 12.0
151 -- vim.g.neovide_floating_blur_amount_y = 12.0
152 -- vim.g.neovide_scroll_animation_length = 0.69
153 -- vim.g.neovide_fullscreen = true
154 vim.g.neovide_remember_window_size = true
155 vim.g.neovide_profiler = false
156 -- vim.g.neovide_cursor_animation_length = 0.42
157 -- vim.g.neovide_cursor_trail_length = 0.42
158 vim.g.neovide_cursor_vfx_mode = 'railgun'
159 -- vim.g.neovide_cursor_unfocused_outline_width = 0.125
160 vim.g.neovide_cursor_antialiasing = true
161 vim.g.neovide_padding_top = 0
162 vim.g.neovide_padding_bottom = 0
163 vim.g.neovide_padding_right = 0
164 vim.g.neovide_padding_left = 0
165 vim.g.neovide_hide_mouse_when_typing = true
166 vim.g.neovide_theme = 'auto'
167 vim.g.neovide_refresh_rate = vim.uv.os_gethostname() == 'pop-os' and 144 or 60
168 vim.g.neovide_refresh_rate_idle = 5
136 -- vim.g.neovide_floating_blur_amount_x = 12.0
137 -- vim.g.neovide_floating_blur_amount_y = 12.0
138 -- vim.g.neovide_scroll_animation_length = 0.69
139 -- vim.g.neovide_fullscreen = true
140 vim.g.neovide_remember_window_size = true
141 vim.g.neovide_profiler = false
142 -- vim.g.neovide_cursor_animation_length = 0.42
143 -- vim.g.neovide_cursor_trail_length = 0.42
144 vim.g.neovide_cursor_vfx_mode = 'railgun'
145 -- vim.g.neovide_cursor_unfocused_outline_width = 0.125
146 vim.g.neovide_cursor_antialiasing = true
147 vim.g.neovide_padding_top = 0
148 vim.g.neovide_padding_bottom = 0
149 vim.g.neovide_padding_right = 0
150 vim.g.neovide_padding_left = 0
151 vim.g.neovide_hide_mouse_when_typing = true
152 vim.g.neovide_theme = 'auto'
153 vim.g.neovide_refresh_rate = vim.uv.os_gethostname() == 'pop-os' and 144 or 60
154 vim.g.neovide_refresh_rate_idle = 5
169155end

neovim/lua/bugabinga/plugins/actions-preview.lua

Modified

+21 / −25 text lines

11local map = require 'std.map'
3map.normal.visual {
4 description = 'Open Code Actions Preview...',
5 category = 'lsp',
6 keys = '<leader>la',
7 command = function () require 'actions-preview'.code_actions() end,
8}
9
310return {
411 'aznhe21/actions-preview.nvim',
5 keys = { '<leader>lap', mode = { 'n', 'v' } },
6 config = function ()
7 local actions_preview = require 'actions-preview'
8 actions_preview.setup {
9 telescope = {
10 sorting_strategy = 'ascending',
11 layout_strategy = 'vertical',
12 layout_config = {
13 width = 0.69,
14 height = 0.42,
15 prompt_position = 'top',
16 preview_cutoff = 21,
17 preview_height = function ( _, _, max_lines )
18 return max_lines - 16
19 end,
20 },
12 opts = {
13 telescope = {
14 sorting_strategy = 'ascending',
15 layout_strategy = 'vertical',
16 layout_config = {
17 width = 0.69,
18 height = 0.42,
19 prompt_position = 'top',
20 preview_cutoff = 21,
21 preview_height = function ( _, _, max_lines )
22 return max_lines - 16
23 end,
2124 },
22 }
24 map.normal {
25 description = 'Open Code Actions Preview...',
26 category = 'lsp',
27 keys = '<leader>lap',
28 command = function () actions_preview.code_actions() end,
29 }
30 end
25 },
26 },

neovim/lua/bugabinga/plugins/align.lua

Deleted
deleted file mode 100644

+0 / −15 text lines

1return {
2 'echasnovski/mini.align',
3 keys = {
4 { 'gA', mode = 'x' }
5 },
6 config = function ()
7 local align = require 'mini.align'
8 align.setup {
9 -- these need to be consistent with treesitter-textobject movements
10 comment = { suffix = 't' },
11 file = { suffix = 'e' },
12 oldfile = { suffix = '' },
13 }
14 end,
15}

neovim/lua/bugabinga/plugins/auto-dark-mode.lua

Modified

+2 / −1 text lines

11return {
22 'f-person/auto-dark-mode.nvim',
33 dev = true,
4 event = 'VeryLazy',
4 -- event = 'VeryLazy',
5 lazy = false,
56 opts = {
67 -- interval of 0 freezes neovim on quit
78 -- update_interval = 0,

neovim/lua/bugabinga/plugins/cmp.lua

Added
new file mode 100644

+142 / −0 text lines

1local map = require 'std.map'
2local user_command = require 'std.user_command'
3local icon = require 'std.icon'
4
5return {
6 'hrsh7th/nvim-cmp',
7 lazy = false,
8 dependencies = {
9 'hrsh7th/cmp-nvim-lsp',
10 'hrsh7th/cmp-buffer',
11 'hrsh7th/cmp-path',
12 'hrsh7th/cmp-nvim-lua',
13 'saadparwaiz1/cmp_luasnip',
14 'onsails/lspkind.nvim',
15 'L3MON4D3/LuaSnip',
16 },
17 config = function ()
18 local cmp = require 'cmp'
19 local luasnip = require 'luasnip'
20 local MAX_INDEX_FILE_SIZE = 4000
22 local has_words_before = function ()
23 local line, col = unpack( vim.api.nvim_win_get_cursor( 0 ) )
24 return col ~= 0 and vim.api.nvim_buf_get_lines( 0, line - 1, line, true )[1]:sub( col, col ):match '%s' == nil
25 end
27 local snippet_next = function ( fallback )
28 if luasnip.expand_or_jumpable() then
29 luasnip.expand_or_jump()
30 elseif cmp.visible() then
31 cmp.select_next_item()
32 elseif has_words_before() then
33 cmp.complete()
34 else
35 fallback()
36 end
37 end
39 local snippet_prev = function ( fallback )
40 if luasnip.jumpable( -1 ) then
41 luasnip.jump( -1 )
42 elseif cmp.visible() then
43 cmp.select_prev_item()
44 else
45 fallback()
46 end
47 end
49 local mapping = cmp.mapping.preset.insert {
50 ['<C-d>'] = cmp.mapping.scroll_docs( -4 ),
51 ['<C-f>'] = cmp.mapping.scroll_docs( 4 ),
52 ['<C-e>'] = cmp.mapping.close(),
53 ['<C-y>'] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, },
54 ['<C-space>'] = cmp.mapping.complete(),
55 ['<Tab>'] = cmp.mapping( snippet_next, { 'i', 's', } ),
56 ['<S-Tab>'] = cmp.mapping( snippet_prev, { 'i', 's', } ),
57 }
59 --TODO: use custom icons
60 local formatting = {}
61 local ok, lspkind = pcall( require, 'lspkind' )
62 if ok then
63 formatting.format = lspkind.cmp_format {
64 mode = 'symbol',
65 symbol_map = {
66 Copilot = icon.copilot,
67 Class = icon.class,
68 Color = icon.color,
69 Constant = icon.constant,
70 Constructor = icon.constructor,
71 Enum = icon.enum,
72 EnumMember = icon.enum_member,
73 Event = icon.event,
74 Field = icon.field,
75 File = icon.file,
76 Folder = icon.folder,
77 Function = icon['function'],
78 Interface = icon.interface,
79 Keyword = icon.keyword,
80 Method = icon.method,
81 Module = icon.module,
82 Operator = icon.operator,
83 Property = icon.property,
84 Reference = icon.reference,
85 Snippet = icon.snippet,
86 Struct = icon.struct,
87 Text = icon.text,
88 TypeParameter = icon.type_parameter,
89 Unit = icon.unit,
90 Value = icon.value,
91 Variable = icon.variable,
92 },
93 menu = {
94 buffer = '[buf]',
95 nvim_lsp = '[LSP]',
96 nvim_lua = '[nvim]',
97 path = '[path]',
98 luasnip = '[snip]',
99 },
100 }
101 end
103 local sources = {
104 { name = 'nvim_lua', },
105 { name = 'nvim_lsp', },
106 { name = 'path', },
107 { name = 'luasnip', },
108 { name = 'neorg', },
109 {
110 name = 'buffer',
111 keyword_length = 4,
112 options = {
113 get_bufnrs = function ()
114 local bufs = {}
115 for _, bufnr in ipairs( vim.api.nvim_list_bufs() ) do
116 -- Don't index giant files
117 if vim.api.nvim_buf_is_loaded( bufnr ) and vim.api.nvim_buf_line_count( bufnr ) < MAX_INDEX_FILE_SIZE then
118 table.insert( bufs, bufnr )
119 end
120 end
121 return bufs
122 end,
123 },
124 },
125 }
127 cmp.setup {
128 mapping = mapping,
129 formatting = formatting,
130 sources = sources,
132 completion = { autocomplete = false, },
133 snippet = {
134 expand = function ( args )
135 luasnip.lsp_expand( args.body )
136 end,
137 },
139 -- experimental = { native_menu = false, },
140 }
141 end,
142}

neovim/lua/bugabinga/plugins/colorizer.lua

Modified

+2 / −2 text lines

11return {
22 {
33 'JosefLitos/colorizer.nvim',
4 event = { 'BufReadPost', 'BufNew', },
4 event = vim.g.FILE_LOADED_EVENTS,
55 opts = {
66 filetypes = { '*', },
77 user_default_options = {
1515 css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
1616 -- Available modes for `mode`: foreground, background, virtualtext
1717 mode = 'virtualtext', -- Set the display mode.
18 names = function () return require 'bugabinga.nugu.palette' end,
18 -- names = function () return require 'bugabinga.nugu.palette' end,
1919 -- parsers can contain values used in |user_default_options|
2020 sass = { enable = false, parsers = { 'css', }, }, -- Enable sass colors
2121 virtualtext = '██',

neovim/lua/bugabinga/plugins/comment.lua

Modified

+1 / −1 text lines

11return { {
22 'numToStr/Comment.nvim',
3 tag = 'v0.8.0',
3 version = '0.*',
44 keys = {
55 { 'gc', mode = { 'n', 'v', }, desc = 'Comment toggle linewise', },
66 { 'gb', mode = { 'n', 'v', }, desc = 'Comment toggle blockwise', },

neovim/lua/bugabinga/plugins/commentstring.lua

Modified

+1 / −1 text lines

44 init = function ()
55 vim.g.skip_ts_context_commentstring_module = true
66 end,
7 opts = { enable_autocmd = false },
7 opts = { enable_autocmd = false, },
88}

neovim/lua/bugabinga/plugins/dap.lua

Added
new file mode 100644

+59 / −0 text lines

1--FIXME: own this
2return {
3 {
4 'mfussenegger/nvim-dap',
5 dependencies = {
6 'rcarriga/nvim-dap-ui',
7 { 'theHamsta/nvim-dap-virtual-text', config = true, },
8 { 'stevearc/overseer.nvim', },
9 },
10 keys = {
11 { '<leader>dc', "<cmd>lua require'dap'.continue()<CR>", mode = 'n', desc = '[D]ebug [C]ontinue', },
12 { '<leader>dj', "<cmd>lua require'dap'.step_over()<CR>", mode = 'n', desc = '[D]ebug step over', },
13 { '<leader>di', "<cmd>lua require'dap'.step_into()<CR>", mode = 'n', desc = '[D]ebug step [I]nto', },
14 { '<leader>do', "<cmd>lua require'dap'.step_out()<CR>", mode = 'n', desc = '[D]ebug step [O]ut', },
15 { '<leader>dl', "<cmd>lua require'dap'.run_last()<CR>", mode = 'n', desc = '[D]ebug run [L]ast', },
16 { '<leader>dr', "<cmd>lua require'dap'.repl.open()<CR>", mode = 'n', desc = '[D]ebug open [R]epl', },
17 { '<leader>dq', "<cmd>lua require'dap'.terminate()<CR>", mode = 'n', desc = '[D]ebug [Q]uit', },
18 { '<leader>db', "<cmd>lua require'dap'.toggle_breakpoint()<CR>", mode = 'n', desc = '[D]ebug set [B]reakpoint', },
19 {
20 '<leader>dB',
21 function ()
22 vim.ui.input( { prompt = 'Breakpoint condition', }, function ( cond )
23 if cond then
24 require 'dap' .set_breakpoint( cond )
25 end
26 end )
27 end,
28 mode = 'n',
29 desc = '[D]ebug set conditional [B]reakpoint',
30 },
31 },
32 config = function ()
33 -- dap.set_log_level("DEBUG")
34 vim.fn.sign_define( 'DapBreakpoint', { text = '•', texthl = 'DiagnosticError', linehl = '', numhl = '', } )
35 vim.fn.sign_define( 'DapBreakpointCondition', { text = '?', texthl = 'DiagnosticError', linehl = '', numhl = '', } )
36 vim.fn.sign_define( 'DapLogPoint', { text = '⁋', texthl = '', linehl = '', numhl = '', } )
37 vim.fn.sign_define( 'DapStopped', { text = ' ', texthl = 'DiagnosticInfo', linehl = '', numhl = '', } )
38 vim.fn.sign_define( 'DapBreakpointRejected', { text = 'X', texthl = 'DiagnosticError', linehl = '', numhl = '', } )
40 local dapui = require 'dapui'
41 local dap = require 'dap'
42 dapui.setup()
43 dap.listeners.after.event_initialized['dapui_config'] = function ()
44 dapui.open()
45 end
46 dap.listeners.before.event_terminated['dapui_config'] = function ()
47 dapui.close()
48 end
49 dap.listeners.before.event_exited['dapui_config'] = function ()
50 dapui.close()
51 end
52 vim.schedule( function ()
53 require 'dap.ext.vscode' .json_decode = require 'overseer.json' .decode
54 require 'dap.ext.vscode' .load_launchjs( nil, { node = { 'typescript', 'javascript', }, } )
55 require 'overseer' .patch_dap( true )
56 end )
57 end,
58 },
59}

neovim/lua/bugabinga/plugins/devicons.lua

Modified

+2 / −2 text lines

1return { {
1return {
22 'nvim-tree/nvim-web-devicons',
33 opts = {
44 -- instead of creating a highlight for every single icon, use only the
55 -- DefaultDevIcon highlight for all
66 color_icons = false,
77 },
8}, }
8}

neovim/lua/bugabinga/plugins/diffview.lua

Modified

+10 / −1 text lines

1local map = require 'std.map'
2
3map.normal {
4 keys = '<leader>vd',
5 description = 'Opens Diffview',
6 category = 'vcs',
7 command = '<cmd>DiffviewOpen<cr>',
8}
9
110return {
211 'sindrets/diffview.nvim',
3 cmd = { 'DiffviewOpen', 'DiffviewToggleFiles' },
12 cmd = { 'DiffviewOpen', },
413 opts = {},
514}

neovim/lua/bugabinga/plugins/dressing.lua

Modified

+66 / −2 text lines

1--FIXME: own this. is vim.ui.open shim still necessary?
12return {
2 'stevearc/dressing.nvim',
3 "stevearc/dressing.nvim",
34 lazy = false,
4 opts = {},
5 opts = {
6 input = {
7 insert_only = false,
8 -- relative = "editor",
9 win_options = {
10 sidescrolloff = 4,
11 },
12 get_config = function()
13 if vim.api.nvim_win_get_width(0) < 50 then
14 return {
15 relative = "editor",
16 }
17 end
18 end,
19 },
20 select = {
21 backend = { "telescope", "builtin", "fzf_lua" },
22 },
23 },
24 config = function(_, opts)
25 require("dressing").setup(opts)
27 -- Shim for vim.ui.open
28 if vim.ui.open then
29 return
30 end
32 ---Copied from vim.ui.open in Neovim 0.10+
33 ---@param path string
34 ---@return nil|string[] cmd
35 ---@return nil|string error
36 local function get_open_cmd(path)
37 if vim.fn.has("mac") == 1 then
38 return { "open", path }
39 elseif vim.fn.has("win32") == 1 then
40 if vim.fn.executable("rundll32") == 1 then
41 return { "rundll32", "url.dll,FileProtocolHandler", path }
42 else
43 return nil, "rundll32 not found"
44 end
45 elseif vim.fn.executable("wslview") == 1 then
46 return { "wslview", path }
47 elseif vim.fn.executable("xdg-open") == 1 then
48 return { "xdg-open", path }
49 else
50 return nil, "no handler found"
51 end
52 end
54 vim.ui.open = function(path)
55 local is_uri = path:match("%w+:")
56 if not is_uri then
57 path = vim.fn.expand(path)
58 end
59 local cmd, err = get_open_cmd(path)
60 if not cmd or err then
61 return nil, err
62 end
63 local jid = vim.fn.jobstart(cmd, { detach = true })
64 if jid <= 0 then
65 return nil, "Failed to start job"
66 end
67 end
68 end,
569}

neovim/lua/bugabinga/plugins/fidget.lua

Modified

+7 / −6 text lines

1local debug = require 'std.debug'
1local debug = require 'std.dbg'
33return {
44 'j-hui/fidget.nvim',
5 version = '1.4.0',
6 event = 'LspAttach',
5 version = '1.*',
6 event = 'VeryLazy',
77 opts = {
88 progress = {
9 suppress_on_insert = false, -- Suppress new messages while in insert mode
9 poll_rate = 500, -- How and when to poll for progress messages
10 suppress_on_insert = true, -- Suppress new messages while in insert mode
1011 lsp = {
11 log_handler = debug.get, -- Log `$/progress` handler invocations (for debugging)
12 log_handler = debug.get(), -- Log `$/progress` handler invocations (for debugging)
1213 },
1314 },
1415 notification = {
15 filter = debug.get and vim.log.levels.DEBUG,
16 filter = debug.get() and vim.log.levels.DEBUG or vim.log.levels.INFO,
1617 override_vim_notify = true, -- Automatically override vim.notify() with Fidget
1718 },
1819 },

neovim/lua/bugabinga/plugins/flash.lua

Modified

+10 / −16 text lines

1local map = require 'std.map'
2
3map.normal.visual.operator_pending {
4 keys = '<cr>',
5 category = 'navigation',
6 description = 'Jump to occurence of next chars quickly',
7 command = function () require 'flash'.jump() end,
8}
9
110return {
211 'folke/flash.nvim',
3 tag = 'v1.18.2',
12 version = '1.*',
413 event = 'VeryLazy',
514 opts = {
615 highlight = { backdrop = false, },
716 modes = { char = { highlight = { backdrop = false, }, },
817 },
918 },
10 keys = {
11 {
12 '<cr>',
13 mode = { 'n', 'x', 'o', },
14 function () require 'flash'.jump() end,
15 desc = 'Flash',
16 },
17 {
18 '<s-cr>',
19 mode = { 'n', 'o', 'x', },
20 function () require 'flash'.treesitter() end,
21 desc =
22 'Flash Treesitter',
23 },
24 },

neovim/lua/bugabinga/plugins/format.lua

Added
new file mode 100644

+54 / −0 text lines

1local debug = require 'std.dbg'
2local map = require 'std.map'
3local user_command = require 'std.user_command'
4
5local format = function ()
6 prequire 'conform'.format( { async = false, lsp_fallback = true, }, function ( err )
7 if err and debug.get() then
8 vim.print( 'Format failed', err )
9 end
10 end )
11end
13map.N {
14 description = 'Format buffer',
15 category = 'format',
16 keys = '=',
17 command = format,
18}
20user_command.Format
21'Format the current buffer' (
22 format
23 )
25return {
26 'stevearc/conform.nvim',
27 cmd = { 'ConformInfo', },
28 opts = {
29 formatters_by_ft = {
30 -- https://github.com/razziel89/mdslw/issues/14
31 markdown = { 'mdslw', },
32 -- lua = { "stylua" },
33 toml = { 'taplo', },
34 sh = { 'shfmt', },
35 just = { 'just', },
36 zig = { 'zigfmt', },
37 -- Use the "*" file type to run formatters on all file types.
38 ['*'] = { 'injected', 'typos', },
39 -- Use the "_" file type to run formatters on file types that don't
40 -- have other formatters configured.
41 ['_'] = { 'trim_whitespace', 'trim_newlines', },
42 },
43 formatters = {
44 mdslw = {
45 -- remove `:` from the default set of end markers
46 -- prepend_args = { '--end-markers', '?!.', },
47 },
48 },
49 log_level = debug.get() and vim.log.levels.TRACE or vim.log.levels.INFO,
50 },
51 init = function ()
52 vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
53 end,
54}

neovim/lua/bugabinga/plugins/gen.lua

Deleted
deleted file mode 100644

+0 / −17 text lines

1require 'bugabinga.health'.add_dependency
2{
3 name_of_executable = 'ollama',
4}
5return {
6 'David-Kunz/gen.nvim',
7 cmd = 'Gen',
8 opts = {
9 -- model = 'codellama:7b-instruct',
10 model = 'codellama',
11 display_mode = 'split',
12 show_prompt = true,
13 show_model = true,
14 no_auto_close = true,
15 debug = require 'std.debug'.get(),
16 }
17}

neovim/lua/bugabinga/plugins/genghis.lua

Modified

+72 / −14 text lines

1local map = require 'std.map'
2
3map.normal {
4 keys = '<leader>fn',
5 category = 'files',
6 description = 'Create new file',
7 command = function () require 'genghis'.createNewFile() end,
8}
9
10map.visual {
11 keys = '<leader>fx',
12 category = 'files',
13 description = 'Move selection to new file',
14 command = function () require 'genghis'.moveSelectionToNewFile() end,
15}
17map.normal {
18 keys = '<leader>fy',
19 category = 'files',
20 description = 'Yank file name',
21 command = function () require 'genghis'.copyFilename() end,
22}
24map.normal {
25 keys = '<leader>fY',
26 category = 'files',
27 description = 'Yank file path',
28 command = function () require 'genghis'.copyFilepath() end,
29}
31map.normal {
32 keys = '<leader>fc',
33 category = 'files',
34 description = 'Change file mode/permissions',
35 command = function () require 'genghis'.chmodx() end,
36}
38map.normal {
39 keys = '<leader>fr',
40 category = 'files',
41 description = 'Rename file',
42 command = function () require 'genghis'.renameFile() end,
43}
45map.normal {
46 keys = '<leader>fm',
47 category = 'files',
48 description = 'Move file',
49 command = function () require 'genghis'.moveAndRenameFile() end,
50}
52map.normal {
53 keys = '<leader>fM',
54 category = 'files',
55 description = 'Move file to current working directory',
56 command = function () require 'genghis'.moveToFolderInCwd() end,
57}
59map.normal {
60 keys = '<leader>ff',
61 category = 'files',
62 description = 'Duplicate file',
63 command = function () require 'genghis'.duplicateFile() end,
64}
66map.normal {
67 keys = '<leader>fd',
68 category = 'files',
69 description = 'Move file to system trash',
70 command = function () require 'genghis'.trashFile() end,
71}
173return {
274 'chrisgrieser/nvim-genghis',
375 cmd = {
1991 dependencies = {
2092 'stevearc/dressing.nvim',
2193 },
22 config = function ()
23 local genghis = require 'genghis' -- no setup needed
24 local keymap = vim.keymap.set
25 keymap( 'n', '<leader>fp', genghis.copyFilepath )
26 keymap( 'n', '<leader>fN', genghis.copyFilename )
27 keymap( 'n', '<leader>fc', genghis.chmodx )
28 keymap( 'n', '<leader>fr', genghis.renameFile )
29 keymap( 'n', '<leader>fm', genghis.moveAndRenameFile )
30 keymap( 'n', '<leader>fi', genghis.moveToFolderInCwd )
31 keymap( 'n', '<leader>fn', genghis.createNewFile )
32 keymap( 'n', '<leader>fy', genghis.duplicateFile )
33 keymap( 'n', '<leader>fd', genghis.trashFile )
34 keymap( 'x', '<leader>fx', genghis.moveSelectionToNewFile )
35 end,

neovim/lua/bugabinga/plugins/gitsigns.lua

Modified

+106 / −98 text lines

1local map = require 'std.map'
1local map = require("std.map")
33return {
4 'lewis6991/gitsigns.nvim',
5 tag = 'v0.7',
6 event = 'VeryLazy',
4 "lewis6991/gitsigns.nvim",
5 version = "0.*",
6 event = vim.g.FILE_LOADED_EVENTS,
77 opts = {
88 signs = {
9 add = { text = '│', },
10 change = { text = '│', },
11 delete = { text = '_', },
12 topdelete = { text = '‾', },
13 changedelete = { text = '~', },
14 untracked = { text = '┆', },
9 add = { text = "│" },
10 change = { text = "│" },
11 delete = { text = "_" },
12 topdelete = { text = "‾" },
13 changedelete = { text = "~" },
14 untracked = { text = "┆" },
1515 },
1616 preview_config = {
1717 border = vim.g.border_style,
2020 current_line_blame_opts = {
2121 ignore_whitespace = true,
2222 },
23 current_line_blame_formatter = '<author>(<author_time:%d.%m.%Y>): <summary>',
24 on_attach = function ( bufnr )
25 local gitsigns = require 'gitsigns'
23 current_line_blame_formatter = "<author>(<author_time:%d.%m.%Y>): <summary>",
24 on_attach = function(bufnr)
25 local gitsigns = require("gitsigns")
27 map.normal {
28 description = 'Goto next hunk',
29 category = 'git',
30 keys = ']h',
27 map.normal({
28 description = "Goto next hunk",
29 category = "git",
30 keys = "]h",
3131 buffer = bufnr,
3232 command = gitsigns.next_hunk,
33 }
33 })
35 map.normal {
36 description = 'Goto previous hunk',
37 category = 'git',
38 keys = '[h',
35 map.normal({
36 description = "Goto previous hunk",
37 category = "git",
38 keys = "[h",
3939 buffer = bufnr,
4040 command = gitsigns.prev_hunk,
41 }
41 })
43 map.normal {
44 description = 'Stage hunk',
45 category = 'git',
46 keys = '<leader>hs',
43 map.normal({
44 description = "Stage hunk",
45 category = "git",
46 keys = "<leader>hs",
4747 buffer = bufnr,
4848 command = gitsigns.stage_hunk,
49 }
49 })
51 map.visual_select {
52 description = 'Stage hunk',
53 category = 'git',
54 keys = '<leader>hs',
51 map.visual_select({
52 description = "Stage hunk",
53 category = "git",
54 keys = "<leader>hs",
5555 buffer = bufnr,
56 command = function () gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v', } end,
57 }
56 command = function()
57 gitsigns.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
58 end,
59 })
59 map.normal {
60 description = 'Reset hunk',
61 category = 'git',
62 keys = '<leader>hr',
61 map.normal({
62 description = "Reset hunk",
63 category = "git",
64 keys = "<leader>hr",
6365 buffer = bufnr,
6466 command = gitsigns.reset_hunk,
65 }
67 })
67 map.visual_select {
68 description = 'Reset hunk',
69 category = 'git',
70 keys = '<leader>hr',
69 map.visual_select({
70 description = "Reset hunk",
71 category = "git",
72 keys = "<leader>hr",
7173 buffer = bufnr,
72 command = function () gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v', } end,
73 }
74 command = function()
75 gitsigns.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
76 end,
77 })
75 map.normal {
76 description = 'Undo stage hunk',
77 category = 'git',
78 keys = '<leader>hu',
79 map.normal({
80 description = "Undo stage hunk",
81 category = "git",
82 keys = "<leader>hu",
7983 buffer = bufnr,
8084 command = gitsigns.undo_stage_hunk,
81 }
85 })
83 map.normal {
84 description = 'Stage buffer',
85 category = 'git',
86 keys = '<leader>hS',
87 map.normal({
88 description = "Stage buffer",
89 category = "git",
90 keys = "<leader>hS",
8791 buffer = bufnr,
8892 command = gitsigns.stage_buffer,
89 }
93 })
91 map.normal {
92 description = 'Reset buffer',
93 category = 'git',
94 keys = '<leader>hR',
95 map.normal({
96 description = "Reset buffer",
97 category = "git",
98 keys = "<leader>hR",
9599 buffer = bufnr,
96100 command = gitsigns.reset_buffer,
97 }
101 })
99 map.normal {
100 description = 'Preview hunk',
101 category = 'git',
102 keys = '<leader>hp',
103 map.normal({
104 description = "Preview hunk",
105 category = "git",
106 keys = "<leader>hp",
103107 buffer = bufnr,
104108 command = gitsigns.preview_hunk,
105 }
109 })
107 map.normal {
108 description = 'Blame line',
109 category = 'git',
110 keys = '<leader>hb',
111 map.normal({
112 description = "Blame line",
113 category = "git",
114 keys = "<leader>hb",
111115 buffer = bufnr,
112 command = function () gitsigns.blame_line { full = true, } end,
113 }
116 command = function()
117 gitsigns.blame_line({ full = true })
118 end,
119 })
115 map.normal {
116 description = 'Diff this',
117 category = 'git',
118 keys = '<leader>hd',
121 map.normal({
122 description = "Diff this",
123 category = "git",
124 keys = "<leader>hd",
119125 buffer = bufnr,
120126 command = gitsigns.diffthis,
121 }
127 })
123 map.normal {
124 description = 'Diff this ~',
125 category = 'git',
126 keys = '<leader>hD',
129 map.normal({
130 description = "Diff this ~",
131 category = "git",
132 keys = "<leader>hD",
127133 buffer = bufnr,
128 command = function () gitsigns.diffthis '~' end,
129 }
134 command = function()
135 gitsigns.diffthis("~")
136 end,
137 })
131 map.normal {
132 description = 'Toggle current line blame',
133 category = 'git',
134 keys = '<leader>tb',
139 map.normal({
140 description = "Toggle current line blame",
141 category = "git",
142 keys = "<leader>tb",
135143 buffer = bufnr,
136144 command = gitsigns.toggle_current_line_blame,
137 }
145 })
139 map.normal {
140 description = 'Toggle removed lines',
141 category = 'git',
142 keys = '<leader>tr',
147 map.normal({
148 description = "Toggle removed lines",
149 category = "git",
150 keys = "<leader>tr",
143151 buffer = bufnr,
144152 command = gitsigns.toggle_deleted,
145 }
153 })
147 map.operator_pending.visual {
148 description = 'select hunk',
149 category = 'git',
150 keys = 'ih',
155 map.operator_pending.visual({
156 description = "select hunk",
157 category = "git",
158 keys = "ih",
151159 buffer = bufnr,
152 command = ':<C-U>Gitsigns select_hunk<CR>',
153 }
160 command = ":<C-U>Gitsigns select_hunk<CR>",
161 })
154162 end,
155163 },

neovim/lua/bugabinga/plugins/glow.lua

Modified

+10 / −0 text lines

33 name = 'Glow',
44 name_of_executable = 'glow',
55}
6
7local map = require 'std.map'
8
9map.normal {
10 description = 'Generate markdown preview',
11 keys = '<leader>gm',
12 category = 'preview',
13 command = '<cmd>Glow<cr>',
14}
616return {
717 'ellisonleao/glow.nvim',
818 cmd = 'Glow',

neovim/lua/bugabinga/plugins/hardtime.lua

Deleted
deleted file mode 100644

+0 / −11 text lines

1local ignored = require 'std.ignored'
2
3return {
4 'm4xshen/hardtime.nvim',
5 lazy = false,
6 enabled = false,
7 dependencies = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim' },
8 opts = {
9 disabled_filetypes = ignored.filetypes,
10 }
11}

neovim/lua/bugabinga/plugins/heirline.lua

Modified

+355 / −318 text lines

11---@diagnostic disable: param-type-mismatch
2local icon = require 'std.icon'
3local auto = require 'std.auto'
4local ignored = require 'std.ignored'
2local icon = require("std.icon")
3local auto = require("std.auto")
4local ignored = require("std.ignored")
6local NEW_FILE = '~untitled~'
6local NEW_FILE = "~untitled~"
88return {
99 {
10 'rebelot/heirline.nvim',
11 tag = 'v1.0.3',
12 event = 'BufEnter',
10 "rebelot/heirline.nvim",
11 version = "1.*",
12 event = "VeryLazy",
1313 dependencies = {
14 'nvim-tree/nvim-web-devicons',
15 'lewis6991/gitsigns.nvim',
16 'SmiteshP/nvim-navic',
14 "nvim-tree/nvim-web-devicons",
15 { "lewis6991/gitsigns.nvim", lazy = true },
16 { "SmiteshP/nvim-navic", lazy = true },
1717 },
18 config = function ()
19 local heirline = require 'heirline'
20 local conditions = require 'heirline.conditions'
21 local utils = require 'heirline.utils'
18 config = function()
19 local heirline = require("heirline")
20 local conditions = require("heirline.conditions")
21 local utils = require("heirline.utils")
23 local nugu = require 'bugabinga.nugu.palette'
24 heirline.load_colors( nugu )
23 local nugu = require("bugabinga.nugu.palette")
24 heirline.load_colors(nugu)
26 auto 'reload_heirline_colors' {
27 description = 'Reload dark/light nugu colors for Heirline',
28 events = 'ColorScheme',
29 command = function () utils.on_colorscheme( nugu ) end,
30 }
26 auto("reload_heirline_colors")({
27 description = "Reload dark/light nugu colors for Heirline",
28 events = "ColorScheme",
29 command = function()
30 utils.on_colorscheme(nugu)
31 end,
32 })
32 local vi_mode = {
33 init = function ( self )
34 self.mode = vim.fn.mode( 1 ) -- :h mode()
34 local vi_mode = {
35 init = function(self)
36 self.mode = vim.fn.mode(1) -- :h mode()
3537 end,
3739 static = {
3840 mode_names = {
3941 n = icon.normal,
40 no = icon.normal .. '?',
41 nov = icon.normal .. '?',
42 noV = icon.normal .. '?',
43 ['no\22'] = icon.normal .. '?',
44 niI = icon.normal .. 'i',
45 niR = icon.normal .. 'r',
46 niV = icon.normal .. 'v',
47 nt = icon.normal .. 't',
42 no = icon.normal .. "?",
43 nov = icon.normal .. "?",
44 noV = icon.normal .. "?",
45 ["no\22"] = icon.normal .. "?",
46 niI = icon.normal .. "i",
47 niR = icon.normal .. "r",
48 niV = icon.normal .. "v",
49 nt = icon.normal .. "t",
4850 v = icon.visual,
49 vs = icon.visual .. 's',
50 V = icon.visual .. '_',
51 Vs = icon.visual .. 's',
52 ['\22'] = '^' .. icon.visual,
53 ['\22s'] = '^' .. icon.visual,
51 vs = icon.visual .. "s",
52 V = icon.visual .. "_",
53 Vs = icon.visual .. "s",
54 ["\22"] = "^" .. icon.visual,
55 ["\22s"] = "^" .. icon.visual,
5456 s = icon.select,
55 S = icon.select .. '_',
56 ['\19'] = '^' .. icon.select,
57 S = icon.select .. "_",
58 ["\19"] = "^" .. icon.select,
5759 i = icon.insert,
58 ic = icon.insert .. 'c',
59 ix = icon.insert .. 'x',
60 ic = icon.insert .. "c",
61 ix = icon.insert .. "x",
6062 R = icon.replace,
61 Rc = icon.replace .. 'c',
62 Rx = icon.replace .. 'x',
63 Rv = icon.replace .. 'v',
64 Rvc = icon.replace .. 'v',
65 Rvx = icon.replace .. 'v',
63 Rc = icon.replace .. "c",
64 Rx = icon.replace .. "x",
65 Rv = icon.replace .. "v",
66 Rvc = icon.replace .. "v",
67 Rvx = icon.replace .. "v",
6668 c = icon.command,
67 cv = icon.command .. 'x',
69 cv = icon.command .. "x",
6870 r = icon.pending,
69 rm = icon.pending .. 'm',
70 ['r?'] = icon.pending .. '?',
71 ['!'] = icon.exclaim,
71 rm = icon.pending .. "m",
72 ["r?"] = icon.pending .. "?",
73 ["!"] = icon.exclaim,
7274 t = icon.terminal,
7375 },
7476 mode_colors = {
75 n = 'ui_normal',
76 i = 'ui_accent',
77 v = 'ui_important_global',
78 V = 'ui_important_global',
79 ['\22'] = 'ui_important_global',
80 c = 'ui_important_global',
81 s = 'ui_important_global',
82 S = 'ui_important_global',
83 ['\19'] = 'ui_important_global',
84 R = 'ui_important_global',
85 r = 'ui_important_global',
86 ['!'] = 'ui_important_global',
87 t = 'ui_important_global',
77 n = "ui_normal",
78 i = "ui_accent",
79 v = "ui_important_global",
80 V = "ui_important_global",
81 ["\22"] = "ui_important_global",
82 c = "ui_important_global",
83 s = "ui_important_global",
84 S = "ui_important_global",
85 ["\19"] = "ui_important_global",
86 R = "ui_important_global",
87 r = "ui_important_global",
88 ["!"] = "ui_important_global",
89 t = "ui_important_global",
8890 },
8991 },
91 provider = function ( self )
93 provider = function(self)
9294 local mode_name = self.mode_names[self.mode]
93 return ' ' .. icon.vim .. ' %3(' .. mode_name .. '%) '
95 return " " .. icon.vim .. " %3(" .. mode_name .. "%) "
9496 end,
96 hl = function ( self )
97 local mode = self.mode:sub( 1, 1 ) -- get only the first mode character
98 return { fg = self.mode_colors[mode], bold = true, }
98 hl = function(self)
99 local mode = self.mode:sub(1, 1) -- get only the first mode character
100 return { fg = self.mode_colors[mode], bold = true }
99101 end,
101103 update = {
102 'ModeChanged',
103 pattern = '*:*',
104 callback = vim.schedule_wrap( function () vim.cmd.redrawstatus() end ),
104 "ModeChanged",
105 pattern = "*:*",
106 callback = vim.schedule_wrap(function()
107 vim.cmd.redrawstatus()
108 end),
105109 },
106110 }
108 local file_icon = {
109 init = function ( self )
112 local file_icon = {
113 init = function(self)
110114 local filename = self.filename
111 local extension = vim.fn.fnamemodify( filename, ':e' )
112 self.icon = require 'nvim-web-devicons'.get_icon_color( filename, extension, { default = true, } )
115 local extension = vim.fn.fnamemodify(filename, ":e")
116 self.icon = require("nvim-web-devicons").get_icon_color(filename, extension, { default = true })
113117 end,
114 provider = function ( self )
115 return self.icon and (self.icon .. ' ')
118 provider = function(self)
119 return self.icon and (self.icon .. " ")
116120 end,
117 hl = 'DefaultIcon',
121 hl = "DefaultIcon",
118122 }
120 local file_name = {
121 init = function ( self )
122 self.lfilename = vim.fs.normalize( vim.fn.fnamemodify( self.filename, ':.' ) )
123 if self.lfilename == '' then self.lfilename = NEW_FILE end
124 local file_name = {
125 init = function(self)
126 self.lfilename = vim.fs.normalize(vim.fn.fnamemodify(self.filename, ":."))
127 if self.lfilename == "" then
128 self.lfilename = NEW_FILE
129 end
124130 end,
126132 flexible = 2,
128134 {
129 provider = function ( self )
135 provider = function(self)
130136 return self.lfilename
131137 end,
132138 },
133139 {
134 provider = function ( self )
135 return vim.fs.normalize( vim.fn.pathshorten( self.lfilename ) )
140 provider = function(self)
141 return vim.fs.normalize(vim.fn.pathshorten(self.lfilename))
136142 end,
137143 },
138144 }
140 local file_flags = {
146 local file_flags = {
141147 {
142 condition = function ()
148 condition = function()
143149 return vim.bo.modified
144150 end,
145 provider = string.format( ' %s ', icon.modified ),
146 hl = 'Comment',
151 provider = string.format(" %s ", icon.modified),
152 hl = "Comment",
147153 },
148154 {
149 condition = function ()
155 condition = function()
150156 return not vim.bo.modifiable or vim.bo.readonly
151157 end,
152 provider = string.format( ' %s ', icon.lock ),
153 hl = 'ErrorMsg',
158 provider = string.format(" %s ", icon.lock),
159 hl = "ErrorMsg",
154160 },
155161 }
157 local file_name_block = {
158 init = function ( self )
159 self.filename = vim.fs.normalize( vim.api.nvim_buf_get_name( 0 ) )
163 local file_name_block = {
164 init = function(self)
165 self.filename = vim.fs.normalize(vim.api.nvim_buf_get_name(0))
160166 end,
162168 file_icon,
163 { provider = ' ', },
169 { provider = " " },
164170 file_name,
165171 file_flags,
166 { provider = '%<', }, -- this means that the statusline is cut here when there's not enough space
172 { provider = "%<" }, -- this means that the statusline is cut here when there's not enough space
167173 }
169 local file_type = {
170 provider = function ()
171 return icon.file .. ' ' .. string.upper( vim.bo.filetype )
175 local file_type = {
176 provider = function()
177 return icon.file .. " " .. string.upper(vim.bo.filetype)
172178 end,
173179 }
175 local file_encoding = {
176 provider = function ()
177 local enc = (vim.bo.fenc ~= '' and vim.bo.fenc) or vim.o.enc -- :h 'enc'
178 return enc ~= 'utf-8' and enc:upper()
181 local file_encoding = {
182 provider = function()
183 local enc = (vim.bo.fenc ~= "" and vim.bo.fenc) or vim.o.enc -- :h 'enc'
184 return enc ~= "utf-8" and enc:upper()
179185 end,
180186 }
182 local file_format = {
188 local file_format = {
183189 static = {
184190 dos = icon.newline .. icon.carriage_return,
185191 unix = icon.newline,
186192 mac = icon.carriage_return,
187193 },
188 provider = function ( self )
194 provider = function(self)
189195 local fileformat = vim.bo.fileformat
190196 return self[fileformat]
191197 end,
192198 }
194 local file_size = {
195 provider = function ()
200 local file_size = {
201 provider = function()
196202 -- stackoverflow, compute human readable file size
197203 -- i want to see vim opening a 1EiB file 󰱯
198 local suffix = { 'b', 'k', 'M', 'G', 'T', 'P', 'E', }
199 local fsize = vim.fn.getfsize( vim.api.nvim_buf_get_name( 0 ) )
204 local suffix = { "b", "k", "M", "G", "T", "P", "E" }
205 local fsize = vim.fn.getfsize(vim.api.nvim_buf_get_name(0))
200206 fsize = (fsize < 0 and 0) or fsize
201207 if fsize < 1024 then
202208 return fsize .. suffix[1]
203209 end
204 local i = math.floor( (math.log( fsize ) / math.log( 1024 )) )
205 return string.format( '%.2g%s', fsize / math.pow( 1024, i ), suffix[i + 1] )
210 local i = math.floor((math.log(fsize) / math.log(1024)))
211 return string.format("%.2g%s", fsize / math.pow(1024, i), suffix[i + 1])
206212 end,
207213 }
209 local file_last_modified = {
210 provider = function ()
211 local ftime = vim.fn.getftime( vim.api.nvim_buf_get_name( 0 ) )
215 local file_last_modified = {
216 provider = function()
217 local ftime = vim.fn.getftime(vim.api.nvim_buf_get_name(0))
212218 if ftime > 0 then
213 local timeago = require 'std.timeago'
214 return timeago.format( ftime )
219 local timeago = require("std.timeago")
220 return timeago.format(ftime)
215221 end
216222 end,
217223 }
219 local lsp_active = {
225 local lsp_active = {
220226 condition = conditions.lsp_attached,
221227 -- FIXME: updates from parent components do not seem to update children,
222228 -- if those have their own updates?
223 update = { 'LspAttach', 'LspDetach', 'BufEnter', 'BufLeave', },
229 update = { "LspAttach", "LspDetach", "BufEnter", "BufLeave" },
225 provider = function ()
231 provider = function()
226232 local names = {}
227 for _, client in pairs( vim.lsp.get_clients { bufnr = 0, } ) do
228 table.insert( names, client.name )
233 for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do
234 table.insert(names, client.name)
229235 end
230 return icon.lsp .. ' ' .. table.concat( names, ' ' )
236 return icon.lsp .. " " .. table.concat(names, " ")
231237 end,
232238 }
234 local navic = {
235 condition = function () return require 'nvim-navic'.is_available() end,
240 local navic = {
241 condition = function()
242 local ok, navic = pcall(require, "nvim-navic")
243 return ok and navic.is_available()
244 end,
236245 static = {
237246 -- create a type highlight map
238247 type_hl = {
239 File = 'Directory',
240 Module = '@include',
241 Namespace = '@namespace',
242 Package = '@include',
243 Class = '@structure',
244 Method = '@method',
245 Property = '@property',
246 Field = '@field',
247 Constructor = '@constructor',
248 Enum = '@field',
249 Interface = '@type',
250 Function = '@function',
251 Variable = '@variable',
252 Constant = '@constant',
253 String = '@string',
254 Number = '@number',
255 Boolean = '@boolean',
256 Array = '@field',
257 Object = '@type',
258 Key = '@keyword',
259 Null = '@comment',
260 EnumMember = '@field',
261 Struct = '@structure',
262 Event = '@keyword',
263 Operator = '@operator',
264 TypeParameter = '@type',
248 File = "Directory",
249 Module = "@include",
250 Namespace = "@namespace",
251 Package = "@include",
252 Class = "@structure",
253 Method = "@method",
254 Property = "@property",
255 Field = "@field",
256 Constructor = "@constructor",
257 Enum = "@field",
258 Interface = "@type",
259 Function = "@function",
260 Variable = "@variable",
261 Constant = "@constant",
262 String = "@string",
263 Number = "@number",
264 Boolean = "@boolean",
265 Array = "@field",
266 Object = "@type",
267 Key = "@keyword",
268 Null = "@comment",
269 EnumMember = "@field",
270 Struct = "@structure",
271 Event = "@keyword",
272 Operator = "@operator",
273 TypeParameter = "@type",
265274 },
266275 -- bit operation dark magic, see below...
267 enc = function ( line, col, winnr )
268 return bit.bor( bit.lshift( line, 16 ), bit.lshift( col, 6 ), winnr )
276 enc = function(line, col, winnr)
277 return bit.bor(bit.lshift(line, 16), bit.lshift(col, 6), winnr)
269278 end,
270279 -- line: 16 bit (65535); col: 10 bit (1023); winnr: 6 bit (63)
271 dec = function ( c )
272 local line = bit.rshift( c, 16 )
273 local col = bit.band( bit.rshift( c, 6 ), 1023 )
274 local winnr = bit.band( c, 63 )
280 dec = function(c)
281 local line = bit.rshift(c, 16)
282 local col = bit.band(bit.rshift(c, 6), 1023)
283 local winnr = bit.band(c, 63)
275284 return line, col, winnr
276285 end,
277286 },
278 init = function ( self )
279 local data = require 'nvim-navic'.get_data() or {}
287 init = function(self)
288 local data = require("nvim-navic").get_data() or {}
280289 local children = {}
281290 -- create a child for each level
282 for i, d in ipairs( data ) do
291 for i, d in ipairs(data) do
283292 -- encode line and column numbers into a single integer
284 local pos = self.enc( d.scope.start.line, d.scope.start.character, self.winnr )
293 local pos = self.enc(d.scope.start.line, d.scope.start.character, self.winnr)
285294 local child = {
286295 {
287296 provider = d.icon,
289298 },
290299 {
291300 -- escape `%`s (elixir) and buggy default separators
292 provider = d.name:gsub( '%%', '%%%%' ):gsub( '%s*->%s*', '' ),
301 provider = d.name:gsub("%%", "%%%%"):gsub("%s*->%s*", ""),
293302 -- highlight icon only or location name as well
294303 hl = self.type_hl[d.type],
296305 on_click = {
297306 -- pass the encoded position through minwid
298307 minwid = pos,
299 callback = function ( _, minwid )
308 callback = function(_, minwid)
300309 -- decode
301 local line, col, winnr = self.dec( minwid )
302 vim.api.nvim_win_set_cursor( vim.fn.win_getid( winnr ), { line, col, } )
310 local line, col, winnr = self.dec(minwid)
311 vim.api.nvim_win_set_cursor(vim.fn.win_getid(winnr), { line, col })
303312 end,
304 name = 'heirline_navic',
313 name = "heirline_navic",
305314 },
306315 },
307316 }
308317 -- add a separator only if needed
309318 if #data > 1 and i < #data then
310 table.insert( child, {
311 provider = ' > ',
319 table.insert(child, {
320 provider = " > ",
312321 -- hl = { fg = 'bright_fg', },
313 } )
322 })
314323 end
315 table.insert( children, child )
324 table.insert(children, child)
316325 end
317326 -- instantiate the new child, overwriting the previous one
318 self.child = self:new( children, 1 )
327 self.child = self:new(children, 1)
319328 end,
320329 -- evaluate the children containing navic components
321 provider = function ( self )
330 provider = function(self)
322331 return self.child:eval()
323332 end,
324333 -- hl = { fg = 'gray', },
325 update = 'CursorMoved',
334 update = "CursorMoved",
326335 }
328 local diagnostic_enabled = {
329 init = function ( self )
337 local diagnostic_enabled = {
338 init = function(self)
330339 self.icon = vim.diagnostic.is_disabled() and icon.toggle_off or icon.toggle_on
331340 end,
332 provider = function ( self )
333 return icon.diagnostic .. ' ' .. self.icon
341 provider = function(self)
342 return icon.diagnostic .. " " .. self.icon
334343 end,
335344 }
337 local diagnostic = {
346 local diagnostic = {
338347 condition = conditions.has_diagnostics,
340349 static = {
344353 hint_icon = icon.hint,
345354 },
347 init = function ( self )
348 self.errors = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.ERROR, } )
349 self.warnings = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.WARN, } )
350 self.hints = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.HINT, } )
351 self.info = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.INFO, } )
356 init = function(self)
357 self.errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
358 self.warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
359 self.hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
360 self.info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
352361 end,
354 update = { 'DiagnosticChanged', 'BufEnter', 'BufLeave', },
363 update = { "DiagnosticChanged", "BufEnter", "BufLeave" },
356365 {
357 provider = function ( self )
366 provider = function(self)
358367 -- 0 is just another output, we can decide to print it or not!
359 return self.errors > 0 and (self.error_icon .. ' ' .. self.errors .. ' ')
368 return self.errors > 0 and (self.error_icon .. " " .. self.errors .. " ")
360369 end,
361 hl = 'DiagnosticError',
370 hl = "DiagnosticError",
362371 },
363372 {
364 provider = function ( self )
365 return self.warnings > 0 and (self.warn_icon .. ' ' .. self.warnings .. ' ')
373 provider = function(self)
374 return self.warnings > 0 and (self.warn_icon .. " " .. self.warnings .. " ")
366375 end,
367 hl = 'DiagnosticWarn',
376 hl = "DiagnosticWarn",
368377 },
369378 {
370 provider = function ( self )
371 return self.info > 0 and (self.info_icon .. ' ' .. self.info .. ' ')
379 provider = function(self)
380 return self.info > 0 and (self.info_icon .. " " .. self.info .. " ")
372381 end,
373 hl = 'DiagnosticInfo',
382 hl = "DiagnosticInfo",
374383 },
375384 {
376 provider = function ( self )
377 return self.hints > 0 and (self.hint_icon .. ' ' .. self.hints)
385 provider = function(self)
386 return self.hints > 0 and (self.hint_icon .. " " .. self.hints)
378387 end,
379 hl = 'DiagnosticHint',
388 hl = "DiagnosticHint",
380389 },
381390 }
383 local is_svn_repo = function ()
384 local svn_dir = vim.fs.find( '.svn', {
392 local is_svn_repo = function()
393 local svn_dir = vim.fs.find(".svn", {
385394 upward = true,
386395 stop = vim.uv.os_homedir(),
387 path = vim.fs.dirname( vim.api.nvim_buf_get_name( 0 ) ),
388 type = 'directory',
389 } )
396 path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
397 type = "directory",
398 })
391 return not vim.tbl_isempty( svn_dir )
400 return not vim.tbl_isempty(svn_dir)
392401 end
394 local svn_get_relative_url = function ()
403 local svn_get_relative_url = function()
395404 -- FIXME: replace with vim.system
396 local job = require 'plenary.job'
397 local relative_url = { '[ERR]', }
405 local job = require("plenary.job")
406 local relative_url = { "[ERR]" }
399 job:new {
400 command = 'svn',
401 args = { 'info', '--show-item', 'relative-url', '--no-newline', },
402 on_exit = function ( current_job, exit_code )
403 if exit_code == 0 then relative_url = current_job:result() end
404 end,
405 }:sync()
408 job
409 :new({
410 command = "svn",
411 args = { "info", "--show-item", "relative-url", "--no-newline" },
412 on_exit = function(current_job, exit_code)
413 if exit_code == 0 then
414 relative_url = current_job:result()
415 end
416 end,
417 })
418 :sync()
407420 return relative_url[1]
408421 end
410 local svn = {
423 local svn = {
411424 condition = is_svn_repo,
413 update = 'BufEnter',
426 update = "BufEnter",
415 init = function ( self )
428 init = function(self)
416429 self.relative_url = svn_get_relative_url()
417430 end,
419432 {
420 provider = function ( self )
421 return icon.subversion .. ' ' .. icon.branch .. ' ' .. self.relative_url
433 provider = function(self)
434 return icon.subversion .. " " .. icon.branch .. " " .. self.relative_url
422435 end,
423436 },
425437 }
427 local git = {
439 local git = {
428440 condition = conditions.is_git_repo,
430 init = function ( self )
442 init = function(self)
431443 self.status_dict = vim.b.gitsigns_status_dict
432444 end,
434446 {
435 provider = function ( self )
436 return icon.git .. ' ' .. icon.branch .. ' ' .. self.status_dict.head .. ' '
447 provider = function(self)
448 return icon.git .. " " .. icon.branch .. " " .. self.status_dict.head .. " "
437449 end,
438450 },
439451 {
440 provider = function ( self )
452 provider = function(self)
441453 local count = self.status_dict.added or 0
442 return count > 0 and (icon.diff_add .. ' ' .. count .. ' ')
454 return count > 0 and (icon.diff_add .. " " .. count .. " ")
443455 end,
444 hl = 'DiffAdd',
456 hl = "DiffAdd",
445457 },
446458 {
447 provider = function ( self )
459 provider = function(self)
448460 local count = self.status_dict.removed or 0
449 return count > 0 and (icon.diff_remove .. ' ' .. count .. ' ')
461 return count > 0 and (icon.diff_remove .. " " .. count .. " ")
450462 end,
451 hl = 'DiffDelete',
463 hl = "DiffDelete",
452464 },
453465 {
454 provider = function ( self )
466 provider = function(self)
455467 local count = self.status_dict.changed or 0
456 return count > 0 and (icon.diff_change .. ' ' .. count .. ' ')
468 return count > 0 and (icon.diff_change .. " " .. count .. " ")
457469 end,
458 hl = 'DiffChange',
470 hl = "DiffChange",
459471 },
460472 }
462 local work_dir = {
463 init = function ( self )
464 self.icon = (vim.fn.haslocaldir( 0 ) == 1 and icon['local'] or '') .. ' ' .. icon.global .. ' '
465 self.cwd = vim.fs.normalize( vim.uv.cwd() ):gsub( vim.fs.normalize( vim.uv.os_homedir() ), '~' )
474 local work_dir = {
475 init = function(self)
476 self.icon = (vim.fn.haslocaldir(0) == 1 and icon["local"] or "") .. " " .. icon.global .. " "
477 self.cwd = vim.fs.normalize(vim.uv.cwd()):gsub(vim.fs.normalize(vim.uv.os_homedir()), "~")
466478 end,
468480 flexible = 1,
470482 {
471 provider = function ( self )
483 provider = function(self)
472484 return self.icon .. self.cwd
473485 end,
474486 },
475487 {
476 provider = function ( self )
477 local cwd = vim.fn.pathshorten( self.cwd )
488 provider = function(self)
489 local cwd = vim.fn.pathshorten(self.cwd)
478490 return self.icon .. cwd
479491 end,
480492 },
481493 {
482 provider = '',
494 provider = "",
483495 },
484496 }
486 local help_file_name = {
487 condition = function ()
488 return vim.bo.filetype == 'help'
498 local help_file_name = {
499 condition = function()
500 return vim.bo.filetype == "help"
489501 end,
490 provider = function ()
491 local filename = vim.api.nvim_buf_get_name( 0 )
492 return vim.fn.fnamemodify( filename, ':t' )
502 provider = function()
503 local filename = vim.api.nvim_buf_get_name(0)
504 return vim.fn.fnamemodify(filename, ":t")
493505 end,
494 hl = 'Question',
506 hl = "Question",
495507 }
497 local terminal_name = {
498 provider = function ()
499 local name, _ = vim.api.nvim_buf_get_name( 0 ):gsub( '.*:', '' )
500 local basename = vim.fs.basename( name )
501 return icon.terminal .. ' ' .. (basename or 'noname')
509 local terminal_name = {
510 provider = function()
511 local name, _ = vim.api.nvim_buf_get_name(0):gsub(".*:", "")
512 local basename = vim.fs.basename(name)
513 return icon.terminal .. " " .. (basename or "noname")
502514 end,
503 hl = 'Bold',
515 hl = "Bold",
504516 }
506 local togglers = {
507 provider = function ()
508 local togglers = require 'bugabinga.options.togglers'
509 return tostring( togglers )
518 local togglers = {
519 provider = function()
520 local togglers = require("bugabinga.options.togglers")
521 return tostring(togglers)
510522 end,
511523 }
513 local macro_recording = {
514 condition = function ()
515 return vim.fn.reg_recording() ~= '' and vim.o.cmdheight == 0
525 local macro_recording = {
526 condition = function()
527 return vim.fn.reg_recording() ~= "" and vim.o.cmdheight == 0
516528 end,
517 provider = icon.macro .. ' ',
518 hl = 'PreProc',
519 utils.surround( { '░▒▓ ', ' ▓▒░', }, nil, {
520 provider = function ()
529 provider = icon.macro .. " ",
530 hl = "PreProc",
531 utils.surround({ "░▒▓ ", " ▓▒░" }, nil, {
532 provider = function()
521533 return vim.fn.reg_recording()
522534 end,
523 hl = 'Bold',
524 } ),
535 hl = "Bold",
536 }),
525537 update = {
526 'RecordingEnter',
527 'RecordingLeave',
538 "RecordingEnter",
539 "RecordingLeave",
528540 },
529541 }
531 local lazy = {
532 condition = function ()
533 local ok, lazy_status = pcall( require, 'lazy.status' )
543 local lazy = {
544 condition = function()
545 local ok, lazy_status = pcall(require, "lazy.status")
534546 return ok and lazy_status.has_updates()
535547 end,
536 update = { 'User', pattern = 'LazyUpdate', },
537 provider = function () return ' ' .. icon.lazy .. ' ' .. require 'lazy.status'.updates() .. ' ' end,
548 update = { "User", pattern = "LazyUpdate" },
549 provider = function()
550 return " " .. icon.lazy .. " " .. require("lazy.status").updates() .. " "
551 end,
538552 on_click = {
539 callback = function () require 'lazy'.update() end,
540 name = 'update_plugins',
553 callback = function()
554 require("lazy").update()
555 end,
556 name = "update_plugins",
541557 },
542558 }
544 local align = { provider = '%=', }
545 local space = { provider = ' ', }
560 local align = { provider = "%=" }
561 local space = { provider = " " }
547 local default_statusline = {
548 vi_mode, macro_recording, work_dir, space, git, svn, align,
549 diagnostic, space, lsp_active, align,
550 togglers, space, space, diagnostic_enabled, space, lazy, space,
551 file_encoding, space, file_format, space, file_type, space, file_size, space, file_last_modified,
563 local default_statusline = {
564 vi_mode,
565 macro_recording,
566 work_dir,
567 space,
568 git,
569 svn,
570 align,
571 diagnostic,
572 space,
573 lsp_active,
574 align,
575 togglers,
576 space,
577 space,
578 diagnostic_enabled,
579 space,
580 lazy,
581 space,
582 file_encoding,
583 space,
584 file_format,
585 space,
586 file_type,
587 space,
588 file_size,
589 space,
590 file_last_modified,
552591 }
554 local special_statusline = {
555 condition = function ()
556 return conditions.buffer_matches {
593 local special_statusline = {
594 condition = function()
595 return conditions.buffer_matches({
557596 buftype = ignored.buftypes,
558597 filetype = ignored.filetypes,
559 }
598 })
560599 end,
562601 file_type,
565604 align,
566605 }
568 local terminal_statusline = {
607 local terminal_statusline = {
570 condition = function ()
571 return conditions.buffer_matches { buftype = { 'terminal', }, }
609 condition = function()
610 return conditions.buffer_matches({ buftype = { "terminal" } })
572611 end,
574 { condition = conditions.is_active, vi_mode, space, },
613 { condition = conditions.is_active, vi_mode, space },
575614 file_type,
576615 space,
577616 terminal_name,
578617 align,
579618 }
581 local inactive_statusline = {
620 local inactive_statusline = {
582621 condition = conditions.is_not_active,
583622 file_type,
584623 space,
586625 align,
587626 }
589 local statuslines = {
590 hl = function ()
628 local statuslines = {
629 hl = function()
591630 if conditions.is_active() then
592 return 'StatusLine'
631 return "StatusLine"
593632 else
594 return 'StatusLineNC'
633 return "StatusLineNC"
595634 end
596635 end,
603642 default_statusline,
604643 }
606 local winbars = {
607 hl = function ()
645 local winbars = {
646 hl = function()
608647 if conditions.is_active() then
609 return 'Winbar'
648 return "Winbar"
610649 else
611 return 'WinbarNC'
650 return "WinbarNC"
612651 end
613652 end,
615654 fallthrough = false,
617656 {
618 condition = function ()
619 return conditions.buffer_matches { buftype = { 'terminal', }, }
657 condition = function()
658 return conditions.buffer_matches({ buftype = { "terminal" } })
620659 end,
622661 file_type,
733772 -- { provider = ' ' .. icon.arrow_right, hl = 'TabLine', }
734773 -- )
736 local tabpage = {
737 provider = function ( self )
738 return '%' .. self.tabnr .. 'T ' .. self.tabpage .. ' %T'
775 local tabpage = {
776 provider = function(self)
777 return "%" .. self.tabnr .. "T " .. self.tabpage .. " %T"
739778 end,
740 hl = function ( self )
779 hl = function(self)
741780 if self.is_active then
742 return 'TabLineSel'
781 return "TabLineSel"
743782 else
744 return 'TabLine'
783 return "TabLine"
745784 end
746785 end,
747786 }
749 local tab_pages = {
750 { provider = '%=', },
751 utils.make_tablist( tabpage ),
788 local tab_pages = {
789 { provider = "%=" },
790 utils.make_tablist(tabpage),
752791 }
754793 -- local tabline = { buffer_line, tab_pages, }
756795 -- local statuscolumn = {}
758 heirline.setup {
797 heirline.setup({
759798 statusline = statuslines,
760799 winbar = winbars,
761800 tabline = tab_pages,
765804 opts = {
766805 colors = nugu,
767 disable_winbar_cb = function ( args )
768 return conditions.buffer_matches(
769 {
770 buftype = ignored.buftypes,
771 filetype = ignored.filetypes,
772 },
773 args.buf )
806 disable_winbar_cb = function(args)
807 return conditions.buffer_matches({
808 buftype = ignored.buftypes,
809 filetype = ignored.filetypes,
810 }, args.buf)
774811 end,
775812 },
776 }
813 })
777814 end,
778815 },

neovim/lua/bugabinga/plugins/hyper.lua

Deleted
deleted file mode 100644

+0 / −8 text lines

1return {
2 'wet-sandwich/hyper.nvim',
3 tag = '0.1.0',
4 dependencies = {
5 'nvim-lua/plenary.nvim',
6 },
7 cmd = 'Hyper',
8}

neovim/lua/bugabinga/plugins/indent_blankline.lua

Modified

+9 / −13 text lines

33return {
44 'lukas-reineke/indent-blankline.nvim',
5 tag = 'v3.5.3',
5 version = '3.*',
66 main = 'ibl',
7 event = { 'BufReadPost', 'BufNew', },
8 config = function ()
9 local ibl = require 'ibl'
11 ibl.setup {
12 debounce = 250,
13 indent = {
14 char = icon.vertical_bar,
15 tab_char = icon.vertical_bar,
16 },
17 }
18 end,
7 event = vim.g.FILE_LOADED_EVENTS,
8 opts = {
9 debounce = 250,
10 indent = {
11 char = icon.vertical_bar,
12 tab_char = icon.vertical_bar,
13 },
14 },

neovim/lua/bugabinga/plugins/last-place.lua

Modified

+1 / −1 text lines

33return {
44 {
55 'ethanholz/nvim-lastplace',
6 event = { 'VimEnter' },
6 event = { 'VimEnter', 'SessionLoadPost', },
77 opts = {
88 lastplace_ignore_buftype = ignored.buftypes,
99 lastplace_ignore_filetype = ignored.filetypes,

neovim/lua/bugabinga/plugins/lint.lua

Added
new file mode 100644

+45 / −0 text lines

1--FIXME: own this
2local uv = vim.uv or vim.loop
3return {
4 'mfussenegger/nvim-lint',
5 ft = {
6 'lua',
7 'sh',
8 'vim',
9 },
10 opts = {
11 linters_by_ft = {
12 lua = { 'luacheck', },
13 sh = { 'shellcheck', },
14 vim = { 'vint', },
15 },
16 linters = {},
17 },
18 config = function ( _, opts )
19 local lint = require 'lint'
20 lint.linters_by_ft = opts.linters_by_ft
21 for k, v in pairs( opts.linters ) do
22 lint.linters[k] = v
23 end
24 local timer = assert( uv.new_timer() )
25 local DEBOUNCE_MS = 500
26 local aug = vim.api.nvim_create_augroup( 'Lint', { clear = true, } )
27 vim.api.nvim_create_autocmd( { 'BufEnter', 'BufWritePost', 'TextChanged', 'InsertLeave', }, {
28 group = aug,
29 callback = function ()
30 local bufnr = vim.api.nvim_get_current_buf()
31 timer:stop()
32 timer:start(
33 DEBOUNCE_MS,
34 0,
35 vim.schedule_wrap( function ()
36 if vim.api.nvim_buf_is_valid( bufnr ) then
37 vim.api.nvim_buf_call( bufnr, function () lint.try_lint( nil, { ignore_errors = true, } ) end )
38 end
39 end )
40 )
41 end,
42 } )
43 lint.try_lint( nil, { ignore_errors = true, } )
44 end,
45}

neovim/lua/bugabinga/plugins/mason.lua

Modified

+14 / −14 text lines

11return {
2 'williamboman/mason.nvim',
3 tag = 'v1.10.0',
4 cmd = { 'Mason', 'MasonUpdate', 'MasonInstall', 'MasonUninstall', 'MasonUninstallAll', 'MasonLog', },
2 "williamboman/mason.nvim",
3 version = "1.*",
4 lazy = false,
55 opts = {
66 ui = {
77 border = vim.g.border_style,
1111 },
1212 dependencies = {
1313 {
14 'WhoIsSethDaniel/mason-tool-installer.nvim',
14 "WhoIsSethDaniel/mason-tool-installer.nvim",
1515 lazy = false,
16 cmd = { 'MasonToolsInstall', 'MasonToolsInstallSync', 'MasonToolsUpdate', 'MasonToolsUpdateSync', 'MasonToolsClean', },
1716 opts = {
1817 ensure_installed = {
19 'lua-language-server',
20 'shellcheck',
21 'editorconfig-checker',
22 'shfmt',
23 'jdtls',
24 'java-test',
25 'java-debug-adapter',
26 'lemminx',
27 'marksman',
18 "lua-language-server",
19 "shellcheck",
20 "editorconfig-checker",
21 "shfmt",
22 "jdtls",
23 "java-test",
24 "java-debug-adapter",
25 "lemminx",
26 "marksman",
27 "typos",
2828 },
2929 },
3030 },

neovim/lua/bugabinga/plugins/mkdir.lua

Modified

+1 / −1 text lines

1return { 'jghauser/mkdir.nvim', event = 'BufWritePre' }
1return { 'jghauser/mkdir.nvim', event = 'BufWritePre', }

neovim/lua/bugabinga/plugins/navic.lua

Modified

+1 / −6 text lines

1return {
2 'SmiteshP/nvim-navic',
3 opts = {
4
5 }
6}
1return { 'SmiteshP/nvim-navic', opts = {}, }

neovim/lua/bugabinga/plugins/neoclip.lua

Modified

+14 / −20 text lines

11local map = require 'std.map'
3return {
4 'AckslD/nvim-neoclip.lua',
5 event = 'TextYankPost',
6 keys = { 'y', '<leader>p' },
7 dependencies = {
8 'nvim-telescope/telescope.nvim',
9 },
10 config = function ()
11 local neoclip = require 'neoclip'
3map.normal {
4 description = 'Open clipboard history...',
5 category = 'history',
6 keys = '<c-p><c-h>',
7 command = function ()
128 local telescope = require 'telescope'
13 local themes = require 'telescope.themes'
14 local cursor = themes.get_cursor { layout_config = { preview_width = 0.69, width = 0.42 } }
16 neoclip.setup {}
179 telescope.load_extension 'neoclip'
19 map.normal {
20 description = 'Open clipboard history...',
21 category = 'history',
22 keys = '<leader>p',
23 command = function () telescope.extensions.neoclip.default( cursor ) end,
24 }
10 telescope.extensions.neoclip.default()
2511 end,
14return {
15 'AckslD/nvim-neoclip.lua',
16 event = 'TextYankPost',
17 dependencies = {
18 'nvim-telescope/telescope.nvim',
19 },
20 opts = {},
21}

neovim/lua/bugabinga/plugins/neodev.lua

Modified

+3 / −6 text lines

11return {
22 'folke/neodev.nvim',
33 opts = {
4 -- With lspconfig, Neodev will automatically setup your lua-language-server
5 -- If you disable this, then you have to set {before_init=require("neodev.lsp").before_init}
6 -- in your lsp start options
47 lspconfig = false,
5 override = function ( root_dir, library )
6 if root_dir:find( '/etc/nixos', 1, true ) == 1 then
7 library.enabled = true
8 library.plugins = true
9 end
10 end,
118 },
129}

neovim/lua/bugabinga/plugins/neogen.lua

Modified

+29 / −34 text lines

11local map = require 'std.map'
3map.normal {
4 description = 'Generate doc comment for outer element',
5 category = 'editing',
6 keys = '<leader>gd',
7 command = function () require 'neogen'.generate() end,
8}
9
10map.normal {
11 name = 'Generate Doc Comment for Function',
12 category = 'editing',
13 keys = '<leader>gdf',
14 command = function () require 'neogen'.generate { type = 'func', } end,
15}
17map.normal {
18 description = 'Generate Doc Comment for File',
19 category = 'editing',
20 keys = '<leader>gdF',
21 command = function () require 'neogen'.generate { type = 'file', } end,
22}
24map.normal {
25 description = 'Generate Doc Comment for Class',
26 category = 'editing',
27 keys = '<leader>gdc',
28 command = function () require 'neogen'.generate { type = 'class', } end,
29}
331return {
432 'danymat/neogen',
5 keys = { '<leader>gd', },
633 dependencies = { 'nvim-treesitter/nvim-treesitter', },
7 config = function ()
8 local neogen = require 'neogen'
9
10 neogen.setup {}
12 map.normal {
13 description = 'Generate doc comment for outer element',
14 category = 'editing',
15 keys = '<leader>gd',
16 command = neogen.generate,
17 }
19 map.normal {
20 name = 'Generate Doc Comment for Function',
21 category = 'editing',
22 keys = '<leader>gd' .. 'f',
23 command = function () neogen.generate { type = 'func', } end,
24 }
26 map.normal {
27 description = 'Generate Doc Comment for File',
28 category = 'editing',
29 keys = '<leader>gd' .. 'F',
30 command = function () neogen.generate { type = 'file', } end,
31 }
33 map.normal {
34 description = 'Generate Doc Comment for Class',
35 category = 'editing',
36 keys = '<leader>gd' .. 'c',
37 command = function () neogen.generate { type = 'class', } end,
38 }
39 end,
34 opts = {},

neovim/lua/bugabinga/plugins/neorg.lua

Added
new file mode 100644

+45 / −0 text lines

1return {
2 'nvim-neorg/neorg',
3 version = '8.*',
4 dependencies = {
5 { 'nvim-lua/plenary.nvim', version = '0.1.4', },
6 { 'nvim-neorg/lua-utils.nvim', version = '1.0.2', },
7 { 'nvim-neotest/nvim-nio', version = '1.7.*', },
8 { 'MunifTanjim/nui.nvim', version = '0.3.0', },
9 { 'nvim-treesitter/nvim-treesitter', },
10 },
11 build = function ()
12 package.loaded['neorg'] = nil
14 require 'neorg'.setup_after_build()
15 pcall( vim.cmd.Neorg, 'sync-parsers' )
16 end,
17 ft = 'norg',
18 cmd = 'Neorg',
19 opts = {
20 load = {
21 ['core.defaults'] = {}, -- Loads default behaviour
22 ['core.concealer'] = { -- Adds pretty icons to your documents
23 config = {
24 icons = {
25 todo = {
26 undone = {
27 icon = ' ',
28 },
29 },
30 },
31 },
32 },
33 ['core.completion'] = {
34 config = {
35 engine = 'nvim-cmp',
36 },
37 },
38 ['core.presenter'] = {
39 config = {
40 zen_mode = 'zen-mode',
41 },
42 },
43 },
44 },
45}

neovim/lua/bugabinga/plugins/noice.lua.off

Deleted
deleted file mode 100644

+0 / −156 text lines

1local map = require 'std.map'
2
3return {
4 {
5 'folke/noice.nvim',
6 event = 'VeryLazy',
7 dependencies = {
8 'MunifTanjim/nui.nvim',
9 'rcarriga/nvim-notify',
10 },
11 opts = {
12 -- cmdline = {
13 -- view = 'cmdline', -- cmdline on cursor
14 -- },
15 lsp = {
16 signature = {
17 auto_open = { trigger = false },
18 },
19 -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
20 override = {
21 ['vim.lsp.util.convert_input_to_markdown_lines'] = true,
22 ['vim.lsp.util.stylize_markdown'] = true,
23 ['cmp.entry.get_documentation'] = true,
24 },
25 },
26 presets = {
27 inc_rename = true, -- enables an input dialog for inc-rename.nvim
28 long_message_to_split = true, -- long messages will be sent to a split
29 },
30 views = {
31 vsplit = {
32 size = { width = 'auto', height = 'auto' },
33 },
34 popupmenu = {
35 border = { style = vim.g.border_style },
36 },
37 popup = {
38 border = { style = vim.g.border_style },
39 },
40 hover = {
41 border = { style = vim.g.border_style },
42 position = { row = -2, col = 2 },
43 },
44 cmdline = {
45 relative = 'cursor',
46 position = { row = 0, col = 2 },
47 size = { width = '42', height = 'auto' },
48 border = { style = 'solid' },
49 zindex = 9999,
50 },
51 cmdline_popupmenu = {
52 relative = 'cursor',
53 position = { row = 1, col = 0 },
54 size = { width = '42', height = 'auto' },
55 border = { style = vim.g.border_style },
56 zindex = 9999,
57 },
58 },
59 routes = {
60 {
61 filter = { cmdline = '^:%s*!' },
62 view = 'vsplit'
63 },
64 {
65 filter = { event = 'msg_show', kind = 'echomsg' },
66 view = 'mini'
67 },
68 {
69 filter = { event = 'msg_show', kind = 'echo' },
70 view = 'mini'
71 },
72 {
73 filter = { event = 'msg_show', kind = '', find = 'written' },
74 view = 'mini'
75 },
76 {
77 filter = { any = { { cmdline = '^:%s*lua%s+' }, { cmdline = '^:%s*lua%s*=%s*' }, { cmdline = '^:%s*=%s*' }, } },
78 view = 'cmdline_output',
79 }
80 },
81 },
82 config = function ( _, opts )
83 local noice = require 'noice'
84 noice.setup( opts )
86 map.normal {
87 description = 'Open search for notifications...',
88 category = 'search',
89 keys = '<C-n><C-n>',
90 command = function () noice.cmd 'history' end,
91 }
93 map.command_line {
94 description = 'Redirect Cmdline',
95 category = 'ui',
96 keys = '<S-cr>',
97 ---@diagnostic disable-next-line: param-type-mismatch
98 command = function () noice.redirect( vim.fn.getcmdline() ) end,
99 }
101 map.normal {
102 description = 'Dismiss current notifications',
103 category = 'notify',
104 keys = '<esc>',
105 command = function () noice.cmd 'dismiss' end,
106 }
108 local noice_lsp = require 'noice.lsp'
110 map.normal {
111 description = 'Scroll up in documentation popup',
112 category = 'ui',
113 keys = '<C-f>',
114 command = function ()
115 if not noice_lsp.scroll( -4 ) then return '<C-f>' end
116 end,
117 options = { expr = true },
118 }
120 map.normal {
121 description = 'Scroll down in documentation popup',
122 category = 'ui',
123 keys = '<C-b>',
124 command = function ()
125 if not noice_lsp.scroll( 4 ) then return '<C-b>' end
126 end,
127 options = { expr = true },
128 }
129 end,
130 },
131 {
132 'rcarriga/nvim-notify',
133 config = function ()
134 local notify = require 'notify'
135 local fade = require 'notify.stages.fade' 'bottom_up'
137 local shadow_fade = function ( ... )
138 local opts = fade[1]( ... )
139 if opts then
140 opts.border = vim.g.border_style
141 opts.row = opts.row - 1
142 end
143 return opts
144 end
146 ---@diagnostic disable-next-line: missing-fields
147 notify.setup {
148 stages = { shadow_fade, unpack( fade, 2 ) },
149 render = 'compact',
150 timeout = 2500,
151 fps = 60,
152 top_down = false,
153 }
154 end,
155 },
156}

neovim/lua/bugabinga/plugins/nrpattern.lua

Modified

+3 / −3 text lines

1return { {
1return {
22 'zegervdv/nrpattern.nvim',
33 keys = { '<C-a>', '<C-x>', },
44 config = function ()
55 local nrpattern = require 'nrpattern'
6 -- this plugin overrides all its settiungs if empty map is given
6 -- this plugin overrides all its settings if empty map is given
77 nrpattern.setup()
88 end,
9}, }
9}

neovim/lua/bugabinga/plugins/nui.lua

Modified

+1 / −3 text lines

1return {
2 'MunifTanjim/nui.nvim',
3}
1return { 'MunifTanjim/nui.nvim', }

neovim/lua/bugabinga/plugins/nvim-jdtls.lua

Modified

+1 / −3 text lines

1return {
2 'bugabinga/nvim-jdtls',
3}
1return { 'bugabinga/nvim-jdtls', }

neovim/lua/bugabinga/plugins/oil.lua

Modified

+57 / −39 text lines

11local map = require 'std.map'
2local icon = require 'std.icon'
3
4map.normal {
5 description = 'Open parent directory in buffer.',
6 category = 'files',
7 keys = '-',
8 -- command = function () require 'oil'.open_float() end,
9 command = function () require 'oil'.open() end,
10}
312return {
413 'stevearc/oil.nvim',
5 keys = '-',
6 cmd = { 'Oil' },
7 dependencies = { 'nvim-tree/nvim-web-devicons' },
8 config = function ()
9 local oil = require 'oil'
10 oil.setup {
11 skip_confirm_for_simple_edits = true,
12 delete_to_trash = true,
13 -- trash_command = 'rm --trash', --nu command
14 lazy = false,
15 cmd = { 'Oil', },
16 dependencies = { 'nvim-tree/nvim-web-devicons', },
17 opts = {
18 -- default_file_explorer = true,
19 -- Set to true to watch the filesystem for changes and reload oil
20 -- experimental_watch_for_changes = true,
21 skip_confirm_for_simple_edits = true,
22 prompt_save_on_select_new_entry = false,
23 delete_to_trash = true,
15 colums = {
16 'icon',
17 'permissions',
18 'size',
19 'mtime',
25 columns = { 'icon', },
26 buf_options = {
27 cursorline = true,
28 },
29 keymaps = {
30 ['q'] = 'actions.close',
31 ['<C-v>'] = 'actions.select_vsplit',
32 ['<C-s>'] = 'actions.select_split',
33 ['`'] = 'actions.tcd',
34 ['~'] = '<cmd>edit $HOME<CR>',
35 ['<F7>'] = 'actions.open_terminal',
36 ['gd'] = {
37 desc = 'Toggle detail view',
38 callback = function ()
39 local oil = require 'oil'
40 local config = require 'oil.config'
41 if #config.columns == 1 then
42 oil.set_columns { 'icon', 'permissions', 'size', { 'mtime', format = '%d/%m/%y %T', }, }
43 else
44 oil.set_columns { 'icon', }
45 end
46 end,
2047 },
21 keymaps = {
22 ['q'] = 'actions.close',
23 ['<esc>'] = 'actions.close',
24 ['<C-/>'] = 'actions.show_help',
25 ['<C-v>'] = 'actions.select_vsplit',
26 ['<C-s>'] = 'actions.select_split',
27 ['<C-h>'] = 'actions.toggle_hidden',
28 },
29 float = {
30 max_width = 69,
31 min_width = 42,
32 border = vim.g.border_style,
33 padding = 2,
34 win_options = { winblend = vim.o.winblend },
35 },
36 }
38 map.normal {
39 description = 'Open parent directory in buffer.',
40 category = 'files',
41 keys = '-',
42 -- command = oil.open,
43 command = oil.open_float,
44 }
45 end,
48 },
49 float = {
50 max_width = 69,
51 min_width = 69,
52 border = vim.g.border_style,
53 padding = 2,
54 },
55 -- Configuration for the floating keymaps help window
56 keymaps_help = {
57 border = vim.g.border_style,
58 },
59 view_options = {
60 is_always_hidden = function ( name, bufnr ) return name == '..' end,
61 show_hidden = true,
62 },
63 },

neovim/lua/bugabinga/plugins/origami.lua

Deleted
deleted file mode 100644

+0 / −6 text lines

1return {
2 'chrisgrieser/nvim-origami',
3 enabled = false,
4 event = 'BufReadPost',
5 opts = true,
6}

neovim/lua/bugabinga/plugins/outline.lua

Added
new file mode 100644

+14 / −0 text lines

1local map = require 'std.map'
2
3return {
4 'SmiteshP/nvim-navbuddy',
5 dependencies = {
6 'SmiteshP/nvim-navic',
7 'MunifTanjim/nui.nvim',
8 },
9 opts = {
10 window = {
11 border = vim.g.border_style,
12 },
13 },
14}

neovim/lua/bugabinga/plugins/pair-ls.lua

Added
new file mode 100644

+11 / −0 text lines

1return {
2 'stevearc/pair-ls.nvim',
3 cmd = { 'Pair', 'PairConnect', },
4 opts = {
5 cmd = { 'pair-ls', 'lsp', },
6 -- cmd = { "pair-ls", "lsp", "-port", "8080" },
7 -- cmd = { "pair-ls", "lsp", "-port", "8081" },
8 -- cmd = { "pair-ls", "lsp", "-signal", "wss://localhost:8080" },
9 -- cmd = { "pair-ls", "lsp", "-forward", "wss://localhost:8080" },
10 },
11}

neovim/lua/bugabinga/plugins/persistence.lua

Deleted
deleted file mode 100644

+0 / −26 text lines

1local map = require 'std.map'
2
3return {
4 'folke/persistence.nvim',
5 tag = 'v2.0.0',
6 event = 'BufReadPre',
7 opts = {},
8 config = function ( _, opts )
9 local persistence = require 'persistence'
10 persistence.setup( opts )
12 map.normal {
13 description = 'Restore session for current directory',
14 category = 'history',
15 keys = '<F4>',
16 command = function () persistence.load() end,
17 }
19 map.normal {
20 description = 'Restore last session',
21 category = 'history',
22 keys = '<F4><F4>',
23 command = function () persistence.load { last = true, } end,
24 }
25 end,
26}

neovim/lua/bugabinga/plugins/quickfix.lua

Added
new file mode 100644

+45 / −0 text lines

1local map = require 'std.map'
2
3map.normal {
4 description = 'Grep search for word under cursor',
5 category = 'search',
6 keys = 'gw',
7 command = '<cmd>cclose <bar> Grep <cword><cr>',
8}
9
10map.normal {
11 description = 'Goto next quickfix item',
12 category = 'navigation',
13 keys = ']q',
14 command = '<cmd>QNext<cr>',
15}
17map.normal {
18 description = 'Goto previous quickfix item',
19 category = 'navigation',
20 keys = '[q',
21 command = '<cmd>QPrev<cr>',
22}
24map.normal {
25 description = 'Toggle open quickfix window',
26 category = 'navigation',
27 keys = '<leader>Q',
28 command = '<cmd>QFToggle!<CR>',
29}
31map.normal {
32 description = 'Toggle open loclist window',
33 category = 'navigation',
34 keys = '<leader>L',
35 command = '<cmd>LLToggle!<CR>',
36}
38return {
39 'stevearc/qf_helper.nvim',
40 ft = 'qf',
41 cmd = { 'QNext', 'QPrev', 'QFToggle', 'QFOpen', 'LLToggle', },
42 opts = {
43 prefer_loclist = false,
44 },
45}

neovim/lua/bugabinga/plugins/schemastore.lua

Modified

+1 / −3 text lines

1return {
2 'b0o/schemastore.nvim',
3}
1return { 'b0o/schemastore.nvim', }

neovim/lua/bugabinga/plugins/sessions.lua

Added
new file mode 100644

+98 / −0 text lines

1local map = require 'std.map'
2local auto = require 'std.auto'
3
4local LAST_SESSION = 'last'
5
6auto 'automatic_session_management' {
7 {
8 events = 'VimEnter',
9 description = 'Load automatically saved session for the CWD',
10 command = function ()
11 -- Only load the session if nvim was started with no args
12 if vim.fn.argc( -1 ) == 0 then
13 -- Save these to a different directory, so our manual sessions don't get polluted
14 prequire 'resession'.load( vim.fn.getcwd(), { dir = 'autosession', silence_errors = true, } )
15 end
16 end,
17 },
18 {
19 events = 'VimLeavePre',
20 description = 'Automatically save sessions for the CWD (tab)',
21 command = function () prequire 'resession'.save_tab( vim.fn.getcwd(), { dir = 'autosession', notify = false, } ) end,
22 },
23 {
24 events = 'VimLeavePre',
25 description = 'Automatically save last session (all tabs)',
26 command = function () prequire 'resession'.save( LAST_SESSION ) end,
27 },
28}
30map.normal {
31 description = 'Restore last session',
32 category = 'history',
33 keys = '<leader>sl',
34 command = function () prequire 'resession'.load( LAST_SESSION ) end,
35}
37map.normal {
38 description = 'Restore a session',
39 category = 'history',
40 keys = '<leader>sL',
41 command = function () prequire 'resession'.load() end,
42}
44map.normal {
45 description = 'Delete session',
46 category = 'history',
47 keys = '<leader>sd',
48 command = function () prequire 'resession'.delete() end,
49}
51map.normal {
52 description = 'Save session (tab)',
53 category = 'history',
54 keys = '<leader>ss',
55 command = function () prequire 'resession'.save_tab() end,
56}
58map.normal {
59 description = 'Save session (all tabs)',
60 category = 'history',
61 keys = '<leader>sS',
62 command = function () prequire 'resession'.save() end,
63}
65return {
66 'stevearc/resession.nvim',
67 version = '1.*',
68 event = 'VeryLazy',
69 opts = {
70 autosave = { enable = true, },
71 -- Save and restore these options
72 options = {
73 'binary',
74 'bufhidden',
75 'buflisted',
76 'cmdheight',
77 'diff',
78 'filetype',
79 'modifiable',
80 'previewwindow',
81 'readonly',
82 'scrollbind',
83 'winfixheight',
84 'winfixwidth',
85 'cursorline',
86 'virtualedit',
87 'number',
88 'spell',
89 },
90 -- only save buffers that are associated with the cwd of the current tab
91 tab_buf_filter = function ( tabpage, bufnr )
92 local dir = vim.fn.getcwd( -1, vim.api.nvim_tabpage_get_number( tabpage ) )
93 -- ensure dir has trailing /
94 dir = dir:sub( -1 ) ~= '/' and dir .. '/' or dir
95 return vim.startswith( vim.api.nvim_buf_get_name( bufnr ), dir )
96 end,
97 },
98}

neovim/lua/bugabinga/plugins/snippets.lua

Added
new file mode 100644

+114 / −0 text lines

1--FIXME: own this
2return {
3 'L3MON4D3/LuaSnip',
4 dependencies = {
5 'stevearc/vim-vscode-snippets',
6 },
7 config = function ()
8 local luasnip = require 'luasnip'
9 local has_vim_snippet, snippet = pcall( require, 'vim.snippet' )
10 require 'luasnip.loaders.from_vscode'.lazy_load()
11 vim.keymap.set( 's', '<Tab>', '<Plug>luasnip-jump-next' )
12 vim.keymap.set( 's', '<C-h>', '<Plug>luasnip-jump-prev' )
13 vim.keymap.set( 's', '<C-l>', '<Plug>luasnip-jump-next' )
14 vim.keymap.set( { 'i', 's', }, '<C-k>', function () pcall( luasnip.change_choice, -1 ) end )
15 vim.keymap.set( { 'i', 's', }, '<C-j>', function () pcall( luasnip.change_choice, 1 ) end )
17 local aug = vim.api.nvim_create_augroup( 'ClearLuasnipSession', { clear = true, } )
18 -- Can't use InsertLeave here because that fires when we go to select mode
19 vim.api.nvim_create_autocmd( 'CursorHold', {
20 desc = 'Deactivate snippet after leaving insert/select mode',
21 pattern = '*',
22 group = aug,
23 callback = function ()
24 vim.cmd.LuaSnipUnlinkCurrent { mods = { emsg_silent = true, }, }
25 if has_vim_snippet then
26 snippet.exit()
27 end
28 end,
29 } )
31 vim.keymap.set( 'i', '<C-h>', function ()
32 if luasnip.get_active_snip() then
33 luasnip.jump( -1 )
34 elseif has_vim_snippet and snippet.active() then
35 snippet.jump( -1 )
36 else
37 local cur = vim.api.nvim_win_get_cursor( 0 )
38 pcall( vim.api.nvim_win_set_cursor, 0, { cur[1], cur[2] - 1, } )
39 end
40 end )
41 vim.keymap.set( 'i', '<C-l>', function ()
42 if luasnip.get_active_snip() then
43 luasnip.jump( 1 )
44 elseif has_vim_snippet and snippet.active() then
45 snippet.jump( 1 )
46 else
47 local cur = vim.api.nvim_win_get_cursor( 0 )
48 pcall( vim.api.nvim_win_set_cursor, 0, { cur[1], cur[2] + 1, } )
49 end
50 end )
52 -- Required to support nested placeholders
53 -- From https://github.com/L3MON4D3/LuaSnip/wiki/Nice-Configs#imitate-vscodes-behaviour-for-nested-placeholders
54 local util = require 'luasnip.util.util'
56 luasnip.config.setup {
57 store_selection_keys = '<Tab>',
58 updateevents = 'TextChanged,TextChangedI',
59 parser_nested_assembler = function ( _, snippet )
60 local select = function ( snip, no_move )
61 snip.parent:enter_node( snip.indx )
62 -- upon deletion, extmarks of inner nodes should shift to end of
63 -- placeholder-text.
64 for _, node in ipairs( snip.nodes ) do
65 node:set_mark_rgrav( true, true )
66 end
68 -- SELECT all text inside the snippet.
69 if not no_move then
70 vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( '<Esc>', true, false, true ), 'n', true )
71 local pos_begin, pos_end = snip.mark:pos_begin_end()
72 util.normal_move_on( pos_begin )
73 vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( 'v', true, false, true ), 'n', true )
74 util.normal_move_before( pos_end )
75 vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( 'o<C-G>', true, false, true ), 'n', true )
76 end
77 end
78 function snippet:jump_into( dir, no_move )
79 if self.active then
80 -- inside snippet, but not selected.
81 if dir == 1 then
82 self:input_leave()
83 return self.next:jump_into( dir, no_move )
84 else
85 select( self, no_move )
86 return self
87 end
88 else
89 -- jumping in from outside snippet.
90 self:input_enter()
91 if dir == 1 then
92 select( self, no_move )
93 return self
94 else
95 return self.inner_last:jump_into( dir, no_move )
96 end
97 end
98 end
100 -- this is called only if the snippet is currently selected.
101 function snippet:jump_from( dir, no_move )
102 if dir == 1 then
103 return self.inner_first:jump_into( dir, no_move )
104 else
105 self:input_leave()
106 return self.prev:jump_into( dir, no_move )
107 end
108 end
110 return snippet
111 end,
112 }
113 end,
114}

neovim/lua/bugabinga/plugins/specs.lua

Modified

+26 / −29 text lines

11local map = require 'std.map'
22local ignored = require 'std.ignored'
4return { {
5 'KevinSilvester/specs.nvim',
6 keys = { '<leader><leader>', '<leader><leader><leader>' },
7 config = function ()
8 local specs = require 'specs'
4map.normal {
5 description = 'Find cursor!',
6 category = 'fun',
7 keys = '<leader><leader>',
8 command = function () require 'specs'.show_specs() end,
9}
10 specs.setup {
11map.normal {
12 description = 'Find cursor, for real!',
13 category = 'fun',
14 keys = '<leader><leader><leader>',
15 command = function ()
16 require 'specs'.show_specs { width = 69, delay_ms = 69, inc_ms = 42, }
17 end,
18}
20return {
21 'KevinSilvester/specs.nvim',
22 opts = function ()
23 return {
1124 show_jumps = true,
1225 min_jump = 30,
1326 popup = {
1427 delay_ms = 10, -- delay before popup displays
15 inc_ms = 10, -- time increments used for fade/resize effects
16 blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend
28 inc_ms = 10, -- time increments used for fade/resize effects
29 blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend
1730 width = 10,
1831 winhl = 'Cursor',
19 fader = specs.exp_fader,
20 resizer = specs.shrink_resizer
32 fader = require 'specs'.exp_fader,
33 resizer = require 'specs'.shrink_resizer,
2134 },
2235 ignore_filetypes = ignored.filetypes_kv,
2336 ignore_buftypes = ignored.buftypes_kv,
2437 }
26 map.normal {
27 description = 'Find cursor!',
28 category = 'fun',
29 keys = '<leader><leader>',
30 command = specs.show_specs,
31 }
33 map.normal {
34 description = 'Find cursor, for real!',
35 category = 'fun',
36 keys = '<leader><leader><leader>',
37 command = function ()
38 specs.show_specs { width = 69, delay_ms = 69, inc_ms = 42 }
39 end,
40 }
41 end,
42} }
38 end
39 ,
40}

neovim/lua/bugabinga/plugins/spectre.lua

Modified

+62 / −30 text lines

33require 'bugabinga.health'.add_dependency
44{
5 name_of_executable = 'rg'
5 name_of_executable = 'rg',
6}
7
8map.normal {
9 description = 'Search and replace',
10 category = 'search',
11 keys = '<leader>rs',
12 command = function () spectre.open() end,
13}
15map.normal {
16 description = 'Search current word',
17 category = 'search',
18 keys = '<leader>rw',
19 command = function () spectre.open_visual { select_word = true, } end,
20}
22map.visual {
23 description = 'Search current word',
24 category = 'search',
25 keys = '<leader>rw',
26 command = function () spectre.open_visual() end,
27}
29map.normal {
30 description = 'Search on current file',
31 category = 'search',
32 keys = '<leader>rf',
33 command = function () spectre.open_file_search { select_word = true, } end,
634}
836return {
9 'bugabinga/nvim-spectre',
37 'nvim-pack/nvim-spectre',
1038 cmd = 'Spectre',
1139 dependencies = {
1240 'nvim-lua/plenary.nvim',
1442 },
1543 opts = {
1644 live_update = true,
17 default = { replace = { cmd = 'oxi' } },
45 default = { replace = { cmd = 'oxi', }, },
1846 },
19 config = function ( _, opts )
20 local spectre = require 'spectre'
21 spectre.setup( opts )
47 build = function ( plugin_spec )
48 local sysname = vim.uv.os_uname().sysname
23 map.normal {
24 description = 'Open Spectre',
25 category = 'search',
26 keys = '<leader>s',
27 command = function () spectre.open() end,
28 }
50 local copy_cmd = {}
51 if sysname == 'Darwin' then
52 copy_cmd = { 'cp', 'target/release/libspectre_oxi.dylib', '../lua/spectre_oxi.so', }
53 elseif sysname == 'Linux' then
54 copy_cmd = { 'cp', 'target/release/libspectre_oxi.so', '../lua/spectre_oxi.so', }
55 elseif sysname == 'Windows_NT' then
56 copy_cmd = { 'cp', 'target/release/libspectre_oxi.dll', '../lua/spectre_oxi.dll', }
57 else
58 error 'unsupported os'
59 end
30 map.normal {
31 description = 'Search current word',
32 category = 'search',
33 keys = '<leader>sw',
34 command = function () spectre.open_visual { select_word = true } end,
35 }
61 local spectre_oxi_dir = vim.fs.joinpath( plugin_spec.dir, 'spectre_oxi' )
37 map.visual {
38 description = 'Search current word',
39 category = 'search',
40 keys = '<leader>sw',
41 command = function () spectre.open_visual() end,
42 }
63 local cargo_build_proc = vim.system(
64 { 'cargo', 'build', '--release', },
65 { text = true, cwd = spectre_oxi_dir, }
66 ):wait()
67 if cargo_build_proc.code ~= 0 then error( cargo_build_proc.stderr ) end
44 map.normal {
45 description = 'Search on current file',
46 category = 'search',
47 keys = '<leader>sp',
48 command = function () spectre.open_file_search { select_word = true } end,
49 }
69 local cp_proc = vim.system(
70 copy_cmd,
71 { text = true, cwd = spectre_oxi_dir, }
72 ):wait()
73 if cp_proc.code ~= 0 then error( cp_proc.stderr ) end
75 local rm_proc = vim.system(
76 { 'rm', '-r', '-f', 'target', },
77 { text = true, cwd = spectre_oxi_dir, }
78 ):wait()
79 if rm_proc.code ~= 0 then error( rm_proc.stderr ) end
81 vim.print 'Building oxi done'
5082 end,

neovim/lua/bugabinga/plugins/ssr.lua

Modified

+31 / −32 text lines

11local map = require 'std.map'
2local user_command = require 'std.user_command'
3
4local open_ssr = function () prequire 'ssr'.open() end
5
6map.normal.visual {
7 description = 'Open structural search and replace',
8 category = 'refactoring',
9 keys = '<leader>rr',
10 command = open_ssr,
11}
13user_command.StructuralSearchAndReplace
14'Open structural search and replace view' (
15 open_ssr
16 )
318return {
4 'cshuaimin/ssr.nvim',
5 cmd = 'StructuralSearchAndReplace',
6 keys = { '<leader>rs', mode = { 'n', 'x' } },
7 config = function ()
8 local ssr = require 'ssr'
9 ssr.setup {
10 border = vim.g.border_style,
11 min_width = 69,
12 min_height = 42,
13 max_width = 3 * 69,
14 max_height = 3 * 42,
15 adjust_window = true,
16 keymaps = {
17 close = 'q',
18 next_match = 'n',
19 prev_match = 'N',
20 replace_confirm = '<cr>',
21 replace_all = '<c-cr>',
22 },
23 }
25 local open_ssr = function () ssr.open() end
27 map.normal.visual {
28 description = 'Open structural search and replace',
29 category = 'refactoring',
30 keys = '<leader>rs',
31 command = open_ssr,
32 }
34 vim.api.nvim_create_user_command( 'StructuralSearchAndReplace', open_ssr, { bang = true } )
35 end
19 'cshuaimin/ssr.nvim',
20 opts = {
21 border = vim.g.border_style,
22 min_width = 69,
23 min_height = 42,
24 max_width = 3 * 69,
25 max_height = 3 * 42,
26 adjust_window = true,
27 keymaps = {
28 close = 'q',
29 next_match = 'n',
30 prev_match = 'N',
31 replace_confirm = '<cr>',
32 replace_all = '<c-cr>',
33 },
34 },

neovim/lua/bugabinga/plugins/starter.lua

Deleted
deleted file mode 100644

+0 / −85 text lines

1local auto = require 'std.auto'
2local icon = require 'std.icon'
3
4return {
5 'echasnovski/mini.starter',
6 lazy = false,
7 config = function ()
8 local starter = require 'mini.starter'
9 local is_home = vim.uv.cwd() == vim.uv.os_homedir()
11 local custom_actions = {
12 { name = 'Find files', action = 'Telescope find_files', section = 'Builtin actions', },
13 { name = 'Oil', action = 'Oil', section = 'Builtin actions', },
14 }
16 local sessions = function ( limit )
17 limit = limit or 8
18 local persistence = require 'persistence'
19 local sessions = persistence.list()
20 table.sort( sessions, function ( a, b )
21 return vim.loop.fs_stat( a ).mtime.sec > vim.loop.fs_stat( b ).mtime.sec
22 end )
23 return vim.iter( sessions )
24 :slice( 1, limit )
25 :filter( function ( session_path )
26 return vim.fn.filereadable( session_path ) ~= 0
27 end )
28 :map( function ( session_path )
29 -- session files encode their cwd as an escaped path in their file name
30 local name = vim.fs.basename( session_path:gsub( '%%%%', '/:' ):gsub( '%%', '/' ):gsub( '%.vim', '' ) )
31 local action = function ()
32 local session_restore = 'silent! source ' .. vim.fn.fnameescape( session_path )
33 vim.cmd( session_restore )
34 vim.notify( 'Restored session: ' .. name )
35 end
36 local section = 'Sessions'
38 return { name = name, action = action, section = section, }
39 end )
40 :totable()
41 end
43 starter.setup {
44 footer = (function ()
45 local startuptime
47 auto 'display_startup_time' {
48 description = 'Display startup time on starter screen',
49 events = 'User',
50 pattern = 'LazyVimStarted',
51 once = true,
52 command = vim.schedule_wrap( function ()
53 if vim.bo.filetype == 'starter' then
54 startuptime = require 'lazy'.stats().startuptime
55 starter.refresh()
56 end
57 end ),
58 }
60 return function ()
61 return icon.start .. ' ' .. (startuptime or ' ') .. 'ms'
62 end
63 end)(),
64 header = [[
65███ ▄ ▄▀ ██ ███ ▄█ ▄ ▄▀ ██
66█ █ █ ▄▀ █ █ █ █ ██ █ ▄▀ █ █
67█ ▀ ▄ █ █ █ ▀▄ █▄▄█ █ ▀ ▄ ██ ██ █ █ ▀▄ █▄▄█
68█ ▄▀ █ █ █ █ █ █ █ ▄▀ ▐█ █ █ █ █ █ █ █
69███ █▄ ▄█ ███ █ ███ ▐ █ █ █ ███ █
70 ▀▀▀ █ █ ██ █
71 ▀ ▀]],
72 items = {
73 starter.sections.builtin_actions(),
74 custom_actions,
75 sessions,
76 starter.sections.recent_files( is_home and 24 or 8, not is_home, is_home ),
77 },
78 content_hooks = {
79 starter.gen_hook.adding_bullet(),
80 starter.gen_hook.aligning( 'center', 'center' ),
81 starter.gen_hook.indexing( 'all', { 'Recent files', 'Recent files (current directory)', 'Builtin actions', } ),
82 },
83 }
84 end,
85}

neovim/lua/bugabinga/plugins/substitute.lua

Modified

+30 / −33 text lines

1local map = require'std.map'
1local map = require 'std.map'
3return {{
4 "gbprod/substitute.nvim",
5 keys = { 's', 'S' },
6 config = function()
7 local substitute = require'substitute'
8 substitute.setup{}
3map.normal {
4 description = 'substitution motion',
5 category = 'editing',
6 keys = 's',
7 command = function () require 'substitute'.operator() end,
8}
10 map.normal {
11 description = 'substitution motion',
12 category = 'editing',
13 keys = 's',
14 command = substitute.operator,
15 }
10map.normal {
11 description = 'substitution of current line',
12 category = 'editing',
13 keys = 'ss',
14 command = function () require 'substitute'.line() end,
15}
17 map.normal {
18 description = 'substitution of current line',
19 category = 'editing',
20 keys = 'ss',
21 command = substitute.line,
22 }
17map.normal {
18 description = 'substitution until end of line',
19 category = 'editing',
20 keys = 'S',
21 command = function () require 'substitute'.eol() end,
22}
24 map.normal {
25 description = 'substitution until end of line',
26 category = 'editing',
27 keys = 'S',
28 command = substitute.eol,
29 }
24map.visual {
25 description = 'substitution motion (visual mode)',
26 category = 'editing',
27 keys = 's',
28 command = function () require 'substitute'.visual() end,
29}
31return {
32 'gbprod/substitute.nvim',
33 opts = {},
34}
31 map.visual {
32 description = 'substitution motion (visual mode)',
33 category = 'editing',
34 keys = 's',
35 command = substitute.visual,
36 }
37 end,
38}}No final newline

neovim/lua/bugabinga/plugins/sudo.lua

Added
new file mode 100644

+1 / −0 text lines

1return { 'lambdalisue/suda.vim', cmd = { 'SudaRead', 'SudaWrite', }, }

neovim/lua/bugabinga/plugins/surround.lua

Modified

+19 / −31 text lines

11return {
2 {
3 'kylechui/nvim-surround',
4 keys = {
5 { 'ms', mode = 'n' },
6 { 'mss', mode = 'n' },
7 { 'mS', mode = 'n' },
8 { 'mSS', mode = 'n' },
9
10 { 'ms', mode = 'x' },
11 { 'mS', mode = 'x' },
13 { 'md', mode = 'n' },
14 { 'mc', mode = 'n' },
15 { 'mC', mode = 'n' },
2 'kylechui/nvim-surround',
3 event = 'VeryLazy',
4 opts = {
5 keymaps = {
6 insert = '<C-g>ms',
7 insert_line = '<C-g>mS',
8 normal = 'ms',
9 normal_cur = 'mss',
10 normal_line = 'mS',
11 normal_cur_line = 'mSS',
12 visual = 'ms',
13 visual_line = 'mS',
14 delete = 'md',
15 change = 'mc',
16 change_line = 'mC',
1617 },
17 opts = {
18 keymaps = {
19 normal = 'ms',
20 normal_cur = 'mss',
21 normal_line = 'mS',
22 normal_cur_line = 'mSS',
23 visual = 'ms',
24 visual_line = 'mS',
25 delete = 'md',
26 change = 'mc',
27 change_line = 'mC',
28 },
29 },
30 dependencies = {
31 'nvim-treesitter/nvim-treesitter',
32 },
33 }
18 },
19 dependencies = {
20 'nvim-treesitter/nvim-treesitter',
21 },

neovim/lua/bugabinga/plugins/symbols-outline.lua

Deleted
deleted file mode 100644

+0 / −13 text lines

1return {
2 'SmiteshP/nvim-navbuddy',
3 cmd = 'NavBuddy',
4 dependencies = {
5 'SmiteshP/nvim-navic',
6 'MunifTanjim/nui.nvim',
7 },
8 opts = {
9 window = {
10 border = vim.g.border_style,
11 },
12 },
13}

neovim/lua/bugabinga/plugins/tasks.lua

Added
new file mode 100644

+162 / −0 text lines

1local map = require 'std.map'
2local user_command = require 'std.user_command'
3
4map.normal {
5 description = 'Toggle task view',
6 category = 'tasks',
7 keys = '<leader>99',
8 command = function () prequire 'overseer'.toggle { enter = true, direction = 'right', } end,
9}
11map.normal {
12 description = 'Run task',
13 category = 'tasks',
14 keys = '<leader>9r',
15 command = function () prequire 'overseer'._run_template() end,
16}
18map.normal {
19 description = 'Run any command as task',
20 category = 'tasks',
21 keys = '<leader>9c',
22 command = function () prequire 'overseer'._run_command() end,
23}
25map.normal {
26 description = 'Load task bundle',
27 category = 'tasks',
28 keys = '<leader>9r',
29 command = function () prequire 'overseer'._load_bundle() end,
30}
32map.normal {
33 description = 'Run an action on the most recent task, or the task under the cursor',
34 category = 'tasks',
35 keys = '<leader>9d',
36 command = function () prequire 'overseer'._quick_action() end,
37}
39map.normal {
40 description = 'Select a task to run an action on',
41 category = 'tasks',
42 keys = '<leader>9s',
43 command = function () prequire 'overseer'._task_action() end,
44}
46map.normal {
47 description = 'Display diagnostic information about overseer',
48 category = 'tasks',
49 keys = '<leader>9i',
50 command = function () prequire 'overseer'._info() end,
51}
53user_command.OverseerDebugParser
54'Open a tab with windows laid out for debugging a parser' (
55 function ()
56 prequire 'overseer'.debug_parser()
57 end
58 )
60user_command.Grep
61'Run your grepprg as an Overseer task'
62 { nargs = '*', bang = true, bar = true, complete = 'file', } (
63 function ( params )
64 local args = vim.fn.expandcmd( params.args )
65 -- Insert args at the '$*' in the grepprg
66 local cmd, num_subs = vim.o.grepprg:gsub( '%$%*', args )
67 if num_subs == 0 then
68 cmd = cmd .. ' ' .. args
69 end
70 local cwd
71 prequire( 'oil', function ( oil )
72 cwd = oil.get_current_dir()
73 end )
74 local task = prequire 'overseer'.new_task {
75 cmd = cmd,
76 cwd = cwd,
77 name = 'grep ' .. args,
78 components = {
79 {
80 'on_output_quickfix',
81 errorformat = vim.o.grepformat,
82 open = not params.bang,
83 open_height = 8,
84 items_only = true,
85 },
86 -- We don't care to keep this around as long as most tasks
87 { 'on_complete_dispose', timeout = 30, },
88 'default',
89 },
90 }
91 task:start()
92 end
93 )
95user_command.Make
96'Run your makeprg as an Overseer task'
97 { nargs = '*', bang = true, } (
98 function ( params )
99 -- Insert args at the '$*' in the makeprg
100 local cmd, num_subs = vim.o.makeprg:gsub( '%$%*', params.args )
101 if num_subs == 0 then
102 cmd = cmd .. ' ' .. params.args
103 end
104 local task = prequire 'overseer'.new_task {
105 cmd = vim.fn.expandcmd( cmd ),
106 components = {
107 { 'on_output_quickfix', open = not params.bang, open_height = 8, },
108 'unique',
109 'default',
110 },
111 }
112 task:start()
113 end
114 )
116return {
117 {
118 'stevearc/resession.nvim',
119 lazy = true,
120 opts = {
121 extensions = {
122 overseer = {
123 status = { 'RUNNING', },
124 },
125 },
126 },
127 },
128 {
129 'stevearc/overseer.nvim',
130 opts = {
131 strategy = { 'jobstart', },
132 dap = false,
133 log = {
134 {
135 type = 'echo',
136 level = vim.log.levels.WARN,
137 },
138 {
139 type = 'file',
140 filename = 'overseer.log',
141 level = vim.log.levels.DEBUG,
142 },
143 },
144 component_aliases = {
145 default = {
146 {
147 'display_duration',
148 detail_level = 2,
149 },
150 'on_output_summarize',
151 'on_exit_set_status',
152 { 'on_complete_notify', system = 'unfocused', },
153 'on_complete_dispose',
154 },
155 default_neotest = {
156 'unique',
157 { 'on_complete_notify', system = 'unfocused', on_change = true, },
158 'default',
159 },
160 },
161 },
162 }, }

neovim/lua/bugabinga/plugins/telescope.lua

Modified

+170 / −155 text lines

1local map = require 'std.map'
2local icon = require 'std.icon'
3local table = require 'std.table'
4
51require 'bugabinga.health'.add_dependency
62{
7 name = 'ripgrep',
8 name_of_executable = 'rg',
3 name = 'ripgrep',
4 name_of_executable = 'rg',
5}
6 {
7 name = 'find-fd',
8 name_of_executable = 'fd',
9 }
10 {
11 name = 'CMake',
12 name_of_executable = 'cmake',
13 }
15local map = require 'std.map'
16local icon = require 'std.icon'
18map.normal {
19 description = 'Switch to recently used folders',
20 category = 'navigation',
21 keys = '<c-p><c-z>',
22 command = function () require 'telescope'.extensions.zoxide.list() end,
23}
25map.normal.visual.terminal {
26 description = 'Search help files',
27 category = 'help',
28 keys = '<F1>',
29 command = function () require 'telescope.builtin'.help_tags() end,
30}
32map.normal {
33 description = 'Open last search...',
34 category = 'plugins',
35 keys = '<c-p>',
36 command = function () require 'telescope.builtin'.resume() end,
37}
39map.normal {
40 description = 'Open search for all files...',
41 category = 'search',
42 keys = '<c-p><c-p>',
43 command = function () require 'telescope.builtin'.find_files() end,
44}
46map.normal {
47 description = 'Open search for keymaps...',
48 category = 'search',
49 keys = '<c-p><c-k>',
50 command = function () require 'telescope.builtin'.keymaps() end,
51}
53map.normal {
54 description = 'Open search for symbols...',
55 category = 'search',
56 keys = '<c-p><c-s>',
57 command = function () require 'telescope.builtin'.symbols() end,
58}
60map.normal {
61 description = 'Open search for all file contents...',
62 category = 'search',
63 keys = '<c-p><c-g>',
64 command = function () require 'telescope.builtin'.live_grep() end,
65}
67map.normal {
68 description = 'Open search for current buffer content...',
69 category = 'search',
70 keys = '<c-p><c-/>',
71 command = function () require 'telescope.builtin'.current_buffer_fuzzy_find() end,
72}
74map.normal {
75 description = 'Open search for buffers...',
76 category = 'search',
77 keys = '<c-e>',
78 command = function () require 'telescope.builtin'.buffers() end,
979}
10 {
11 name = 'find-fd',
12 name_of_executable = 'fd',
13 }
1581return {
16 'nvim-telescope/telescope.nvim',
17 tag = '0.1.6',
18 cmd = 'Telescope',
19 event = 'VeryLazy',
20 dependencies = {
21 'nvim-lua/plenary.nvim',
22 'nvim-tree/nvim-web-devicons',
23 'nvim-telescope/telescope-symbols.nvim',
24 'nvim-telescope/telescope-ui-select.nvim',
25 'jvgrootveld/telescope-zoxide',
26 },
27 config = function ()
28 local telescope = require 'telescope'
29 local builtin = require 'telescope.builtin'
30 local actions = require 'telescope.actions'
31 local themes = require 'telescope.themes'
82 'nvim-telescope/telescope.nvim',
83 version = '0.*',
84 cmd = 'Telescope',
85 event = 'VeryLazy',
86 dependencies = {
87 {
88 'nvim-telescope/telescope-fzf-native.nvim',
89 build =
90 function ( plugin_spec )
91 local result
92 result = vim.system( { 'cmake', '-S.', '-Bbuild', '-DCMAKE_BUILD_TYPE=Release', },
93 { text = true, cwd = plugin_spec.dir, } ):wait()
94 if result.code ~= 0 then error( result.stderr ) end
95 result = vim.system( { 'cmake', '--build', 'build', '--config', 'Release', },
96 { text = true, cwd = plugin_spec.dir, } ):wait()
97 if result.code ~= 0 then error( result.stderr ) end
98 result = vim.system( { 'cmake', '--install', 'build', '--prefix', 'build', },
99 { text = true, cwd = plugin_spec.dir, } ):wait()
100 if result.code ~= 0 then error( result.stderr ) end
101 end,
102 },
103 'nvim-lua/plenary.nvim',
104 'nvim-tree/nvim-web-devicons',
105 'nvim-telescope/telescope-symbols.nvim',
106 'jvgrootveld/telescope-zoxide',
107 },
108 config = function ()
109 local telescope = require 'telescope'
110 local actions = require 'telescope.actions'
111 local themes = require 'telescope.themes'
33 local ivy = themes.get_ivy { hidden = true, layout_config = { preview_width = 0.69, }, }
34 local dropdown = themes.get_dropdown { layout_config = { width = 0.69, }, }
35 local cursor = themes.get_cursor { layout_config = { preview_width = 0.42, width = 0.69, }, }
113 local ivy = themes.get_ivy { hidden = true, layout_config = { preview_width = 0.69, }, }
114 local dropdown = themes.get_dropdown { layout_config = { width = 0.69, }, }
115 local cursor = themes.get_cursor { layout_config = { preview_width = 0.42, width = 0.69, }, }
37 telescope.setup {
38 defaults = {
39 path_display = { 'truncate', },
40 sorting_strategy = 'ascending',
41 layout_config = {
42 horizontal = { prompt_position = 'bottom', preview_width = 0.69, },
43 vertical = { mirror = false, },
44 width = 0.69,
45 height = 0.42,
46 preview_cutoff = 124,
47 },
48 prompt_prefix = icon.telescope .. ' ',
49 selection_caret = icon.arrow_right .. ' ',
50 border = true,
51 file_ignore_patterns = {
52 '.git/',
53 '.svn/',
54 '.cache',
55 '%.o',
56 '%.a',
57 '%.out',
58 '%.class',
59 '%.pdf',
60 '%.mkv',
61 '%.mp4',
62 '%.zip',
63 },
64 mappings = {
65 i = {
66 ['<c-j>'] = actions.cycle_history_next,
67 ['<c-k>'] = actions.cycle_history_prev,
68 ['<c-n>'] = actions.move_selection_next,
69 ['<c-p>'] = actions.move_selection_previous,
70 ['<c-s>'] = actions.file_split,
71 },
72 n = { q = actions.close, },
73 },
74 },
75 pickers = {
76 find_files = ivy,
77 fd = ivy,
78 keymaps = dropdown,
79 diagnostics = dropdown,
80 symbols = cursor,
81 live_grep = ivy,
82 current_buffer_fuzzy_find = cursor,
83 buffers = cursor,
84 },
85 extensions = {
86 ['ui-select'] = { cursor, },
87 zoxide = { prompt_title = 'Navigate deez nuts!', },
88 },
89 }
117 telescope.setup {
118 defaults = {
119 selection_strategy = 'reset',
120 hidden = true,
121 scroll_strategy = 'limit',
122 wrap_results = true,
123 layout_config = {
124 horizontal = { prompt_position = 'bottom', preview_width = 0.69, },
125 vertical = { mirror = false, },
126 width = 0.69,
127 height = 0.42,
128 preview_cutoff = 124,
129 },
130 prompt_prefix = icon.telescope .. ' ',
131 selection_caret = icon.arrow_right .. ' ',
132 file_ignore_patterns = {
133 '.git/',
134 '.svn/',
135 '.cache',
136 '%.o',
137 '%.a',
138 '%.out',
139 '%.class',
140 '%.pdf',
141 '%.mkv',
142 '%.mp4',
143 '%.zip',
144 '%.spl',
145 },
146 mappings = {
147 i = {
148 ['<c-j>'] = actions.cycle_history_next,
149 ['<c-k>'] = actions.cycle_history_prev,
150 ['<c-n>'] = actions.move_selection_next,
151 ['<c-p>'] = actions.move_selection_previous,
152 ['<c-s>'] = actions.file_split,
153 ['g?'] = actions.which_key,
154 },
155 n = { q = actions.close, },
156 },
157 },
158 -- FIXME: some themes have an issue, where filtered results do not get
159 -- selected and are not in view
160 pickers = {
161 find_files = ivy,
162 fd = ivy,
163 keymaps = dropdown,
164 diagnostics = dropdown,
165 symbols = cursor,
166 live_grep = ivy,
167 current_buffer_fuzzy_find = cursor,
168 buffers = cursor,
169 help_tags = dropdown,
170 },
171 extensions = {
172 zoxide = { prompt_title = 'Navigate deez nuts!', },
173 },
174 }
91 telescope.load_extension 'ui-select'
92 telescope.load_extension 'zoxide'
94 map.normal {
95 description = 'Switch to recently used folders',
96 category = 'navigation',
97 keys = '<c-z>',
98 command = telescope.extensions.zoxide.list,
99 }
101 map.normal.visual.terminal {
102 description = 'Search help files',
103 category = 'help',
104 keys = '<F1>',
105 command = function () builtin.help_tags( dropdown ) end,
106 }
108 map.normal {
109 description = 'Open last search...',
110 category = 'plugins',
111 keys = '<c-p>',
112 command = function () builtin.resume() end,
113 }
115 map.normal {
116 description = 'Open search for commands...',
117 category = 'plugins',
118 keys = '<c-p><c-m>',
119 command = function () builtin.commands() end,
120 }
122 map.normal {
123 description = 'Open search for all files...',
124 category = 'search',
125 keys = '<c-p><c-p>',
126 command = function () builtin.find_files() end,
127 }
129 map.normal {
130 description = 'Open search for keymaps...',
131 category = 'search',
132 keys = '<c-p><c-k>',
133 command = function () builtin.keymaps() end,
134 }
136 map.normal {
137 description = 'Open search for symbols...',
138 category = 'search',
139 keys = '<c-p><c-s>',
140 command = function () builtin.symbols() end,
141 }
143 map.normal {
144 description = 'Open search for all file contents...',
145 category = 'search',
146 keys = '<c-p><c-g>',
147 command = function () builtin.live_grep() end,
148 }
150 map.normal {
151 description = 'Open search for current buffer content...',
152 category = 'search',
153 keys = '<c-p><c-b>',
154 command = function () builtin.current_buffer_fuzzy_find() end,
155 }
157 map.normal {
158 description = 'Open search for buffers...',
159 category = 'search',
160 keys = '<c-e>',
161 command = function () builtin.buffers() end,
162 }
163 end,
176 telescope.load_extension 'fzf'
177 telescope.load_extension 'zoxide'
178 end,

neovim/lua/bugabinga/plugins/tests.lua

Added
new file mode 100644

+137 / −0 text lines

1local debug = require 'std.dbg'
2local icon = require 'std.icon'
3local map = require 'std.map'
4
5map.normal {
6 description = 'Run all tests',
7 category = 'test',
8 keys = '<leader>7n',
9 command = function () prequire 'neotest'.run.run {} end,
10}
12map.normal {
13 description = 'Run all tests',
14 category = 'test',
15 keys = '<leader>7n',
16 command = function () prequire 'neotest'.run.run {} end,
17}
19map.normal {
20 description = 'Run tests for current file',
21 category = 'test',
22 keys = '<leader>7t',
23 command = function () prequire 'neotest'.run.run { vim.api.nvim_buf_get_name( 0 ), } end,
24}
26map.normal {
27 description = 'Run all test suites',
28 category = 'test',
29 keys = '<leader>7a',
30 command = function ()
31 for _, adapter_id in ipairs( require 'neotest'.run.adapters() ) do
32 prequire 'neotest'.run.run { suite = true, adapter = adapter_id, }
33 end
34 end,
35}
37map.normal {
38 description = 'Run last test',
39 category = 'test',
40 keys = '<leader>7l',
41 command = function () prequire 'neotest'.run.run_last() end,
42}
44map.normal {
45 description = 'Run all tests in debugger',
46 category = 'test',
47 keys = '<leader>7d',
48 command = function () prequire 'neotest'.run.run { strategy = 'dap', } end,
49}
51map.normal {
52 description = 'Show test summary',
53 category = 'test',
54 keys = '<leader>7p',
55 command = function () prequire 'neotest'.summary.toggle() end,
56}
58map.normal {
59 description = 'Show test output',
60 category = 'test',
61 keys = '<leader>7o',
62 command = function () prequire 'neotest'.output.open { short = true, } end,
63}
65-- Investigate:
66-- * Does neotest have ability to throttle groups of individual test runs?
67-- * Tangential, but also check out https://github.com/andythigpen/nvim-coverage
68return {
69 'nvim-neotest/neotest',
70 dependencies = {
71 'nvim-lua/plenary.nvim',
72 'nvim-neotest/neotest-plenary',
73 'nvim-neotest/nvim-nio',
74 'stevearc/overseer.nvim',
75 },
77 config = function ()
78 local neotest = require 'neotest'
79 if debug.get() then
80 require 'neotest.logging':set_level 'trace'
81 end
82 neotest.setup {
83 adapters = {
84 require 'neotest-plenary',
85 },
86 discovery = {
87 enabled = false,
88 },
89 consumers = {
90 overseer = prequire 'neotest.consumers.overseer',
91 },
92 summary = {
93 mappings = {
94 attach = 'a',
95 expand = 'l',
96 expand_all = 'L',
97 jumpto = 'gf',
98 output = 'o',
99 run = '<C-r>',
100 short = 'p',
101 stop = 'u',
102 },
103 },
104 icons = {
105 passed = icon.passed,
106 running = icon.running,
107 failed = icon.failed,
108 unknown = icon.unknown,
109 running_animated = vim.tbl_map(
110 function ( s ) return s .. ' ' end,
111 {
112 icon.progress_0,
113 icon.progress_1,
114 icon.progress_2,
115 icon.progress_3,
116 icon.progress_4,
117 icon.progress_5,
118 icon.progress_6,
119 icon.progress_7,
120 icon.progress_8,
121 icon.progress_9,
122 }
123 ),
124 },
125 diagnostic = {
126 enabled = true,
127 },
128 output = {
129 enabled = true,
130 open_on_run = false,
131 },
132 status = {
133 enabled = true,
134 },
135 }
136 end,
137}

neovim/lua/bugabinga/plugins/tint.lua

Added
new file mode 100644

+5 / −0 text lines

1return {
2 'levouh/tint.nvim',
3 event = { 'WinNew', 'SessionLoadPost', },
4 opts = {},
5}

neovim/lua/bugabinga/plugins/todo-comments.lua

Modified

+2 / −2 text lines

11return {
22 'folke/todo-comments.nvim',
3 tag = 'v1.1.0',
3 version = '1.*',
44 dependencies = { 'nvim-lua/plenary.nvim', },
5 event = 'BufReadPost',
5 event = vim.g.FILE_LOADED_EVENTS,
66 opts = {},
77}

neovim/lua/bugabinga/plugins/toggleterm.lua

Deleted
deleted file mode 100644

+0 / −105 text lines

1local map = require 'std.map'
2local auto = require 'std.auto'
3
4require 'bugabinga.health'.add_dependency
5{
6 name_of_executable = 'gitui',
7}
8 {
9 name_of_executable = 'mdcat',
10 }
11 {
12 name_of_executable = 'dot',
13 }
15return {
16 'akinsho/toggleterm.nvim',
17 tag = 'v2.10.0',
18 keys = {
19 '<F7>',
20 '<F8>',
21 '<F9>',
22 '<F10>',
23 },
24 cmd = {
25 'ToggleTerm',
26 'TermExec',
27 'Gitui',
28 'Mdcat',
29 'Graphviz',
30 'Graphviz',
31 },
32 opts = {
33 open_mapping = '<F7>',
34 direction = 'float',
35 float_opts = {
36 border = vim.g.border_style,
37 winblend = vim.o.winblend,
38 },
39 size = function ( term )
40 if term.direction == 'horizontal' then
41 return 18
42 elseif term.direction == 'vertical' then
43 return vim.o.columns * 0.42
44 end
45 end,
46 },
47 config = function ( _, opts )
48 local toggleterm = require 'toggleterm'
49 toggleterm.setup( opts )
51 local set_terminal_keymaps = function ()
52 local local_to_buffer = { buffer = 0, }
53 map.terminal {
54 description = 'Quit insert mode',
55 category = 'terminal',
56 keys = '<esc>',
57 options = local_to_buffer,
58 command = [[ <C-\><C-n> ]],
59 }
60 end
62 auto 'normalize_terminal_windows' {
63 description = 'Make terminal windows behave more normally.',
64 events = 'TermOpen',
65 pattern = 'term://*',
66 command = set_terminal_keymaps,
67 }
69 map.normal {
70 description = 'Open vertical Terminal',
71 category = 'terminal',
72 keys = '<F8>',
73 command = '<CMD>exe v:count1 . "ToggleTerm size=60 direction=vertical"<CR>',
74 }
76 map.normal {
77 description = 'Open horizontal Terminal',
78 category = 'terminal',
79 keys = '<F9>',
80 command = '<CMD>exe v:count1 . "ToggleTerm size=20 direction=horizontal"<CR>',
81 }
83 local Terminal = require 'toggleterm.terminal'.Terminal
85 --[ GITUI ]
87 local gitui = Terminal:new {
88 hidden = true,
89 cmd = 'gitui',
90 dir = 'git_dir',
91 direction = 'tab',
92 }
94 local toggle_gitui = function () gitui:toggle() end
96 map.normal.terminal.insert {
97 description = 'Toggle gitui terminal in tab',
98 category = 'terminal',
99 keys = '<F10>',
100 command = toggle_gitui,
101 }
103 vim.api.nvim_create_user_command( 'Gitui', toggle_gitui, { desc = 'Toggle Gitui', } )
104 end,
105}

neovim/lua/bugabinga/plugins/tree.lua

Modified

+24 / −8 text lines

11local map = require 'std.map'
3map.normal {
4 description = 'Toggle Tree File Explorer',
5 category = 'explorer',
6 keys = '<leader>e',
7 command = function () require 'nvim-tree.api'.tree.toggle() end,
8}
9
310return {
411 'nvim-tree/nvim-tree.lua',
512 version = '1.*',
613 -- docs do not recommend to lazy load, but it does load slowly on win32!
714 -- lazy = false,
815 cmd = 'NvimTreeOpen',
9 keys = '<leader>e',
1016 dependencies = {
1117 'nvim-tree/nvim-web-devicons',
1218 'antosha417/nvim-lsp-file-operations',
1925 -- set termguicolors to enable highlight groups
2026 vim.opt.termguicolors = true
2127 end,
28<<<<<<< HEAD
2229 config = function ()
2330 require 'nvim-tree'.setup {
2431 sort = {
3441 dotfiles = false,
3542 },
3643 }
44=======
45 opts = {
46 sort_by = 'case_sensitive',
47 view = {
48 width = 69,
49 },
50 renderer = {
51 group_empty = true,
52 },
53 filters = {
54 dotfiles = false,
55 },
56 },
57 config = function ( _, opts )
58 require 'nvim-tree'.setup( opts )
59>>>>>>> ae9ecfa7bfa272a7c951b77be07353ffb28995d7
3760 require 'lsp-file-operations'.setup()
39 map.normal {
40 description = 'Toggle Tree File Explorer',
41 category = 'explorer',
42 keys = '<leader>e',
43 command = '<cmd>NvimTreeToggle<cr>',
44 }
4561 end,

neovim/lua/bugabinga/plugins/treesitter.lua

Modified

+29 / −31 text lines

88return {
99 'nvim-treesitter/nvim-treesitter',
10 branch = 'master',
11 -- to get access to newer parsers, TS cannot yet be pinned
1210 -- version = '0.9.*',
13 event = 'VeryLazy',
14 -- event = { 'BufReadPre', 'BufNewFile', },
11 branch = 'master',
12 -- restoring session throws errors, if this is lazy
13 lazy = false,
1514 build = function ()
1615 require 'nvim-treesitter.install'.update { with_sync = true, }
1716 end,
1817 dependencies = {
19 'windwp/nvim-ts-autotag',
2018 'nvim-treesitter/playground',
2119 'nvim-treesitter/nvim-treesitter-textobjects',
20 'windwp/nvim-ts-autotag',
21 'RRethy/nvim-treesitter-endwise',
2222 'nushell/tree-sitter-nu',
2323 },
2424 config = function ()
2525 local install = require 'nvim-treesitter.install'
2626 local configs = require 'nvim-treesitter.configs'
27 local parsers = require 'nvim-treesitter.parsers'
2928 install.prefer_git = false
3029 install.compilers = { 'zig', 'clang', 'gcc', 'cl', 'cc', vim.fn.getenv 'CC', }
32 local should_disable = function ( _, bufnr )
33 local max_filesize = 5 * 1024 * 1024 --MiB
34 local ok, stats = pcall( vim.loop.fs_stat, vim.api.nvim_buf_get_name( bufnr or 0 ) )
35 if ok and stats and stats.size > max_filesize then
36 return true
37 end
38 return false
39 end
3241 ---@diagnostic disable-next-line: missing-fields
3342 configs.setup {
3543 sync_install = false,
3744 ensure_installed = {
3845 'bash',
3946 'c',
4754 'gitignore',
4855 'ini',
4956 'java',
57 'just',
5058 'jsonc',
5159 'lua',
5260 'luap',
7886 auto_install = true,
80 autotag = { enable = false, },
88 autotag = { enable = true, disable = should_disable, },
89 ewndwise = { enable = true, disable = should_disable, },
8291 highlight = {
8392 enable = true,
84 disable = function ( _, buf )
85 local max_filesize = 1000 * 1024 -- 1000 KiB
86 local ok, stats = pcall( vim.loop.fs_stat, vim.api.nvim_buf_get_name( buf ) )
87 if ok and stats and stats.size > max_filesize then
88 return true
89 end
90 end,
93 disable = should_disable,
9194 additional_vim_regex_highlighting = false,
9295 },
9497 incremental_selection = {
9598 enable = true,
99 disable = should_disable,
96100 keymaps = {
97101 init_selection = '<up>',
98 node_incremental = '<right>',
102 node_incremental = '<up>',
99103 node_decremental = '<down>',
100 scope_incremental = '<up>',
104 scope_incremental = '<right>',
101105 },
102106 },
106110 playground = {
107111 enable = true,
108 disable = {},
112 disable = should_disable,
109113 updatetime = 25,
110114 persist_queries = false,
111115 keybindings = {
125129 textobjects = {
126130 select = {
127131 enable = true,
132 disable = should_disable,
128133 lookahead = true,
129134 keymaps = {
130135 ['af'] = { query = '@call.outer', desc = 'outer function call', },
169174 swap = {
170175 enable = true,
176 disable = should_disable,
171177 swap_next = {
172 ['<leader>spn'] = { query = '@parameter.inner', desc = 'Swap parameter with next', },
178 ['<leader>rwn'] = { query = '@parameter.inner', desc = 'Swap parameter with next', },
173179 },
174180 swap_previous = {
175 ['<leader>spp'] = { query = '@parameter.inner', desc = 'Swap parameter with previous', },
181 ['<leader>rwp'] = { query = '@parameter.inner', desc = 'Swap parameter with previous', },
176182 },
177183 },
179185 lsp_interop = {
180186 enable = true,
187 disable = should_disable,
181188 border = vim.g.border_style,
182189 floating_preview_opts = {},
183190 peek_definition_code = {
189196 move = {
190197 enable = true,
198 disable = should_disable,
191199 set_jumps = true,
192200 goto_next = {
193201 [']f'] = { query = '@call.outer', desc = 'Goto next function call', },
206214 },
207215 },
208216 }
210 ---@diagnostic disable-next-line: inject-field
211 parsers.get_parser_configs().just = {
212 install_info = {
213 url = 'https://github.com/IndianBoy42/tree-sitter-just', -- local path or git repo
214 files = { 'src/parser.c', 'src/scanner.cc', },
215 branch = 'main',
216 },
217 maintainers = { '@IndianBoy42', },
218 }
219217 end,

neovim/lua/bugabinga/plugins/treesj.lua

Modified

+15 / −17 text lines

11local map = require 'std.map'
3return {
4 'Wansmer/treesj',
3map.normal {
4 description = 'Toggle Tree Join/Split',
5 category = 'editing',
6 -- WARN: <C-j> produces the same key code as <C-enter> on some terminals
57 keys = '<C-j>',
6 dependencies = { 'nvim-treesitter/nvim-treesitter' },
7 opts = {
8 use_default_keymaps = false,
9 },
10 config = function ( _, opts )
11 local treesj = require 'treesj'
12 treesj.setup( opts )
14 map.normal {
15 description = 'Toggle Tree Join/Split',
16 category = 'editing',
17 -- WARN: <C-j> produces the same keycode as <C-enter> on some terminals
18 keys = '<C-j>',
19 command = treesj.toggle,
20 }
8 command = function ()
9 require 'treesj'.toggle()
2110 end,
13return {
14 'Wansmer/treesj',
15 dependencies = { 'nvim-treesitter/nvim-treesitter', },
16 opts = {
17 use_default_keymaps = false,
18 ---@type number If line after join will be longer than max value, node will not be formatted
19 max_join_length = vim.opt.textwidth:get(),
20 },
21}

neovim/lua/bugabinga/plugins/venn.lua

Added
new file mode 100644

+13 / −0 text lines

1local map = require 'std.map'
2
3map.visual {
4 description = 'Enable box drawing mode',
5 category = 'draw',
6 keys = '<leader>b',
7 command = function () vim.cmd.VBox() end,
8}
9
10return {
11 'jbyuki/venn.nvim',
12 cmd = 'VBox',
13}

neovim/lua/bugabinga/plugins/virt-column.lua

Modified

+8 / −12 text lines

11local ignored = require 'std.ignored'
33return {
4 {
5 'lukas-reineke/virt-column.nvim',
6 tag = 'v2.0.2',
7 event = { 'BufReadPost', 'BufNew', },
8 opts = {
9 -- FIXME: I have visual redrawing bugs right now.
10 enabled = false,
11 char = { '░', '▒', '▓', },
12 exclude = {
13 filetypes = ignored.filetypes,
14 buftypes = ignored.buftypes,
15 },
4 'lukas-reineke/virt-column.nvim',
5 version = '2.*',
6 event = vim.g.FILE_LOADED_EVENTS,
7 opts = {
8 char = { '┆', '╎', '│', },
9 exclude = {
10 filetypes = ignored.filetypes,
11 buftypes = ignored.buftypes,
1612 },
1713 },

neovim/lua/bugabinga/plugins/whichkey.lua

Modified

+19 / −14 text lines

44return {
55 'folke/which-key.nvim',
6 tag = 'v1.6.0',
6 version = '1.*',
77 event = 'VeryLazy',
88 init = function ()
99 vim.o.timeout = true
4040 -- use category as prefix?
4141 wk.register {
4242 ['<leader>'] = {
43 m = { name = 'mark', _ = 'which_key_ignore', },
44 h = { name = 'hunk', _ = 'which_key_ignore', },
45 l = { name = 'lsp', _ = 'which_key_ignore', },
46 r = { name = 'refactor', _ = 'which_key_ignore', },
47 s = {
48 name = 'swap',
49 _ = 'which_key_ignore',
43 ['7'] = { name = 'tests', _ = 'which_key_ignore', },
44 m = { name = '|m|ark', _ = 'which_key_ignore', },
45 h = { name = '|h|unk', _ = 'which_key_ignore', },
46 f = { name = '|f|iles', _ = 'which_key_ignore', },
47 g = { name = '|g|enerate', _ = 'which_key_ignore', },
48 d = { name = '|d|ebug', _ = 'which_key_ignore', },
49 v = { name = '|v|ersion control', _ = 'which_key_ignore', },
50 s = { name = '|s|essions', _ = 'which_key_ignore', },
51 r = { name = '|r|efactor', _ = 'which_key_ignore', },
52 w = { name = 's|w|ap', _ = 'which_key_ignore',
5053 {
51 p = { name = 'parameter', _ = 'which_key_ignore', },
54 p = { name = '|p|arameter', _ = 'which_key_ignore', },
5255 },
5356 },
54 t = {
55 name = 'toggle',
56 _ = 'which_key_ignore',
57 l = { name = '|l|sp', _ = 'which_key_ignore',
58 p = { name = '|p|eek', _ = 'which_key_ignore', },
59 c = { name = '|c|alls', _ = 'which_key_ignore', },
60 },
61 t = { name = '|t|oggle', _ = 'which_key_ignore',
5762 {
58 o = { name = 'options', _ = 'which_key_ignore', },
63 o = { name = '|o|ptions', _ = 'which_key_ignore', },
5964 },
6065 },
61 z = { name = 'lazy', _ = 'which_key_ignore', },
66 z = { name = 'la|z|y', _ = 'which_key_ignore', },
6267 [' '] = { name = 'fun', _ = 'which_key_ignore', },
6368 },
6469 }

neovim/lua/bugabinga/plugins/window.lua

Modified

+15 / −46 text lines

11local map = require 'std.map'
2local user_command = require 'std.user_command'
3
4map.normal {
5 description = 'Open window picker...',
6 category = 'navigation',
7 keys = '<c-w>a',
8 command = function () prequire 'nvim-window'.pick() end,
9}
11user_command.PickWindow
12'Pick a window with a simple char motion' (
13 function () prequire 'nvim-window'.pick() end
14 )
316return {
417 'yorickpeterse/nvim-window',
5 cmd = 'PickWindow',
6 keys = '<c-w>a',
7
818 opts = {
9 -- from wezterm for easz qwerty moitions
10 chars = {
11 'a',
12 's',
13 'd',
14 'f',
15 'q',
16 'w',
17 'e',
18 'r',
19 'z',
20 'x',
21 'c',
22 'v',
23 'j',
24 'k',
25 'l',
26 'm',
27 'i',
28 'u',
29 'o',
30 'p',
31 'g',
32 'h',
33 't',
34 'y',
35 'b',
36 'n',
37 },
19 -- from wezterm for easy qwerty motions
20 chars = { 'a', 's', 'd', 'f', 'q', 'w', 'e', 'r', 'z', 'x', 'c', 'v', 'j', 'k', 'l', 'm', 'i', 'u', 'o', 'p', 'g', 'h', 't', 'y', 'b', 'n', },
3821 border = vim.g.border_style,
3922 normal_hl = 'NormalFloat',
4023 hint_hl = 'Special',
4124 },
42 config = function ( _, opts )
43 local window = require 'nvim-window'
45 window.setup( opts )
47 map.normal {
48 description = 'Open window picker...',
49 category = 'navigation',
50 keys = '<c-w>a',
51 command = function () window.pick() end,
52 }
54 vim.api.nvim_create_user_command( 'PickWindow', window.pick, { bang = true } )
55 end

neovim/lua/bugabinga/plugins/zen.lua

Modified

+14 / −5 text lines

1local map = require 'std.map'
2
3map.normal {
4 description = 'Enable zen mode',
5 category = 'ui',
6 keys = '<leader>tz',
7 command = function () require 'zen-mode'.toggle() end,
8}
9
110return {
2 "folke/zen-mode.nvim",
11 'folke/zen-mode.nvim',
312 cmd = 'ZenMode',
4 dependencies = { { 'folke/twilight.nvim', opts = { dimming = { inactive = true } } } },
13 dependencies = { { 'folke/twilight.nvim', opts = { dimming = { inactive = true, }, }, }, },
514 opts = {
615 --FIXME: this does not work, because on win32 there is no base64 binary
7 plugins = { wezterm = { enabled = true, font = "+4" } },
16 plugins = { wezterm = { enabled = true, font = '+4', }, },
817 window = {
918 width = 0.69,
1019 backdrop = 0.42,
1120 options = {
12 signcolumn = "no",
21 signcolumn = 'no',
1322 number = false,
1423 relativenumber = false,
1524 cursorline = false,
1625 cursorcolumn = false,
17 foldcolumn = "0",
26 foldcolumn = '0',
1827 list = false,
1928 },
2029 },

neovim/lua/bugabinga/save_actions.lua

Added
new file mode 100644

+31 / −0 text lines

1local map = require 'std.map'
2local localrc = require 'std.localrc'
3local user_command = require 'std.user_command'
4
5local global_actions = vim.g.save_actions or {}
6local project_local_actions = localrc( '.save.actions.lua', 'table' ) or {}
7local all_actions = vim.tbl_deep_extend( 'force', global_actions, project_local_actions )
8
9local apply_save_actions = function ()
10 vim.iter( all_actions ):each(
11 function ( action )
12 vim.validate {
13 action = { action, 'string', },
14 }
15 local parsed_command = vim.api.nvim_parse_cmd( action, {} )
16 vim.api.nvim_cmd( parsed_command, { output = true, } )
17 end
18 )
20 --save all
21 vim.cmd [[wa]]
22end
24user_command.SaveActions 'Execute all declared save actions' ( apply_save_actions )
26map.normal.visual {
27 description = 'Save all buffers and apply save actions',
28 category = 'actions',
29 keys = '<c-s>',
30 command = '<cmd>SaveActions<cr>',
31}

neovim/lua/bugabinga/terminal.lua

Added
new file mode 100644

+44 / −0 text lines

1local map = require 'std.map'
2local auto = require 'std.auto'
3
4map.normal {
5 description = 'Open terminal in a split',
6 category = 'terminal',
7 keys = '<F7>',
8 command = function ()
9 local cwd = vim.uv.cwd()
10 ---@diagnostic disable-next-line: undefined-field
11 local shell = vim.opt.shell:get()
12 local open_term_cmd = string.format( 'split term://%s//%s', cwd, shell )
13 vim.cmd( open_term_cmd )
14 end,
15}
17local terminal_settings = function ()
18 map.terminal {
19 description = 'Quit insert mode via <esc>',
20 category = 'terminal',
21 keys = '<esc>',
22 buffer = true,
23 command = [[ <C-\><C-n> ]],
24 }
26 map.terminal.normal {
27 description = 'Close current terminal',
28 category = 'terminal',
29 keys = '<F7>',
30 buffer = true,
31 command = [[ <C-\><C-n><cmd>q<cr> ]],
32 }
34 vim.opt_local.spell = false
36 vim.cmd.startinsert()
37end
39auto 'normalize_terminal_windows' {
40 description = 'Make terminal windows behave more normally.',
41 events = 'TermOpen',
42 pattern = 'term://*',
43 command = terminal_settings,
44}

neovim/lua/bugabinga/trim.lua

Deleted
deleted file mode 100644

+0 / −65 text lines

1-- If invoked as a preview callback, performs 'inccommand' preview by
2-- highlighting trailing whitespace in the current buffer.
3local function trim_space_preview(opts, preview_ns, preview_buf)
4 vim.cmd('hi clear Whitespace')
5 local line1 = opts.line1
6 local line2 = opts.line2
7 local buf = vim.api.nvim_get_current_buf()
8 local lines = vim.api.nvim_buf_get_lines(buf, line1 - 1, line2, false)
9 local preview_buf_line = 0
10 for i, line in ipairs(lines) do
11 local start_idx, end_idx = string.find(line, '%s+$')
12 if start_idx then
13 -- Highlight the match
14 vim.api.nvim_buf_add_highlight(
15 buf,
16 preview_ns,
17 'Substitute',
18 line1 + i - 2,
19 start_idx - 1,
20 end_idx
21 )
22 -- Add lines and set highlights in the preview buffer
23 -- if inccommand=split
24 if preview_buf then
25 local prefix = string.format('|%d| ', line1 + i - 1)
26 vim.api.nvim_buf_set_lines(
27 preview_buf,
28 preview_buf_line,
29 preview_buf_line,
30 false,
31 { prefix .. line }
32 )
33 vim.api.nvim_buf_add_highlight(
34 preview_buf,
35 preview_ns,
36 'Substitute',
37 preview_buf_line,
38 #prefix + start_idx - 1,
39 #prefix + end_idx
40 )
41 preview_buf_line = preview_buf_line + 1
42 end
43 end
44 end
45 -- Return the value of the preview type
46 return 2
47end
48-- Trims all trailing whitespace in the current buffer.
49local function trim_space(opts)
50 local line1 = opts.line1
51 local line2 = opts.line2
52 local buf = vim.api.nvim_get_current_buf()
53 local lines = vim.api.nvim_buf_get_lines(buf, line1 - 1, line2, false)
54 local new_lines = {}
55 for i, line in ipairs(lines) do
56 new_lines[i] = string.gsub(line, '%s+$', '')
57 end
58 vim.api.nvim_buf_set_lines(buf, line1 - 1, line2, false, new_lines)
59end
60-- Create the user command
61vim.api.nvim_create_user_command(
62 'TrimTrailingWhitespace',
63 trim_space,
64 { nargs = '?', range = '%', addr = 'lines', preview = trim_space_preview }
65)

neovim/lua/bugabinga/ui.lua

Modified

+3 / −3 text lines

1local NuiPopup = require 'nui.popup'
2local NuiText = require 'nui.text'
3local NuiLine = require 'nui.line'
1local NuiPopup = prequire 'nui.popup'
2local NuiText = prequire 'nui.text'
3local NuiLine = prequire 'nui.line'
55local get_nui_popup = function ()
66 local popup = NuiPopup {

neovim/lua/std/auto.lua

Modified

+5 / −2 text lines

1-- TODO: metatable for api like map.modes
2-- Wrapper over `vim.api.nvim_create_autocmd` for automatic grouping and idempotency.
1--- Wrapper over `vim.api.nvim_create_autocmd` for automatic grouping and idempotency.
2--- @param group_name string name of the group of autocommands to define
3--- @return function a function to add new autocommands to the defined group
34return function ( group_name )
45 local group = vim.api.nvim_create_augroup( group_name, { clear = true, } )
6 --- adds new autocommands to the outer group
7 --- @param list_of_autocommands table a single autocommand definition, or a list of those.
58 return function ( list_of_autocommands )
69 if list_of_autocommands.events then
710 list_of_autocommands = { list_of_autocommands, }

neovim/lua/std/dbg.lua

Added
new file mode 100644

+29 / −0 text lines

1local user_command = require 'std.user_command'
2
3if vim.g.bugabinga_debug_mode == nil then
4 vim.g.bugabinga_debug_mode = false
5end
6
7local function is_debug_mode()
8 return vim.g.bugabinga_debug_mode
9end
11local function print_debug( message, ... )
12 if is_debug_mode() then
13 -- TODO: pipe messages into custom debug buffer and file
14 vim.print( message, ... )
15 end
16end
18local function toggle_debug_mode()
19 vim.g.bugabinga_debug_mode = not vim.g.bugabinga_debug_mode
20 vim.notify( 'Toggled debug mode to ' .. tostring( is_debug_mode() ) )
21end
23user_command.Debug 'Toggle global vim config debug mode.' ( toggle_debug_mode )
25return {
26 print = print_debug,
27 toggle = toggle_debug_mode,
28 get = is_debug_mode,
29}

neovim/lua/std/debug.lua

Deleted
deleted file mode 100644

+0 / −27 text lines

1if vim.g.bugabinga_debug_mode == nil then
2 vim.g.bugabinga_debug_mode = false
3end
4
5local function is_debug_mode()
6 return vim.g.bugabinga_debug_mode
7end
8
9local function print_debug( message, ... )
10 if is_debug_mode() then
11 -- TODO: pipe messages into custom debug buffer and file
12 vim.print( message, ... )
13 end
14end
16local function toggle_debug_mode()
17 vim.g.bugabinga_debug_mode = not vim.g.bugabinga_debug_mode
18 vim.notify( 'Toggled debug mode to ' .. tostring( is_debug_mode() ) )
19end
21vim.api.nvim_create_user_command( 'Debug', toggle_debug_mode, {} )
23return {
24 print = print_debug,
25 toggle = toggle_debug_mode,
26 get = is_debug_mode,
27}

neovim/lua/std/icon.lua

Modified

+50 / −12 text lines

44 ['table'] = '',
55 arrow_left = '',
66 arrow_right = '',
7 backspace_key = '',
8 block = '█',
79 branch = '',
810 carriage_return = '␍',
911 checkbox_mark = '',
1012 checkbox_unmark = '',
11 command = '󰘳',
13 class = '󰆧 ',
1214 close = '',
13 block = '█',
15 color = ' ',
16 command = '󰘳',
17 constant = ' ',
18 constructor = ' ',
19 copilot = ' ',
1420 data = '',
1521 diagnostic = '⊙',
1622 diff_add = '',
1723 diff_change = '',
1824 diff_remove = '',
25 enum = ' ',
26 enum_member = ' ',
1927 eol = '↴',
2028 error = '󰇷',
29 esc_key = '󱊷',
30 event = '',
2131 exclaim = '',
2232 extends = '❯',
33 failed = ' ',
34 field = ' ',
2335 file = '',
2436 folder = '',
2537 git = '',
2941 hint = '',
3042 info = '󰩖',
3143 insert = '',
44 interface = ' ',
45 keyword = '󰌆 ',
3246 lazy = '󰄻',
47 leader_key = '󱁐',
3348 linehighlight = '󰘤',
3449 linenumber = '󰉻',
3550 lock = '',
3651 lsp = '',
3752 macro = '',
53 method = '󰊕 ',
54 middle_ellipsis = '⋯',
3855 modified = '',
56 module = ' ',
3957 nbsp = '␣',
4058 newline = '␤',
4159 normal = 'Ν',
60 operator = '󰆕 ',
61 passed = ' ',
4262 pending = '',
4363 precedes = '❮',
64 progress_0 = '⠋',
65 progress_1 = '⠙',
66 progress_2 = '⠹',
67 progress_3 = '⠸',
68 progress_4 = '⠼',
69 progress_5 = '⠴',
70 progress_6 = '⠦',
71 progress_7 = '⠧',
72 progress_8 = '⠇',
73 progress_9 = '⠏',
74 property = ' ',
4475 quot_left = '"',
4576 quot_right = '"',
77 reference = '󰈇 ',
4678 replace = '',
79 return_key = '',
80 running = ' ',
4781 select = '󰒉',
82 slant_left = '▟',
83 slant_right = '▙',
84 snippet = ' ',
4885 space = '·',
86 space_key = '󱁐',
4987 spelling = '󰓆',
88 start = '',
89 struct = ' ',
5090 subversion = '󰳗',
5191 tab = '󰌒',
92 tab_key = '',
93 telescope = '🔭',
5294 terminal = '',
95 text = ' ',
5396 thread = '󱇫',
5497 toggle_off = '',
5598 toggle_on = '',
5699 trail = '•',
100 type_parameter = '󰉿 ',
101 unit = ' ',
102 unknown = ' ',
57103 user = ' ',
104 value = '󰎠 ',
105 variable = '󰀫 ',
58106 vertical_bar = '│',
59107 vim = '',
60108 virtual = '󰢔',
61109 visual = '󰒉',
62110 warn = '󰱯',
63 space_key = '󱁐',
64 return_key = '',
65 tab_key = '',
66 esc_key = '󱊷',
67 backspace_key = '',
68 leader_key = '󱁐',
69 start = '',
70 slant_left = '▟',
71 slant_right = '▙',
72 telescope = '🔭',

neovim/lua/std/light_up.lua

Added
new file mode 100644

+65 / −0 text lines

1local _ = {}
2
3--- Highlights given words in a buffer.
4--- Word matching is case sensitive.
5--- @param bufnr number Number of buffer to highlight. If 0, current buffer is used.
6--- @param words table Word to highlight group name mapping. Every occurrence with keys in this table, will be
7--- highlighted with its mapped value, which is expected to be a highlight group name.
8_.buffer = function ( bufnr, words )
9 vim.validate {
10 bufnr = { bufnr, 'number', },
11 words = { words, 'table', },
12 }
14 local namespace = vim.api.nvim_create_namespace 'light_up_ns'
15 vim.api.nvim_buf_clear_namespace( bufnr, namespace, 0, -1 )
17 local handler = function ( event, buffer_handle, tick, first_line, last_line_changed, last_line_updated, bytes )
18 -- vim.print( event, buffer_handle, tick, first_line, last_line_changed, last_line_updated, bytes )
19 assert( event == 'lines', 'this handler is for `on_lines` notification' )
21 local last = math.max( last_line_updated, last_line_changed )
22 local lines = vim.api.nvim_buf_get_lines( bufnr, first_line, last, true )
23 --NOTE: dubbel loop. can we faster?
24 for index, line in ipairs( lines ) do
25 local current_line = first_line + index - 1 -- adjust for 0-based indexing
26 for word, highlight_group in pairs( words ) do
27 -- NOTE: the way find is used here, we can only ever match one word per line
28 -- vim.print( 'looking for word ', word, line )
29 local start_offset, end_offset = line:find( '[%s%.](' .. word .. ')[%s$]' )
30 if start_offset then
31 -- vim.print( 'marking line ' .. current_line, start_offset, end_offset, highlight_group )
32 vim.api.nvim_buf_set_extmark( bufnr, namespace, current_line, start_offset, {
33 end_col = end_offset - 1,
34 hl_group = highlight_group,
35 } )
36 break
37 end
38 end
39 end
40 end
42 local ok = vim.api.nvim_buf_attach( bufnr, false, { on_lines = handler, } )
43 if not ok then error( 'unable to attach to buffer ' .. bufnr ) end
45 -- initial scan of whole buffer
46 handler( 'lines', bufnr, nil, 0, -1, -1, nil )
47end
49--- @return table groups A map of all highlight group names, mapping to themselves g:match('^([%w@%._]+)%s').
50_.get_vim_highlight_groups = function ()
51 local groups = {}
53 local highlight_command_output = vim.fn.execute 'highlight'
54 for line in highlight_command_output:gmatch '[^\n]+' do
55 -- Delimiter xxx guifg=#727272
56 -- @punctuation.special xxx links to Special
57 -- Match anything that could be a valid highlight name
58 local match = line:match '^([%w@%._]+)%s'
59 if match then groups[match] = match end
60 end
62 return groups
63end
65return _

neovim/lua/std/localrc.lua

Added
new file mode 100644

+29 / −0 text lines

1local debug = require 'std.dbg'
2
3--- loads given lua file path in current working directory into the current neovim lua runtime.
4--- @param file_name string path to lua file, that should be loaded
5--- @param validator function|string|table a validation function, that checks, if the loaded value fulfills your requirements.
6--- If `validator` is a string or table, then it should contain the allowed types of the value.
7--- @return any returns the evaluated value of the loaded lua file or `nil`, if it does not exists or did not pass
8--- validation.
9return function ( file_name, validator )
10 local filepath = vim.fn.fnamemodify( file_name, ':p' )
11 local file = vim.secure.read( filepath )
12 if not file then
13 return nil
14 end
15 local fn, err = loadstring( file )
16 if not fn or err then
17 debug.print( 'unable to load ' .. file_name .. '. ' .. err )
18 return nil
19 end
20 local value = fn()
21 local validator_type = type( validator )
22 if validator_type == 'string' or validator_type == table then
23 local expected_types = validator_type == table and validator or { validator, }
24 local value_type = type( value )
25 local is_valid = vim.iter( expected_types ):any( function ( t ) return t == value_type end )
26 return is_valid and value or nil
27 end
28 return validator( value ) and value or nil
29end

neovim/lua/std/map.lua

Modified

+53 / −50 text lines

11local available_modes = {
2 normal_visual_select_operator_pending = '',
2 normal_visual_select_operator_pending = "",
3 N = "",
4 normal = 'n',
5 n = 'n',
5 normal = "n",
6 n = "n",
7 insert = 'i',
8 i = 'i',
8 insert = "i",
9 i = "i",
10 visual = 'x',
11 x = 'x',
11 visual = "x",
12 x = "x",
13 visual_select = 'v',
14 v = 'v',
14 visual_select = "v",
15 v = "v",
16 select = 's',
17 s = 's',
17 select = "s",
18 s = "s",
19 operator_pending = 'o',
20 o = 'o',
20 operator_pending = "o",
21 o = "o",
22 ['!'] = '!',
23 insert_command_line = '!',
23 ["!"] = "!",
24 insert_command_line = "!",
25 command_line = 'c',
26 c = 'c',
26 command_line = "c",
27 c = "c",
28 terminal = 't',
29 t = 't',
29 terminal = "t",
30 t = "t",
32local bind = function ( self, map )
33 vim.validate {
34 map = { map, 'table', },
35 ['map.keys'] = { map.keys, { 'string', 'table', }, },
36 ['map.command'] = { map.command, { 'function', 'string', }, },
37 }
33local bind = function(self, map)
34 vim.validate({
35 map = { map, "table" },
36 ["map.keys"] = { map.keys, { "string", "table" } },
37 ["map.command"] = { map.command, { "function", "string" } },
38 })
3940 local keys = map.keys
4041 local command = map.command
4243 map.options = map.options or {}
4445 if map.category and map.description then
45 map.description = map.category .. ': ' .. map.description
46 map.description = map.category .. ": " .. map.description
4647 end
48 local options = vim.tbl_extend( 'keep', map.options, {
49 local options = vim.tbl_extend("keep", map.options, {
4950 silent = true,
5051 desc = map.description,
51 } )
52 })
53 if vim.tbl_isempty( self.modes ) then self.modes[1] = available_modes.normal_visual_select_operator_pending end
54 if vim.tbl_isempty(self.modes) then
55 self.modes[1] = available_modes.normal_visual_select_operator_pending
56 end
55 if type( keys ) == 'table' then
56 for _, key in ipairs( keys ) do
57 vim.keymap.set( self.modes, key, command, options )
58 if type(keys) == "table" then
59 for _, key in ipairs(keys) do
60 vim.keymap.set(self.modes, key, command, options)
5861 end
5962 else
60 vim.keymap.set( self.modes, keys, command, options )
63 vim.keymap.set(self.modes, keys, command, options)
6164 end
6366 self.modes = {}
65 return function ()
66 local delete_options = options.buffer and { buffer = options.buffer, } or {}
67 if type( keys ) == 'table' then
68 for _, key in ipairs( keys ) do
69 vim.keymap.del( self.modes, key, delete_options )
68 return function()
69 local delete_options = options.buffer and { buffer = options.buffer } or {}
70 if type(keys) == "table" then
71 for _, key in ipairs(keys) do
72 vim.keymap.del(self.modes, key, delete_options)
7073 end
7174 else
72 vim.keymap.del( self.modes, keys, delete_options )
75 vim.keymap.del(self.modes, keys, delete_options)
7376 end
7477 end
7578end
77local add_mode = function ( self, key )
80local add_mode = function(self, key)
7881 local new_mode = available_modes[key]
79 if new_mode == nil then error( 'unknown keymap mode requested: ' .. key ) end
82 if new_mode == nil then
83 error("unknown keymap mode requested: " .. key)
84 end
8085 if not self.modes[new_mode] then
81 table.insert( self.modes, new_mode )
86 table.insert(self.modes, new_mode)
8287 end
8388 return self
8489end
8691--- @overload fun(map:table): function
87local map = setmetatable(
88 {
89 modes = {},
90 },
91 {
92 __index = add_mode,
93 __call = bind,
94 } )
92local map = setmetatable({
93 modes = {},
94}, {
95 __index = add_mode,
96 __call = bind,
97})
9699return map

neovim/lua/std/prequire.lua

Added
new file mode 100644

+60 / −0 text lines

1local dbg = require 'std.dbg'
2
3local function printStackTrace()
4 local level = 2
5 while true do
6 local info = debug.getinfo( level, 'nSl' )
7 if not info then break end
8 dbg.print( string.format( "%s:%d in function '%s'", info.short_src, info.currentline, info.name or '' ) )
9 level = level + 1
10 end
11end
13---Require one or more modules gracefully.
14---Calls `require` in protected mode.
15---@example
16--- local want = require 'std.prequire'
17--- prequire 'foo'.setup {}
18--- prequire('foo', 'bar', function(foo, bar)
19--- foo.setup{arg = bar}
20--- end)
21---@see pcall
22---@param ... ... or more module names. The last argument may optionally be a function, consuming all modules
23---previously given.
24---@return any module The first module, when loaded successfully. Otherwise a proxy object, that does nothing when called or
25---indexed into. This prevents nil dereferencing errors when using the pattern `require('std.prequire')('this mod does
26---not exist').setup()`.
27return function ( ... )
28 local args = { ..., }
29 local mods = {}
30 local first_mod
31 for _, arg in ipairs( args ) do
32 if type( arg ) == 'function' then
33 arg( unpack( mods ) )
34 break
35 end
36 local ok, mod = pcall( require, arg )
37 if ok then
38 if not first_mod then
39 first_mod = mod
40 end
41 table.insert( mods, mod )
42 else
43 printStackTrace()
44 vim.notify_once( string.format( 'Missing module: %s', arg ), vim.log.levels.WARN )
45 -- Return a proxy item that returns itself, so we can do things like
46 -- prequire("module").setup()
47 local proxy = {}
48 setmetatable( proxy, {
49 __call = function ()
50 return proxy
51 end,
52 __index = function ()
53 return proxy
54 end,
55 } )
56 return proxy
57 end
58 end
59 return first_mod
60end

neovim/lua/std/project.lua

Modified

+80 / −74 text lines

1local debug = require 'std.debug'
1local debug = require 'std.dbg'
22local table = require 'std.table'
44local join = table.join
1212local markers_to_string = function ( markers )
1313 return vim.inspect( markers )
1414end
15local create_hash = function ( path, markers )
15local create_hash = function ( path, markers, stop )
1616 local path_hash = hasher( path )
17 local stop_hash = hasher( stop )
1718 local markers_hash = hasher( markers_to_string( markers ) )
18 return path_hash .. '|' .. markers_hash
19 local hash = path_hash .. '|' .. markers_hash .. '|' .. stop_hash
20 return hash
1921end
20local cache_get = function ( path, markers )
21 local hash = create_hash( path, markers )
22local cache_get = function ( path, markers, stop )
23 local hash = create_hash( path, markers, stop )
2224 local hit = cache[hash]
2325 return hit
2426end
25local cache_set = function ( project_root, path, markers )
26 local hash = create_hash( path, markers )
27local cache_set = function ( project_root, path, markers, stop )
28 local hash = create_hash( path, markers, stop )
2729 cache[hash] = project_root
2830end
3234--- number of max loop iterations when searching for markers
3335local MAX_TRAVERSAL_COUNT = 100
35--- the weight of a project marker, when the likelyhood is low
37--- the weight of a project marker, when the likelihood is low
3638local MAYBE = 1
37--- the weight of a project marker, when the likelyhood is high
38local LIKELY = 2
39--- the weight of a project marker, when the likelyhood is 100%
40local DEFINITLY = 3
39--- the weight of a project marker, when the likelihood is high
40local LIKELY = 3
41--- the weight of a project marker, when the likelihood is 100%
42local DEFINITELY = 7
4244--- Determines the path to a root directory, starting from the given path.
4345-- Markers have a name and weight.
4951-- Assuming you want to determine the root of your current buffer, that is part
5052-- of some project.
5153-- Buffer: `/home/user/workspace/some\_project/a/b/c/d/the\_buffer.c`
52-- Project root: `/home/user/workspace/some\_project`
53-- -> contains `.git`, `README` and `Makefile`
54-- Project root: `/home/user/workspace/some\_project` -> contains `.git`, `README` and `Makefile`
5455--
5556-- ```lua
56-- local project = require'std.project'
57-- local project = require 'std.project'
5758-- local current_buffer = vim.api.nvim_buf_get_name(0)
5859-- local markers = {
59-- { name = ".git", weight = MAYEB },
60-- { name = "README", weight = LIKELY },
61-- { naem = "Makefile", weight = DEFINITLY },
60-- { name = ".git", weight = MAYBE },
61-- { name = "README", weight = LIKELY },
62-- { name = "Makefile", weight = DEFINITELY },
6263-- }
6364-- local root = project.find_root(current_buffer, markers, vim.uv.os_homedir())
6465-- print(root) -- /home/user/workspace/some_project
8687 if #path == 0 then return nil end
88 local cache_hit = cache_get( path, markers )
89 local cache_hit = cache_get( path, markers, stop )
8990 if cache_hit then
9091 debug.print( 'CACHE HIT', cache_hit )
9192 return cache_hit
135136 local project_root = nil
136137 local max_likelyhood = 0
137138 -- the project root is most likely the directory with the highest marker count
138 -- and highest distance to current buffer.
139 -- because if there are markers further away from the buffer than other markers,
140 -- then it is most likely a nested project structure (multi-module).
139 -- and closest distance to current buffer.
140 -- however, if there are markers further away from the buffer than other markers,
141 -- then it could be a nested project structure (multi-module).
141142 -- in those cases we are looking for the root project folder, instead the nearest
142143 -- child project root folder.
143144 for _, score in ipairs( directory_scores ) do
144 local likelihood = score.marker_count + score.distance_to_buffer_file
145 if likelihood > max_likelyhood then
146 max_likelyhood = likelihood
145 local likelyhood = score.marker_count * (1 / score.distance_to_buffer_file)
146 if debug.get() then score.likelyhood = likelyhood end
147 if likelyhood > max_likelyhood then
148 max_likelyhood = likelyhood
147149 project_root = score.path
148150 end
149151 end
150152 if project_root then
151 cache_set( project_root, path, markers )
153 cache_set( project_root, path, markers, stop )
152154 end
155 debug.print( 'found project root', project_root, directory_scores )
153156 return project_root
154157end
162165local function find_project_root( path, markers )
163166 -- define some language-independent markers
164167 local default_markers = {
165 { name = '.git', weight = LIKELY, },
166 { name = '.gitignore', weight = LIKELY, },
167 { name = '.svn', weight = LIKELY, },
168 { name = 'justfile', weight = LIKELY, },
169 { name = 'Jenkinsfile', weight = MAYBE, },
170 { name = '.editorconfig', weight = MAYBE, },
171 { name = 'LICENSE', weight = MAYBE, },
172 { name = 'LICENSE.md', weight = MAYBE, },
173 { name = 'LICENSE.txt', weight = MAYBE, },
174 { name = 'COPYING', weight = MAYBE, },
175 { name = 'README', weight = MAYBE, },
176 { name = 'README.md', weight = MAYBE, },
177 { name = 'Makefile', weight = LIKELY, },
178 { name = 'flake.nix', weight = MAYBE, },
179 { name = 'flake.nix', weight = MAYBE, },
180 { name = '.project_model', weight = DEFINITLY, },
168 { name = '.save.actions.lua', weight = DEFINITELY, },
169 { name = '.lsp.settings.lua', weight = DEFINITELY, },
170 { name = '.lazy.specs.lua', weight = DEFINITELY, },
171 { name = '.editorconfig', weight = LIKELY, },
172 { name = '.git', weight = LIKELY, },
173 { name = '.gitignore', weight = LIKELY, },
174 { name = '.svn', weight = LIKELY, },
175 { name = 'justfile', weight = LIKELY, },
176 { name = 'Makefile', weight = LIKELY, },
177 { name = 'Jenkinsfile', weight = MAYBE, },
178 { name = 'LICENSE', weight = MAYBE, },
179 { name = 'LICENSE.md', weight = MAYBE, },
180 { name = 'LICENSE.txt', weight = MAYBE, },
181 { name = 'COPYING', weight = MAYBE, },
182 { name = 'README', weight = MAYBE, },
183 { name = 'README.md', weight = MAYBE, },
184 { name = 'flake.nix', weight = MAYBE, },
185 { name = 'flake.nix', weight = MAYBE, },
181186 }
183188 markers = markers or {}
196201 { name = '.project', weight = LIKELY, },
197202 { name = 'target', weight = LIKELY, },
198203 { name = 'pom.xml', weight = LIKELY, },
199 { name = 'mvnw', weight = DEFINITLY, },
200 { name = '.mvn', weight = DEFINITLY, },
201 { name = 'mvnw.cmd', weight = DEFINITLY, },
202 { name = 'build.gradle', weight = DEFINITLY, },
203 { name = 'gradle.properties', weight = DEFINITLY, },
204 { name = 'settings.gradle', weight = DEFINITLY, },
205 { name = 'gradlew', weight = DEFINITLY, },
206 { name = 'gradlew.bat', weight = DEFINITLY, },
204 { name = 'mvnw', weight = DEFINITELY, },
205 { name = '.mvn', weight = DEFINITELY, },
206 { name = 'mvnw.cmd', weight = DEFINITELY, },
207 { name = 'build.gradle', weight = DEFINITELY, },
208 { name = 'gradle.properties', weight = DEFINITELY, },
209 { name = 'settings.gradle', weight = DEFINITELY, },
210 { name = 'gradlew', weight = DEFINITELY, },
211 { name = 'gradlew.bat', weight = DEFINITELY, },
207212 }
208 return find_root( path, java_markers )
213 return find_project_root( path, java_markers )
209214end
211local lua_markers = {
212 { name = '.luarc.json', weight = MAYBE, },
213 { name = '.luarc.jsonc', weight = MAYBE, },
214 { name = '.luacheckrc', weight = MAYBE, },
215 { name = '.stylua.toml', weight = MAYBE, },
216 { name = 'stylua.toml', weight = MAYBE, },
217 { name = 'selene.toml', weight = MAYBE, },
218 { name = 'selene.yml', weight = MAYBE, },
219 { name = 'neovim.yml', weight = MAYBE, },
220 { name = 'lua', weight = MAYBE, },
221}
223216local find_lua_project_root = function ( path )
224 return find_root( path, lua_markers )
217 local lua_markers = {
218 { name = '.luarc.json', weight = MAYBE, },
219 { name = '.luarc.jsonc', weight = MAYBE, },
220 { name = '.luacheckrc', weight = MAYBE, },
221 { name = '.stylua.toml', weight = MAYBE, },
222 { name = 'stylua.toml', weight = MAYBE, },
223 { name = 'selene.toml', weight = MAYBE, },
224 { name = 'selene.yml', weight = MAYBE, },
225 { name = 'neovim.yml', weight = MAYBE, },
226 { name = 'lua', weight = MAYBE, },
227 }
229 return find_project_root( path, lua_markers )
225230end
227local zig_markers = {
228 { name = 'build.zig', weight = DEFINITLY, },
229 { name = 'zls.build.json', weight = DEFINITLY, },
230 { name = 'zig-cache', weight = MAYBE, },
231 { name = 'zig-out', weight = MAYBE, },
232}
234232local find_zig_project_root = function ( path )
235 return find_root( path, zig_markers )
233 local zig_markers = {
234 { name = 'build.zig', weight = DEFINITELY, },
235 { name = 'zls.build.json', weight = DEFINITELY, },
236 { name = 'zig-cache', weight = MAYBE, },
237 { name = 'zig-out', weight = MAYBE, },
238 }
240 --FIXME: can we ask the zig build system for this info?
241 return find_project_root( path, zig_markers )
236242end
238244local find_rust_project_root = function ( path )
239245 local markers = {
240 { name = 'Cargo.toml', weight = DEFINITLY, },
246 { name = 'Cargo.toml', weight = DEFINITELY, },
241247 }
242 local cargo_crate_dir = find_root( path, markers )
248 local cargo_crate_dir = find_project_root( path, markers )
243249 if cargo_crate_dir == nil then return nil end
245251 local cmd = {

neovim/lua/std/user_command.lua

Added
new file mode 100644

+66 / −0 text lines

1--- Creates a new user command
2--- @param user_command table Necessary data to create a new user command.
3local create_user_command = function ( user_command )
4 local options = { desc = user_command.description, }
5 local merged_options = vim.tbl_deep_extend( 'force', options, user_command.options or {} )
6 vim.api.nvim_create_user_command(
7 user_command.name,
8 user_command.command,
9 merged_options
10 )
11end
13--- Sets the field `command` in `self` to given value in `command`
14--- Then creates a new user command with data in `self`.
15--- @param self table any table.
16--- @param command function command to be executed when the user command is run.
17--- @return function deleter A function that deletes the created user command.
18local set_command = function ( self, command )
19 self.command = command
20 create_user_command( self )
21 --- Deletes the created user command
22 return function () vim.api.nvim_del_user_command( self.name ) end
23end
25--- meta table, that sets the function value, when called, to a field named `command`
26local COMMAND_SETTER = {
27 __call = function ( self, command )
28 vim.validate { command = { command, 'function', }, }
29 return set_command( self, command )
30 end,
31}
33--- meta table, that either sets the table value to a field named `options`,
34--- or the function value to a field named `command`, when called.
35local OPTIONS_OR_COMMAND_SETTER = {
36 __call = function ( self, options_or_command )
37 vim.validate { options_or_command = { options_or_command, { 'table', 'function', }, }, }
38 if type( options_or_command ) == 'table' then
39 self.options = options_or_command
40 return setmetatable( self, COMMAND_SETTER )
41 end
42 return set_command( self, options_or_command )
43 end,
44}
46--- meta table, that sets the string value to a field named `description`, when called.
47local DESCRIPTION_SETTER = {
48 __call = function ( self, description )
49 vim.validate { description = { description, 'string', }, }
50 self.description = description
51 return setmetatable( self, OPTIONS_OR_COMMAND_SETTER )
52 end,
53}
55--- meta table, that sets the string value to a field named `name`, when indexed into.
56local COMMAND_NAME_SETTER = {
57 __index = function ( _, command_name )
58 vim.validate { command_name = { command_name, 'string', }, }
59 local new_user_command = { name = command_name, }
60 return setmetatable( new_user_command, DESCRIPTION_SETTER )
61 end,
62}
64--TODO: think about how to create buffer commands
66return setmetatable( {}, COMMAND_NAME_SETTER )

neovim/neovim.yml

Deleted
deleted file mode 100644

+0 / −25 text lines

1---
2base: lua51
3name: neovim
4globals:
5 after_each:
6 args:
7 - type: function
8 assert:
9 args:
10 - type: bool
11 - required: false
12 type: string
13 before_each:
14 args:
15 - type: function
16 describe:
17 args:
18 - type: string
19 - type: function
20 it:
21 args:
22 - type: string
23 - type: function
24 vim:
25 any: true

neovim/neovim/lua/bugabinga/plugins/lush.lua

Deleted
deleted file mode 100644

+0 / −14 text lines

1return {
2 {
3 'rktjmp/lush.nvim',
4 -- tag = 'v2.0.1',
5 -- we rely on injects.sym for better treesitter support
6 branch = 'main',
7 -- lazy = false,
8 -- priority = 1000,
9 config = function ()
10 -- disabled to find theming issues with heirline
11 -- vim.cmd.colorscheme 'nugu'
12 end,
13 },
14}

neovim/spell/de.utf-8.add

Modified

+1 / −0 text lines

11Enums
22Skripte
3startuptime

neovim/spell/de.utf-8.add.spl

Modified

Binary size (old → new): 53 → 74 bytes.

neovim/spell/en.utf-8.add

Added
new file mode 100644

+1 / −0 text lines

neovim/spell/en.utf-8.add.spl

Modified

Binary size (old → new): 40 → 41 bytes.

neovim/spell/nerd.utf-8.add

Modified

+33 / −0 text lines

2626cterm/!
2727navic
2828winbar
29resession
30configs
31BufNewFile
32LuaLS
33editorconfig
34exrc
35localrc
36signcolumn
37togglers
38ripgrep
39prequire
40pcall
41args
42ipairs
43setmetatable
44colorscheme
45cmdline
46treesitter
47cmd
48popups
49neovide
50wezterm
51fullscreen
52checkhealth
53pls
54stylua
55eol
56kool
57grepprg
58makeprg
59modulepath
60FFI
61jdtls

neovim/spell/pl.utf-8.add

Added
new file mode 100644

+1 / −0 text lines

neovim/spell/pl.utf-8.add.spl

Added
new file mode 100644

Binary size (old → new): 0 → 41 bytes.

nushell/modules/aliases.nu

Modified

+3 / −5 text lines

11# Semantic aliases
22export alias show = bat
33export def list [] { ls --all --long --du --mime-type | where type == dir | append (ls --all --long --du --mime-type | where type != dir) }
4export alias web = firefox
4export alias walk = yazi
5export alias browse = firefox
56export alias code = nvim
67export alias edit = nvim --clean
78# TODO ewrite bak command
1011# https://gist.github.com/mullnerz/9fff80593d6b442d5c1b
1112export alias archive = wget -mpck --html-extension --user-agent="" -e robots=off --wait 1 -P .
14# FIXME: README preview does not work (in WSL2)
1315def --env workspace [] {
1416 fd --type directory --max-depth 1 . $env.WORKSPACE | fzf --ansi --preview 'mdcat {}README.md' --preview-window 'up:69%,border-bottom' | cd $in
1517}
1618export alias w = workspace
18export def --env lk [] {
19 cd (walk --icons)
20}
21
2220def open-editor-with-content-search [ initial_query:string = ''] {
2321 rg --color=always --line-number --no-heading --smart-case $initial_query | fzf --ansi --delimiter : --preview 'bat --color=always {1} --highlight-line {2}' --color "hl:-1:underline,hl+:-1:underline:reverse" --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' | parse '{file}:{number}:{line}' | each { nvim -c $in.number -c $"?\\V($in.line | str trim )" $in.file }