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)

env.nu

Deleted
deleted file mode 100644
1 -# GLOBAL VARIABLES
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 }
9 -if ($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 -]
40 -if $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
1 ----@diagnostic disable: param-type-mismatch
2 -local icon = require 'std.icon'
3 -local auto = require 'std.auto'
4 -local ignored = require 'std.ignored'
6 -local NEW_FILE = '~untitled~'
8 -return {
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 - },

neovim/.editorconfig

Modified
1 -# see https://github.com/CppCXY/EmmyLuaCodeStyle
2 -[*.lua]
1 +root = true
3 +[*]
4 +spell = true
6 +[*.lua]
7 +diagnostic = true
9 +# see https://github.com/CppCXY/EmmyLuaCodeStyle
4 10 # optional space/tab
5 11 indent_style = space
6 12 # if indent_style is space, this is valid

neovim/.lazy.specs.lua

Added
new file mode 100644
1 +return {
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 + },

neovim/.lsp.settings.lua

Added
new file mode 100644
1 +return {
2 + LuaLS = {
3 + Lua = {
4 + diagnostics = { globals = { 'vim', 'prequire', }, },
5 + runtime = { version = 'LuaJIT', },
6 + },
7 + },
8 +}

neovim/.luarc.jsonc

Deleted
deleted file mode 100644
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 +return { 'Format', }

neovim/README.md

Modified
12 12 : standard lib. can only depend on itself and neovim apis.
14 14 lua/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
16 +only depend on itself, std and plugins.
17 18 lua/bugabinga/plugins
18 19 : third party plugins and their config glue integrating it into the config.
30 31 I am the bone of my code, bugs are my body and exceptions are my blood.
31 32 I have created over a thousand bugs, unknown to testers, nor known to debuggers.
32 -Have withstood pain to create many programs, yet those hands will never hold a working program.
33 +Have withstood pain to create many programs, yet those hands will never hold a
34 +working program.
33 35 So as I pray, Unlimited Bug Works.
35 37 ~ Shirou Emiya
37 ----------
39 39 # todo
41 -* which-key and lazy loaded keys are not clean yet
42 -* telescope find filter binary files (spell files)
43 41 * 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?)
45 42 * does status bar fail to display if lsp fails to load?
46 43 * pandoc with lua filters for diagrams for generating documents and previewing --> https://github.com/tex/vimpreviewpandoc
47 44 * 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
48 53 * learn marks and refactor mark.lua
54 +* try Termdebug with gdb
55 +* adapt config to respect `vim.g.nerdfont` (std.constants?)
49 56 * 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`
51 60 * 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
56 61 * 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
6 6 end
7 7 vim.opt_local.suffixesadd:prepend '.lua'
8 8 vim.opt_local.conceallevel = 1
10 +local map = require 'std.map'
12 +map.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,
24 +--TODO: add dbg.print, require, prequire
25 +prequire '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 + },

neovim/ftplugin/oil.lua

Added
new file mode 100644
1 +vim.opt_local.syntax = 'on'

neovim/init.lua

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

neovim/justfile

Modified
7 7 # Reproduce some neovim issue
8 8 repro:
9 - nvim -u repro.lua
9 + nvim -u repro.lua
11 11 # update nvim plugins
12 12 update:

neovim/lazy-lock.json

Modified
2 2 "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
3 + "LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" },
3 4 "actions-preview.nvim": { "branch": "master", "commit": "5072b1b1065a6b22bdd46b5c21780a91d6a08071" },
5 + "auto-dark-mode.nvim": { "branch": "master", "commit": "e328dc463d238cb7d690fb4daf068eba732a5a14" },
4 6 "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" },
5 12 "colorizer.nvim": { "branch": "master", "commit": "107719885290366c893e1c1c58b7474cbeabfef6" },
13 + "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
6 14 "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
7 15 "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
8 - "fidget.nvim": { "branch": "main", "commit": "4e854f3299e21d1c18279add340428a97520fc44" },
16 + "fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
9 17 "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
10 18 "gen.nvim": { "branch": "main", "commit": "87fbe811155b90eea58622614809705b966009ad" },
11 19 "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
17 25 "mason-tool-installer.nvim": { "branch": "main", "commit": "1212fb6082b7177dde17ea65e429e027835aeb40" },
18 26 "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
19 27 "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" },
20 37 "mini.bracketed": { "branch": "main", "commit": "65c7dfb51e832de9e279e5d5b0741e7af6755ab5" },
21 - "mini.starter": { "branch": "main", "commit": "ce222a5b6de50a9963c1eb62aa16ec6d5efca7ee" },
22 38 "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
23 39 "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
24 40 "neogen": { "branch": "main", "commit": "0daffcec249bf42275e322361fe55b89a05ff278" },
25 41 "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" },
26 42 "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
27 43 "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" },
28 54 "nvim-genghis": { "branch": "main", "commit": "8613fc1b43db6cc761733b3630eabff9e86296f7" },
29 55 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
30 56 "nvim-jdtls": { "branch": "master", "commit": "a4746791876166dc146eae573a1b49d24a6652e7" },
31 57 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
58 + "nvim-lint": { "branch": "master", "commit": "3317b73ec3eb76cd8ca83e05880c07c83e368c1e" },
32 59 "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" },
33 60 "nvim-navbuddy": { "branch": "master", "commit": "f34237e8a41ebc6e2716af2ebf49854d8c5289c8" },
34 61 "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
46 73 "persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" },
47 74 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
48 75 "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" },
49 94 "schemastore.nvim": { "branch": "main", "commit": "80d701841487f72bf9d3fa56b25146b95e190502" },
50 95 "specs.nvim": { "branch": "main", "commit": "e929006d3f6bb8e43f03e13ac364c67236eb5299" },
51 96 "speedtyper.nvim": { "branch": "main", "commit": "2d158eed4c753995b0501a3a7a72464fbb213e3d" },
52 97 "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
53 98 "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
99 + "suda.vim": { "branch": "master", "commit": "66727b416837836712975e748bc8a19fb6cf4ec3" },
100 + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
54 101 "telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
55 - "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
56 102 "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" },
57 103 "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
58 104 "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" },
59 105 "toggleterm.nvim": { "branch": "main", "commit": "193786e0371e3286d3bc9aa0079da1cd41beaa62" },
106 + "tint.nvim": { "branch": "master", "commit": "862835626941d263466754b9c8e2ce2cb004f5ac" },
107 + "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" },
60 108 "tree-sitter-nu": { "branch": "main", "commit": "c5b7816043992b1cdc1462a889bc74dc08576fa6" },
61 109 "treesj": { "branch": "main", "commit": "60e27280030f9cd8dfb6ceb335922c6ff76682cc" },
62 110 "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
111 + "venn.nvim": { "branch": "main", "commit": "e4d68341a73dd56c64955058821a58295fb337b1" },
112 + "vim-vscode-snippets": { "branch": "master", "commit": "812e60d1c648f889328761ec71daff09d1eb3177" },
63 113 "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" },
64 114 "which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" },
65 115 "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" }
66 -}

neovim/lua/bugabinga/const.lua

Added
new file mode 100644
1 +--- constant 'global' values
2 +return {
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
1 +local editorconfig = require 'editorconfig'
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
13 +local tobool = function ( str )
14 + -- intentionally strict
15 + return str == 'true'
16 +end
18 +local expose_option = function ( option_name, parser )
19 + editorconfig.properties[option_name] = function ( _, value )
20 + vim.opt_local[option_name] = parser( value )
21 + end
22 +end
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
26 +expose_option( 'spell', tobool )
27 +expose_option( 'number', tobool )
28 +expose_option( 'cursorline', tobool )
29 +expose_option( 'virtualedit', tostring )
31 +editorconfig.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
38 +end

neovim/lua/bugabinga/lazy.lua

Modified
19 19 local lazy = require 'lazy'
20 20 local icon = require 'std.icon'
22 -lazy.setup( 'bugabinga.plugins', {
22 +local 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
25 +vim.g.FILE_LOADED_EVENTS = { 'BufRead', 'BufNew', 'SessionLoadPost', }
27 +lazy.setup {
28 + spec = { { import = 'bugabinga.plugins', }, overrides, },
23 29 defaults = {
24 30 lazy = true,
25 31 -- version = '*',
32 + -- useful to globally disable plugins
33 + -- cond = function ( plugin_spec )
34 + -- return plugin_spec.name:find 'oil'
35 + -- end,
27 37 install = {
28 38 missing = true,
40 50 task = icon.terminal,
41 51 ft = icon.file,
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 + },
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', },
56 74 change_detection = { notify = false, },
57 75 performance = {
58 76 rtp = {
86 104 patterns = { 'bugabinga', },
87 105 path = win32 and 'W:/' or '~/Workspace',
89 -} )
91 109 local map = require 'std.map'
108 126 lazy_cmds:each( function ( cmd )
109 127 map.normal {
110 - name = cmd[1] .. ' plugins',
128 + description = cmd[1],
111 129 category = 'plugins',
112 130 keys = base_key .. cmd[2],
113 131 command = cmd[3],
135 +local auto = require 'std.auto'
137 +auto '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 ),

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

Deleted
deleted file mode 100644
1 -local project = require 'std.project'
3 -return {
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
3 3 return {
4 4 require 'bugabinga.lsp.clients.java',
5 5 require 'bugabinga.lsp.clients.lua',
6 6 require 'bugabinga.lsp.clients.json',
7 7 require 'bugabinga.lsp.clients.asm',
8 - require 'bugabinga.lsp.clients.bash',
9 8 require 'bugabinga.lsp.clients.c',
10 9 require 'bugabinga.lsp.clients.graphviz',
11 10 require 'bugabinga.lsp.clients.markdown',

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

Modified
46 46 --FIXME: refactor this!
47 47 vim.list_extend( bundles,
48 48 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 + -- "
49 53 vim.fn.glob( java_debug_path .. '/extension/server/com.microsoft.java.debug.plugin-*.jar' ), '\n' ) )
50 54 vim.list_extend( bundles, vim.split( vim.fn.glob( java_test_path .. '/extension/server/*.jar' ), '\n' ) )
51 55 return bundles
110 114 vim.notify 'missing jdk paths in java settings for lsp'
113 - return { jdk11, jdk17, jdk21 }
117 + return { jdk11, jdk17, jdk21, }
116 120 local java_settings = {
117 - signatureHelp = { enabled = true },
121 + signatureHelp = { enabled = true, },
118 122 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, },
122 126 organizeImports = {
123 127 starThreshold = 9999,
124 128 staticStarThreshold = 9999,
127 131 toString = {
128 132 template = '${object.className}{${member.name()}=${member.value()}, ${otherMembers}}',
130 - hashCodeEquals = { useJava7Objects = true },
134 + hashCodeEquals = { useJava7Objects = true, },
131 135 useBlocks = true,
133 - eclipse = { downloadSources = true },
137 + eclipse = { downloadSources = true, },
135 139 configuration = {
136 140 updateBuildConfiguration = 'interactive',
137 141 runtimes = find_jdks(),
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', }, },
144 148 format = {
145 149 enabled = true,
146 150 -- TODO: set these here with my preferred settings
166 170 local on_attach = function ()
167 171 local jdtls = require 'jdtls'
168 172 vim.lsp.codelens.refresh()
169 - jdtls.setup_dap { hotcodereplace = 'auto' }
173 + jdtls.setup_dap { hotcodereplace = 'auto', }
170 174 require 'jdtls.dap'.setup_dap_main_class_configs()
171 175 require 'jdtls.setup'.add_commands()
249 253 root_dir = project.find_java_project_root,
250 254 single_file_support = true,
251 255 workspaces = true,
252 - settings = { java = java_settings },
256 + settings = { java = java_settings, },
253 257 on_attach = on_attach,
254 258 init_options = {
255 259 bundles = get_bundles(),
256 260 extendedClientCapabilities = get_extended_capabilites(),
257 - }
261 + },

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

Modified
7 7 root_dir = project.find_lua_project_root,
8 8 single_file_support = true,
9 9 workspaces = true,
10 - before_init = require 'neodev.lsp'.before_init,
10 + before_init = prequire 'neodev.lsp'.before_init,
11 11 settings = {
12 12 Lua = {
13 13 addonManager = { enable = false, },
14 - completion = { callSnippet = 'Disable', postfix = '.', },
15 - diagnostics = { globals = { 'vim', }, workspaceRate = 50, },
14 + completion = { callSnippet = 'Replace', },
16 15 hint = { enable = true, setType = true, },
17 16 telemetry = { enable = false, },
18 17 window = { progressBar = true, statusBar = true, },

neovim/lua/bugabinga/lsp/init.lua

Modified
1 -require 'bugabinga.lsp.lightbulb'
3 -local debug = require 'std.debug'
1 +local debug = require 'std.dbg'
2 +local icon = require 'std.icon'
4 3 local defer = require 'std.defer'
5 4 local map = require 'std.map'
6 5 local auto = require 'std.auto'
7 6 local ui = require 'bugabinga.ui'
8 7 local table = require 'std.table'
9 8 local ignored = require 'std.ignored'
10 -local user_command = vim.api.nvim_create_user_command
9 +local user_command = require 'std.user_command'
11 10 local lsp_client_configs = require 'bugabinga.lsp.clients'
11 +local localrc = require 'std.localrc'
12 13 local _ = {}
14 -local token_update = function ( lsp_client )
15 +require 'bugabinga.lsp.lightbulb'
17 +local token_update = function ( lsp_client )
15 18 local token = lsp_client.data.token
16 19 local buffer = lsp_client.buffer
17 20 local client_id = lsp_client.data.client_id
27 30 --* closures that capture something
30 -local expand_path = function ( path )
33 +local expand_path = function ( path )
31 34 if vim.fn.executable( path ) == 1 then
32 35 return vim.fn.exepath( path )
38 -local expand_command = function ( command )
41 +local expand_command = function ( command )
39 42 vim.validate { command = { command, { 'string', 'table', }, }, }
41 44 if type( command ) == 'table' then
46 49 return expand_path( command )
49 -local lsp_start = function ( file_type_event )
52 +local lsp_start = function ( file_type_event )
50 53 debug.print 'trying to start lsp'
51 54 local match = file_type_event.match
112 115 return
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 {}
120 122 for _, config in ipairs( potential_client_configs ) do
121 123 local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
122 124 local capabilities = vim.lsp.protocol.make_client_capabilities()
123 125 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
125 134 debug.print( 'starting command:', config.command )
127 136 local start_config = {
133 142 -- 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?
134 143 capabilities = capabilities,
135 144 -- handlers = vim.lsp.handlers,
136 - settings = config.settings,
145 + settings = settings,
137 146 -- commands = nil, -- what is this?
138 147 init_options = config.init_options,
139 148 name = config.name,
192 201 local old_omnifunc
193 202 local old_tagfunc
195 -local keybinds = {}
196 -local add = function ( client_id, keybind )
204 +local keybinds = {}
205 +local add = function ( client_id, keybind_remover )
206 + vim.validate {
207 + client_id = { client_id, 'number', },
208 + keybind_remover = { keybind_remover, 'function', },
197 210 if not table.contains( keybinds, client_id ) then
198 211 keybinds[client_id] = {}
200 - table.insert( keybinds[client_id], keybind )
213 + table.insert( keybinds[client_id], keybind_remover )
203 -local lsp_attach = function ( args )
216 +local lsp_attach = function ( args )
204 217 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 )
206 220 if not client then return end
208 222 debug.print( client.server_capabilities )
232 246 local navbuddy_ok, navbuddy = pcall( require, 'nvim-navbuddy' )
233 247 if navbuddy_ok then
234 248 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,
236 257 vim.notify 'nvim-navbuddy not found. could not attach to lsp client.'
262 283 if client.server_capabilities.inlayHintProvider then
263 - add( map.normal {
284 + add( client_id, map.normal {
264 285 description = 'Toggle inlay hints',
265 286 category = 'lsp',
266 287 buffer = bufnr,
267 288 keys = '<leader>ti',
268 289 command = function ()
269 - vim.lsp.inlay_hint( bufnr, nil )
290 + vim.lsp.inlay_hint.enable( bufnr, nil )
274 - add( map.normal {
295 + add( client_id, map.normal {
275 296 description = 'Show hover documentation above cursor.',
276 297 category = 'lsp',
277 298 buffer = bufnr,
279 300 command = vim.lsp.buf.hover,
282 - add( map.normal {
303 + add( client_id, map.normal {
283 304 description = 'Show signature help under cursor.',
284 305 category = 'lsp',
285 306 buffer = bufnr,
286 - keys = '<leader>ls',
307 + keys = { 'H', '<leader>ls', },
287 308 command = vim.lsp.buf.signature_help,
290 - add( map.normal {
311 + add( client_id, map.normal {
291 312 description = 'Show available code actions on current line.',
292 313 category = 'lsp',
293 314 buffer = bufnr,
295 316 command = vim.lsp.buf.code_action,
298 - add( map.normal {
319 + add( client_id, map.normal {
299 320 description = 'Goto to definition of symbol under cursor.',
300 321 category = 'lsp',
301 322 buffer = bufnr,
303 324 command = vim.lsp.buf.definition,
306 - add( map.normal {
327 + add( client_id, map.normal {
307 328 description = 'Show implementations of symbol under cursor.',
308 329 category = 'lsp',
309 330 buffer = bufnr,
311 332 command = vim.lsp.buf.implementation,
314 - add( map.normal {
335 + add( client_id, map.normal {
315 336 description = 'Show incoming calls of symbol under cursor.',
316 337 category = 'lsp',
317 338 buffer = bufnr,
319 340 command = vim.lsp.buf.incoming_calls,
322 - add( map.normal {
343 + add( client_id, map.normal {
323 344 description = 'Show outgoing calls of symbol under cursor.',
324 345 category = 'lsp',
325 346 buffer = bufnr,
327 348 command = vim.lsp.buf.outgoing_calls,
330 - add( map.normal {
351 + add( client_id, map.normal {
331 352 description = 'Show references of symbol under cursor.',
332 353 category = 'lsp',
333 354 buffer = bufnr,
334 - keys = '<leader>lr',
355 + keys = '<leader>ln',
335 356 command = vim.lsp.buf.references,
338 - add( map.normal {
359 + add( client_id, map.normal {
339 360 description = 'Rename symbol under cursor.',
340 361 category = 'lsp',
341 362 buffer = bufnr,
342 - keys = { '<f2>', '<leader>ln', },
363 + keys = { '<f2>', '<leader>lr', },
343 364 command = vim.lsp.buf.rename,
347 -local lsp_detach = function ( args )
368 +local lsp_detach = function ( args )
348 369 debug.print( 'DETACH LSP', args )
350 371 local bufnr = args.buf
429 450 ui.show_tree( active_clients )
432 -user_command( 'LspInfo', lsp_info, {
433 - nargs = '?',
434 - complete = function () return { 'all', } end,
435 - desc = 'Shows basic information about running LSP clients.',
436 -} )
453 +user_command.LspInfo
454 +'Shows basic information about running LSP clients.'
455 + { nargs = '?', complete = function () return { 'all', } end, } (
456 + lsp_info
438 -user_command( 'LspInfoExtended', lsp_info_extended, {
439 - nargs = '?',
440 - complete = function () return { 'all', } end,
441 - desc = 'Shows detailed information about running LSP clients.',
442 -} )
459 +user_command.LspInfoExtended
460 +'Shows detailed information about running LSP clients.'
461 + { nargs = '?', complete = function () return { 'all', } end, } (
462 + lsp_info_extended
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
447 469 local 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,
471 493 local completion_kinds = vim.lsp.protocol.CompletionItemKind

neovim/lua/bugabinga/nugu/init.lua

Modified
42 42 vim.g.terminal_color_14 = ui_important_global -- aqua
43 43 vim.g.terminal_color_15 = ui_normal -- white
45 46 local 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
93 94 local new_group = function ()
94 - return setmetatable( {}, {
95 - __call = set_group_properties,
96 - } )
95 + return setmetatable( {}, {
96 + __call = set_group_properties,
97 + } )
99 100 local 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]
106 107 local 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
118 119 local _ = setmetatable( { groups = {}, }, {
119 - __index = add_group,
120 - __newindex = link_group,
120 + __index = add_group,
121 + __newindex = link_group,
123 124 _.Debug { fg = ui_normal, bg = debug, bold = true, }
124 125 _.Normal { fg = content_normal, bg = content_backdrop, }
125 -_.NotifyBackground { bg = ui_backdrop, }
126 126 _.Comment { fg = content_important_global, }
127 +_.NotifyBackground { bg = ui_backdrop, }
127 128 _.LineNr { fg = ui_minor, bg = content_backdrop, }
128 129 _.CursorLineNr { fg = ui_focus, bg = ui_backdrop, }
129 130 _.Search { bg = content_unfocus, }
204 205 _.Define = _.PreProc
205 206 _.Macro = _.PreProc
206 207 _.PreCondit = _.PreProc
208 +_.Parameter { fg = content_focus, }
208 210 _.Type = _.Statement
209 211 _.StorageClass = _.Statement
276 278 _['@function'] = _.Function
277 279 _['@function.builtin'] = _.Special
278 280 _['@function.macro'] = _.Macro
279 -_['@parameter'] = _.Identifier
281 +_['@parameter'] = _.Parameter
280 282 _['@method'] = _.Function
281 283 _['@field'] = _.Identifier
282 284 _['@property'] = _.Identifier
293 295 _['@type.definition'] = _.Typedef
294 296 _['@storageclass'] = _.StorageClass
295 297 _['@structure'] = _.Structure
296 -_['@namespace'] = _.Identifier
298 +_['@namespace'] = _.PreProc
297 299 _['@include'] = _.Include
298 300 _['@preproc'] = _.PreProc
299 301 _['@debug'] = _.Debug
518 520 _.IblWhitespace = _.Whitespace
519 521 _.IblScope { fg = ui_focus, bg = _.Normal.bg, }
521 -_.Hlargs { fg = content_important_local, }
523 524 _.MiniStarterCurrent { fg = ui_normal, bg = ui_accent, }
524 525 _.MiniStarterFooter = _.Keyword
533 534 --TODO: Oil highlights
535 536 return 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

neovim/lua/bugabinga/options/behaviour.lua

Modified
1 -local debug = require 'std.debug'
1 +local debug = require 'std.dbg'
2 2 local auto = require 'std.auto'
4 4 -- How many milliseconds must pass before neovim decides I was "idle"
34 34 -- try to guess indentation based on context
35 35 vim.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
37 37 vim.opt.autoindent = true
38 38 vim.opt.copyindent = true
58 58 require 'bugabinga.health'.add_dependency
60 60 name = 'Nushell',
61 - name_of_executable = 'nu'
61 + name_of_executable = 'nu',
64 64 -- highlight all search matches
80 80 require 'bugabinga.health'.add_dependency
82 82 name = 'Ripgrep',
83 - name_of_executable = 'rg'
83 + name_of_executable = 'rg',
86 86 -- ask me to force failed commands
89 89 auto 'load_project_if_available' {
90 90 description = 'Loads the project root dir as cwd, if it can be determined from a file path.',
91 - events = { 'FileType' },
91 + events = { 'FileType', },
92 92 pattern = '*',
93 93 command = function ( event )
94 94 local project = require 'std.project'
100 100 if table.contains( ignored.filetypes, filetype ) then return end
101 101 local buftype = vim.api.nvim_buf_get_option( buffer, 'buftype' )
102 102 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 )
104 106 local cwd = vim.fs.normalize( vim.uv.cwd() )
105 107 if root and cwd ~= root then
106 108 vim.uv.chdir( root )

neovim/lua/bugabinga/options/commands.lua

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

neovim/lua/bugabinga/options/file.lua

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

neovim/lua/bugabinga/options/init.lua

Modified
5 5 require 'bugabinga.options.file'
6 6 require 'bugabinga.options.keymaps'
7 7 require 'bugabinga.options.spelling'
8 +require 'bugabinga.options.commands'
9 10 -- disable some runtime providers that i will not use.
10 11 -- keeps checkhealth clean

neovim/lua/bugabinga/options/keymaps.lua

Modified
1 1 local map = require 'std.map'
2 +local const = require 'bugabinga.const'
2 3 local togglers = require 'bugabinga.options.togglers'
4 5 -- set <SPACE> as leader key
18 19 local current_buffer = 0
19 20 local current_line = vim.api.nvim_win_get_cursor( current_buffer )[1]
20 21 local strict_indexing = false
21 - local newline = { '' }
22 + local newline = { '', }
22 23 vim.api.nvim_buf_set_lines( current_buffer, current_line, current_line, strict_indexing, newline )
31 32 local current_buffer = 0
32 33 local current_line = vim.api.nvim_win_get_cursor( current_buffer )[1] - 1
33 34 local strict_indexing = false
34 - local newline = { '' }
35 + local newline = { '', }
36 37 vim.api.nvim_buf_set_lines( current_buffer, current_line, current_line, strict_indexing, newline )
79 80 command = '<nop>',
82 --- system clipboard copy and paste
83 -map.normal.visual {
84 - description = 'system clipboard motion',
85 - category = 'editing',
86 - keys = '<c-s-v>',
87 - command = '"+',
90 -map.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,
98 ---TODO make global
99 -local win32 = vim.loop.os_uname().sysname:match 'Win'
100 -local wsl2 = vim.loop.os_uname().release:match 'WSL2'
102 83 local function open_link_under_cursor()
103 84 ---@diagnostic disable-next-line: missing-parameter
104 85 local file_under_cursor = vim.fn.expand '<cfile>'
107 88 if file_under_cursor and file_under_cursor:match '%a+://.+' then
108 89 vim.system(
109 90 ---@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, },
113 94 function ( completed )
114 95 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 )
117 100 error( 'Failed to open ' .. file_under_cursor .. ' because: ' .. completed.stderr )
130 113 command = open_link_under_cursor,
133 -map.normal {
134 - description = 'Grep search for word under cursor',
135 - category = 'search',
136 - keys = 'gw',
137 - command = '<cmd>grep <cword> . <cr>',
140 116 map.normal {
141 117 description = 'Dismiss current search highlight',
142 118 category = 'search',
143 119 keys = '<esc><esc>',
144 - command = function () vim.cmd [[ nohlsearch ]] end,
120 + command = function ()
121 + vim.cmd [[ nohlsearch ]]
122 + end,
147 125 map.normal {
149 127 category = 'ui',
150 128 keys = '<leader>tt',
151 129 command = function ()
130 + ---@diagnostic disable-next-line: undefined-field
152 131 if vim.opt.background:get() == 'dark' then
153 132 vim.opt.background = 'light'
155 134 vim.opt.background = 'dark'
136 +---@diagnostic disable-next-line: undefined-field
157 137 vim.notify( 'Toggled background to ' .. vim.opt.background:get() .. '.' )
179 159 command = vim.cmd.redo,
182 -map.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,
204 162 for _, toggler in ipairs( togglers ) do
205 163 local option_name = toggler.options[1].name
206 164 local first_char = string.sub( option_name, 1, 1 )
209 167 description = 'Toggle ' .. option_name .. ' option',
210 168 category = 'options',
211 169 keys = '<leader>to' .. first_char,
212 - command = function () toggler:toggle() end,
170 + command = function ()
171 + toggler:toggle()
172 + end,

neovim/lua/bugabinga/options/ui.lua

Modified
3 3 local icon = require 'std.icon'
4 4 local auto = require 'std.auto'
5 5 local ignored = require 'std.ignored'
7 7 auto 'highlight_yanked_text' {
8 - description = 'briefly highlight yanked text',
9 - events = 'TextYankPost',
10 - pattern = '*',
11 - command = function () vim.highlight.on_yank() end,
8 + description = 'briefly highlight yanked text',
9 + events = 'TextYankPost',
10 + pattern = '*',
11 + command = function () vim.highlight.on_yank() end,
14 14 auto 'disable_columns_in_special_buffers' {
15 - description = 'Hide columns in buffers, that do not show source code.',
16 - events = { 'FileType' },
17 - pattern = ignored.filetypes,
18 - command = function ()
19 - vim.opt_local.colorcolumn = {}
20 - vim.opt_local.signcolumn = 'no'
21 - vim.opt_local.foldcolumn = '0'
22 - vim.opt_local.number = false
23 - end,
15 + description = 'Hide columns in buffers, that do not show source code.',
16 + events = { 'FileType', },
17 + pattern = ignored.filetypes,
18 + command = function ()
19 + vim.opt_local.colorcolumn = {}
20 + vim.opt_local.signcolumn = 'no'
21 + vim.opt_local.foldcolumn = '0'
22 + vim.opt_local.number = false
23 + end,
26 --- TODO: this should probably live in nugu?
28 --- local hl_to_mode = {
29 --- n = { bg = 'black' },
30 --- i = { bg = 'blue' },
31 --- v = { bg = 'green' },
32 --- }
33 ---
34 --- auto 'change_cursor_highlight_based_on_mode' {
35 --- description = 'Changes the highlight of the cursor based on the current mode.',
36 --- events = 'ModeChanged',
37 --- command = function ()
38 --- local current_mode = vim.fn.mode()
39 --- local hl = hl_to_mode[current_mode]
40 --- vim.notify( 'changing Cursor highlight for mode ' .. current_mode .. ' to ' .. vim.inspect( hl ) )
41 --- if hl then
42 --- vim.api.nvim_set_hl( 0, 'Cursor', hl )
43 --- end
44 --- end,
45 --- }
47 26 -- show trailing whitespace
48 27 vim.opt.list = true
49 28 vim.opt.listchars = {
50 - space = icon.space,
51 - -- eol = icon.eol,
52 - tab = icon.tab .. ' ',
53 - trail = icon.trail,
54 - extends = icon.extends,
55 - precedes = icon.precedes,
56 - nbsp = icon.nbsp,
29 + -- space = icon.space,
30 + -- eol = icon.eol,
31 + -- tab = icon.tab .. icon.middle_ellipsis,
32 + tab = ' ',
33 + trail = icon.trail,
34 + extends = icon.extends,
35 + precedes = icon.precedes,
36 + nbsp = icon.nbsp,
59 --- force english messages
39 +-- force English messages
60 40 vim.cmd [[ language mes en_US.utf8 ]]
62 42 -- do not spam the cmdline with every little input
62 42 vim.opt.wildmode = 'list:longest'
64 44 -- virtually break lines on border
65 -vim.opt.wrap = true
67 46 -- always display the signcolumn to avoid jitter
68 47 vim.opt.signcolumn = 'yes:1'
76 55 -- hide weird symbol at end of buffer
77 56 vim.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 = '┼',
92 71 -- better have no syntax highlighting than regex based, treesitter will take over later
93 -vim.cmd.syntax 'off'
72 +vim.opt.syntax = 'off'
95 74 -- hide output of insert completion popup in status
96 75 vim.opt.shortmess:append 'c'
99 78 -- truncate messages at end
100 79 vim.opt.shortmess:append 't'
102 --- show cmd window to prevent jitter ui
81 +-- show cmd window to prevent jitter UI
103 82 vim.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.
106 85 vim.opt.conceallevel = 0
108 87 -- I do not care for folding
109 88 vim.opt.foldenable = false
111 90 -- show visual indicators for lines too long
112 -vim.opt.colorcolumn = { '80', '120', '140' }
91 +vim.opt.colorcolumn = { '80', '120', '140', }
114 93 -- highlight the current line
115 94 vim.opt.cursorline = false
126 105 -- hide the mode indicator in status
127 106 vim.opt.showmode = false
129 --- always show tabs, to avoid jitter ui
108 +-- always show tabs, to avoid jitter UI
130 109 vim.opt.showtabline = 2
132 --- Use true colors
133 -vim.opt.termguicolors = true
134 -vim.opt.lazyredraw = false
111 +local is_tty = os.getenv 'XDG_SESSION_TYPE' == 'tty' and os.getenv 'SSH_TTY' == ''
112 +if is_tty then
113 + vim.opt.termguicolors = false
114 + vim.g.nerdfont = false
115 + vim.opt.lazyredraw = true
116 +else
117 + vim.opt.termguicolors = true
118 + vim.g.nerdfont = true
119 + vim.opt.lazyredraw = false
120 +end
136 122 -- scroll by screen lines if buffer is wrapped
137 123 vim.opt.smoothscroll = true
148 134 -- neovide only options
149 135 if 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

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

Modified
1 1 local map = require 'std.map'
3 +map.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 +}
3 10 return {
4 11 '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,
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
1 -return {
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
1 1 return {
2 2 'f-person/auto-dark-mode.nvim',
3 3 dev = true,
4 - event = 'VeryLazy',
4 + -- event = 'VeryLazy',
5 + lazy = false,
5 6 opts = {
6 7 -- interval of 0 freezes neovim on quit
7 8 -- update_interval = 0,

neovim/lua/bugabinga/plugins/cmp.lua

Added
new file mode 100644
1 +local map = require 'std.map'
2 +local user_command = require 'std.user_command'
3 +local icon = require 'std.icon'
5 +return {
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 + },
101 + end
103 + local sources = {
104 + { name = 'nvim_lua', },
105 + { name = 'nvim_lsp', },
106 + { name = 'path', },
107 + { name = 'luasnip', },
108 + { name = 'neorg', },
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 + },
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, },
141 + end,

neovim/lua/bugabinga/plugins/colorizer.lua

Modified
1 1 return {
3 3 'JosefLitos/colorizer.nvim',
4 - event = { 'BufReadPost', 'BufNew', },
4 + event = vim.g.FILE_LOADED_EVENTS,
5 5 opts = {
6 6 filetypes = { '*', },
7 7 user_default_options = {
15 15 css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
16 16 -- Available modes for `mode`: foreground, background, virtualtext
17 17 mode = 'virtualtext', -- Set the display mode.
18 - names = function () return require 'bugabinga.nugu.palette' end,
18 + -- names = function () return require 'bugabinga.nugu.palette' end,
19 19 -- parsers can contain values used in |user_default_options|
20 20 sass = { enable = false, parsers = { 'css', }, }, -- Enable sass colors
21 21 virtualtext = '██',

neovim/lua/bugabinga/plugins/comment.lua

Modified
1 1 return { {
2 2 'numToStr/Comment.nvim',
3 - tag = 'v0.8.0',
3 + version = '0.*',
4 4 keys = {
5 5 { 'gc', mode = { 'n', 'v', }, desc = 'Comment toggle linewise', },
6 6 { 'gb', mode = { 'n', 'v', }, desc = 'Comment toggle blockwise', },

neovim/lua/bugabinga/plugins/commentstring.lua

Modified
4 4 return {
5 5 'JoosepAlviste/nvim-ts-context-commentstring',
6 6 lazy = false,
7 7 init = function ()
8 8 vim.g.skip_ts_context_commentstring_module = true
9 9 end,
10 - opts = { enable_autocmd = false },
10 + opts = { enable_autocmd = false, },

neovim/lua/bugabinga/plugins/dap.lua

Added
new file mode 100644
1 +--FIXME: own this
2 +return {
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 + },

neovim/lua/bugabinga/plugins/devicons.lua

Modified
1 -return { {
1 +return {
2 2 'nvim-tree/nvim-web-devicons',
3 3 opts = {
4 4 -- instead of creating a highlight for every single icon, use only the
5 5 -- DefaultDevIcon highlight for all
6 6 color_icons = false,
8 -}, }
8 +}

neovim/lua/bugabinga/plugins/diffview.lua

Modified
1 +local map = require 'std.map'
3 +map.normal {
4 + keys = '<leader>vd',
5 + description = 'Opens Diffview',
6 + category = 'vcs',
7 + command = '<cmd>DiffviewOpen<cr>',
8 +}
1 10 return {
2 11 'sindrets/diffview.nvim',
3 - cmd = { 'DiffviewOpen', 'DiffviewToggleFiles' },
12 + cmd = { 'DiffviewOpen', },
4 13 opts = {},

neovim/lua/bugabinga/plugins/dressing.lua

Modified
1 +--FIXME: own this. is vim.ui.open shim still necessary?
1 2 return {
2 - 'stevearc/dressing.nvim',
3 + "stevearc/dressing.nvim",
3 4 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,

neovim/lua/bugabinga/plugins/fidget.lua

Modified
1 -local debug = require 'std.debug'
1 +local debug = require 'std.dbg'
3 3 return {
4 4 'j-hui/fidget.nvim',
5 - version = '1.4.0',
6 - event = 'LspAttach',
5 + version = '1.*',
6 + event = 'VeryLazy',
7 7 opts = {
8 8 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
10 11 lsp = {
11 - log_handler = debug.get, -- Log `$/progress` handler invocations (for debugging)
12 + log_handler = debug.get(), -- Log `$/progress` handler invocations (for debugging)
14 15 notification = {
15 - filter = debug.get and vim.log.levels.DEBUG,
16 + filter = debug.get() and vim.log.levels.DEBUG or vim.log.levels.INFO,
16 17 override_vim_notify = true, -- Automatically override vim.notify() with Fidget

neovim/lua/bugabinga/plugins/flash.lua

Modified
1 +local map = require 'std.map'
3 +map.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 +}
1 10 return {
2 11 'folke/flash.nvim',
3 - tag = 'v1.18.2',
12 + version = '1.*',
4 13 event = 'VeryLazy',
5 14 opts = {
6 15 highlight = { backdrop = false, },
7 16 modes = { char = { highlight = { backdrop = false, }, },
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
1 +local debug = require 'std.dbg'
2 +local map = require 'std.map'
3 +local user_command = require 'std.user_command'
5 +local 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 )
11 +end
13 +map.N {
14 + description = 'Format buffer',
15 + category = 'format',
16 + keys = '=',
17 + command = format,
20 +user_command.Format
21 +'Format the current buffer' (
22 + format
23 + )
25 +return {
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,

neovim/lua/bugabinga/plugins/gen.lua

Deleted
deleted file mode 100644
1 -require 'bugabinga.health'.add_dependency
2 -{
3 - name_of_executable = 'ollama',
4 -}
5 -return {
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
1 +local map = require 'std.map'
3 +map.normal {
4 + keys = '<leader>fn',
5 + category = 'files',
6 + description = 'Create new file',
7 + command = function () require 'genghis'.createNewFile() end,
8 +}
10 +map.visual {
11 + keys = '<leader>fx',
12 + category = 'files',
13 + description = 'Move selection to new file',
14 + command = function () require 'genghis'.moveSelectionToNewFile() end,
17 +map.normal {
18 + keys = '<leader>fy',
19 + category = 'files',
20 + description = 'Yank file name',
21 + command = function () require 'genghis'.copyFilename() end,
24 +map.normal {
25 + keys = '<leader>fY',
26 + category = 'files',
27 + description = 'Yank file path',
28 + command = function () require 'genghis'.copyFilepath() end,
31 +map.normal {
32 + keys = '<leader>fc',
33 + category = 'files',
34 + description = 'Change file mode/permissions',
35 + command = function () require 'genghis'.chmodx() end,
38 +map.normal {
39 + keys = '<leader>fr',
40 + category = 'files',
41 + description = 'Rename file',
42 + command = function () require 'genghis'.renameFile() end,
45 +map.normal {
46 + keys = '<leader>fm',
47 + category = 'files',
48 + description = 'Move file',
49 + command = function () require 'genghis'.moveAndRenameFile() end,
52 +map.normal {
53 + keys = '<leader>fM',
54 + category = 'files',
55 + description = 'Move file to current working directory',
56 + command = function () require 'genghis'.moveToFolderInCwd() end,
59 +map.normal {
60 + keys = '<leader>ff',
61 + category = 'files',
62 + description = 'Duplicate file',
63 + command = function () require 'genghis'.duplicateFile() end,
66 +map.normal {
67 + keys = '<leader>fd',
68 + category = 'files',
69 + description = 'Move file to system trash',
70 + command = function () require 'genghis'.trashFile() end,
1 73 return {
2 74 'chrisgrieser/nvim-genghis',
3 75 cmd = {
19 91 dependencies = {
20 92 'stevearc/dressing.nvim',
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
1 -local map = require 'std.map'
1 +local map = require("std.map")
3 3 return {
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,
7 7 opts = {
8 8 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 = "┆" },
16 16 preview_config = {
17 17 border = vim.g.border_style,
20 20 current_line_blame_opts = {
21 21 ignore_whitespace = true,
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",
31 31 buffer = bufnr,
32 32 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",
39 39 buffer = bufnr,
40 40 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",
47 47 buffer = bufnr,
48 48 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",
55 55 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",
63 65 buffer = bufnr,
64 66 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",
71 73 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",
79 83 buffer = bufnr,
80 84 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",
87 91 buffer = bufnr,
88 92 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",
95 99 buffer = bufnr,
96 100 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",
103 107 buffer = bufnr,
104 108 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",
111 115 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",
119 125 buffer = bufnr,
120 126 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",
127 133 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",
135 143 buffer = bufnr,
136 144 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",
143 151 buffer = bufnr,
144 152 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",
151 159 buffer = bufnr,
152 - command = ':<C-U>Gitsigns select_hunk<CR>',
153 - }
160 + command = ":<C-U>Gitsigns select_hunk<CR>",
161 + })

neovim/lua/bugabinga/plugins/glow.lua

Modified
3 3 require 'bugabinga.health'.add_dependency
5 5 name = 'Glow',
6 6 name_of_executable = 'glow',
9 +local map = require 'std.map'
11 +map.normal {
12 + description = 'Generate markdown preview',
13 + keys = '<leader>gm',
14 + category = 'preview',
15 + command = '<cmd>Glow<cr>',
8 18 return {
9 19 'ellisonleao/glow.nvim',
10 20 cmd = 'Glow',

neovim/lua/bugabinga/plugins/hardtime.lua

Deleted
deleted file mode 100644
1 -local ignored = require 'std.ignored'
3 -return {
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
1 1 ---@diagnostic disable: param-type-mismatch
2 -local icon = require 'std.icon'
3 -local auto = require 'std.auto'
4 -local ignored = require 'std.ignored'
2 +local icon = require("std.icon")
3 +local auto = require("std.auto")
4 +local ignored = require("std.ignored")
6 -local NEW_FILE = '~untitled~'
6 +local NEW_FILE = "~untitled~"
8 8 return {
10 - 'rebelot/heirline.nvim',
11 - tag = 'v1.0.3',
12 - event = 'BufEnter',
10 + "rebelot/heirline.nvim",
11 + version = "1.*",
12 + event = "VeryLazy",
13 13 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 },
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()
37 39 static = {
38 40 mode_names = {
39 41 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",
48 50 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,
54 56 s = icon.select,
55 - S = icon.select .. '_',
56 - ['\19'] = '^' .. icon.select,
57 + S = icon.select .. "_",
58 + ["\19"] = "^" .. icon.select,
57 59 i = icon.insert,
58 - ic = icon.insert .. 'c',
59 - ix = icon.insert .. 'x',
60 + ic = icon.insert .. "c",
61 + ix = icon.insert .. "x",
60 62 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",
66 68 c = icon.command,
67 - cv = icon.command .. 'x',
69 + cv = icon.command .. "x",
68 70 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,
72 74 t = icon.terminal,
74 76 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",
91 - provider = function ( self )
93 + provider = function(self)
92 94 local mode_name = self.mode_names[self.mode]
93 - return ' ' .. icon.vim .. ' %3(' .. mode_name .. '%) '
95 + return " " .. icon.vim .. " %3(" .. mode_name .. "%) "
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 }
101 103 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),
108 - local file_icon = {
109 - init = function ( self )
112 + local file_icon = {
113 + init = function(self)
110 114 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 })
114 - provider = function ( self )
115 - return self.icon and (self.icon .. ' ')
118 + provider = function(self)
119 + return self.icon and (self.icon .. " ")
117 - hl = 'DefaultIcon',
121 + hl = "DefaultIcon",
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
126 132 flexible = 2,
129 - provider = function ( self )
135 + provider = function(self)
130 136 return self.lfilename
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))
140 - local file_flags = {
146 + local file_flags = {
142 - condition = function ()
148 + condition = function()
143 149 return vim.bo.modified
145 - provider = string.format( ' %s ', icon.modified ),
146 - hl = 'Comment',
151 + provider = string.format(" %s ", icon.modified),
152 + hl = "Comment",
149 - condition = function ()
155 + condition = function()
150 156 return not vim.bo.modifiable or vim.bo.readonly
152 - provider = string.format( ' %s ', icon.lock ),
153 - hl = 'ErrorMsg',
158 + provider = string.format(" %s ", icon.lock),
159 + hl = "ErrorMsg",
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))
162 168 file_icon,
163 - { provider = ' ', },
169 + { provider = " " },
164 170 file_name,
165 171 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
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)
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()
182 - local file_format = {
188 + local file_format = {
183 189 static = {
184 190 dos = icon.newline .. icon.carriage_return,
185 191 unix = icon.newline,
186 192 mac = icon.carriage_return,
188 - provider = function ( self )
194 + provider = function(self)
189 195 local fileformat = vim.bo.fileformat
190 196 return self[fileformat]
194 - local file_size = {
195 - provider = function ()
200 + local file_size = {
201 + provider = function()
196 202 -- stackoverflow, compute human readable file size
197 203 -- 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))
200 206 fsize = (fsize < 0 and 0) or fsize
201 207 if fsize < 1024 then
202 208 return fsize .. suffix[1]
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])
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))
212 218 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)
219 - local lsp_active = {
225 + local lsp_active = {
220 226 condition = conditions.lsp_attached,
221 227 -- FIXME: updates from parent components do not seem to update children,
222 228 -- if those have their own updates?
223 - update = { 'LspAttach', 'LspDetach', 'BufEnter', 'BufLeave', },
229 + update = { "LspAttach", "LspDetach", "BufEnter", "BufLeave" },
225 - provider = function ()
231 + provider = function()
226 232 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)
230 - return icon.lsp .. ' ' .. table.concat( names, ' ' )
236 + return icon.lsp .. " " .. table.concat(names, " ")
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,
236 245 static = {
237 246 -- create a type highlight map
238 247 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",
266 275 -- 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)
270 279 -- 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)
275 284 return line, col, winnr
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 {}
280 289 local children = {}
281 290 -- create a child for each level
282 - for i, d in ipairs( data ) do
291 + for i, d in ipairs(data) do
283 292 -- 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)
285 294 local child = {
287 296 provider = d.icon,
291 300 -- escape `%`s (elixir) and buggy default separators
292 - provider = d.name:gsub( '%%', '%%%%' ):gsub( '%s*->%s*', '' ),
301 + provider = d.name:gsub("%%", "%%%%"):gsub("%s*->%s*", ""),
293 302 -- highlight icon only or location name as well
294 303 hl = self.type_hl[d.type],
296 305 on_click = {
297 306 -- pass the encoded position through minwid
298 307 minwid = pos,
299 - callback = function ( _, minwid )
308 + callback = function(_, minwid)
300 309 -- 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 })
304 - name = 'heirline_navic',
313 + name = "heirline_navic",
308 317 -- add a separator only if needed
309 318 if #data > 1 and i < #data then
310 - table.insert( child, {
311 - provider = ' > ',
319 + table.insert(child, {
320 + provider = " > ",
312 321 -- hl = { fg = 'bright_fg', },
313 - } )
322 + })
315 - table.insert( children, child )
324 + table.insert(children, child)
317 326 -- instantiate the new child, overwriting the previous one
318 - self.child = self:new( children, 1 )
327 + self.child = self:new(children, 1)
320 329 -- evaluate the children containing navic components
321 - provider = function ( self )
330 + provider = function(self)
322 331 return self.child:eval()
324 333 -- hl = { fg = 'gray', },
325 - update = 'CursorMoved',
334 + update = "CursorMoved",
328 - local diagnostic_enabled = {
329 - init = function ( self )
337 + local diagnostic_enabled = {
338 + init = function(self)
330 339 self.icon = vim.diagnostic.is_disabled() and icon.toggle_off or icon.toggle_on
332 - provider = function ( self )
333 - return icon.diagnostic .. ' ' .. self.icon
341 + provider = function(self)
342 + return icon.diagnostic .. " " .. self.icon
337 - local diagnostic = {
346 + local diagnostic = {
338 347 condition = conditions.has_diagnostics,
340 349 static = {
344 353 hint_icon = icon.hint,
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 })
354 - update = { 'DiagnosticChanged', 'BufEnter', 'BufLeave', },
363 + update = { "DiagnosticChanged", "BufEnter", "BufLeave" },
357 - provider = function ( self )
366 + provider = function(self)
358 367 -- 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 .. " ")
361 - hl = 'DiagnosticError',
370 + hl = "DiagnosticError",
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 .. " ")
367 - hl = 'DiagnosticWarn',
376 + hl = "DiagnosticWarn",
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 .. " ")
373 - hl = 'DiagnosticInfo',
382 + hl = "DiagnosticInfo",
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)
379 - hl = 'DiagnosticHint',
388 + hl = "DiagnosticHint",
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", {
385 394 upward = true,
386 395 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)
394 - local svn_get_relative_url = function ()
403 + local svn_get_relative_url = function()
395 404 -- 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()
407 420 return relative_url[1]
410 - local svn = {
423 + local svn = {
411 424 condition = is_svn_repo,
413 - update = 'BufEnter',
426 + update = "BufEnter",
415 - init = function ( self )
428 + init = function(self)
416 429 self.relative_url = svn_get_relative_url()
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
427 - local git = {
439 + local git = {
428 440 condition = conditions.is_git_repo,
430 - init = function ( self )
442 + init = function(self)
431 443 self.status_dict = vim.b.gitsigns_status_dict
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 .. " "
440 - provider = function ( self )
452 + provider = function(self)
441 453 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 .. " ")
444 - hl = 'DiffAdd',
456 + hl = "DiffAdd",
447 - provider = function ( self )
459 + provider = function(self)
448 460 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 .. " ")
451 - hl = 'DiffDelete',
463 + hl = "DiffDelete",
454 - provider = function ( self )
466 + provider = function(self)
455 467 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 .. " ")
458 - hl = 'DiffChange',
470 + hl = "DiffChange",
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()), "~")
468 480 flexible = 1,
471 - provider = function ( self )
483 + provider = function(self)
472 484 return self.icon .. self.cwd
476 - provider = function ( self )
477 - local cwd = vim.fn.pathshorten( self.cwd )
488 + provider = function(self)
489 + local cwd = vim.fn.pathshorten(self.cwd)
478 490 return self.icon .. cwd
482 - provider = '',
494 + provider = "",
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"
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")
494 - hl = 'Question',
506 + hl = "Question",
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")
503 - hl = 'Bold',
515 + hl = "Bold",
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)
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
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()
521 533 return vim.fn.reg_recording()
523 - hl = 'Bold',
524 - } ),
535 + hl = "Bold",
536 + }),
525 537 update = {
526 - 'RecordingEnter',
527 - 'RecordingLeave',
538 + "RecordingEnter",
539 + "RecordingLeave",
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")
534 546 return ok and lazy_status.has_updates()
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,
538 552 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",
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,
554 - local special_statusline = {
555 - condition = function ()
556 - return conditions.buffer_matches {
593 + local special_statusline = {
594 + condition = function()
595 + return conditions.buffer_matches({
557 596 buftype = ignored.buftypes,
558 597 filetype = ignored.filetypes,
559 - }
598 + })
562 601 file_type,
565 604 align,
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" } })
574 - { condition = conditions.is_active, vi_mode, space, },
613 + { condition = conditions.is_active, vi_mode, space },
575 614 file_type,
576 615 space,
577 616 terminal_name,
578 617 align,
581 - local inactive_statusline = {
620 + local inactive_statusline = {
582 621 condition = conditions.is_not_active,
583 622 file_type,
584 623 space,
586 625 align,
589 - local statuslines = {
590 - hl = function ()
628 + local statuslines = {
629 + hl = function()
591 630 if conditions.is_active() then
592 - return 'StatusLine'
631 + return "StatusLine"
594 - return 'StatusLineNC'
633 + return "StatusLineNC"
603 642 default_statusline,
606 - local winbars = {
607 - hl = function ()
645 + local winbars = {
646 + hl = function()
608 647 if conditions.is_active() then
609 - return 'Winbar'
648 + return "Winbar"
611 - return 'WinbarNC'
650 + return "WinbarNC"
615 654 fallthrough = false,
618 - condition = function ()
619 - return conditions.buffer_matches { buftype = { 'terminal', }, }
657 + condition = function()
658 + return conditions.buffer_matches({ buftype = { "terminal" } })
622 661 file_type,
733 772 -- { provider = ' ' .. icon.arrow_right, hl = 'TabLine', }
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"
740 - hl = function ( self )
779 + hl = function(self)
741 780 if self.is_active then
742 - return 'TabLineSel'
781 + return "TabLineSel"
744 - return 'TabLine'
783 + return "TabLine"
749 - local tab_pages = {
750 - { provider = '%=', },
751 - utils.make_tablist( tabpage ),
788 + local tab_pages = {
789 + { provider = "%=" },
790 + utils.make_tablist(tabpage),
754 793 -- local tabline = { buffer_line, tab_pages, }
756 795 -- local statuscolumn = {}
758 - heirline.setup {
797 + heirline.setup({
759 798 statusline = statuslines,
760 799 winbar = winbars,
761 800 tabline = tab_pages,
765 804 opts = {
766 805 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)
776 - }
813 + })

neovim/lua/bugabinga/plugins/hyper.lua

Deleted
deleted file mode 100644
1 -return {
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
2 2 local icon = require 'std.icon'
4 4 return {
5 5 'lukas-reineke/indent-blankline.nvim',
6 - tag = 'v3.5.3',
6 + version = '3.*',
7 7 main = 'ibl',
8 - event = { 'BufReadPost', 'BufNew', },
9 - config = function ()
10 - local ibl = require 'ibl'
12 - ibl.setup {
13 - debounce = 250,
14 - indent = {
15 - char = icon.vertical_bar,
16 - tab_char = icon.vertical_bar,
17 - },
18 - }
19 - end,
8 + event = vim.g.FILE_LOADED_EVENTS,
9 + opts = {
10 + debounce = 250,
11 + indent = {
12 + char = icon.vertical_bar,
13 + tab_char = icon.vertical_bar,
14 + },
15 + },

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

Modified
3 3 local ignored = require 'std.ignored'
5 5 return {
7 7 'ethanholz/nvim-lastplace',
8 - event = { 'VimEnter' },
8 + event = { 'VimEnter', 'SessionLoadPost', },
9 9 opts = {
10 10 lastplace_ignore_buftype = ignored.buftypes,
11 11 lastplace_ignore_filetype = ignored.filetypes,

neovim/lua/bugabinga/plugins/lint.lua

Added
new file mode 100644
1 +--FIXME: own this
2 +local uv = vim.uv or vim.loop
3 +return {
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,

neovim/lua/bugabinga/plugins/mason.lua

Modified
1 1 return {
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,
5 5 opts = {
6 6 ui = {
7 7 border = vim.g.border_style,
12 12 dependencies = {
14 - 'WhoIsSethDaniel/mason-tool-installer.nvim',
14 + "WhoIsSethDaniel/mason-tool-installer.nvim",
15 15 lazy = false,
16 - cmd = { 'MasonToolsInstall', 'MasonToolsInstallSync', 'MasonToolsUpdate', 'MasonToolsUpdateSync', 'MasonToolsClean', },
17 16 opts = {
18 17 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",

neovim/lua/bugabinga/plugins/mkdir.lua

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

neovim/lua/bugabinga/plugins/navic.lua

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

neovim/lua/bugabinga/plugins/neoclip.lua

Modified
1 1 local map = require 'std.map'
3 -return {
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'
3 +map.normal {
4 + description = 'Open clipboard history...',
5 + category = 'history',
6 + keys = '<c-p><c-h>',
7 + command = function ()
12 8 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 {}
17 9 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()
25 11 end,
14 +return {
15 + 'AckslD/nvim-neoclip.lua',
16 + event = 'TextYankPost',
17 + dependencies = {
18 + 'nvim-telescope/telescope.nvim',
19 + },
20 + opts = {},

neovim/lua/bugabinga/plugins/neodev.lua

Modified
1 1 return {
2 2 'folke/neodev.nvim',
3 3 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
4 7 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,

neovim/lua/bugabinga/plugins/neogen.lua

Modified
1 1 local map = require 'std.map'
3 +map.normal {
4 + description = 'Generate doc comment for outer element',
5 + category = 'editing',
6 + keys = '<leader>gd',
7 + command = function () require 'neogen'.generate() end,
8 +}
10 +map.normal {
11 + name = 'Generate Doc Comment for Function',
12 + category = 'editing',
13 + keys = '<leader>gdf',
14 + command = function () require 'neogen'.generate { type = 'func', } end,
17 +map.normal {
18 + description = 'Generate Doc Comment for File',
19 + category = 'editing',
20 + keys = '<leader>gdF',
21 + command = function () require 'neogen'.generate { type = 'file', } end,
24 +map.normal {
25 + description = 'Generate Doc Comment for Class',
26 + category = 'editing',
27 + keys = '<leader>gdc',
28 + command = function () require 'neogen'.generate { type = 'class', } end,
3 31 return {
4 32 'danymat/neogen',
5 - keys = { '<leader>gd', },
6 33 dependencies = { 'nvim-treesitter/nvim-treesitter', },
7 - config = function ()
8 - local neogen = require 'neogen'
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
1 +return {
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 + },

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

Deleted
deleted file mode 100644
1 -local map = require 'std.map'
3 -return {
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 - },

neovim/lua/bugabinga/plugins/nrpattern.lua

Modified
1 -return { {
1 +return {
2 2 'zegervdv/nrpattern.nvim',
3 3 keys = { '<C-a>', '<C-x>', },
4 4 config = function ()
5 5 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
7 7 nrpattern.setup()
8 8 end,
9 -}, }
9 +}

neovim/lua/bugabinga/plugins/nui.lua

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

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

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

neovim/lua/bugabinga/plugins/oil.lua

Modified
1 1 local map = require 'std.map'
2 +local icon = require 'std.icon'
4 +map.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,
3 12 return {
4 13 '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,
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
1 -return {
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
1 +local map = require 'std.map'
3 +return {
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 + },

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

Added
new file mode 100644
1 +return {
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 + },

neovim/lua/bugabinga/plugins/persistence.lua

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

neovim/lua/bugabinga/plugins/schemastore.lua

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

neovim/lua/bugabinga/plugins/sessions.lua

Added
new file mode 100644
1 +local map = require 'std.map'
2 +local auto = require 'std.auto'
4 +local LAST_SESSION = 'last'
6 +auto '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 + },
30 +map.normal {
31 + description = 'Restore last session',
32 + category = 'history',
33 + keys = '<leader>sl',
34 + command = function () prequire 'resession'.load( LAST_SESSION ) end,
37 +map.normal {
38 + description = 'Restore a session',
39 + category = 'history',
40 + keys = '<leader>sL',
41 + command = function () prequire 'resession'.load() end,
44 +map.normal {
45 + description = 'Delete session',
46 + category = 'history',
47 + keys = '<leader>sd',
48 + command = function () prequire 'resession'.delete() end,
51 +map.normal {
52 + description = 'Save session (tab)',
53 + category = 'history',
54 + keys = '<leader>ss',
55 + command = function () prequire 'resession'.save_tab() end,
58 +map.normal {
59 + description = 'Save session (all tabs)',
60 + category = 'history',
61 + keys = '<leader>sS',
62 + command = function () prequire 'resession'.save() end,
65 +return {
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 + },

neovim/lua/bugabinga/plugins/snippets.lua

Added
new file mode 100644
1 +--FIXME: own this
2 +return {
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,
113 + end,

neovim/lua/bugabinga/plugins/specs.lua

Modified
1 1 local map = require 'std.map'
2 2 local ignored = require 'std.ignored'
4 -return { {
5 - 'KevinSilvester/specs.nvim',
6 - keys = { '<leader><leader>', '<leader><leader><leader>' },
7 - config = function ()
8 - local specs = require 'specs'
4 +map.normal {
5 + description = 'Find cursor!',
6 + category = 'fun',
7 + keys = '<leader><leader>',
8 + command = function () require 'specs'.show_specs() end,
9 +}
10 - specs.setup {
11 +map.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,
20 +return {
21 + 'KevinSilvester/specs.nvim',
22 + opts = function ()
23 + return {
11 24 show_jumps = true,
12 25 min_jump = 30,
13 26 popup = {
14 27 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
17 30 width = 10,
18 31 winhl = 'Cursor',
19 - fader = specs.exp_fader,
20 - resizer = specs.shrink_resizer
32 + fader = require 'specs'.exp_fader,
33 + resizer = require 'specs'.shrink_resizer,
22 35 ignore_filetypes = ignored.filetypes_kv,
23 36 ignore_buftypes = ignored.buftypes_kv,
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 + ,

neovim/lua/bugabinga/plugins/spectre.lua

Modified
2 2 local map = require 'std.map'
4 4 require 'bugabinga.health'.add_dependency
6 - name_of_executable = 'rg'
6 + name_of_executable = 'rg',
7 +}
9 +map.normal {
10 + description = 'Search and replace',
11 + category = 'search',
12 + keys = '<leader>rs',
13 + command = function () spectre.open() end,
16 +map.normal {
17 + description = 'Search current word',
18 + category = 'search',
19 + keys = '<leader>rw',
20 + command = function () spectre.open_visual { select_word = true, } end,
23 +map.visual {
24 + description = 'Search current word',
25 + category = 'search',
26 + keys = '<leader>rw',
27 + command = function () spectre.open_visual() end,
30 +map.normal {
31 + description = 'Search on current file',
32 + category = 'search',
33 + keys = '<leader>rf',
34 + command = function () spectre.open_file_search { select_word = true, } end,
9 37 return {
10 - 'bugabinga/nvim-spectre',
38 + 'nvim-pack/nvim-spectre',
11 39 cmd = 'Spectre',
12 40 dependencies = {
13 41 'nvim-lua/plenary.nvim',
15 43 opts = {
16 44 live_update = true,
17 - default = { replace = { cmd = 'oxi' } },
45 + default = { replace = { cmd = 'oxi', }, },
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'
50 82 end,

neovim/lua/bugabinga/plugins/ssr.lua

Modified
1 1 local map = require 'std.map'
2 +local user_command = require 'std.user_command'
4 +local open_ssr = function () prequire 'ssr'.open() end
6 +map.normal.visual {
7 + description = 'Open structural search and replace',
8 + category = 'refactoring',
9 + keys = '<leader>rr',
10 + command = open_ssr,
13 +user_command.StructuralSearchAndReplace
14 +'Open structural search and replace view' (
15 + open_ssr
16 + )
3 18 return {
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
1 -local auto = require 'std.auto'
2 -local icon = require 'std.icon'
4 -return {
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
1 -local map = require'std.map'
1 +local map = require 'std.map'
3 -return {{
4 - "gbprod/substitute.nvim",
5 - keys = { 's', 'S' },
6 - config = function()
7 - local substitute = require'substitute'
8 - substitute.setup{}
3 +map.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 - }
10 +map.normal {
11 + description = 'substitution of current line',
12 + category = 'editing',
13 + keys = 'ss',
14 + command = function () require 'substitute'.line() end,
17 - map.normal {
18 - description = 'substitution of current line',
19 - category = 'editing',
20 - keys = 'ss',
21 - command = substitute.line,
22 - }
17 +map.normal {
18 + description = 'substitution until end of line',
19 + category = 'editing',
20 + keys = 'S',
21 + command = function () require 'substitute'.eol() end,
24 - map.normal {
25 - description = 'substitution until end of line',
26 - category = 'editing',
27 - keys = 'S',
28 - command = substitute.eol,
29 - }
24 +map.visual {
25 + description = 'substitution motion (visual mode)',
26 + category = 'editing',
27 + keys = 's',
28 + command = function () require 'substitute'.visual() end,
31 +return {
32 + 'gbprod/substitute.nvim',
33 + opts = {},
31 - map.visual {
32 - description = 'substitution motion (visual mode)',
33 - category = 'editing',
34 - keys = 's',
35 - command = substitute.visual,
36 - }
37 - end,
38 -}}

neovim/lua/bugabinga/plugins/sudo.lua

Added
new file mode 100644
1 +return { 'lambdalisue/suda.vim', cmd = { 'SudaRead', 'SudaWrite', }, }

neovim/lua/bugabinga/plugins/surround.lua

Modified
1 1 return {
2 - {
3 - 'kylechui/nvim-surround',
4 - keys = {
5 - { 'ms', mode = 'n' },
6 - { 'mss', mode = 'n' },
7 - { 'mS', mode = 'n' },
8 - { 'mSS', mode = 'n' },
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',
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
1 -return {
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
1 +local map = require 'std.map'
2 +local user_command = require 'std.user_command'
4 +map.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 +}
11 +map.normal {
12 + description = 'Run task',
13 + category = 'tasks',
14 + keys = '<leader>9r',
15 + command = function () prequire 'overseer'._run_template() end,
18 +map.normal {
19 + description = 'Run any command as task',
20 + category = 'tasks',
21 + keys = '<leader>9c',
22 + command = function () prequire 'overseer'._run_command() end,
25 +map.normal {
26 + description = 'Load task bundle',
27 + category = 'tasks',
28 + keys = '<leader>9r',
29 + command = function () prequire 'overseer'._load_bundle() end,
32 +map.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,
39 +map.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,
46 +map.normal {
47 + description = 'Display diagnostic information about overseer',
48 + category = 'tasks',
49 + keys = '<leader>9i',
50 + command = function () prequire 'overseer'._info() end,
53 +user_command.OverseerDebugParser
54 +'Open a tab with windows laid out for debugging a parser' (
55 + function ()
56 + prequire 'overseer'.debug_parser()
57 + end
58 + )
60 +user_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 + )
95 +user_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 + },
112 + task:start()
113 + end
116 +return {
118 + 'stevearc/resession.nvim',
119 + lazy = true,
120 + opts = {
121 + extensions = {
122 + overseer = {
123 + status = { 'RUNNING', },
124 + },
125 + },
126 + },
127 + },
129 + 'stevearc/overseer.nvim',
130 + opts = {
131 + strategy = { 'jobstart', },
132 + dap = false,
133 + log = {
135 + type = 'echo',
136 + level = vim.log.levels.WARN,
137 + },
139 + type = 'file',
140 + filename = 'overseer.log',
141 + level = vim.log.levels.DEBUG,
142 + },
143 + },
144 + component_aliases = {
145 + default = {
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
1 -local map = require 'std.map'
2 -local icon = require 'std.icon'
3 -local table = require 'std.table'
5 1 require 'bugabinga.health'.add_dependency
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 + }
15 +local map = require 'std.map'
16 +local icon = require 'std.icon'
18 +map.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,
25 +map.normal.visual.terminal {
26 + description = 'Search help files',
27 + category = 'help',
28 + keys = '<F1>',
29 + command = function () require 'telescope.builtin'.help_tags() end,
32 +map.normal {
33 + description = 'Open last search...',
34 + category = 'plugins',
35 + keys = '<c-p>',
36 + command = function () require 'telescope.builtin'.resume() end,
39 +map.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,
46 +map.normal {
47 + description = 'Open search for keymaps...',
48 + category = 'search',
49 + keys = '<c-p><c-k>',
50 + command = function () require 'telescope.builtin'.keymaps() end,
53 +map.normal {
54 + description = 'Open search for symbols...',
55 + category = 'search',
56 + keys = '<c-p><c-s>',
57 + command = function () require 'telescope.builtin'.symbols() end,
60 +map.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,
67 +map.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,
74 +map.normal {
75 + description = 'Open search for buffers...',
76 + category = 'search',
77 + keys = '<c-e>',
78 + command = function () require 'telescope.builtin'.buffers() end,
10 - {
11 - name = 'find-fd',
12 - name_of_executable = 'fd',
13 - }
15 81 return {
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 + },
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
1 +local debug = require 'std.dbg'
2 +local icon = require 'std.icon'
3 +local map = require 'std.map'
5 +map.normal {
6 + description = 'Run all tests',
7 + category = 'test',
8 + keys = '<leader>7n',
9 + command = function () prequire 'neotest'.run.run {} end,
12 +map.normal {
13 + description = 'Run all tests',
14 + category = 'test',
15 + keys = '<leader>7n',
16 + command = function () prequire 'neotest'.run.run {} end,
19 +map.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,
26 +map.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,
37 +map.normal {
38 + description = 'Run last test',
39 + category = 'test',
40 + keys = '<leader>7l',
41 + command = function () prequire 'neotest'.run.run_last() end,
44 +map.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,
51 +map.normal {
52 + description = 'Show test summary',
53 + category = 'test',
54 + keys = '<leader>7p',
55 + command = function () prequire 'neotest'.summary.toggle() end,
58 +map.normal {
59 + description = 'Show test output',
60 + category = 'test',
61 + keys = '<leader>7o',
62 + command = function () prequire 'neotest'.output.open { short = true, } end,
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
68 +return {
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,
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,
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 + },
136 + end,

neovim/lua/bugabinga/plugins/tint.lua

Added
new file mode 100644
1 +return {
2 + 'levouh/tint.nvim',
3 + event = { 'WinNew', 'SessionLoadPost', },
4 + opts = {},
5 +}

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

Modified
1 1 return {
2 2 'folke/todo-comments.nvim',
3 - tag = 'v1.1.0',
3 + version = '1.*',
4 4 dependencies = { 'nvim-lua/plenary.nvim', },
5 - event = 'BufReadPost',
5 + event = vim.g.FILE_LOADED_EVENTS,
6 6 opts = {},

neovim/lua/bugabinga/plugins/toggleterm.lua

Deleted
deleted file mode 100644
1 -local map = require 'std.map'
2 -local auto = require 'std.auto'
4 -require '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 - }
15 -return {
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,

neovim/lua/bugabinga/plugins/tree.lua

Modified
1 1 local map = require 'std.map'
3 +map.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 +}
3 10 return {
4 11 'nvim-tree/nvim-tree.lua',
5 12 version = '1.*',
6 13 -- docs do not recommend to lazy load, but it does load slowly on win32!
7 14 -- lazy = false,
8 15 cmd = 'NvimTreeOpen',
9 - keys = '<leader>e',
10 16 dependencies = {
11 17 'nvim-tree/nvim-web-devicons',
12 18 'antosha417/nvim-lsp-file-operations',
19 25 -- set termguicolors to enable highlight groups
20 26 vim.opt.termguicolors = true
21 27 end,
28 +<<<<<<< HEAD
22 29 config = function ()
23 30 require 'nvim-tree'.setup {
24 31 sort = {
34 41 dotfiles = false,
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
37 60 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 - }
45 61 end,

neovim/lua/bugabinga/plugins/treesitter.lua

Modified
8 8 return {
9 9 'nvim-treesitter/nvim-treesitter',
10 - branch = 'master',
11 - -- to get access to newer parsers, TS cannot yet be pinned
12 10 -- 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,
15 14 build = function ()
16 15 require 'nvim-treesitter.install'.update { with_sync = true, }
18 17 dependencies = {
19 - 'windwp/nvim-ts-autotag',
20 18 'nvim-treesitter/playground',
21 19 'nvim-treesitter/nvim-treesitter-textobjects',
20 + 'windwp/nvim-ts-autotag',
21 + 'RRethy/nvim-treesitter-endwise',
22 22 'nushell/tree-sitter-nu',
24 24 config = function ()
25 25 local install = require 'nvim-treesitter.install'
26 26 local configs = require 'nvim-treesitter.configs'
27 - local parsers = require 'nvim-treesitter.parsers'
29 28 install.prefer_git = false
30 29 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
32 41 ---@diagnostic disable-next-line: missing-fields
33 42 configs.setup {
35 43 sync_install = false,
37 44 ensure_installed = {
38 45 'bash',
47 54 'gitignore',
48 55 'ini',
49 56 'java',
57 + 'just',
50 58 'jsonc',
51 59 'lua',
52 60 'luap',
78 86 auto_install = true,
80 - autotag = { enable = false, },
88 + autotag = { enable = true, disable = should_disable, },
89 + ewndwise = { enable = true, disable = should_disable, },
82 91 highlight = {
83 92 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,
91 94 additional_vim_regex_highlighting = false,
94 97 incremental_selection = {
95 98 enable = true,
99 + disable = should_disable,
96 100 keymaps = {
97 101 init_selection = '<up>',
98 - node_incremental = '<right>',
102 + node_incremental = '<up>',
99 103 node_decremental = '<down>',
100 - scope_incremental = '<up>',
104 + scope_incremental = '<right>',
106 110 playground = {
107 111 enable = true,
108 - disable = {},
112 + disable = should_disable,
109 113 updatetime = 25,
110 114 persist_queries = false,
111 115 keybindings = {
125 129 textobjects = {
126 130 select = {
127 131 enable = true,
132 + disable = should_disable,
128 133 lookahead = true,
129 134 keymaps = {
130 135 ['af'] = { query = '@call.outer', desc = 'outer function call', },
169 174 swap = {
170 175 enable = true,
176 + disable = should_disable,
171 177 swap_next = {
172 - ['<leader>spn'] = { query = '@parameter.inner', desc = 'Swap parameter with next', },
178 + ['<leader>rwn'] = { query = '@parameter.inner', desc = 'Swap parameter with next', },
174 180 swap_previous = {
175 - ['<leader>spp'] = { query = '@parameter.inner', desc = 'Swap parameter with previous', },
181 + ['<leader>rwp'] = { query = '@parameter.inner', desc = 'Swap parameter with previous', },
179 185 lsp_interop = {
180 186 enable = true,
187 + disable = should_disable,
181 188 border = vim.g.border_style,
182 189 floating_preview_opts = {},
183 190 peek_definition_code = {
189 196 move = {
190 197 enable = true,
198 + disable = should_disable,
191 199 set_jumps = true,
192 200 goto_next = {
193 201 [']f'] = { query = '@call.outer', desc = 'Goto next function call', },
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 - }

neovim/lua/bugabinga/plugins/treesj.lua

Modified
1 1 local map = require 'std.map'
3 -return {
4 - 'Wansmer/treesj',
3 +map.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
5 7 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()
21 10 end,
13 +return {
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 + },

neovim/lua/bugabinga/plugins/venn.lua

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

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

Modified
1 1 local ignored = require 'std.ignored'
3 3 return {
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,

neovim/lua/bugabinga/plugins/whichkey.lua

Modified
3 3 local ignored = require 'std.ignored'
4 4 local icon = require 'std.icon'
6 6 return {
7 7 'folke/which-key.nvim',
8 - tag = 'v1.6.0',
8 + version = '1.*',
9 9 event = 'VeryLazy',
10 10 init = function ()
11 11 vim.o.timeout = true
40 40 -- use category as prefix?
41 41 wk.register {
42 42 ['<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',
51 - p = { name = 'parameter', _ = 'which_key_ignore', },
54 + p = { name = '|p|arameter', _ = 'which_key_ignore', },
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',
58 - o = { name = 'options', _ = 'which_key_ignore', },
63 + o = { name = '|o|ptions', _ = 'which_key_ignore', },
61 - z = { name = 'lazy', _ = 'which_key_ignore', },
66 + z = { name = 'la|z|y', _ = 'which_key_ignore', },
62 67 [' '] = { name = 'fun', _ = 'which_key_ignore', },

neovim/lua/bugabinga/plugins/window.lua

Modified
1 1 local map = require 'std.map'
2 +local user_command = require 'std.user_command'
4 +map.normal {
5 + description = 'Open window picker...',
6 + category = 'navigation',
7 + keys = '<c-w>a',
8 + command = function () prequire 'nvim-window'.pick() end,
9 +}
11 +user_command.PickWindow
12 +'Pick a window with a simple char motion' (
13 + function () prequire 'nvim-window'.pick() end
14 + )
3 16 return {
4 17 'yorickpeterse/nvim-window',
5 - cmd = 'PickWindow',
6 - keys = '<c-w>a',
8 18 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', },
38 21 border = vim.g.border_style,
39 22 normal_hl = 'NormalFloat',
40 23 hint_hl = 'Special',
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
1 +local map = require 'std.map'
3 +map.normal {
4 + description = 'Enable zen mode',
5 + category = 'ui',
6 + keys = '<leader>tz',
7 + command = function () require 'zen-mode'.toggle() end,
8 +}
1 10 return {
2 - "folke/zen-mode.nvim",
11 + 'folke/zen-mode.nvim',
3 12 cmd = 'ZenMode',
4 - dependencies = { { 'folke/twilight.nvim', opts = { dimming = { inactive = true } } } },
13 + dependencies = { { 'folke/twilight.nvim', opts = { dimming = { inactive = true, }, }, }, },
5 14 opts = {
6 15 --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', }, },
8 17 window = {
9 18 width = 0.69,
10 19 backdrop = 0.42,
11 20 options = {
12 - signcolumn = "no",
21 + signcolumn = 'no',
13 22 number = false,
14 23 relativenumber = false,
15 24 cursorline = false,
16 25 cursorcolumn = false,
17 - foldcolumn = "0",
26 + foldcolumn = '0',
18 27 list = false,

neovim/lua/bugabinga/save_actions.lua

Added
new file mode 100644
1 +local map = require 'std.map'
2 +local localrc = require 'std.localrc'
3 +local user_command = require 'std.user_command'
5 +local global_actions = vim.g.save_actions or {}
6 +local project_local_actions = localrc( '.save.actions.lua', 'table' ) or {}
7 +local all_actions = vim.tbl_deep_extend( 'force', global_actions, project_local_actions )
9 +local 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]]
22 +end
24 +user_command.SaveActions 'Execute all declared save actions' ( apply_save_actions )
26 +map.normal.visual {
27 + description = 'Save all buffers and apply save actions',
28 + category = 'actions',
29 + keys = '<c-s>',
30 + command = '<cmd>SaveActions<cr>',

neovim/lua/bugabinga/terminal.lua

Added
new file mode 100644
1 +local map = require 'std.map'
2 +local auto = require 'std.auto'
4 +map.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,
17 +local 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()
37 +end
39 +auto 'normalize_terminal_windows' {
40 + description = 'Make terminal windows behave more normally.',
41 + events = 'TermOpen',
42 + pattern = 'term://*',
43 + command = terminal_settings,

neovim/lua/bugabinga/trim.lua

Deleted
deleted file mode 100644
1 --- If invoked as a preview callback, performs 'inccommand' preview by
2 --- highlighting trailing whitespace in the current buffer.
3 -local 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
47 -end
48 --- Trims all trailing whitespace in the current buffer.
49 -local 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)
59 -end
60 --- Create the user command
61 -vim.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
1 -local NuiPopup = require 'nui.popup'
2 -local NuiText = require 'nui.text'
3 -local NuiLine = require 'nui.line'
1 +local NuiPopup = prequire 'nui.popup'
2 +local NuiText = prequire 'nui.text'
3 +local NuiLine = prequire 'nui.line'
5 5 local get_nui_popup = function ()
6 6 local popup = NuiPopup {

neovim/lua/std/auto.lua

Modified
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
3 4 return function ( group_name )
4 5 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.
5 8 return function ( list_of_autocommands )
6 9 if list_of_autocommands.events then
7 10 list_of_autocommands = { list_of_autocommands, }

neovim/lua/std/dbg.lua

Added
new file mode 100644
1 +local user_command = require 'std.user_command'
3 +if vim.g.bugabinga_debug_mode == nil then
4 + vim.g.bugabinga_debug_mode = false
5 +end
7 +local function is_debug_mode()
8 + return vim.g.bugabinga_debug_mode
9 +end
11 +local 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
16 +end
18 +local 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() ) )
21 +end
23 +user_command.Debug 'Toggle global vim config debug mode.' ( toggle_debug_mode )
25 +return {
26 + print = print_debug,
27 + toggle = toggle_debug_mode,
28 + get = is_debug_mode,

neovim/lua/std/debug.lua

Deleted
deleted file mode 100644
1 -if vim.g.bugabinga_debug_mode == nil then
2 - vim.g.bugabinga_debug_mode = false
3 -end
5 -local function is_debug_mode()
6 - return vim.g.bugabinga_debug_mode
7 -end
9 -local 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
14 -end
16 -local 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() ) )
19 -end
21 -vim.api.nvim_create_user_command( 'Debug', toggle_debug_mode, {} )
23 -return {
24 - print = print_debug,
25 - toggle = toggle_debug_mode,
26 - get = is_debug_mode,
27 -}

neovim/lua/std/icon.lua

Modified
4 4 return {
5 5 ['function'] = '󰡱',
6 6 ['local'] = '󱥕',
7 7 ['table'] = '',
8 8 arrow_left = '',
9 9 arrow_right = '',
10 + backspace_key = '',
11 + block = '█',
10 12 branch = '',
11 13 carriage_return = '␍',
12 14 checkbox_mark = '',
13 15 checkbox_unmark = '',
14 - command = '󰘳',
16 + class = '󰆧 ',
15 17 close = '',
16 - block = '█',
18 + color = ' ',
19 + command = '󰘳',
20 + constant = ' ',
21 + constructor = ' ',
22 + copilot = ' ',
17 23 data = '',
18 24 diagnostic = '⊙',
19 25 diff_add = '',
20 26 diff_change = '',
21 27 diff_remove = '',
28 + enum = ' ',
29 + enum_member = ' ',
22 30 eol = '↴',
23 31 error = '󰇷',
32 + esc_key = '󱊷',
33 + event = '',
24 34 exclaim = '',
25 35 extends = '❯',
36 + failed = ' ',
37 + field = ' ',
26 38 file = '',
27 39 folder = '',
28 40 git = '',
29 41 hint = '',
30 42 info = '󰩖',
31 43 insert = '',
44 + interface = ' ',
45 + keyword = '󰌆 ',
32 46 lazy = '󰄻',
47 + leader_key = '󱁐',
33 48 linehighlight = '󰘤',
34 49 linenumber = '󰉻',
35 50 lock = '',
36 51 lsp = '',
37 52 macro = '',
53 + method = '󰊕 ',
54 + middle_ellipsis = '⋯',
38 55 modified = '',
56 + module = ' ',
39 57 nbsp = '␣',
40 58 newline = '␤',
41 59 normal = 'Ν',
60 + operator = '󰆕 ',
61 + passed = ' ',
42 62 pending = '',
43 63 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 = ' ',
44 75 quot_left = '"',
45 76 quot_right = '"',
77 + reference = '󰈇 ',
46 78 replace = '',
79 + return_key = '',
80 + running = ' ',
47 81 select = '󰒉',
82 + slant_left = '▟',
83 + slant_right = '▙',
84 + snippet = ' ',
48 85 space = '·',
86 + space_key = '󱁐',
49 87 spelling = '󰓆',
88 + start = '',
89 + struct = ' ',
50 90 subversion = '󰳗',
51 91 tab = '󰌒',
92 + tab_key = '',
93 + telescope = '🔭',
52 94 terminal = '',
95 + text = ' ',
53 96 thread = '󱇫',
54 97 toggle_off = '',
55 98 toggle_on = '',
56 99 trail = '•',
100 + type_parameter = '󰉿 ',
101 + unit = ' ',
102 + unknown = ' ',
57 103 user = ' ',
104 + value = '󰎠 ',
105 + variable = '󰀫 ',
58 106 vertical_bar = '│',
59 107 vim = '',
60 108 virtual = '󰢔',
61 109 visual = '󰒉',
62 110 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
1 +local _ = {}
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 )
47 +end
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
63 +end
65 +return _

neovim/lua/std/localrc.lua

Added
new file mode 100644
1 +local debug = require 'std.dbg'
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.
9 +return 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
29 +end

neovim/lua/std/map.lua

Modified
1 1 local 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",
32 -local 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 - }
33 +local 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 + })
39 40 local keys = map.keys
40 41 local command = map.command
42 43 map.options = map.options or {}
44 45 if map.category and map.description then
45 - map.description = map.category .. ': ' .. map.description
46 + map.description = map.category .. ": " .. map.description
48 - local options = vim.tbl_extend( 'keep', map.options, {
49 + local options = vim.tbl_extend("keep", map.options, {
49 50 silent = true,
50 51 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)
59 62 else
60 - vim.keymap.set( self.modes, keys, command, options )
63 + vim.keymap.set(self.modes, keys, command, options)
63 66 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)
71 74 else
72 - vim.keymap.del( self.modes, keys, delete_options )
75 + vim.keymap.del(self.modes, keys, delete_options)
77 -local add_mode = function ( self, key )
80 +local add_mode = function(self, key)
78 81 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
80 85 if not self.modes[new_mode] then
81 - table.insert( self.modes, new_mode )
86 + table.insert(self.modes, new_mode)
83 88 return self
86 91 --- @overload fun(map:table): function
87 -local map = setmetatable(
88 - {
89 - modes = {},
90 - },
91 - {
92 - __index = add_mode,
93 - __call = bind,
94 - } )
92 +local map = setmetatable({
93 + modes = {},
94 +}, {
95 + __index = add_mode,
96 + __call = bind,
97 +})
96 99 return map

neovim/lua/std/prequire.lua

Added
new file mode 100644
1 +local dbg = require 'std.dbg'
3 +local 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
11 +end
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()`.
27 +return 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
60 +end

neovim/lua/std/project.lua

Modified
1 -local debug = require 'std.debug'
1 +local debug = require 'std.dbg'
2 2 local table = require 'std.table'
4 4 local join = table.join
12 12 local markers_to_string = function ( markers )
13 13 return vim.inspect( markers )
15 -local create_hash = function ( path, markers )
15 +local create_hash = function ( path, markers, stop )
16 16 local path_hash = hasher( path )
17 + local stop_hash = hasher( stop )
17 18 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
20 -local cache_get = function ( path, markers )
21 - local hash = create_hash( path, markers )
22 +local cache_get = function ( path, markers, stop )
23 + local hash = create_hash( path, markers, stop )
22 24 local hit = cache[hash]
23 25 return hit
25 -local cache_set = function ( project_root, path, markers )
26 - local hash = create_hash( path, markers )
27 +local cache_set = function ( project_root, path, markers, stop )
28 + local hash = create_hash( path, markers, stop )
27 29 cache[hash] = project_root
32 34 --- number of max loop iterations when searching for markers
33 35 local 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
36 38 local MAYBE = 1
37 ---- the weight of a project marker, when the likelyhood is high
38 -local LIKELY = 2
39 ---- the weight of a project marker, when the likelyhood is 100%
40 -local DEFINITLY = 3
39 +--- the weight of a project marker, when the likelihood is high
40 +local LIKELY = 3
41 +--- the weight of a project marker, when the likelihood is 100%
42 +local DEFINITELY = 7
42 44 --- Determines the path to a root directory, starting from the given path.
43 45 -- Markers have a name and weight.
49 51 -- Assuming you want to determine the root of your current buffer, that is part
50 52 -- of some project.
51 53 -- 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`
55 56 -- ```lua
56 --- local project = require'std.project'
57 +-- local project = require 'std.project'
57 58 -- local current_buffer = vim.api.nvim_buf_get_name(0)
58 59 -- 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 },
63 64 -- local root = project.find_root(current_buffer, markers, vim.uv.os_homedir())
64 65 -- print(root) -- /home/user/workspace/some_project
86 87 if #path == 0 then return nil end
88 - local cache_hit = cache_get( path, markers )
89 + local cache_hit = cache_get( path, markers, stop )
89 90 if cache_hit then
90 91 debug.print( 'CACHE HIT', cache_hit )
91 92 return cache_hit
135 136 local project_root = nil
136 137 local max_likelyhood = 0
137 138 -- 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).
141 142 -- in those cases we are looking for the root project folder, instead the nearest
142 143 -- child project root folder.
143 144 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
147 149 project_root = score.path
150 152 if project_root then
151 - cache_set( project_root, path, markers )
153 + cache_set( project_root, path, markers, stop )
155 + debug.print( 'found project root', project_root, directory_scores )
153 156 return project_root
162 165 local function find_project_root( path, markers )
163 166 -- define some language-independent markers
164 167 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, },
183 188 markers = markers or {}
196 201 { name = '.project', weight = LIKELY, },
197 202 { name = 'target', weight = LIKELY, },
198 203 { 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, },
208 - return find_root( path, java_markers )
213 + return find_project_root( path, java_markers )
211 -local 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, },
223 216 local 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, },
229 + return find_project_root( path, lua_markers )
227 -local 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, },
234 232 local 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, },
240 + --FIXME: can we ask the zig build system for this info?
241 + return find_project_root( path, zig_markers )
238 244 local find_rust_project_root = function ( path )
239 245 local markers = {
240 - { name = 'Cargo.toml', weight = DEFINITLY, },
246 + { name = 'Cargo.toml', weight = DEFINITELY, },
242 - local cargo_crate_dir = find_root( path, markers )
248 + local cargo_crate_dir = find_project_root( path, markers )
243 249 if cargo_crate_dir == nil then return nil end
245 251 local cmd = {

neovim/lua/std/user_command.lua

Added
new file mode 100644
1 +--- Creates a new user command
2 +--- @param user_command table Necessary data to create a new user command.
3 +local 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 + )
11 +end
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.
18 +local 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
23 +end
25 +--- meta table, that sets the function value, when called, to a field named `command`
26 +local COMMAND_SETTER = {
27 + __call = function ( self, command )
28 + vim.validate { command = { command, 'function', }, }
29 + return set_command( self, command )
30 + end,
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.
35 +local 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,
46 +--- meta table, that sets the string value to a field named `description`, when called.
47 +local 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,
55 +--- meta table, that sets the string value to a field named `name`, when indexed into.
56 +local 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,
64 +--TODO: think about how to create buffer commands
66 +return setmetatable( {}, COMMAND_NAME_SETTER )

neovim/neovim.yml

Deleted
deleted file mode 100644
1 ----
2 -base: lua51
3 -name: neovim
4 -globals:
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
1 -return {
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 1 Enums
2 2 Skripte
3 +startuptime

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

Modified

Previous version contains binary or non-UTF-8 data.

Current version contains binary or non-UTF-8 data.

neovim/spell/en.utf-8.add

Added
new file mode 100644

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

Modified

Previous version contains binary or non-UTF-8 data.

Current version contains binary or non-UTF-8 data.

neovim/spell/nerd.utf-8.add

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

neovim/spell/pl.utf-8.add

Added
new file mode 100644

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

Added
new file mode 100644

Current version contains binary or non-UTF-8 data.

nushell/modules/aliases.nu

Modified
1 1 # Semantic aliases
2 2 export alias show = bat
3 3 export def list [] { ls --all --long --du --mime-type | where type == dir | append (ls --all --long --du --mime-type | where type != dir) }
4 -export alias web = firefox
4 +export alias walk = yazi
5 +export alias browse = firefox
5 6 export alias code = nvim
6 7 export alias edit = nvim --clean
7 8 # TODO ewrite bak command
10 11 # https://gist.github.com/mullnerz/9fff80593d6b442d5c1b
11 12 export alias archive = wget -mpck --html-extension --user-agent="" -e robots=off --wait 1 -P .
14 +# FIXME: README preview does not work (in WSL2)
13 15 def --env workspace [] {
14 16 fd --type directory --max-depth 1 . $env.WORKSPACE | fzf --ansi --preview 'mdcat {}README.md' --preview-window 'up:69%,border-bottom' | cd $in
16 18 export alias w = workspace
18 -export def --env lk [] {
19 - cd (walk --icons)
20 -}
22 20 def open-editor-with-content-search [ initial_query:string = ''] {
23 21 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 }