dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Compare Notes Search neovim: put inlay hints at the end of the line
5b861af34403b8795e05ffa5b0db55c359fa8418
Oliver Jan Krylow <oliver@bugabinga.net > · 5 Oct 2025
unsigned
Browse files Compare with HEAD
Changed files (4) 59 59 require 'bugabinga.sessions' 60 60 require 'bugabinga.treesitter' 61 61 require 'bugabinga.terminal' 62 + require 'bugabinga.inlay' 64 65 require 'bugabinga.autotag' neovim/lua/bugabinga/fuzzy_find.lua Modified 25 - description =
'Find files' ,
25 + description =
'find files' ,
26 26 command = pick.builtin.files,
27 27 keys =
'<leader>ff' ,
32 - description =
'Live Grep' ,
32 + description =
'live grep' ,
33 33 command = pick.builtin.grep_live,
34 34 keys =
'<leader>fg' ,
39 - description =
'Find symbols' ,
39 + description =
'find symbols' ,
40 40 command =
function () extra.pickers.lsp {
scope =
'document_symbol' }
end ,
41 41 keys =
'<leader>fs' ,
46 - description =
'Find highlight groups' ,
46 + description =
'find highlight groups' ,
47 47 command = extra.pickers.hl_groups,
48 48 keys =
'<leader>fl' ,
53 - description =
'Find spellsuggests' ,
53 + description =
'find spellsuggests' ,
54 54 command = extra.pickers.spellsuggest,
55 55 keys =
'<leader>fz' ,
60 - description =
'Find keymaps' ,
60 + description =
'find keymaps' ,
61 61 command = extra.pickers.keymaps,
62 62 keys =
'<leader>fk' ,
67 + description =
'find marks' ,
68 + command = extra.pickers.marks,
69 + keys =
'<leader>fm' ,
neovim/lua/bugabinga/inlay.lua Added new file mode 100644 14 + truncateAtChars =
20 ,
17 + sameKindSeparator =
", " ,
24 + local ns
= vim.api.nvim_create_namespace(
"bugabinga-inlay" )
26 + local function changedRefreshHandler (err, result, ctx, _)
28 + if not vim.lsp.inlay_hint.is_enabled()
then return end 29 + local bufnr
= ctx.bufnr
or - 1 30 + if not vim.api.nvim_buf_is_valid(bufnr)
then return end 31 + if not result
then return end 32 + local client
= vim.lsp.get_client_by_id(ctx.client_id)
33 + if not client
then return end 34 + local inlayHintProvider
= client.server_capabilities.inlayHintProvider
35 + if not inlayHintProvider
then return end 37 + vim.notify(vim.inspect(err), vim.log.levels.ERROR)
41 + local padding
= (
" " ):rep(config.label.padding)
42 + local marginLeft
= (
" " ):rep(config.label.marginLeft)
44 + vim.api.nvim_buf_clear_namespace(bufnr, ns,
0 ,
- 1 )
48 + local hintLines
= vim.iter(result):fold({},
function (acc, hint)
49 + local lnum
= hint.position.line
50 + local col
= hint.position.character
53 + local label
= hint.label
54 + if type (label)
~= "string" then 56 + label
= vim.iter(hint.label):map(
function (labelPart)
return labelPart.value
end ):join(
"" )
58 + label
= vim.trim(label:gsub(
"^:" ,
"" ):gsub(
":$" ,
"" ))
59 + if config.label.truncateAtChars
and # label
> config.label.truncateAtChars
then 60 + label
= label:sub(
1 , config.label.truncateAtChars)
.. "…" 66 + if hint.kind
== 1 then 68 + elseif hint.kind
== 2 then 70 + elseif hint.kind
== nil then 76 + if not acc[lnum]
then acc[lnum]
= {}
end 77 + table .
insert (acc[lnum], {
label = label,
col = col,
kind = kind })
82 + for lnum, hints
in pairs (hintLines)
do 83 + table .
sort (hints,
function (a, b)
return a.col
< b.col
end )
87 + local hintsMerged
= "" 88 + for i
= 1 ,
# hints
do 89 + local hint
= hints[i]
90 + local lastKind
= hints[i
- 1 ]
and hints[i
- 1 ].kind
91 + if lastKind
== hint.kind
then 92 + hintsMerged
= hintsMerged
.. config.label.sameKindSeparator
.. hint.label
94 + local icon
= config.icons[hint.kind]
95 + local pad
= i
~= 1 and " " or "" 96 + hintsMerged
= hintsMerged
.. pad
.. icon
.. hint.label
102 + { padding
.. hintsMerged
.. padding,
"LspInlayHint" },
104 + if marginLeft
~= "" then table .
insert (virtText,
1 , { marginLeft })
end 107 + vim.api.nvim_buf_set_extmark(bufnr, ns, lnum,
0 , {
108 + virt_text = virtText,
109 + virt_text_pos =
"eol" ,
110 + hl_mode =
"combine" ,
112 + priority = config.extmark.priority,
117 + vim.lsp.handlers[
"textDocument/inlayHint" ]
= changedRefreshHandler
10 10 $env.CARGO_HOME = (
"~/.cargo" | path expand )
11 11 $env.GO_HOME = (
"~/.go" | path expand )
12 12 $env.NIM_HOME = (
"~/.nimble" | path expand)
13 + $env.OPENCODE_HOME = (
"~/.opencode" | path expand)
19 20 | append (
$env.GO_HOME | path join bin)
20 21 | append (
$env.NIM_HOME | path join bin)
21 22 | append (
$env.TOOLS | path join bin)
23 + | append (
$env.OPENCODE_HOME | path join bin)
29 31 | append (
$env.GO_HOME | path join bin)
30 32 | append (
$env.NIM_HOME | path join bin)
31 33 | append (
$env.TOOLS | path join bin)
34 + | append (
$env.OPENCODE_HOME | path join bin)