repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: custom lsp info command

212725f07f9939c2dfd315e28252c979b15d6965

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (22)

helix/config.toml

Modified
1 -theme = "nugu-dark"
1 +theme = "nugu-light"
3 3 [editor]
4 4 shell = ["nu", "--commands"]

neovim/init.lua

Modified
14 14 -- configures the vim diagnostic subsystem
15 15 require'bugabinga.diagnostic'
16 16 require'bugabinga.trim'
17 -require 'bugabinga.lsp'
17 +require'bugabinga.lsp'
19 19 -- TODO:
20 20 -- [ ] use ltex-ls for markdown, code comments and commit messages

neovim/lazy-lock.json

Modified
8 8 "heirline.nvim": { "branch": "master", "commit": "76136ccd93ed608e8109762f032cf1118981ebbd" },
9 9 "hlargs.nvim": { "branch": "main", "commit": "cfc9beab4e176a13311efe03e38e6b6fed5df4f6" },
10 10 "inc-rename.nvim": { "branch": "main", "commit": "ed0f6f2b917cac4eb3259f907da0a481b27a3b7e" },
11 - "indent-blankline.nvim": { "branch": "master", "commit": "b7aa0aed55887edfaece23f7b46ab22232fc8741" },
11 + "indent-blankline.nvim": { "branch": "master", "commit": "73640233cca0da8e01aced8c1f9e63fd892128b7" },
12 12 "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
13 - "lush.nvim": { "branch": "main", "commit": "b10ef2bfff0647e701b691019ade3edd5e44eb50" },
13 + "lush.nvim": { "branch": "main", "commit": "2d753a67616052064db9b2c3e8c7fb55dc3956a2" },
14 14 "neodev.nvim": { "branch": "main", "commit": "da1562e1e3df0e994ddc52cb4ba22376a5d7f2fc" },
15 15 "neogen": { "branch": "main", "commit": "cb1f384df804c1bf729332c4f728253fe17962d4" },
16 16 "noice.nvim": { "branch": "main", "commit": "894db25ec726d32047799d4d0a982b701bec453b" },
19 19 "nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" },
20 20 "nvim-cmp": { "branch": "main", "commit": "983453e32cb35533a119725883c04436d16c0120" },
21 21 "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
22 - "nvim-genghis": { "branch": "main", "commit": "9f04102a6f591c231dfb23b58ad3b49cd0a43c03" },
22 + "nvim-genghis": { "branch": "main", "commit": "13b773cb3935b25962b0e00ff0795cce6be2eb1e" },
23 23 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
24 - "nvim-lastplace": { "branch": "main", "commit": "aeb0e0bd399288092729da89a9e51dda4ccbc9ec" },
24 + "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
25 25 "nvim-neoclip.lua": { "branch": "main", "commit": "4e406ae0f759262518731538f2585abb9d269bac" },
26 26 "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
27 - "nvim-spectre": { "branch": "master", "commit": "be7ff1d29ddf2de59b3dc293988d110c2c00ac84" },
28 27 "nvim-surround": { "branch": "main", "commit": "211eaad7c6d01ef4ac02cba9052b3082ec232101" },
29 - "nvim-treesitter": { "branch": "master", "commit": "25158a8b3916a354911928942daf185c32b19cce" },
28 + "nvim-treesitter": { "branch": "master", "commit": "e8648569d82c7bb46dc511cda9dbec687774461f" },
30 29 "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
31 30 "nvim-ts-context-commentstring": { "branch": "main", "commit": "e9062e2dfb9854e6a927370f2d720de354c88524" },
32 31 "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" },

neovim/lua/bugabinga/diagnostic.lua

Modified
45 45 float = {
46 46 focusable = false,
47 47 style = 'minimal',
48 - border = 'shadow',
48 + border = vim.g.border_style,
49 49 source = 'if_many',
50 50 header = 'Diagnostic',
51 51 prefix = prefix_format,

neovim/lua/bugabinga/lazy.lua

Modified
35 35 ui = {
36 36 size = { width = 0.69 , heigth = 0.69 },
37 - border = 'shadow',
37 + border = vim.g.border_style,
38 38 icons = {
39 39 lazy = icon.lazy,
40 40 task = icon.terminal,

neovim/lua/bugabinga/lsp/init.lua

Modified
8 8 local map = require'std.keymap'
9 9 local auto = require'std.auto'
10 -local deep_concat = require'std.table.deep_concat'
10 +local ui = require'bugabinga.ui'
11 +local table = require'std.table'
12 13 local lsp_client_configs = require'bugabinga.lsp.clients'
156 157 local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0 }
157 158 local active_clients = vim.lsp.get_active_clients(all_or_current)
159 - -- basic info is:
160 - -- * id
161 - -- * name
162 - -- * cmd
163 - -- * pid, cpu, mem
164 - -- * root_dir/workspaces
165 - -- * filetypes
166 - -- * single file support
167 - -- * workspaces support
168 - -- * buffers (if 'all')
169 - --
170 - -- TODO extended infos (needs GUI)
171 - -- * client caps
172 - -- * server caps
173 - -- * settings
174 - -- * ...
176 160 local infos = vim.iter(active_clients)
177 161 :map(function(client)
178 162 local name = client.name
179 163 local config = vim.iter(lsp_client_configs):find(function(config) return config.name == name end)
180 164 assert(config, ( 'How did we not find a config for %s ?!?!' ):format(name))
181 - local basic = {
166 + local full_cmd = table.deep_copy(client.config.cmd)
167 + full_cmd[1] = vim.fn.exepath(full_cmd[1])
168 + local basic = {
182 169 id = client.id,
183 170 name = name,
184 - --TODO: find cmd in (neovim) PATH
185 - cmd = { client.config.cmd, client.config.cmd_cwd, 'TODO:pid', 'TODO:cpu', 'TODO:mem'},
171 + cmd = table.concat(full_cmd, ' '),
186 172 workspace_folders = vim.iter(client.workspace_folders):map(function(w) return vim.fs.normalize(w.name) end):totable(),
187 - filetypes = config.filetypes,
173 + filetypes = table.concat(config.filetypes, ', '),
188 174 single_file_support = config.single_file_support,
189 175 workspaces = config.workspaces,
190 - }
191 - return basic
192 - end)
193 - :totable()
177 + return basic
178 + end)
179 + :totable()
195 - --TODO replace with GUI
196 - vim.print(deep_concat(infos))
181 + ui.show_tree(infos)
182 +end
184 +local lsp_info_extended = function(command)
185 + local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0 }
186 + local active_clients = vim.lsp.get_active_clients(all_or_current)
187 + ui.show_tree(active_clients)
199 190 vim.api.nvim_create_user_command ('LspInfo',
204 195 desc = 'Shows basic information about running LSP clients.',
198 +vim.api.nvim_create_user_command ('LspInfoExtended',
199 + lsp_info_extended,
201 + nargs = '?',
202 + complete = function() return {"all"} end,
203 + desc = 'Shows detailed information about running LSP clients.',
204 + })
207 205 return setmetatable(_ ,{ })

neovim/lua/bugabinga/options/ui.lua

Modified
1 - local icon = require'std.icon'
1 +local icon = require'std.icon'
3 3 -- show trailing whitespace
4 4 vim.opt.list = true
63 63 vim.opt.pumblend = 5
64 64 vim.opt.winblend = 5
66 +vim.g.border_style = 'shadow'
66 68 -- hide the mode indicator in status
67 69 vim.opt.showmode = false

neovim/lua/bugabinga/plugins/heirline.lua

Modified
255 255 provider = function(self)
256 256 -- 0 is just another output, we can decide to print it or not!
257 - return self.errors > 0 and (self.error_icon .. self.errors .. " ")
257 + return self.errors > 0 and (self.error_icon .. ' ' .. self.errors .. " ")
259 259 hl = 'DiagnosticError',
262 262 provider = function(self)
263 - return self.warnings > 0 and (self.warn_icon .. self.warnings .. " ")
263 + return self.warnings > 0 and (self.warn_icon .. ' ' .. self.warnings .. " ")
265 265 hl = 'DiagnosticWarn',
268 268 provider = function(self)
269 - return self.info > 0 and (self.info_icon .. self.info .. " ")
269 + return self.info > 0 and (self.info_icon .. ' ' .. self.info .. " ")
271 271 hl = 'DiagnosticInfo',
274 274 provider = function(self)
275 - return self.hints > 0 and (self.hint_icon .. self.hints)
275 + return self.hints > 0 and (self.hint_icon .. ' ' .. self.hints)
277 277 hl = 'DiagnosticHint',
307 307 local svn = {
308 308 condition = is_svn_repo,
310 + update = 'BufEnter',
310 312 init = function(self)
311 313 self.relative_url = svn_get_relative_url()

neovim/lua/bugabinga/plugins/neoclip.lua

Modified
2 2 local map = require'std.keymap'
4 4 return {
5 5 'AckslD/nvim-neoclip.lua',
6 + event = 'TextYankPost',
6 7 keys = {'y', '<C-v><C-v>' },
7 8 dependencies = {
8 9 'nvim-telescope/telescope.nvim',

neovim/lua/bugabinga/plugins/noice.lua

Modified
28 28 size = { width = 'auto', height = 'auto'},
30 30 popupmenu = {
31 - border = { style = "shadow" },
31 + border = { style = vim.g.border_style},
33 33 popup = {
34 - border = { style = "shadow" },
34 + border = { style = vim.g.border_style},
36 36 hover = {
37 - border = { style = "shadow" },
37 + border = { style = vim.g.border_style},
38 38 position = { row = -2, col = 2 },
40 40 -- does not seem to play well with other popups?
42 42 relative = "cursor",
43 43 position = { row = 0, col = 0 },
44 44 size = { min_width = 42, width = 'auto', height = 'auto'},
45 - border = { style = "shadow" },
45 + border = { style = vim.g.border_style},
47 47 cmdline_popupmenu = {
48 48 relative = "cursor",
49 49 position = { row = 1, col = 0 },
50 50 size = { min_width = 42, width = "auto", height = 'auto' },
51 - border = { style = "shadow", padding = { 0, 1 } },
51 + border = { style =vim.g.border_style, padding = { 0, 1 } },
52 52 win_options = { winhighlight = { Normal = "Normal", FloatBorder = "NoiceCmdlinePopupBorder" } },
143 143 local shadow_fade = function(...)
144 144 local opts = fade[1](...)
145 145 if opts then
146 - opts.border = 'shadow'
146 + opts.border = vim.g.border_style
147 147 opts.row = opts.row - 1
149 149 return opts

neovim/lua/bugabinga/plugins/oil.lua

Modified
29 29 ["<C-h>"] = "actions.toggle_hidden",
31 31 float = {
32 - border = 'shadow',
32 + border = vim.g.border_style,
33 33 padding = 2,
34 34 win_options = { winblend = 10 },

neovim/lua/bugabinga/plugins/toggleterm.lua

Modified
32 32 open_mapping = '<F7>',
33 33 direction = "float",
34 34 float_opts = {
35 - border = "shadow",
35 + border = vim.g.border_style,
36 36 winblend = 10,
38 38 size = function(term)

neovim/lua/bugabinga/ui.lua

Added
new file mode 100644
1 +local want = require'std.want'
2 +local display = require'std.display'
4 +return want{
5 + 'nui.popup',
6 + 'nui.text',
7 + 'nui.line',
8 +}(
9 + function(
10 + NuiPopup,
11 + NuiText,
12 + NuiLine
13 + )
14 + local get_nui_popup = function()
15 + local popup = NuiPopup{
16 + relative = 'editor',
17 + focusable = true,
18 + position= '50%',
19 + enter = true,
20 + size = {
21 + width = '69%',
22 + height = '42%',
23 + },
24 + border = {
25 + style = vim.g.border_style,
26 + },
27 + buf_options = {
28 + modifiable = true,
29 + readonly = false,
30 + }
31 + }
32 + popup:map("n", "q", function() popup:unmount() end, { noremap = true })
33 + return popup
34 + end
36 + return {
37 + show_tree = function(tree)
38 + local popup = get_nui_popup()
39 + local bufnr = popup.bufnr
40 + local text, _ = display(tree)
42 + local line_number = 1
43 + for line in text:gmatch('[^\r\n]+') do
44 + local nui_line = NuiLine()
45 + nui_line:append(NuiText(line, 'NormalFloat'))
46 + nui_line:render(bufnr, -1, line_number)
47 + line_number = line_number + 1
48 + end
50 + popup:mount()
51 + end,
52 + }
53 + end)

neovim/lua/std/display.lua

Added
new file mode 100644
1 +local icon = require'std.icon'
2 +local table = require'std.table'
4 +local function display(value)
5 + if value == nil then
6 + return 'nil', 'Special'
7 + end
9 + local value_type = type(value)
11 + if value_type == 'string' then
12 + return icon.quot_left .. ' ' .. value .. ' ' .. icon.quot_right, 'String'
13 + end
15 + if value_type == 'number' then
16 + return icon.hash .. ' ' .. tostring(value), 'Number'
17 + end
19 + if value_type == 'boolean' then
20 + local mark = value and icon.checkbox_mark or icon.checkbox_unmark
21 + return mark, 'Boolean'
22 + end
24 + if value_type == 'userdata' then
25 + local ud = icon.user .. icon.data
26 + return ud .. ' ' .. tostring(value), 'Identifier'
27 + end
29 + if value_type == 'thread' then
30 + local thread = icon.thread
31 + return thread .. ' ' .. tostring(value), 'Identifier'
32 + end
34 + if value_type == 'function' then
35 + local fn = icon['function']
36 + return fn .. ' ' .. tostring(value), 'Function'
37 + end
39 + if value_type == 'table' then
40 + return table.deep_concat(value, {render_value = display}), 'Identifier'
41 + end
42 +end
44 +return display

neovim/lua/std/icon.lua

Modified
3 3 return {
4 4 error = '󰇷',
5 5 warn = '󰱯',
6 6 info = '󰩖',
7 7 hint = '󰊪',
8 - toggle_on = '',
9 - toggle_off = '',
10 - diagnostic = '⊙',
11 - spelling = '󰓆',
12 - linenumber = '󰉻',
13 - linehighlight = '󰘤',
14 - modified = '',
15 - lock = '',
16 - file = '',
17 - newline = '␤',
18 - carriage_return = '␍',
19 - lsp = '',
20 - subversion = '🐢',
21 - vim = '',
22 - branch = '',
23 - git = '',
24 - diff_add = '',
25 - diff_remove = '',
26 - diff_change = '',
27 - folder = '',
28 - terminal = '',
29 - macro = '',
30 - lazy = '󰄻',
31 - global = '󱥔',
32 - ['local'] = '󱥕',
33 - space = '∸',
34 - eol = '↴',
35 - tab = '󰌒',
36 - trail = '•',
37 - extends = '❯',
38 - precedes = '❮',
39 - nbsp = '␣',
40 - normal = 'Ν',
41 - visual = '󰒉',
42 - insert = '',
43 - select = '󰒉',
8 + quot_left = '',
9 + quot_right = '',
10 + hash = '',
11 + checkbox_mark = '',
12 + checkbox_unmark = '',
13 + user = ' ',
14 + data = '',
15 + thread = '󱇫',
16 + ['function'] = '',
17 + ['table'] = '',
18 + toggle_on = '',
19 + toggle_off = '',
20 + diagnostic = '⊙',
21 + spelling = '󰓆',
22 + linenumber = '󰉻',
23 + linehighlight = '󰘤',
24 + modified = '',
25 + lock = '',
26 + file = '',
27 + newline = '␤',
28 + carriage_return = '␍',
29 + lsp = '',
30 + subversion = '󰳗',
31 + vim = '',
32 + branch = '',
33 + git = '',
34 + diff_add = '',
35 + diff_remove = '',
36 + diff_change = '',
37 + folder = '',
38 + terminal = '',
39 + macro = '',
40 + lazy = '󰄻',
41 + global = '󱥔',
42 + ['local'] = '󱥕',
43 + space = '∸',
44 + eol = '↴',
45 + tab = '󰌒',
46 + trail = '•',
47 + extends = '❯',
48 + precedes = '❮',
49 + nbsp = '␣',
50 + normal = 'Ν',
51 + visual = '󰒉',
52 + insert = '',
53 + select = '󰒉',
44 54 replace = '',
45 55 command = '󰘳',
46 56 pending = '',

neovim/lua/std/project.lua

Modified
182 182 local find_lua_nvim_project_root = function()
183 - return find_root(nil, join(lua_markers, nvim_lua_markers))
183 + return find_root(nil, nvim_lua_markers)
186 186 return {

neovim/lua/std/table/deep_concat.lua

Modified
1 -return function(some_table, prefix, suffix, key_value_delimiter, row_delimiter, fill, newline)
1 +return function( some_table, options)
2 + options = options or {}
2 4 vim.validate{
3 5 some_table = { some_table, 'table'},
4 - prefix = {prefix, 'string', true},
5 - suffix = {suffix, 'string', true},
6 - fill = {fill, 'string', true},
7 - key_value_delimiter = {key_value_delimiter, 'string', true},
8 - row_delimiter = {row_delimiter, 'string', true},
9 - newline = {newline, 'string', true},
6 + [ 'options.prefix' ] = {options.prefix, 'string', true},
7 + [ 'options.suffix' ] = {options.suffix, 'string', true},
8 + [ 'options.fill' ] = {options.fill, 'string', true},
9 + [ 'options.key_value_delimiter' ] = {options.key_value_delimiter, 'string', true},
10 + [ 'options.row_delimiter' ] = {options.row_delimiter, 'string', true},
11 + [ 'options.newline' ] = {options.newline, 'string', true},
12 + [ 'options.render_key' ] = {options.render_key, 'function', true},
13 + [ 'options.render_value' ] = {options.render_value, 'function', true},
11 - prefix = prefix or '⦃'
12 - suffix = suffix or '⦄'
13 - key_value_delimiter = key_value_delimiter or ' ≔ '
14 - row_delimiter = row_delimiter or ','
15 - fill = fill or ' '
16 - newline = newline or '\n'
16 + local prefix = options.prefix or '⦃'
17 + local suffix = options.suffix or '⦄'
18 + local key_value_delimiter = options.key_value_delimiter or ' ≔ '
19 + local row_delimiter = options.row_delimiter or ','
20 + local fill = options.fill or ' '
21 + local newline = options.newline or '\n'
22 + local render_key = options.render_key or function(key) return type(key) == 'number' and ('['..key..']') or key end
23 + local render_value = options.render_value or function(value) return tostring(value):gsub('\n','') end
17 24 local string_builder = {}
18 25 local append = function(thing) table.insert(string_builder, thing) end
19 - local render_key = function(key) return type(key) == 'number' and ('['..key..']') or key end
20 - local render_value = function(value) return tostring(value):gsub('\n','') end
21 27 local function deep_concat_table (tbl, level)
22 28 level = level or 0
23 29 if newline then append(fill:rep(level)) end

neovim/lua/std/table/deep_copy.lua

Added
new file mode 100644
1 +local function deep_copy(any)
2 + if type(any) ~= 'table' then return any end
4 + local result = {}
5 + for key, value in pairs(any) do
6 + result[key] = deep_copy(value)
7 + end
8 + return result
9 +end
11 +return deep_copy

neovim/lua/std/table/human_readable.lua

Deleted
deleted file mode 100644

No text changes.

neovim/lua/std/table/init.lua

Modified
1 1 --- Facade over various table functions in lua, neovim and some of my own.
2 ---- @see #_G.table
3 ---- @see #vim.tbl_*
4 2 return {
5 - human_readable = require'std.table.human_readable',
6 3 deep_concat = require'std.table.deep_concat',
4 + deep_copy = require'std.table.deep_copy',
7 5 join = require'std.table.join',
9 7 add_reverse_lookup = vim.tbl_add_reverse_lookup,
22 20 values = vim.tbl_values,
24 22 concat = table.concat,
25 - foreach = table.foreach,
26 - foreachi = table.foreachi,
27 23 insert = table.insert,
28 24 maxn = table.maxn,
29 25 remove = table.remove,

nushell/env.nu

Modified
9 9 let-env TERM = if ($env | get -i TERM_PROGRAM) == WezTerm { "wezterm" } else { "xterm-256color" }
11 11 # theme for ls and other programs, that use LS_COLORS
12 -let-env LS_COLORS = ( try { vivid generate nord } catch { "" } )
12 +# let-env LS_COLORS = ( try { vivid generate nord } catch { "" } )
14 14 # Specifies how environment variables are:
15 15 # - converted from a string to a value on Nushell startup (from_string)

wezterm/wezterm.service

Deleted
deleted file mode 100644
1 -[Unit]
2 -Description=Wezterm Multiplexing Server
3 -After=gnome-session.target
5 -[Service]
6 -ExecStart=/usr/bin/wezterm-mux-server
7 -Restart=on-failure
9 -[Install]
10 -WantedBy=gnome-session.target