repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

feat(cmdline): update icons and highlight links

5e821d2c05a313e47e976f3a85c8bc66d6e31d8b

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

- Update cmdline icons in std.icon: search, search_up, shell, help, vim, command
- Link CmdlineIcon* highlights to CmdlineBorder* fg via { fg = _.CmdlineBorder*.fg }
- Update CmdlineBorderSearch to ui_important_global, CmdlineBorderShell to content_focus
- Update format_spec.lua tests to match new icon values

Changed files (3)

neovim/lua/bugabinga/nugu/init.lua

Modified
41 41 vim.g.terminal_color_14 = content_focus -- aqua
42 42 vim.g.terminal_color_15 = content_normal -- white
44 -local set_group_properties = function(self, properties)
45 - vim.validate('properties', properties, 'table')
46 - vim.validate('properties.fg', properties.fg, 'string', true)
47 - vim.validate('properties.bg', properties.bg, 'string', true)
48 - vim.validate('properties.sp', properties.sp, 'string', true)
49 - vim.validate('properties.blend', properties.blend, 'number', true)
50 - vim.validate('properties.bold', properties.bold, 'boolean', true)
51 - vim.validate('properties.standout', properties.standout, 'boolean', true)
52 - vim.validate('properties.underline', properties.underline, 'boolean', true)
53 - vim.validate('properties.undercurl', properties.undercurl, 'boolean', true)
54 - vim.validate('properties.underdotted', properties.underdotted, 'boolean', true)
55 - vim.validate('properties.underdashed', properties.underdashed, 'boolean', true)
56 - vim.validate('properties.strikethrough', properties.strikethrough, 'boolean', true)
57 - vim.validate('properties.italic', properties.italic, 'boolean', true)
58 - vim.validate('properties.reverse', properties.reverse, 'boolean', true)
59 - vim.validate('properties.nocombine', properties.nocombine, 'boolean', true)
60 - vim.validate('properties.default', properties.default, 'boolean', true)
61 - vim.validate('properties.ctermfg', properties.ctermfg, 'string', true)
62 - vim.validate('properties.ctermbg', properties.ctermbg, 'string', true)
63 - vim.validate('properties.cterm', properties.cterm, 'table', true)
64 - vim.validate('properties.force', properties.force, 'boolean', true)
44 +local set_group_properties = function ( self, properties )
45 + vim.validate( 'properties', properties, 'table' )
46 + vim.validate( 'properties.fg', properties.fg, 'string', true )
47 + vim.validate( 'properties.bg', properties.bg, 'string', true )
48 + vim.validate( 'properties.sp', properties.sp, 'string', true )
49 + vim.validate( 'properties.blend', properties.blend, 'number', true )
50 + vim.validate( 'properties.bold', properties.bold, 'boolean', true )
51 + vim.validate( 'properties.standout', properties.standout, 'boolean', true )
52 + vim.validate( 'properties.underline', properties.underline, 'boolean', true )
53 + vim.validate( 'properties.undercurl', properties.undercurl, 'boolean', true )
54 + vim.validate( 'properties.underdotted', properties.underdotted, 'boolean', true )
55 + vim.validate( 'properties.underdashed', properties.underdashed, 'boolean', true )
56 + vim.validate( 'properties.strikethrough', properties.strikethrough, 'boolean', true )
57 + vim.validate( 'properties.italic', properties.italic, 'boolean', true )
58 + vim.validate( 'properties.reverse', properties.reverse, 'boolean', true )
59 + vim.validate( 'properties.nocombine', properties.nocombine, 'boolean', true )
60 + vim.validate( 'properties.default', properties.default, 'boolean', true )
61 + vim.validate( 'properties.ctermfg', properties.ctermfg, 'string', true )
62 + vim.validate( 'properties.ctermbg', properties.ctermbg, 'string', true )
63 + vim.validate( 'properties.cterm', properties.cterm, 'table', true )
64 + vim.validate( 'properties.force', properties.force, 'boolean', true )
66 - -- vim.print( 'SET GROUP PROPERTIES', self, properties )
67 - for key, value in pairs(properties) do
66 + for key, value in pairs( properties ) do
68 67 self[key] = value
72 -local new_group = function()
73 - return setmetatable({}, {
71 +local new_group = function ()
72 + return setmetatable( {}, {
74 73 __call = set_group_properties,
75 - })
74 + } )
78 -local add_group = function(self, key)
77 +local add_group = function ( self, key )
79 78 if not self.groups[key] then
80 79 self.groups[key] = new_group()
82 81 return self.groups[key]
85 -local link_group = function(self, key, value)
86 - -- vim.print( 'linking group', self, key, value )
87 - local group = add_group(self, key)
88 - for name, group_link in pairs(self.groups) do
84 +local link_group = function ( self, key, value )
85 + local group = add_group( self, key )
86 + for name, group_link in pairs( self.groups ) do
89 87 if group_link == value then
90 - -- vim.print( 'found group to link ' .. name .. ' to ' .. key )
91 88 group.link = name
92 89 return group
97 -local _ = setmetatable({ groups = {} }, {
94 +local _ = setmetatable( { groups = {} }, {
98 95 __index = add_group,
99 96 __newindex = link_group,
100 -})
97 +} )
102 99 _.Debug { fg = ui_normal, bg = debug, bold = true }
156 153 _.PmenuKind { fg = ui_minor }
157 154 _.PmenuKindSel { fg = ui_important_local }
158 155 _.BugabingaCmdlineCursor { fg = ui_important_local, bg = ui_unfocus, bold = true }
159 -_.CmdlineBorderSearch { fg = content_accent, bg = _.NormalFloat.bg }
160 -_.CmdlineBorderShell { fg = warning, bg = _.NormalFloat.bg }
161 -_.CmdlineBorderHelp { fg = info, bg = _.NormalFloat.bg }
162 -_.CmdlineBorderLua { fg = content_focus, bg = _.NormalFloat.bg }
163 -_.CmdlineBorderInput { fg = ui_important_local, bg = _.NormalFloat.bg }
164 -_.CmdlineBorderCmdline { fg = ui_minor, bg = _.NormalFloat.bg }
165 -_.CmdlineIconSearch { fg = content_accent }
166 -_.CmdlineIconShell { fg = warning }
167 -_.CmdlineIconHelp { fg = info }
168 -_.CmdlineIconLua { fg = content_focus }
169 -_.CmdlineIconInput { fg = ui_important_local }
170 -_.CmdlineIconCmdline { fg = ui_minor }
156 + _.CmdlineBorderSearch { fg = ui_important_global, bg = _.NormalFloat.bg }
157 + _.CmdlineBorderShell { fg = content_focus, bg = _.NormalFloat.bg }
158 + _.CmdlineBorderHelp { fg = info, bg = _.NormalFloat.bg }
159 + _.CmdlineBorderLua { fg = content_focus, bg = _.NormalFloat.bg }
160 + _.CmdlineBorderInput { fg = ui_important_local, bg = _.NormalFloat.bg }
161 + _.CmdlineBorderCmdline { fg = ui_minor, bg = _.NormalFloat.bg }
162 + _.CmdlineIconSearch { fg = _.CmdlineBorderSearch.fg }
163 + _.CmdlineIconShell { fg = _.CmdlineBorderShell.fg }
164 + _.CmdlineIconHelp { fg = _.CmdlineBorderHelp.fg }
165 + _.CmdlineIconLua { fg = _.CmdlineBorderLua.fg }
166 + _.CmdlineIconInput { fg = _.CmdlineBorderInput.fg }
167 + _.CmdlineIconCmdline { fg = _.CmdlineBorderCmdline.fg }
171 168 _.Question { fg = ui_important_local, bold = true }
172 169 _.QuickFixLine = _.PmenuSel
173 170 _.SpecialKey { fg = error, bg = content_unfocus, bold = true }
253 250 _.DiagnosticUnderlineInfo { fg = _.DiagnosticInfo.fg, sp = _.DiagnosticInfo.fg, underdashed = true }
254 251 _.DiagnosticUnderlineHint { fg = _.DiagnosticHint.fg, sp = _.DiagnosticHint.fg, italic = true, underdotted = true }
255 252 _.DiagnosticUnderlineOk { fg = _.DiagnosticOk.fg, italic = true }
256 -_.DiagnosticSignError = _.DiagnosticError
257 -_.DiagnosticSignWarn = _.DiagnosticWarn
258 -_.DiagnosticSignInfo = _.DiagnosticInfo
259 -_.DiagnosticSignHint = _.DiagnosticHint
260 -_.DiagnosticSignOk = _.DiagnosticOk
253 +_.DiagnosticSignError = _.DiagnosticError
254 +_.DiagnosticSignWarn = _.DiagnosticWarn
255 +_.DiagnosticSignInfo = _.DiagnosticInfo
256 +_.DiagnosticSignHint = _.DiagnosticHint
257 +_.DiagnosticSignOk = _.DiagnosticOk
262 259 _.BugabingaCodeActionFixAll = _.DiagnosticWarn
263 260 _.BugabingaCodeActionQuickFix = _.DiagnosticHint
266 263 _.BugabingaCodeActionRefactorMove = _.DiagnosticInfo
267 264 _.BugabingaCodeActionSource = _.DiagnosticHint
268 265 _.BugabingaCodeActionSourceImports = _.DiagnosticHint
269 -_.BugabingaCodeActionDefault = _.DiagnosticHint
266 +_.BugabingaCodeActionDefault = _.DiagnosticHint
271 268 _.LspReferenceText { sp = content_unfocus, underline = true }
272 269 _.LspReferenceRead = _.LspReferenceText
352 349 _['@lsp.typemod.method.declaration'] = _.FunctionDeclaration
353 350 _['@lsp.typemod.parameter.declaration'] = _.Parameter
355 -return function()
352 +return function ()
356 353 local namespace = 0
357 - for name, group in pairs(_.groups) do
358 - vim.api.nvim_set_hl(namespace, name, group)
354 + for name, group in pairs( _.groups ) do
355 + vim.api.nvim_set_hl( namespace, name, group )

neovim/lua/std/icon.lua

Modified
13 13 class = '󰆧 ',
14 14 close = '',
15 15 color = ' ',
16 - command = '󰘳',
17 - constant = ' ',
16 + constant = ' ',
18 17 constructor = ' ',
19 18 copilot = ' ',
20 19 data = '',
110 109 value = '󰎠 ',
111 110 variable = '󰀫 ',
112 111 vertical_bar = '│',
113 - vim = '',
112 + vim = '',
114 113 virtual = '󰢔',
115 114 visual = '󰒉',
116 115 warn = '󰱯',
120 119 edit = '󰏫',
121 120 format = '󰁦',
122 121 hammer = '󱁢',
123 - search = '󰍉',
124 - search_up = '󰤁',
125 - shell = '',
126 - help = '󰋝',
127 - calculator = '󰃬',
122 + search = '',
123 + search_up = '',
124 + shell = '',
125 + help = '󰋖',
126 + calculator = '󰃬',
128 127 star = '󰧑',
128 + command = '',

neovim/tests/bugabinga/cmdline/format_spec.lua

Modified
4 4 local format = require 'bugabinga.cmdline.format'
6 6 describe('format.detect', function()
7 7 it('detects : as cmdline', function()
8 8 local result = format.detect(':', 'hello', '')
9 9 assert.equals('cmdline', result.type)
10 - assert.equals('󰘳', result.icon)
10 + assert.equals('', result.icon)
13 13 it('detects / as search_down', function()
14 14 local result = format.detect('/', 'hello', '')
15 15 assert.equals('search_down', result.type)
16 - assert.equals('󰍉', result.icon)
16 + assert.equals('', result.icon)
19 19 it('detects ? as search_up', function()
20 20 local result = format.detect('?', 'hello', '')
21 21 assert.equals('search_up', result.type)
22 - assert.equals('󰤁', result.icon)
22 + assert.equals('', result.icon)
25 25 it('detects ! as shell', function()
26 26 local result = format.detect('!', 'ls -la', '')
27 27 assert.equals('shell', result.type)
28 - assert.equals('', result.icon)
28 + assert.equals('', result.icon)
31 31 it('detects :help as help', function()
32 32 local result = format.detect(':', 'help mytopic', '')
33 33 assert.equals('help', result.type)
34 - assert.equals('󰋝', result.icon)
34 + assert.equals('󰋖', result.icon)
37 37 it('detects :h as help', function()
38 38 local result = format.detect(':', 'h', '')
39 39 assert.equals('help', result.type)
40 - assert.equals('󰋝', result.icon)
40 + assert.equals('󰋖', result.icon)
43 43 it('detects :he as help', function()
44 44 local result = format.detect(':', 'he', '')
45 45 assert.equals('help', result.type)
46 - assert.equals('󰋝', result.icon)
46 + assert.equals('󰋖', result.icon)
49 49 it('detects :hel as help', function()
50 50 local result = format.detect(':', 'hel', '')
51 51 assert.equals('help', result.type)
52 - assert.equals('󰋝', result.icon)
52 + assert.equals('󰋖', result.icon)
55 55 it('detects :help alone as help', function()
56 56 local result = format.detect(':', 'help', '')
57 57 assert.equals('help', result.type)
58 - assert.equals('󰋝', result.icon)
58 + assert.equals('󰋖', result.icon)
61 61 it('detects :h with topic as help', function()
62 62 local result = format.detect(':', 'h usr_01', '')
63 63 assert.equals('help', result.type)
64 - assert.equals('󰋝', result.icon)
64 + assert.equals('󰋖', result.icon)
67 67 it('detects :!cmd as shell', function()
68 68 local result = format.detect(':', '!ls', '')
69 69 assert.equals('shell', result.type)
70 - assert.equals('', result.icon)
70 + assert.equals('', result.icon)
73 73 it('detects :lua as lua', function()
74 74 local result = format.detect(':', 'lua print("hi")', '')
75 75 assert.equals('lua', result.type)
76 - assert.equals('', result.icon)
76 + assert.equals('', result.icon)
79 79 it('detects :lua alone as lua', function()
80 80 local result = format.detect(':', 'lua', '')
81 81 assert.equals('lua', result.type)
82 - assert.equals('', result.icon)
82 + assert.equals('', result.icon)
85 85 it('detects := as lua', function()
86 86 local result = format.detect(':', '= { foo = 1 }', '')
87 87 assert.equals('lua', result.type)
88 - assert.equals('', result.icon)
88 + assert.equals('', result.icon)
91 91 it('detects input when prompt is non-empty', function()