repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: simpler tabline. cooler winbar.

3d7b4722554b4d0b540ac72c44f4023803c7bfad

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (13)

env.nu

Added
new 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 + }
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 + }
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')
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 ) )

lua/bugabinga/plugins/heirline.lua

Added
new 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 + },
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',
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,
128 + provider = function ( self )
129 + return self.lfilename
130 + end,
131 + },
133 + provider = function ( self )
134 + return vim.fs.normalize( vim.fn.pathshorten( self.lfilename ) )
135 + end,
136 + },
139 + local file_flags = {
141 + condition = function ()
142 + return vim.bo.modified
143 + end,
144 + provider = string.format( ' %s ', icon.modified ),
145 + hl = 'Comment',
146 + },
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 + },
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
168 + local file_type = {
169 + provider = function ()
170 + return icon.file .. ' ' .. string.upper( vim.bo.filetype )
171 + end,
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,
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,
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,
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,
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,
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,
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', },
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 + },
269 + provider = function ( self )
270 + return self.warnings > 0 and (self.warn_icon .. ' ' .. self.warnings .. ' ')
271 + end,
272 + hl = 'DiagnosticWarn',
273 + },
275 + provider = function ( self )
276 + return self.info > 0 and (self.info_icon .. ' ' .. self.info .. ' ')
277 + end,
278 + hl = 'DiagnosticInfo',
279 + },
281 + provider = function ( self )
282 + return self.hints > 0 and (self.hint_icon .. ' ' .. self.hints)
283 + end,
284 + hl = 'DiagnosticHint',
285 + },
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,
325 + provider = function ( self )
326 + return icon.subversion .. ' ' .. icon.branch .. ' ' .. self.relative_url
327 + end,
328 + },
332 + local git = {
333 + condition = conditions.is_git_repo,
335 + init = function ( self )
336 + self.status_dict = vim.b.gitsigns_status_dict
337 + end,
340 + provider = function ( self )
341 + return icon.git .. ' ' .. icon.branch .. ' ' .. self.status_dict.head .. ' '
342 + end,
343 + },
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 + },
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 + },
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 + },
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,
376 + provider = function ( self )
377 + return self.icon .. self.cwd
378 + end,
379 + },
381 + provider = function ( self )
382 + local cwd = vim.fn.pathshorten( self.cwd )
383 + return self.icon .. cwd
384 + end,
385 + },
387 + provider = '',
388 + },
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',
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',
411 + local togglers = {
412 + provider = function ()
413 + local togglers = require 'bugabinga.options.togglers'
414 + return tostring( togglers )
415 + end,
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 + },
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 + },
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,
460 + local special_statusline = {
461 + condition = function ()
462 + return conditions.buffer_matches {
463 + buftype = ignored.buftypes,
464 + filetype = ignored.filetypes,
466 + end,
468 + file_type,
469 + space,
470 + help_file_name,
471 + align,
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,
487 + local inactive_statusline = {
488 + condition = conditions.is_not_active,
489 + file_type,
490 + space,
491 + file_name,
492 + align,
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,
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,
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,
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,
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,
559 + local tabline_file_flags = {
561 + condition = function ( self ) return vim.api.nvim_get_option_value( 'modified', { buf = self.bufnr, } ) end,
562 + provider = icon.modified .. ' ',
563 + },
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',
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,
617 + local tabline_buffer_block = utils.surround(
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, }
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', }
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,
651 + local tab_pages = {
652 + { provider = '%=', },
653 + utils.make_tablist( tabpage ),
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(
671 + buftype = ignored.buftypes,
672 + filetype = ignored.filetypes,
673 + },
674 + args.buf )
675 + end,
676 + },
678 + end,
679 + },

neovim/init.lua

Modified
9 9 -- ▀ ▀
11 11 -- setup debug mode
12 --- require 'std.debug'.toggle()
12 +require 'std.debug'.toggle()
14 14 local ok, loaded

neovim/lazy-lock.json

Modified
5 5 "better-escape.nvim": { "branch": "master", "commit": "7e86edafb8c7e73699e0320f225464a298b96d12" },
6 6 "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
7 7 "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
8 + "fidget.nvim": { "branch": "main", "commit": "4e854f3299e21d1c18279add340428a97520fc44" },
8 9 "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
9 - "gen.nvim": { "branch": "main", "commit": "9682435008677a329f8b1f1cd812903fd2b9d6f4" },
10 + "gen.nvim": { "branch": "main", "commit": "2cb643b1a827bcdfc665a37d5f8174249d2d5bf5" },
10 11 "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
11 12 "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
12 13 "heirline.nvim": { "branch": "master", "commit": "03cff30d7e7d3ba6fdc00925f015822f79cef908" },
31 32 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
32 33 "nvim-jdtls": { "branch": "master", "commit": "a4746791876166dc146eae573a1b49d24a6652e7" },
33 34 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
35 + "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" },
36 + "nvim-navbuddy": { "branch": "master", "commit": "f137a3466a6cd1965cdcc5398daff54e66eebbe5" },
37 + "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
34 38 "nvim-neoclip.lua": { "branch": "main", "commit": "798cd0592a81c185465db3a091a0ff8a21af60fd" },
35 39 "nvim-spectre": { "branch": "master", "commit": "e7db8ebca7fd0a604027ebf85acee52f6642c91c" },
36 40 "nvim-surround": { "branch": "main", "commit": "84a26afce16cffa7e3322cfa80a42cddf60616eb" },
37 - "nvim-tree.lua": { "branch": "master", "commit": "041dbd18f440207ad161503a384e7c82d575db66" },
41 + "nvim-tree.lua": { "branch": "master", "commit": "d35a8d5ec6358ada4b058431b367b32360737466" },
38 42 "nvim-treesitter": { "branch": "master", "commit": "f197a15b0d1e8d555263af20add51450e5aaa1f0" },
39 43 "nvim-treesitter-textobjects": { "branch": "master", "commit": "d2a4ffc22d9d38d44edb73da007b3cf43451e9b4" },
40 44 "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
45 49 "persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" },
46 50 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
47 51 "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
48 - "schemastore.nvim": { "branch": "main", "commit": "7a4bac1aa44c50979432b71f34f237bad3a0a232" },
52 + "schemastore.nvim": { "branch": "main", "commit": "e97df1d0c525360b392904a0ff8ba8cbb9b8c0e6" },
49 53 "specs.nvim": { "branch": "main", "commit": "e929006d3f6bb8e43f03e13ac364c67236eb5299" },
50 54 "speedtyper.nvim": { "branch": "main", "commit": "2d158eed4c753995b0501a3a7a72464fbb213e3d" },
51 55 "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
52 56 "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
53 - "symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" },
54 57 "telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
55 58 "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
56 59 "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" },
57 60 "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
58 61 "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" },
59 62 "toggleterm.nvim": { "branch": "main", "commit": "193786e0371e3286d3bc9aa0079da1cd41beaa62" },
60 - "transparent.nvim": { "branch": "main", "commit": "fd35a46f4b7c1b244249266bdcb2da3814f01724" },
61 63 "tree-sitter-nu": { "branch": "main", "commit": "c5b7816043992b1cdc1462a889bc74dc08576fa6" },
62 64 "treesj": { "branch": "main", "commit": "60e27280030f9cd8dfb6ceb335922c6ff76682cc" },
63 65 "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },

neovim/lua/bugabinga/lsp/init.lua

Modified
38 38 local expand_command = function ( command )
39 - vim.validate { command = { command, { 'string', 'table' } } }
39 + vim.validate { command = { command, { 'string', 'table', }, }, }
41 41 if type( command ) == 'table' then
42 42 command[1] = expand_path( command[1] )
55 55 if vim.iter( ignored.filetypes ):find( match ) then return end
57 57 local bufnr = file_type_event.buf
58 - local buftype = vim.api.nvim_get_option_value( 'buftype', { buf = bufnr } )
58 + local buftype = vim.api.nvim_get_option_value( 'buftype', { buf = bufnr, } )
59 59 debug.print( 'buftypes to ignore', ignored.buftypes, 'current buftype', buftype )
60 60 if vim.iter( ignored.buftypes ):find( buftype ) then return end
66 66 local potential_client_configs = vim.iter( lsp_client_configs )
67 67 :map( function ( config )
68 68 vim.validate {
69 - ['config'] = { config, 'table' },
70 - ['config.name'] = { config.name, 'string' },
71 - ['config.filetypes'] = { config.filetypes, { 'string', 'table' } },
72 - ['config.command'] = { config.command, { 'string', 'table' } },
73 - ['config.environment'] = { config.environment, 'table', true },
74 - ['config.root_dir'] = { config.root_dir, 'function', 'string' },
75 - ['config.single_file_support'] = { config.single_file_support, 'boolean', true },
76 - ['config.settings'] = { config.settings, 'table', true },
77 - ['config.workspaces'] = { config.workspaces, 'boolean', true },
78 - ['config.before_init'] = { config.before_init, 'function', true },
79 - ['config.init_options'] = { config.init_options, 'table', true },
80 - ['config.capabilities'] = { config.capabilities, 'table', true },
81 - ['config.custom_start'] = { config.custom_start, 'function', true },
69 + ['config'] = { config, 'table', },
70 + ['config.name'] = { config.name, 'string', },
71 + ['config.filetypes'] = { config.filetypes, { 'string', 'table', }, },
72 + ['config.command'] = { config.command, { 'string', 'table', }, },
73 + ['config.environment'] = { config.environment, 'table', true, },
74 + ['config.root_dir'] = { config.root_dir, 'function', 'string', },
75 + ['config.single_file_support'] = { config.single_file_support, 'boolean', true, },
76 + ['config.settings'] = { config.settings, 'table', true, },
77 + ['config.workspaces'] = { config.workspaces, 'boolean', true, },
78 + ['config.before_init'] = { config.before_init, 'function', true, },
79 + ['config.init_options'] = { config.init_options, 'table', true, },
80 + ['config.capabilities'] = { config.capabilities, 'table', true, },
81 + ['config.custom_start'] = { config.custom_start, 'function', true, },
83 83 -- normalize scalar values to its vector alternative for easier processing later on
84 84 -- this mutates the lsp client configs! careful!
85 - config.command = type( config.command ) == 'string' and { expand_command( config.command ) } or
85 + config.command = type( config.command ) == 'string' and { expand_command( config.command ), } or
86 86 expand_command( config.command )
87 87 config.environment = config.environment or {}
88 - config.filetypes = type( config.filetypes ) == 'string' and { config.filetypes } or config.filetypes
88 + config.filetypes = type( config.filetypes ) == 'string' and { config.filetypes, } or config.filetypes
89 89 config.single_file_support = config.single_file_support == nil and false or config.single_file_support
90 90 config.workspaces = config.workspaces == nil and false or config.workspaces
91 91 config.capabilities = config.capabilities or {}
103 103 return {
104 104 name = config.name,
105 105 command =
106 - config.command
106 + config.command,
109 109 :totable() )
145 145 on_exit = function ( code, signal, client_id ) vim.print( 'LSP CLIENT EXIT', code, signal, client_id ) end,
146 146 on_attach = function ( client, bufnr ) debug.print( 'LSP CLIENT ATTACH', client, bufnr ) end,
147 147 trace = 'off',
148 - flags = { allow_incremental_sync = true, debounce_text_changes = 250, exit_timeout = 200 },
148 + flags = { allow_incremental_sync = true, debounce_text_changes = 250, exit_timeout = 200, },
149 149 root_dir = root_dir,
188 - debug.print( 'ATTACHING LSP CLIENT', client_id )
188 + debug.print( 'ATTACHING LSP CLIENT', config.name )
223 223 vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
226 + if client.server_capabilities.documentSymbolProvider then
227 + local ok, navic = pcall( require, 'nvim-navic' )
228 + if ok then
229 + vim.notify 'navic ready'
230 + navic.attach( client, bufnr )
231 + else
232 + vim.notify 'nvim-navic not found. could not attach to lsp client.'
233 + end
234 + local ok, navbuddy = pcall( require, 'nvim-navbuddy' )
235 + if ok then
236 + vim.notify 'navbuddy ready'
237 + navbuddy.attach( client, bufnr )
238 + else
239 + vim.notify 'nvim-navbuddy not found. could not attach to lsp client.'
240 + end
241 + end
226 243 if client.server_capabilities.documentHighlightProvider then
227 244 -- the timer has application lifetime. no need to close
228 245 local delay = 300
240 257 description = 'Remove highlight from symbol under cursor on move',
241 - events = { 'CursorMoved', 'InsertEnter' },
258 + events = { 'CursorMoved', 'InsertEnter', },
242 259 buffer = bufnr,
243 260 command = debounced_clear,
244 - }
261 + },
261 278 description = 'Show hover documentation above cursor.',
262 279 category = 'lsp',
263 280 buffer = bufnr,
264 - keys = { 'K', '<leader>lk' },
281 + keys = { 'K', '<leader>lk', },
265 282 command = vim.lsp.buf.hover,
325 342 description = 'Rename symbol under cursor.',
326 343 category = 'lsp',
327 344 buffer = bufnr,
328 - keys = { '<f2>', '<leader>ln' },
345 + keys = { '<f2>', '<leader>ln', },
329 346 command = vim.lsp.buf.rename,
377 394 description = 'Semantic Tokens from the LSP',
378 395 events = 'LspTokenUpdate',
379 396 command = token_update,
380 - }
397 + },
383 400 local lsp_info = function ( command )
384 - local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0 }
401 + local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0, }
385 402 local active_clients = vim.lsp.get_clients( all_or_current )
387 404 local infos = vim.iter( active_clients )
412 429 local lsp_info_extended = function ( command )
413 - local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0 }
430 + local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0, }
414 431 local active_clients = vim.lsp.get_clients( all_or_current )
415 432 ui.show_tree( active_clients )
418 435 user_command( 'LspInfo', lsp_info, {
419 436 nargs = '?',
420 - complete = function () return { 'all' } end,
437 + complete = function () return { 'all', } end,
421 438 desc = 'Shows basic information about running LSP clients.',
424 441 user_command( 'LspInfoExtended', lsp_info_extended, {
425 442 nargs = '?',
426 - complete = function () return { 'all' } end,
443 + complete = function () return { 'all', } end,
427 444 desc = 'Shows detailed information about running LSP clients.',

neovim/lua/bugabinga/plugins/heirline.lua

Modified
193 - local file_size = {
193 + local file_size = {
194 194 provider = function ()
195 195 -- stackoverflow, compute human readable file size
196 196 -- i want to see vim opening a 1EiB file 󰱯
208 - local file_last_modified = {
208 + local file_last_modified = {
209 209 provider = function ()
210 210 local ftime = vim.fn.getftime( vim.api.nvim_buf_get_name( 0 ) )
211 211 if ftime > 0 then
218 - local lsp_active = {
218 + local lsp_active = {
219 219 condition = conditions.lsp_attached,
220 - update = { 'LspAttach', 'LspDetach', 'BufEnter', },
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', },
222 224 provider = function ()
223 225 local names = {}
231 - local diagnostic_enabled = {
233 + local navic = {
234 + condition = function () return require 'nvim-navic'.is_available() end,
235 + static = {
236 + -- create a type highlight map
237 + type_hl = {
238 + File = 'Directory',
239 + Module = '@include',
240 + Namespace = '@namespace',
241 + Package = '@include',
242 + Class = '@structure',
243 + Method = '@method',
244 + Property = '@property',
245 + Field = '@field',
246 + Constructor = '@constructor',
247 + Enum = '@field',
248 + Interface = '@type',
249 + Function = '@function',
250 + Variable = '@variable',
251 + Constant = '@constant',
252 + String = '@string',
253 + Number = '@number',
254 + Boolean = '@boolean',
255 + Array = '@field',
256 + Object = '@type',
257 + Key = '@keyword',
258 + Null = '@comment',
259 + EnumMember = '@field',
260 + Struct = '@structure',
261 + Event = '@keyword',
262 + Operator = '@operator',
263 + TypeParameter = '@type',
264 + },
265 + -- bit operation dark magic, see below...
266 + enc = function ( line, col, winnr )
267 + return bit.bor( bit.lshift( line, 16 ), bit.lshift( col, 6 ), winnr )
268 + end,
269 + -- line: 16 bit (65535); col: 10 bit (1023); winnr: 6 bit (63)
270 + dec = function ( c )
271 + local line = bit.rshift( c, 16 )
272 + local col = bit.band( bit.rshift( c, 6 ), 1023 )
273 + local winnr = bit.band( c, 63 )
274 + return line, col, winnr
275 + end,
276 + },
277 + init = function ( self )
278 + local data = require 'nvim-navic'.get_data() or {}
279 + local children = {}
280 + -- create a child for each level
281 + for i, d in ipairs( data ) do
282 + -- encode line and column numbers into a single integer
283 + local pos = self.enc( d.scope.start.line, d.scope.start.character, self.winnr )
284 + local child = {
286 + provider = d.icon,
287 + hl = self.type_hl[d.type],
288 + },
290 + -- escape `%`s (elixir) and buggy default separators
291 + provider = d.name:gsub( '%%', '%%%%' ):gsub( '%s*->%s*', '' ),
292 + -- highlight icon only or location name as well
293 + hl = self.type_hl[d.type],
295 + on_click = {
296 + -- pass the encoded position through minwid
297 + minwid = pos,
298 + callback = function ( _, minwid )
299 + -- decode
300 + local line, col, winnr = self.dec( minwid )
301 + vim.api.nvim_win_set_cursor( vim.fn.win_getid( winnr ), { line, col, } )
302 + end,
303 + name = 'heirline_navic',
304 + },
305 + },
307 + -- add a separator only if needed
308 + if #data > 1 and i < #data then
309 + table.insert( child, {
310 + provider = ' > ',
311 + -- hl = { fg = 'bright_fg', },
312 + } )
313 + end
314 + table.insert( children, child )
315 + end
316 + -- instantiate the new child, overwriting the previous one
317 + self.child = self:new( children, 1 )
318 + end,
319 + -- evaluate the children containing navic components
320 + provider = function ( self )
321 + return self.child:eval()
322 + end,
323 + -- hl = { fg = 'gray', },
324 + update = 'CursorMoved',
327 + local diagnostic_enabled = {
232 328 init = function ( self )
233 329 self.icon = vim.diagnostic.is_disabled() and icon.toggle_off or icon.toggle_on
240 - local diagnostic = {
336 + local diagnostic = {
241 337 condition = conditions.has_diagnostics,
243 339 static = {
254 350 self.info = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.INFO, } )
257 - update = { 'DiagnosticChanged', 'BufEnter', },
353 + update = { 'DiagnosticChanged', 'BufEnter', 'BufLeave', },
260 356 provider = function ( self )
286 - local is_svn_repo = function ()
382 + local is_svn_repo = function ()
287 383 local svn_dir = vim.fs.find( '.svn', {
288 384 upward = true,
289 385 stop = vim.uv.os_homedir(),
294 390 return not vim.tbl_isempty( svn_dir )
297 - local svn_get_relative_url = function ()
393 + local svn_get_relative_url = function ()
298 394 -- FIXME: replace with vim.system
299 395 local job = require 'plenary.job'
300 396 local relative_url = { '[ERR]', }
310 406 return relative_url[1]
313 - local svn = {
409 + local svn = {
314 410 condition = is_svn_repo,
316 412 update = 'BufEnter',
330 - local git = {
426 + local git = {
331 427 condition = conditions.is_git_repo,
333 429 init = function ( self )
365 - local work_dir = {
461 + local work_dir = {
366 462 init = function ( self )
367 463 self.icon = (vim.fn.haslocaldir( 0 ) == 1 and icon['local'] or '') .. ' ' .. icon.global .. ' '
368 464 self.cwd = vim.fs.normalize( vim.uv.cwd() ):gsub( vim.fs.normalize( vim.uv.os_homedir() ), '~' )
389 - local help_file_name = {
485 + local help_file_name = {
390 486 condition = function ()
391 487 return vim.bo.filetype == 'help'
397 493 hl = 'Question',
400 - local terminal_name = {
496 + local terminal_name = {
401 497 provider = function ()
402 498 local name, _ = vim.api.nvim_buf_get_name( 0 ):gsub( '.*:', '' )
403 499 local basename = vim.fs.basename( name )
406 502 hl = 'Bold',
409 - local togglers = {
505 + local togglers = {
410 506 provider = function ()
411 507 local togglers = require 'bugabinga.options.togglers'
412 508 return tostring( togglers )
416 - local macro_recording = {
512 + local macro_recording = {
417 513 condition = function ()
418 514 return vim.fn.reg_recording() ~= '' and vim.o.cmdheight == 0
434 - local lazy = {
530 + local lazy = {
435 531 condition = function ()
436 532 local ok, lazy_status = pcall( require, 'lazy.status' )
437 533 return ok and lazy_status.has_updates()
447 - local align = { provider = '%=', }
448 - local space = { provider = ' ', }
543 + local align = { provider = '%=', }
544 + local space = { provider = ' ', }
450 - local default_statusline = {
451 - vi_mode, macro_recording, align,
452 - work_dir, space, git, svn, align,
453 - diagnostic_enabled, space, diagnostic, space, lsp_active, align,
454 - togglers, align,
455 - lazy, space, file_encoding, space, file_format, space, file_type, space, file_size, space, file_last_modified,
546 + local default_statusline = {
547 + vi_mode, macro_recording, work_dir, space, git, svn, align,
548 + diagnostic, space, lsp_active, align,
549 + togglers, space, space, diagnostic_enabled, space, lazy, space,
550 + file_encoding, space, file_format, space, file_type, space, file_size, space, file_last_modified,
458 - local special_statusline = {
553 + local special_statusline = {
459 554 condition = function ()
460 555 return conditions.buffer_matches {
461 556 buftype = ignored.buftypes,
469 564 align,
472 - local terminal_statusline = {
567 + local terminal_statusline = {
474 569 condition = function ()
475 570 return conditions.buffer_matches { buftype = { 'terminal', }, }
482 577 align,
485 - local inactive_statusline = {
580 + local inactive_statusline = {
486 581 condition = conditions.is_not_active,
487 582 file_type,
488 583 space,
490 585 align,
493 - local statuslines = {
588 + local statuslines = {
494 589 hl = function ()
495 590 if conditions.is_active() then
496 591 return 'StatusLine'
507 602 default_statusline,
510 - local winbars = {
605 + local winbars = {
511 606 hl = function ()
512 607 if conditions.is_active() then
513 608 return 'Winbar'
528 623 terminal_name,
531 - file_name_block,
532 - }
534 - local tabline_buffer_number = {
535 - provider = function ( self )
536 - return '(' .. tostring( self.bufnr ) .. ')'
537 - end,
538 - hl = function ( self )
539 - if self.is_active then
540 - return { fg = utils.get_highlight 'TabLineSel'.fg, }
541 - elseif not vim.api.nvim_buf_is_loaded( self.bufnr ) then
542 - return { fg = 'ui_normal', }
543 - else
544 - return { fg = utils.get_highlight 'TabLine'.fg, }
545 - end
546 - end,
547 - }
549 - local tabline_file_name = {
550 - provider = function ( self )
551 - local name = self.file_name
552 - return name == '' and NEW_FILE or vim.fs.normalize( vim.fn.fnamemodify( name, ':t' ) )
553 - end,
554 - hl = function ( self ) return { bold = self.is_active or self.is_visible, italic = true, } end,
555 - }
557 - local tabline_file_flags = {
559 - condition = function ( self ) return vim.api.nvim_get_option_value( 'modified', { buf = self.bufnr, } ) end,
560 - provider = icon.modified .. ' ',
627 + file_name_block,
628 + space,
629 + navic,
562 - {
563 - condition = function ( self )
564 - return not vim.api.nvim_get_option_value( 'modifiable', { buf = self.bufnr, } ) or
565 - vim.api.nvim_get_option_value( 'readonly', { buf = self.bufnr, } )
566 - end,
567 - provider = function ( self )
568 - if vim.api.nvim_get_option_value( 'buftype', { buf = self.bufnr, } ) == 'terminal' then
569 - return icon.terminal
570 - else
571 - return icon.lock
572 - end
573 - end,
574 - },
575 - hl = 'Bold',
578 - local tabline_file_name_block = {
579 - init = function ( self )
580 - self.file_name = vim.api.nvim_buf_get_name( self.bufnr )
581 - end,
633 + -- local tabline_buffer_number = {
634 + -- provider = function ( self )
635 + -- return '(' .. tostring( self.bufnr ) .. ')'
636 + -- end,
637 + -- hl = function ( self )
638 + -- if self.is_active then
639 + -- return { fg = utils.get_highlight 'TabLineSel'.fg, }
640 + -- elseif not vim.api.nvim_buf_is_loaded( self.bufnr ) then
641 + -- return { fg = utils.get_highlight 'StatusLineNc'.fg, }
642 + -- else
643 + -- return { fg = utils.get_highlight 'TabLine'.fg, }
644 + -- end
645 + -- end,
646 + -- }
583 - hl = function ( self )
584 - if self.is_active then
585 - return 'TabLineSel'
586 - elseif not vim.api.nvim_buf_is_loaded( self.bufnr ) then
587 - return { fg = 'ui_normal', }
588 - else
589 - return 'TabLine'
590 - end
591 - end,
648 + -- local tabline_file_name = {
649 + -- provider = function ( self )
650 + -- local name = self.file_name
651 + -- return name == '' and NEW_FILE or vim.fs.normalize( vim.fn.fnamemodify( name, ':t' ) )
652 + -- end,
653 + -- hl = function ( self ) return { bold = self.is_active or self.is_visible, italic = true, } end,
654 + -- }
593 - on_click = {
594 - callback = function ( _, minwid, _, button )
595 - if button == 'm' then --m = middle click
596 - vim.schedule( function ()
597 - vim.api.nvim_buf_delete( minwid, { force = false, } )
598 - vim.cmd.redrawtabline()
599 - end )
600 - else
601 - vim.api.nvim_win_set_buf( 0, minwid )
602 - end
603 - end,
604 - minwid = function ( self ) return self.bufnr end,
605 - name = 'heirline_tabline_buffer_callback',
606 - },
656 + -- local tabline_file_flags = {
657 + -- {
658 + -- condition = function ( self ) return vim.api.nvim_get_option_value( 'modified', { buf = self.bufnr, } ) end,
659 + -- provider = icon.modified .. ' ',
660 + -- },
661 + -- {
662 + -- condition = function ( self )
663 + -- return not vim.api.nvim_get_option_value( 'modifiable', { buf = self.bufnr, } ) or
664 + -- vim.api.nvim_get_option_value( 'readonly', { buf = self.bufnr, } )
665 + -- end,
666 + -- provider = function ( self )
667 + -- if vim.api.nvim_get_option_value( 'buftype', { buf = self.bufnr, } ) == 'terminal' then
668 + -- return icon.terminal
669 + -- else
670 + -- return icon.lock
671 + -- end
672 + -- end,
673 + -- },
674 + -- hl = 'Bold',
675 + -- }
608 - file_icon,
609 - { provider = ' ', },
610 - tabline_file_name,
611 - tabline_buffer_number,
612 - tabline_file_flags,
613 - }
677 + -- local tabline_file_name_block = {
678 + -- init = function ( self )
679 + -- self.file_name = vim.api.nvim_buf_get_name( self.bufnr )
680 + -- end,
681 + --
682 + -- hl = function ( self )
683 + -- if self.is_active then
684 + -- return 'TabLineSel'
685 + -- elseif not vim.api.nvim_buf_is_loaded( self.bufnr ) then
686 + -- return { fg = utils.get_highlight 'StatusLineNc'.fg, }
687 + -- else
688 + -- return 'TabLine'
689 + -- end
690 + -- end,
691 + --
692 + -- on_click = {
693 + -- callback = function ( _, minwid, _, button )
694 + -- if button == 'm' then --m = middle click
695 + -- vim.schedule( function ()
696 + -- vim.api.nvim_buf_delete( minwid, { force = false, } )
697 + -- vim.cmd.redrawtabline()
698 + -- end )
699 + -- else
700 + -- vim.api.nvim_win_set_buf( 0, minwid )
701 + -- end
702 + -- end,
703 + -- minwid = function ( self ) return self.bufnr end,
704 + -- name = 'heirline_tabline_buffer_callback',
705 + -- },
706 + --
707 + -- file_icon,
708 + -- { provider = ' ', },
709 + -- tabline_file_name,
710 + -- tabline_buffer_number,
711 + -- tabline_file_flags,
712 + -- }
615 - local tabline_buffer_block = utils.surround(
616 - {
617 - ' ' .. icon.slant_left,
618 - icon.slant_right .. ' ',
619 - },
620 - function ( self )
621 - if self.is_active then
622 - return utils.get_highlight 'TabLineSel'.bg
623 - else
624 - return utils.get_highlight 'TabLine'.bg
625 - end
626 - end,
627 - { tabline_file_name_block, }
628 - )
714 + -- local tabline_buffer_block = utils.surround(
715 + -- {
716 + -- ' ' .. icon.slant_left,
717 + -- icon.slant_right .. ' ',
718 + -- },
719 + -- function ( self )
720 + -- if self.is_active then
721 + -- return utils.get_highlight 'TabLine'.bg
722 + -- else
723 + -- return utils.get_highlight 'TabLineFill'.bg
724 + -- end
725 + -- end,
726 + -- { tabline_file_name_block, }
727 + -- )
630 - local buffer_line = utils.make_buflist(
631 - tabline_buffer_block,
632 - { provider = icon.arrow_left .. ' ', hl = 'TabLineFill', },
633 - { provider = ' ' .. icon.arrow_right, hl = 'TabLineFill', }
634 - )
729 + -- local buffer_line = utils.make_buflist(
730 + -- tabline_buffer_block,
731 + -- { provider = icon.arrow_left .. ' ', hl = 'TabLine', },
732 + -- { provider = ' ' .. icon.arrow_right, hl = 'TabLine', }
733 + -- )
636 - local tabpage = {
735 + local tabpage = {
637 736 provider = function ( self )
638 737 return '%' .. self.tabnr .. 'T ' .. self.tabpage .. ' %T'
640 739 hl = function ( self )
641 - if not self.is_active then
642 - return 'TabLine'
643 - else
740 + if self.is_active then
644 741 return 'TabLineSel'
742 + else
743 + return 'TabLine'
649 - local tab_pages = {
748 + local tab_pages = {
650 749 { provider = '%=', },
651 750 utils.make_tablist( tabpage ),
654 - local tabline = { buffer_line, tab_pages, }
753 + -- local tabline = { buffer_line, tab_pages, }
656 755 -- local statuscolumn = {}
658 757 heirline.setup {
659 758 statusline = statuslines,
660 759 winbar = winbars,
661 - tabline = tabline,
760 + tabline = tab_pages,
761 + -- tabline = tabline,
662 762 -- statuscolumn = statuscolumn,
664 764 opts = {

neovim/lua/bugabinga/plugins/hlargs.lua

Modified
1 1 return {
2 2 'm-demare/hlargs.nvim',
3 - event = 'BufRead',
3 + event = { 'BufRead', 'BufLeave', 'BufEnter', 'SessionLoadPost', },
4 4 opts = {
5 5 -- highlight = { 'Hlargs', },
6 6 paint_arg_declarations = true,

neovim/lua/bugabinga/plugins/navic.lua

Added
new file mode 100644
1 +return {
2 + 'SmiteshP/nvim-navic',
3 + opts = {
5 + }
6 +}

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

Modified
1 1 return {
2 - 'simrat39/symbols-outline.nvim',
3 - cmd = 'SymbolsOutline',
4 - opts = {},
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 + },

neovim/lua/bugabinga/plugins/tree.lua

Modified
2 2 local map = require 'std.map'
4 4 return {
5 5 'nvim-tree/nvim-tree.lua',
6 + version = 'v1.0',
7 + lazy = false,
6 8 cmd = 'NvimTreeOpen',
7 9 keys = '<leader>e',
10 + dependencies = {
11 + 'nvim-tree/nvim-web-devicons',
12 + 'antosha417/nvim-lsp-file-operations',
13 + },
8 14 init = function ()
9 15 -- disable netrw at the very start of your init.lua
10 16 vim.g.loaded_netrw = 1
25 31 dotfiles = false,
34 + require 'lsp-file-operations'.setup()
29 36 map.normal {
30 37 description = 'Toggle Tree File Explorer',

neovim/lua/std/debug.lua

Modified
6 6 return vim.g.bugabinga_debug_mode
9 -local function print_debug( ... )
9 +local function print_debug( message, ... )
10 10 if is_debug_mode() then
11 - vim.print( ... )
11 + -- TODO: pipe messages into custom debug buffer and file
12 + vim.print( message, ... )
15 16 local function toggle_debug_mode()
16 17 vim.g.bugabinga_debug_mode = not vim.g.bugabinga_debug_mode
17 - vim.notify( 'Toggled debug mode to ' .. tostring(is_debug_mode()) )
18 + vim.notify( 'Toggled debug mode to ' .. tostring( is_debug_mode() ) )
20 -vim.api.nvim_create_user_command( 'Debug', toggle_debug_mode ,{})
21 +vim.api.nvim_create_user_command( 'Debug', toggle_debug_mode, {} )
22 23 return {
23 24 print = print_debug,

neovim/lua/std/project.lua

Modified
32 32 --- number of max loop iterations when searching for markers
33 33 local MAX_TRAVERSAL_COUNT = 100
35 +--- the weight of a project marker, when the likelyhood is low
36 +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
35 42 --- Determines the path to a root directory, starting from the given path.
36 43 -- Markers have a name and weight.
37 44 -- Each name is checked for existence in all directories up to the root.
49 56 -- local project = require'std.project'
50 57 -- local current_buffer = vim.api.nvim_buf_get_name(0)
51 58 -- local markers = {
52 --- { name = ".git", weight = 1 },
53 --- { name = "README", weight = 2 },
54 --- { naem = "Makefile", weight = 3 },
59 +-- { name = ".git", weight = MAYEB },
60 +-- { name = "README", weight = LIKELY },
61 +-- { naem = "Makefile", weight = DEFINITLY },
56 63 -- local root = project.find_root(current_buffer, markers, vim.uv.os_homedir())
57 64 -- print(root) -- /home/user/workspace/some_project
64 71 ---@return string? # Directory, that contains the `markers` and lies on the path from `path` to `stop`.
65 72 local function find_root( path, markers, stop )
66 73 validate {
67 - path = { path, 'string', true },
68 - markers = { markers, 'table' },
69 - stop = { stop, 'string', true },
74 + path = { path, 'string', true, },
75 + markers = { markers, 'table', },
76 + stop = { stop, 'string', true, },
72 79 path = path or dirname( vim.api.nvim_buf_get_name( 0 ) )
128 135 local project_root = nil
129 136 local max_likelyhood = 0
130 137 -- the project root is most likely the directory with the highest marker count
131 - -- and lowest distance to current buffer.
138 + -- and highest distance to current buffer.
132 139 -- because if there are markers further away from the buffer than other markers,
133 140 -- then it is most likely a nested project structure (multi-module).
134 141 -- in those cases we are looking for the root project folder, instead the nearest
135 142 -- child project root folder.
136 143 for _, score in ipairs( directory_scores ) do
137 - local likelihood = score.marker_count + 1 / score.distance_to_buffer_file
144 + local likelihood = score.marker_count + score.distance_to_buffer_file
138 145 if likelihood > max_likelyhood then
139 146 max_likelyhood = likelihood
140 147 project_root = score.path
155 162 local function find_project_root( path, markers )
156 163 -- define some language-independent markers
157 164 local default_markers = {
158 - { name = '.git', weight = 1 },
159 - { name = '.gitignore', weight = 1 },
160 - { name = '.svn', weight = 1 },
161 - { name = 'justfile', weight = 1 },
162 - { name = 'Jenkinsfile', weight = 1 },
163 - { name = '.editorconfig', weight = 1 },
164 - { name = 'LICENSE', weight = 1 },
165 - { name = 'LICENSE.md', weight = 1 },
166 - { name = 'LICENSE.txt', weight = 1 },
167 - { name = 'COPYING', weight = 1 },
168 - { name = 'README', weight = 1 },
169 - { name = 'README.md', weight = 1 },
170 - { name = 'Makefile', weight = 1 },
171 - { name = 'flake.nix', weight = 1 },
172 - { name = 'flake.nix', weight = 1 },
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, },
175 183 markers = markers or {}
183 191 local function find_java_project_root( path )
184 192 local java_markers = {
185 - { name = '.idea', weight = 2 },
186 - { name = '.classpath', weight = 2 },
187 - { name = '.settings', weight = 2 },
188 - { name = '.project', weight = 2 },
189 - { name = 'target', weight = 2 },
190 - { name = 'pom.xml', weight = 2 },
191 - { name = 'mvnw', weight = 3 },
192 - { name = '.mvn', weight = 3 },
193 - { name = 'mvnw.cmd', weight = 3 },
194 - { name = 'build.gradle', weight = 2 },
195 - { name = 'gradle.properties', weight = 3 },
196 - { name = 'settings.gradle', weight = 3 },
197 - { name = 'gradlew', weight = 3 },
198 - { name = 'gradlew.bat', weight = 3 },
193 + { name = '.idea', weight = LIKELY, },
194 + { name = '.classpath', weight = LIKELY, },
195 + { name = '.settings', weight = LIKELY, },
196 + { name = '.project', weight = LIKELY, },
197 + { name = 'target', weight = LIKELY, },
198 + { 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, },
200 208 return find_root( path, java_markers )
203 211 local lua_markers = {
204 - { name = '.luarc.json', weight = 1 },
205 - { name = '.luarc.jsonc', weight = 1 },
206 - { name = '.luacheckrc', weight = 1 },
207 - { name = '.stylua.toml', weight = 1 },
208 - { name = 'stylua.toml', weight = 1 },
209 - { name = 'selene.toml', weight = 1 },
210 - { name = 'selene.yml', weight = 1 },
211 - { name = 'neovim.yml', weight = 1 },
212 - { name = 'lua', weight = 1 },
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, },
215 223 local find_lua_project_root = function ( path )
219 227 local zig_markers = {
220 - { name = 'build.zig', weight = 3 },
221 - { name = 'zls.build.json', weight = 3 },
222 - { name = 'zig-cache', weight = 1 },
223 - { name = 'zig-out', weight = 1 },
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, },
226 234 local find_zig_project_root = function ( path )
230 238 local find_rust_project_root = function ( path )
231 239 local markers = {
232 - { name = 'Cargo.toml', weight = 3 },
240 + { name = 'Cargo.toml', weight = DEFINITLY, },
234 242 local cargo_crate_dir = find_root( path, markers )
235 243 if cargo_crate_dir == nil then return nil end
244 252 vim.fs.joinpath( cargo_crate_dir, 'Cargo.toml' ),
247 - local result = vim.system( cmd, { text = true } ):wait()
255 + local result = vim.system( cmd, { text = true, } ):wait()
248 256 local cargo_workspace_root
250 258 if result.code == 0 then
272 280 return rooter and rooter( path ) or fallback_rooter( path )
275 ---- @return table parsed configuration as could be found in the `.project` file in the root directory. Empty otherwise.
283 +--- @return table parsed configuration as could be found in the `.project_model` file in the root directory. Empty otherwise.
276 284 local parse_project_configuration = function ()
279 -local override_neovim_options = function ( options )
280 -end
282 -local setup = function ()
283 - local local_project_config = parse_project_configuration()
284 - if vim.tbl_isempty( local_project_config ) then return end
286 - if local_project_config.neovim then
287 - override_neovim_options( local_project_config.neovim )
288 - end
290 - local ok, lazy_core_loader = pcall( require, 'lazy.core.loader' )
291 - if not ok then return end
293 - local old_config = lazy_core_loader.config
294 - lazy_core_loader.config = function ( plugin )
296 - end
297 -end
299 287 return {
300 - setup = setup,
301 288 find_root = find_root,
302 289 find_root_by_filetype = find_root_by_filetype,
303 290 find_project_root = find_project_root,

nushell/env.nu

Modified
6 6 $env.WORKSPACE = if $env.WIN32 { "W:/" } else { "~/Workspace" | path expand }
7 7 $env.NOTES = if $env.WIN32 { "N:/" } else { "~/Notes" | path expand }
9 +if not (which nvim | is-empty) {
10 + $env.EDITOR = 'nvim'
11 + $env.GIT_EDITOR = 'nvim'
14 +if not (which neovide | is-empty) {
15 + $env.VISUAL = 'neovide'
9 18 if ($env | get -i TERM_PROGRAM) == WezTerm {
10 19 $env.TERM = "wezterm"
11 20 if not $env.WIN32 {