repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: facade for user commands

cb896f8f84172bcbdee58c88367d7ef9d56683f4

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (24)

neovim/.lsp.settings.lua

Modified
1 +return {
2 + LuaLS = {
3 + Lua = {
4 + diagnostics = { globals = { 'vim', 'prequire', }, },
5 + },
6 + },
7 +}

neovim/README.md

Modified
39 39 * ]s [s to jump to spelling mistakes
40 40 * try Termdebug with gdb
41 41 * adapt config to respect `vim.g.nerdfont` (std.constants?)
42 -* make lsp config extensible, so that plugin configs can hook into it (e.g. on_attach)
43 -* pandoc with lua filters for diagrams for generating documents and previewing --> https://github.com/tex/vimpreviewpandoc
44 -* create facade over vim.api.nvim_create_user_command
45 42 * use ltex-ls for markdown, code comments and commit messages
46 43 * learn from <https://github.com/stevearc/dotfiles/blob/master/.config/nvim/plugin/exrc.lua> and maybe adapt `std.localrc`
47 44 * setup DAP
49 46 * learn marks and refactor mark.lua
50 47 * add nu-check to nvim-lint
51 48 * create skeleton-plugin for default file content based on file type (BufNewFile?)
52 -* add support for Java multi line string in autopairs
49 +* make lsp config extensible, so that plugin configs can hook into it (e.g. on_attach)
53 50 * split parts of config into plugins
51 +* add support for Java multi line string in autopairs
52 +* pandoc with lua filters for diagrams for generating documents and previewing --> https://github.com/tex/vimpreviewpandoc
53 + outside of vim?

neovim/lazy-lock.json

Modified
3 3 "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
4 4 "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" },
5 5 "actions-preview.nvim": { "branch": "master", "commit": "5072b1b1065a6b22bdd46b5c21780a91d6a08071" },
6 - "aerial.nvim": { "branch": "master", "commit": "51a07949abf169b4cad30e14c165ac1ec0ce4e6f" },
6 + "aerial.nvim": { "branch": "master", "commit": "24ebacab5821107c50f628e8e7774f105c08fe9b" },
7 7 "auto-dark-mode.nvim": { "branch": "master", "commit": "e328dc463d238cb7d690fb4daf068eba732a5a14" },
8 8 "better-escape.nvim": { "branch": "master", "commit": "7e86edafb8c7e73699e0320f225464a298b96d12" },
9 9 "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
11 11 "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
12 12 "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
13 13 "colorizer.nvim": { "branch": "master", "commit": "107719885290366c893e1c1c58b7474cbeabfef6" },
14 - "conform.nvim": { "branch": "master", "commit": "f9523f75134614fc0eff29c2377ed36603a1b0aa" },
14 + "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
15 15 "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
16 16 "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
17 17 "fidget.nvim": { "branch": "main", "commit": "4e854f3299e21d1c18279add340428a97520fc44" },
20 20 "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
21 21 "heirline.nvim": { "branch": "master", "commit": "03cff30d7e7d3ba6fdc00925f015822f79cef908" },
22 22 "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
23 - "lazy.nvim": { "branch": "main", "commit": "d37a76b87137c777f3d778ed03729d7f332a85f0" },
23 + "lazy.nvim": { "branch": "main", "commit": "e753eb602539bdad9f0709066d5893a788cb5db9" },
24 24 "lsp_signature.nvim": { "branch": "master", "commit": "c6aeb2f1d2538bbdfdaab1664d9d4c3c75aa9db8" },
25 25 "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
26 26 "lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" },
49 49 "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
50 50 "nvim-neoclip.lua": { "branch": "main", "commit": "798cd0592a81c185465db3a091a0ff8a21af60fd" },
51 51 "nvim-nio": { "branch": "master", "commit": "5a3a06e5df34f1b4fc1500622b10620c49c60da6" },
52 - "nvim-spectre": { "branch": "master", "commit": "31f62d7fc30257b2a5c5327ff7b47719da37a1b4" },
52 + "nvim-spectre": { "branch": "master", "commit": "2b012554a2536465243c0dff3605b5927c49ed23" },
53 53 "nvim-surround": { "branch": "main", "commit": "84a26afce16cffa7e3322cfa80a42cddf60616eb" },
54 54 "nvim-tree.lua": { "branch": "master", "commit": "85c502e9076d9c82e2f04addabb3614846ae7558" },
55 - "nvim-treesitter": { "branch": "master", "commit": "7f3179315959bd762abd0f8dbe0361db805fb2d4" },
55 + "nvim-treesitter": { "branch": "master", "commit": "23ba63028c6acca29be6462c0a291fc4a1b9eae8" },
56 56 "nvim-treesitter-endwise": { "branch": "master", "commit": "60e8c288e011403f248b5f6478dde12bed8a6c55" },
57 57 "nvim-treesitter-textobjects": { "branch": "master", "commit": "d2a4ffc22d9d38d44edb73da007b3cf43451e9b4" },
58 58 "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
59 - "nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
59 + "nvim-ts-context-commentstring": { "branch": "main", "commit": "734ebad31c81c6198dfe102aa23280937c937c42" },
60 60 "nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" },
61 61 "nvim-window": { "branch": "main", "commit": "e7f5d60eeec8ff37af7be4c9a99f65edf67fc574" },
62 62 "oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
66 66 "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
67 67 "qf_helper.nvim": { "branch": "master", "commit": "91dad029c11d1c39b0d1276eda52616f651072be" },
68 68 "resession.nvim": { "branch": "master", "commit": "dc8825439c619030925543a444c4186a2487c200" },
69 - "schemastore.nvim": { "branch": "main", "commit": "65f07cde64d9123eab8639c1a3f7aa7939060cde" },
69 + "schemastore.nvim": { "branch": "main", "commit": "4ce271f0db8b5224b4d69a43a75c13f5b4dcba43" },
70 70 "specs.nvim": { "branch": "main", "commit": "e929006d3f6bb8e43f03e13ac364c67236eb5299" },
71 71 "speedtyper.nvim": { "branch": "main", "commit": "2d158eed4c753995b0501a3a7a72464fbb213e3d" },
72 72 "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
73 73 "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
74 74 "suda.vim": { "branch": "master", "commit": "66727b416837836712975e748bc8a19fb6cf4ec3" },
75 + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
75 76 "telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
76 77 "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" },
77 78 "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
78 79 "tint.nvim": { "branch": "master", "commit": "862835626941d263466754b9c8e2ce2cb004f5ac" },
79 - "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" },
80 + "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" },
80 81 "tree-sitter-nu": { "branch": "main", "commit": "c5b7816043992b1cdc1462a889bc74dc08576fa6" },
81 82 "treesj": { "branch": "main", "commit": "60e27280030f9cd8dfb6ceb335922c6ff76682cc" },
82 83 "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },

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

Modified
11 11 Lua = {
12 12 addonManager = { enable = false, },
13 13 completion = { callSnippet = 'Replace', },
14 - diagnostics = { globals = { 'vim', 'prequire', }, workspaceRate = 50, },
14 + diagnostics = { workspaceRate = 50, },
15 15 hint = { enable = true, setType = true, },
16 16 telemetry = { enable = false, },
17 17 window = { progressBar = true, statusBar = true, },

neovim/lua/bugabinga/lsp/init.lua

Modified
14 14 require 'bugabinga.lsp.lightbulb'
16 16 local token_update = function ( lsp_client )
17 - local token = lsp_client.data.token
18 - local buffer = lsp_client.buffer
19 - local client_id = lsp_client.data.client_id
20 - local mutable_variable_highlight = 'MutableVariable'
17 + local token = lsp_client.data.token
18 + local buffer = lsp_client.buffer
19 + local client_id = lsp_client.data.client_id
20 + local mutable_variable_highlight = 'MutableVariable'
22 - if token.type == 'variable' and not token.modifiers.readonly then
23 - vim.lsp.semantic_tokens.highlight_token( token, buffer, client_id, mutable_variable_highlight )
24 - end
22 + if token.type == 'variable' and not token.modifiers.readonly then
23 + vim.lsp.semantic_tokens.highlight_token( token, buffer, client_id, mutable_variable_highlight )
24 + end
26 - --TODO: find more use cases for semantic tokens
27 - --* global variables
28 - --* functions with side effects
29 - --* closures that capture something
26 + --TODO: find more use cases for semantic tokens
27 + --* global variables
28 + --* functions with side effects
29 + --* closures that capture something
32 32 local expand_path = function ( path )
33 - if vim.fn.executable( path ) == 1 then
34 - return vim.fn.exepath( path )
35 - else
36 - return path
37 - end
33 + if vim.fn.executable( path ) == 1 then
34 + return vim.fn.exepath( path )
35 + else
36 + return path
37 + end
40 40 local expand_command = function ( command )
41 - vim.validate { command = { command, { 'string', 'table', }, }, }
41 + vim.validate { command = { command, { 'string', 'table', }, }, }
43 - if type( command ) == 'table' then
44 - command[1] = expand_path( command[1] )
45 - return command
46 - end
43 + if type( command ) == 'table' then
44 + command[1] = expand_path( command[1] )
45 + return command
46 + end
48 - return expand_path( command )
48 + return expand_path( command )
51 51 local lsp_start = function ( file_type_event )
52 - debug.print 'trying to start lsp'
53 - local match = file_type_event.match
52 + debug.print 'trying to start lsp'
53 + local match = file_type_event.match
55 - debug.print( 'filetypes to ignore', ignored.filetypes, 'current filetype', match )
56 - if vim.iter( ignored.filetypes ):find( match ) then return end
55 + debug.print( 'filetypes to ignore', ignored.filetypes, 'current filetype', match )
56 + if vim.iter( ignored.filetypes ):find( match ) then return end
58 - local bufnr = file_type_event.buf
59 - local buftype = vim.api.nvim_get_option_value( 'buftype', { buf = bufnr, } )
60 - debug.print( 'buftypes to ignore', ignored.buftypes, 'current buftype', buftype )
61 - if vim.iter( ignored.buftypes ):find( buftype ) then return end
58 + local bufnr = file_type_event.buf
59 + local buftype = vim.api.nvim_get_option_value( 'buftype', { buf = bufnr, } )
60 + debug.print( 'buftypes to ignore', ignored.buftypes, 'current buftype', buftype )
61 + if vim.iter( ignored.buftypes ):find( buftype ) then return end
63 - local buffer_path = vim.api.nvim_buf_get_name( bufnr )
63 + local buffer_path = vim.api.nvim_buf_get_name( bufnr )
65 - debug.print( string.format( 'searching lsp client for: match: %s, buffer: %s, path: %s', match, bufnr, buffer_path ) )
65 + debug.print( string.format( 'searching lsp client for: match: %s, buffer: %s, path: %s', match, bufnr, buffer_path ) )
67 - local potential_client_configs = vim.iter( lsp_client_configs )
68 - :map( function ( config )
69 - vim.validate {
70 - ['config'] = { config, 'table', },
71 - ['config.name'] = { config.name, 'string', },
72 - ['config.filetypes'] = { config.filetypes, { 'string', 'table', }, },
73 - ['config.command'] = { config.command, { 'string', 'table', }, },
74 - ['config.environment'] = { config.environment, 'table', true, },
75 - ['config.root_dir'] = { config.root_dir, 'function', 'string', },
76 - ['config.single_file_support'] = { config.single_file_support, 'boolean', true, },
77 - ['config.settings'] = { config.settings, 'table', true, },
78 - ['config.workspaces'] = { config.workspaces, 'boolean', true, },
79 - ['config.before_init'] = { config.before_init, 'function', true, },
80 - ['config.init_options'] = { config.init_options, 'table', true, },
81 - ['config.capabilities'] = { config.capabilities, 'table', true, },
82 - ['config.custom_start'] = { config.custom_start, 'function', true, },
83 - }
84 - -- normalize scalar values to its vector alternative for easier processing later on
85 - -- this mutates the lsp client configs! careful!
86 - config.command = type( config.command ) == 'string' and { expand_command( config.command ), } or
87 - expand_command( config.command )
88 - config.environment = config.environment or {}
89 - config.filetypes = type( config.filetypes ) == 'string' and { config.filetypes, } or config.filetypes
90 - config.single_file_support = config.single_file_support == nil and false or config.single_file_support
91 - config.workspaces = config.workspaces == nil and false or config.workspaces
92 - config.capabilities = config.capabilities or {}
93 - config.init_options = config.init_options or {}
67 + local potential_client_configs = vim.iter( lsp_client_configs )
68 + :map( function ( config )
69 + vim.validate {
70 + ['config'] = { config, 'table', },
71 + ['config.name'] = { config.name, 'string', },
72 + ['config.filetypes'] = { config.filetypes, { 'string', 'table', }, },
73 + ['config.command'] = { config.command, { 'string', 'table', }, },
74 + ['config.environment'] = { config.environment, 'table', true, },
75 + ['config.root_dir'] = { config.root_dir, 'function', 'string', },
76 + ['config.single_file_support'] = { config.single_file_support, 'boolean', true, },
77 + ['config.settings'] = { config.settings, 'table', true, },
78 + ['config.workspaces'] = { config.workspaces, 'boolean', true, },
79 + ['config.before_init'] = { config.before_init, 'function', true, },
80 + ['config.init_options'] = { config.init_options, 'table', true, },
81 + ['config.capabilities'] = { config.capabilities, 'table', true, },
82 + ['config.custom_start'] = { config.custom_start, 'function', true, },
83 + }
84 + -- normalize scalar values to its vector alternative for easier processing later on
85 + -- this mutates the lsp client configs! careful!
86 + config.command = type( config.command ) == 'string' and { expand_command( config.command ), } or
87 + expand_command( config.command )
88 + config.environment = config.environment or {}
89 + config.filetypes = type( config.filetypes ) == 'string' and { config.filetypes, } or config.filetypes
90 + config.single_file_support = config.single_file_support == nil and false or config.single_file_support
91 + config.workspaces = config.workspaces == nil and false or config.workspaces
92 + config.capabilities = config.capabilities or {}
93 + config.init_options = config.init_options or {}
95 - return config
96 - end )
97 - :filter( function ( config )
98 - return vim.iter( config.filetypes ):find( match )
99 - end )
100 - :totable()
95 + return config
96 + end )
97 + :filter( function ( config )
98 + return vim.iter( config.filetypes ):find( match )
99 + end )
100 + :totable()
102 - debug.print( 'POTENTIAL CLIENTS',
103 - vim.iter( potential_client_configs ):map( function ( config )
104 - return {
105 - name = config.name,
106 - command =
107 - config.command,
108 - }
109 - end )
110 - :totable() )
102 + debug.print( 'POTENTIAL CLIENTS',
103 + vim.iter( potential_client_configs ):map( function ( config )
104 + return {
105 + name = config.name,
106 + command =
107 + config.command,
109 + end )
110 + :totable() )
112 - if table.is_empty( potential_client_configs ) then
113 - debug.print( 'found no lsp client for', buffer_path )
114 - return
115 - end
112 + if table.is_empty( potential_client_configs ) then
113 + debug.print( 'found no lsp client for', buffer_path )
114 + return
115 + end
117 - -- TODO: LspStart
118 - -- TODO: LspStop
117 + -- TODO: LspStart
118 + -- TODO: LspStop
120 - local project_local_lsp_settings = localrc( '.lsp.settings.lua', 'table' ) or {}
120 + --NOTE: this is super kool but has the limitation, that only lsp clients
121 + -- configured via my special lsp module are affected.
122 + local project_local_lsp_settings = localrc( '.lsp.settings.lua', 'table' ) or {}
122 - for _, config in ipairs( potential_client_configs ) do
123 - local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
124 - local capabilities = vim.lsp.protocol.make_client_capabilities()
125 - capabilities = table.extend( 'force', capabilities, config.capabilities )
124 + for _, config in ipairs( potential_client_configs ) do
125 + local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
126 + local capabilities = vim.lsp.protocol.make_client_capabilities()
127 + capabilities = table.extend( 'force', capabilities, config.capabilities )
127 - debug.print( 'starting command:', config.command )
129 + local settings = config.settings
130 + local settings_override = project_local_lsp_settings[config.name]
131 + if settings_override then
132 + debug.print( 'overriding settings with project local settings', settings, settings_override )
133 + settings = vim.tbl_deep_extend( 'force', settings, settings_override )
134 + end
129 - local start_config = {
130 - cmd = config.command,
131 - cmd_cwd = root_dir,
132 - -- cmd_env = config.environment,
133 - detached = false, -- do i want this?
134 - root_dir = root_dir,
135 - -- workspace_folders = { config.root_dir(buffer_path) }, -- TODO: i think workspaces can only ever be declared per project. i cannot think of a generic way to calculate those, like with root_dir. maybe a toml/ini file in root_dir sets these?
136 - capabilities = capabilities,
137 - -- handlers = vim.lsp.handlers,
138 - settings = config.settings,
139 - -- commands = nil, -- what is this?
140 - init_options = config.init_options,
141 - name = config.name,
142 - -- get_language_id = nil,
143 - -- offset_encoding = nil,
144 - on_error = function ( code, ... ) vim.print( 'LSP ERROR', code, ... ) end,
145 - before_init = config.before_init,
146 - -- on_init = nil, -- should i send workspace/didChangeConfiguration here?
147 - on_exit = function ( code, signal, client_id ) debug.print( 'LSP CLIENT EXIT', code, signal, client_id ) end,
148 - on_attach = function ( client, attach_bufnr ) debug.print( 'LSP CLIENT ATTACH', client, attach_bufnr ) end,
149 - trace = debug.get() and 'on' or 'off',
150 - flags = { allow_incremental_sync = true, debounce_text_changes = 250, exit_timeout = 200, },
151 - }
136 + debug.print( 'starting command:', config.command )
153 - local lsp_starter = config.custom_start or vim.lsp.start
138 + local start_config = {
139 + cmd = config.command,
140 + cmd_cwd = root_dir,
141 + -- cmd_env = config.environment,
142 + detached = false, -- do i want this?
143 + root_dir = root_dir,
144 + -- workspace_folders = { config.root_dir(buffer_path) }, -- TODO: i think workspaces can only ever be declared per project. i cannot think of a generic way to calculate those, like with root_dir. maybe a toml/ini file in root_dir sets these?
145 + capabilities = capabilities,
146 + -- handlers = vim.lsp.handlers,
147 + settings = settings,
148 + -- commands = nil, -- what is this?
149 + init_options = config.init_options,
150 + name = config.name,
151 + -- get_language_id = nil,
152 + -- offset_encoding = nil,
153 + on_error = function ( code, ... ) vim.print( 'LSP ERROR', code, ... ) end,
154 + before_init = config.before_init,
155 + -- on_init = nil, -- should i send workspace/didChangeConfiguration here?
156 + on_exit = function ( code, signal, client_id ) debug.print( 'LSP CLIENT EXIT', code, signal, client_id ) end,
157 + on_attach = function ( client, attach_bufnr ) debug.print( 'LSP CLIENT ATTACH', client, attach_bufnr ) end,
158 + trace = debug.get() and 'on' or 'off',
159 + flags = { allow_incremental_sync = true, debounce_text_changes = 250, exit_timeout = 200, },
155 - debug.print( 'starting lsp', start_config.name, root_dir )
162 + local lsp_starter = config.custom_start or vim.lsp.start
157 - lsp_starter( start_config, {
158 - bufnr = bufnr,
159 - -- TODO: reuse if workspaces
160 - -- local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
161 - reuse_client = function ( existing_client, new_config )
162 - debug.print(
163 - 'lsp resuse client',
164 - existing_client.name,
165 - existing_client.workspace_folders,
166 - new_config.name,
167 - new_config.root_dir
168 - )
164 + debug.print( 'starting lsp', start_config.name, root_dir )
170 - --TODO lsps with single file or worksopaces support do not need smame root dir. instead add_workspace_folder
171 - local same_name = existing_client.name == new_config.name
166 + lsp_starter( start_config, {
167 + bufnr = bufnr,
168 + -- TODO: reuse if workspaces
169 + -- local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
170 + reuse_client = function ( existing_client, new_config )
171 + debug.print(
172 + 'lsp resuse client',
173 + existing_client.name,
174 + existing_client.workspace_folders,
175 + new_config.name,
176 + new_config.root_dir
173 - local new_root_raw = new_config.root_dir or nil
174 - local existing_root_raw = existing_client.workspace_folders and #existing_client.workspace_folders >= 1 and
175 - existing_client.workspace_folders[1].name or nil
179 + --TODO lsps with single file or worksopaces support do not need smame root dir. instead add_workspace_folder
180 + local same_name = existing_client.name == new_config.name
177 - if not (new_root_raw and existing_root_raw) then return false end
182 + local new_root_raw = new_config.root_dir or nil
183 + local existing_root_raw = existing_client.workspace_folders and #existing_client.workspace_folders >= 1 and
184 + existing_client.workspace_folders[1].name or nil
179 - local new_root = vim.fs.normalize( new_root_raw )
180 - local existing_root = vim.fs.normalize( existing_root_raw )
181 - local same_root = new_root == existing_root
186 + if not (new_root_raw and existing_root_raw) then return false end
183 - local reuse = same_name and same_root
184 - debug.print( 'reusing lsp client?', reuse )
185 - return reuse
186 - end,
187 - } )
188 + local new_root = vim.fs.normalize( new_root_raw )
189 + local existing_root = vim.fs.normalize( existing_root_raw )
190 + local same_root = new_root == existing_root
189 - debug.print( 'ATTACHING LSP CLIENT', config.name )
190 - end
192 + local reuse = same_name and same_root
193 + debug.print( 'reusing lsp client?', reuse )
194 + return reuse
195 + end,
196 + } )
198 + debug.print( 'ATTACHING LSP CLIENT', config.name )
199 + end
193 202 local old_formatexpr
197 206 local keybinds = {}
198 207 local add = function ( client_id, keybind_remover )
199 - vim.validate {
200 - client_id = { client_id, 'number', },
201 - keybind_remover = { keybind_remover, 'function', },
202 - }
203 - if not table.contains( keybinds, client_id ) then
204 - keybinds[client_id] = {}
205 - end
206 - table.insert( keybinds[client_id], keybind_remover )
208 + vim.validate {
209 + client_id = { client_id, 'number', },
210 + keybind_remover = { keybind_remover, 'function', },
212 + if not table.contains( keybinds, client_id ) then
213 + keybinds[client_id] = {}
214 + end
215 + table.insert( keybinds[client_id], keybind_remover )
209 218 local lsp_attach = function ( args )
210 - local bufnr = args.buf
211 - local client_id = args.data.client_id
212 - local client = vim.lsp.get_client_by_id( client_id )
213 - if not client then return end
219 + local bufnr = args.buf
220 + local client_id = args.data.client_id
221 + local client = vim.lsp.get_client_by_id( client_id )
222 + if not client then return end
215 - debug.print( client.server_capabilities )
224 + debug.print( client.server_capabilities )
217 - if client.server_capabilities.definitionProvider then
218 - old_tagfunc = vim.bo[bufnr].tagfunc
219 - vim.bo[bufnr].tagfunc = 'v:lua.vim.lsp.tagfunc'
220 - end
226 + if client.server_capabilities.definitionProvider then
227 + old_tagfunc = vim.bo[bufnr].tagfunc
228 + vim.bo[bufnr].tagfunc = 'v:lua.vim.lsp.tagfunc'
229 + end
222 - if client.server_capabilities.documentFormattingProvider then
223 - old_formatexpr = vim.bo[bufnr].formatexpr
224 - vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr'
225 - end
231 + if client.server_capabilities.documentFormattingProvider then
232 + old_formatexpr = vim.bo[bufnr].formatexpr
233 + vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr'
234 + end
227 - if client.server_capabilities.completionProvider then
228 - old_omnifunc = vim.bo[bufnr].omnifunc
229 - vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
230 - end
236 + if client.server_capabilities.completionProvider then
237 + old_omnifunc = vim.bo[bufnr].omnifunc
238 + vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
239 + end
232 - if client.server_capabilities.documentSymbolProvider then
233 - local navic_ok, navic = pcall( require, 'nvim-navic' )
234 - if navic_ok then
235 - navic.attach( client, bufnr )
236 - else
237 - vim.notify 'nvim-navic not found. could not attach to lsp client.'
238 - end
239 - local navbuddy_ok, navbuddy = pcall( require, 'nvim-navbuddy' )
240 - if navbuddy_ok then
241 - navbuddy.attach( client, bufnr )
242 - map.normal {
243 - description = 'Open overview of symbols in current buffer',
244 - category = 'lsp',
245 - keys = '<leader>lo',
246 - command = function () navbuddy.open( bufnr ) end,
247 - buffer = bufnr,
248 - }
249 - else
250 - vim.notify 'nvim-navbuddy not found. could not attach to lsp client.'
251 - end
252 - end
241 + if client.server_capabilities.documentSymbolProvider then
242 + local navic_ok, navic = pcall( require, 'nvim-navic' )
243 + if navic_ok then
244 + navic.attach( client, bufnr )
245 + else
246 + vim.notify 'nvim-navic not found. could not attach to lsp client.'
247 + end
248 + local navbuddy_ok, navbuddy = pcall( require, 'nvim-navbuddy' )
249 + if navbuddy_ok then
250 + navbuddy.attach( client, bufnr )
251 + map.normal {
252 + description = 'Open overview of symbols in current buffer',
253 + category = 'lsp',
254 + keys = '<leader>lo',
255 + command = function () navbuddy.open( bufnr ) end,
256 + buffer = bufnr,
258 + else
259 + vim.notify 'nvim-navbuddy not found. could not attach to lsp client.'
260 + end
261 + end
254 - local lsp_signature_ok, lsp_signature = pcall( require, 'lsp_signature' )
255 - if lsp_signature_ok then
256 - lsp_signature.on_attach( {}, bufnr )
257 - end
263 + local lsp_signature_ok, lsp_signature = pcall( require, 'lsp_signature' )
264 + if lsp_signature_ok then
265 + lsp_signature.on_attach( {}, bufnr )
266 + end
259 - if client.server_capabilities.documentHighlightProvider then
260 - -- the timer has application lifetime. no need to close
261 - local delay = 300
262 - local debounced_highlight = defer.debounce_leading( vim.lsp.buf.document_highlight, delay )
263 - local debounced_clear = defer.debounce_leading( vim.lsp.buf.clear_references, delay )
268 + if client.server_capabilities.documentHighlightProvider then
269 + -- the timer has application lifetime. no need to close
270 + local delay = 300
271 + local debounced_highlight = defer.debounce_leading( vim.lsp.buf.document_highlight, delay )
272 + local debounced_clear = defer.debounce_leading( vim.lsp.buf.clear_references, delay )
265 - auto 'document_highlight' {
266 - {
267 - description = 'Highlight symbol under cursor on hold',
268 - events = 'CursorHold',
269 - buffer = bufnr,
270 - command = debounced_highlight,
271 - },
272 - {
273 - description = 'Remove highlight from symbol under cursor on move',
274 - events = { 'CursorMoved', 'InsertEnter', },
275 - buffer = bufnr,
276 - command = debounced_clear,
277 - },
278 - }
279 - end
274 + auto 'document_highlight' {
276 + description = 'Highlight symbol under cursor on hold',
277 + events = 'CursorHold',
278 + buffer = bufnr,
279 + command = debounced_highlight,
280 + },
282 + description = 'Remove highlight from symbol under cursor on move',
283 + events = { 'CursorMoved', 'InsertEnter', },
284 + buffer = bufnr,
285 + command = debounced_clear,
286 + },
288 + end
281 - if client.server_capabilities.inlayHintProvider then
282 - add( client_id, map.normal {
283 - description = 'Toggle inlay hints',
284 - category = 'lsp',
285 - buffer = bufnr,
286 - keys = '<leader>ti',
287 - command = function ()
288 - vim.lsp.inlay_hint.enable( bufnr, nil )
289 - end,
290 - } )
291 - end
290 + if client.server_capabilities.inlayHintProvider then
291 + add( client_id, map.normal {
292 + description = 'Toggle inlay hints',
293 + category = 'lsp',
294 + buffer = bufnr,
295 + keys = '<leader>ti',
296 + command = function ()
297 + vim.lsp.inlay_hint.enable( bufnr, nil )
298 + end,
299 + } )
300 + end
293 - add( client_id, map.normal {
294 - description = 'Show hover documentation above cursor.',
295 - category = 'lsp',
296 - buffer = bufnr,
297 - keys = { 'K', '<leader>lk', },
298 - command = vim.lsp.buf.hover,
299 - } )
302 + add( client_id, map.normal {
303 + description = 'Show hover documentation above cursor.',
304 + category = 'lsp',
305 + buffer = bufnr,
306 + keys = { 'K', '<leader>lk', },
307 + command = vim.lsp.buf.hover,
308 + } )
301 - add( client_id, map.normal {
302 - description = 'Show signature help under cursor.',
303 - category = 'lsp',
304 - buffer = bufnr,
305 - keys = { 'H', '<leader>ls', },
306 - command = vim.lsp.buf.signature_help,
307 - } )
310 + add( client_id, map.normal {
311 + description = 'Show signature help under cursor.',
312 + category = 'lsp',
313 + buffer = bufnr,
314 + keys = { 'H', '<leader>ls', },
315 + command = vim.lsp.buf.signature_help,
316 + } )
309 - add( client_id, map.normal {
310 - description = 'Show available code actions on current line.',
311 - category = 'lsp',
312 - buffer = bufnr,
313 - keys = '<leader>la',
314 - command = vim.lsp.buf.code_action,
315 - } )
318 + add( client_id, map.normal {
319 + description = 'Show available code actions on current line.',
320 + category = 'lsp',
321 + buffer = bufnr,
322 + keys = '<leader>la',
323 + command = vim.lsp.buf.code_action,
324 + } )
317 - add( client_id, map.normal {
318 - description = 'Goto to definition of symbol under cursor.',
319 - category = 'lsp',
320 - buffer = bufnr,
321 - keys = '<leader>ld',
322 - command = vim.lsp.buf.definition,
323 - } )
326 + add( client_id, map.normal {
327 + description = 'Goto to definition of symbol under cursor.',
328 + category = 'lsp',
329 + buffer = bufnr,
330 + keys = '<leader>ld',
331 + command = vim.lsp.buf.definition,
332 + } )
325 - add( client_id, map.normal {
326 - description = 'Show implementations of symbol under cursor.',
327 - category = 'lsp',
328 - buffer = bufnr,
329 - keys = '<leader>li',
330 - command = vim.lsp.buf.implementation,
331 - } )
334 + add( client_id, map.normal {
335 + description = 'Show implementations of symbol under cursor.',
336 + category = 'lsp',
337 + buffer = bufnr,
338 + keys = '<leader>li',
339 + command = vim.lsp.buf.implementation,
340 + } )
333 - add( client_id, map.normal {
334 - description = 'Show incoming calls of symbol under cursor.',
335 - category = 'lsp',
336 - buffer = bufnr,
337 - keys = '<leader>lci',
338 - command = vim.lsp.buf.incoming_calls,
339 - } )
342 + add( client_id, map.normal {
343 + description = 'Show incoming calls of symbol under cursor.',
344 + category = 'lsp',
345 + buffer = bufnr,
346 + keys = '<leader>lci',
347 + command = vim.lsp.buf.incoming_calls,
348 + } )
341 - add( client_id, map.normal {
342 - description = 'Show outgoing calls of symbol under cursor.',
343 - category = 'lsp',
344 - buffer = bufnr,
345 - keys = '<leader>lco',
346 - command = vim.lsp.buf.outgoing_calls,
347 - } )
350 + add( client_id, map.normal {
351 + description = 'Show outgoing calls of symbol under cursor.',
352 + category = 'lsp',
353 + buffer = bufnr,
354 + keys = '<leader>lco',
355 + command = vim.lsp.buf.outgoing_calls,
356 + } )
349 - add( client_id, map.normal {
350 - description = 'Show references of symbol under cursor.',
351 - category = 'lsp',
352 - buffer = bufnr,
353 - keys = '<leader>ln',
354 - command = vim.lsp.buf.references,
355 - } )
358 + add( client_id, map.normal {
359 + description = 'Show references of symbol under cursor.',
360 + category = 'lsp',
361 + buffer = bufnr,
362 + keys = '<leader>ln',
363 + command = vim.lsp.buf.references,
364 + } )
357 - add( client_id, map.normal {
358 - description = 'Rename symbol under cursor.',
359 - category = 'lsp',
360 - buffer = bufnr,
361 - keys = { '<f2>', '<leader>lr', },
362 - command = vim.lsp.buf.rename,
363 - } )
366 + add( client_id, map.normal {
367 + description = 'Rename symbol under cursor.',
368 + category = 'lsp',
369 + buffer = bufnr,
370 + keys = { '<f2>', '<leader>lr', },
371 + command = vim.lsp.buf.rename,
372 + } )
366 375 local lsp_detach = function ( args )
367 - debug.print( 'DETACH LSP', args )
376 + debug.print( 'DETACH LSP', args )
369 - local bufnr = args.buf
370 - local client_id = args.data.client_id
371 - local client = vim.lsp.get_client_by_id( client_id )
372 - if not client then return end
378 + local bufnr = args.buf
379 + local client_id = args.data.client_id
380 + local client = vim.lsp.get_client_by_id( client_id )
381 + if not client then return end
374 - if client.server_capabilities.definitionProvider then
375 - vim.bo[bufnr].tagfunc = old_tagfunc
376 - end
383 + if client.server_capabilities.definitionProvider then
384 + vim.bo[bufnr].tagfunc = old_tagfunc
385 + end
378 - if client.server_capabilities.documentFormattingProvider then
379 - vim.bo[bufnr].formatexpr = old_formatexpr
380 - end
387 + if client.server_capabilities.documentFormattingProvider then
388 + vim.bo[bufnr].formatexpr = old_formatexpr
389 + end
382 - if client.server_capabilities.completionProvider then
383 - vim.bo[bufnr].omnifunc = old_omnifunc
384 - end
391 + if client.server_capabilities.completionProvider then
392 + vim.bo[bufnr].omnifunc = old_omnifunc
393 + end
386 - if table.contains( keybinds, client_id ) then
387 - for _, keybind_delete in ipairs( keybinds[client_id] ) do
388 - keybind_delete()
389 - end
390 - end
395 + if table.contains( keybinds, client_id ) then
396 + for _, keybind_delete in ipairs( keybinds[client_id] ) do
397 + keybind_delete()
398 + end
399 + end
393 402 auto 'lsp' {
394 - {
395 - description = 'Start or reuse LSP client',
396 - events = 'FileType',
397 - command = lsp_start,
398 - },
399 - {
400 - description = 'Hook: LSP client attached to buffer',
401 - events = 'LspAttach',
402 - command = lsp_attach,
403 - },
404 - {
405 - description = 'Hook: LSP client detached from buffer',
406 - events = 'LspDetach',
407 - command = lsp_detach,
408 - },
409 - {
410 - description = 'Semantic Tokens from the LSP',
411 - events = 'LspTokenUpdate',
412 - command = token_update,
413 - },
404 + description = 'Start or reuse LSP client',
405 + events = 'FileType',
406 + command = lsp_start,
407 + },
409 + description = 'Hook: LSP client attached to buffer',
410 + events = 'LspAttach',
411 + command = lsp_attach,
412 + },
414 + description = 'Hook: LSP client detached from buffer',
415 + events = 'LspDetach',
416 + command = lsp_detach,
417 + },
419 + description = 'Semantic Tokens from the LSP',
420 + events = 'LspTokenUpdate',
421 + command = token_update,
422 + },
416 425 local lsp_info = function ( command )
417 - local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0, }
418 - local active_clients = vim.lsp.get_clients( all_or_current )
426 + local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0, }
427 + local active_clients = vim.lsp.get_clients( all_or_current )
420 - local infos = vim.iter( active_clients )
421 - :map( function ( client )
422 - local name = client.name
423 - local config = vim.iter( lsp_client_configs ):find( function ( config ) return config.name == name end )
424 - assert( config, ('How did we not find a config for %s ?!?!'):format( name ) )
429 + local infos = vim.iter( active_clients )
430 + :map( function ( client )
431 + local name = client.name
432 + local config = vim.iter( lsp_client_configs ):find( function ( config ) return config.name == name end )
433 + assert( config, ('How did we not find a config for %s ?!?!'):format( name ) )
426 - local full_cmd = table.deep_copy( client.config.cmd )
427 - full_cmd[1] = vim.fn.exepath( full_cmd[1] )
428 - local basic = {
429 - id = client.id,
430 - name = name,
431 - cmd = table.concat( full_cmd, ' ' ),
432 - workspace_folders = vim.iter( client.workspace_folders ):map( function ( w ) return vim.fs.normalize( w.name ) end )
433 - :totable(),
434 - filetypes = table.concat( config.filetypes, ', ' ),
435 - single_file_support = config.single_file_support,
436 - workspaces = config.workspaces,
437 - }
438 - return basic
439 - end )
440 - :totable()
435 + local full_cmd = table.deep_copy( client.config.cmd )
436 + full_cmd[1] = vim.fn.exepath( full_cmd[1] )
437 + local basic = {
438 + id = client.id,
439 + name = name,
440 + cmd = table.concat( full_cmd, ' ' ),
441 + workspace_folders = vim.iter( client.workspace_folders ):map( function ( w ) return vim.fs.normalize( w.name ) end )
442 + :totable(),
443 + filetypes = table.concat( config.filetypes, ', ' ),
444 + single_file_support = config.single_file_support,
445 + workspaces = config.workspaces,
447 + return basic
448 + end )
449 + :totable()
442 - ui.show_tree( infos )
451 + ui.show_tree( infos )
445 454 local lsp_info_extended = function ( command )
446 - local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0, }
447 - local active_clients = vim.lsp.get_clients( all_or_current )
448 - ui.show_tree( active_clients )
455 + local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0, }
456 + local active_clients = vim.lsp.get_clients( all_or_current )
457 + ui.show_tree( active_clients )
451 460 user_command( 'LspInfo', lsp_info, {
452 - nargs = '?',
453 - complete = function () return { 'all', } end,
454 - desc = 'Shows basic information about running LSP clients.',
461 + nargs = '?',
462 + complete = function () return { 'all', } end,
463 + desc = 'Shows basic information about running LSP clients.',
457 466 user_command( 'LspInfoExtended', lsp_info_extended, {
458 - nargs = '?',
459 - complete = function () return { 'all', } end,
460 - desc = 'Shows detailed information about running LSP clients.',
467 + nargs = '?',
468 + complete = function () return { 'all', } end,
469 + desc = 'Shows detailed information about running LSP clients.',
463 472 -- TODO: lsp restart, lsp exit
465 474 -- TODO: move to std.icons.lua
466 475 local completion_icons = {
467 - Class = ' ',
468 - Color = ' ',
469 - Constant = ' ',
470 - Constructor = ' ',
471 - Enum = ' ',
472 - EnumMember = ' ',
473 - Field = '󰄶 ',
474 - File = ' ',
475 - Folder = ' ',
476 - Function = ' ',
477 - Interface = '󰜰',
478 - Keyword = '󰌆 ',
479 - Method = 'ƒ ',
480 - Module = '󰏗 ',
481 - Property = ' ',
482 - Snippet = '󰘍 ',
483 - Struct = ' ',
484 - Text = ' ',
485 - Unit = ' ',
486 - Value = '󰎠 ',
487 - Variable = ' ',
476 + Class = ' ',
477 + Color = ' ',
478 + Constant = ' ',
479 + Constructor = ' ',
480 + Enum = ' ',
481 + EnumMember = ' ',
482 + Field = '󰄶 ',
483 + File = ' ',
484 + Folder = ' ',
485 + Function = ' ',
486 + Interface = '󰜰',
487 + Keyword = '󰌆 ',
488 + Method = 'ƒ ',
489 + Module = '󰏗 ',
490 + Property = ' ',
491 + Snippet = '󰘍 ',
492 + Struct = ' ',
493 + Text = ' ',
494 + Unit = ' ',
495 + Value = '󰎠 ',
496 + Variable = ' ',
490 499 local completion_kinds = vim.lsp.protocol.CompletionItemKind
491 500 for i, kind in ipairs( completion_kinds ) do
492 - completion_kinds[i] = completion_icons[kind] or kind
501 + completion_kinds[i] = completion_icons[kind] or kind
495 504 return setmetatable( _, {} )

neovim/lua/bugabinga/options/commands.lua

Modified
5 5 light_up.buffer( 0, group_names )
8 ---TODO: use facade
9 8 vim.api.nvim_create_user_command(
10 9 'LightUp',
11 10 light_up_current_buffer,

neovim/lua/bugabinga/options/ui.lua

Modified
8 8 pattern = '*',
9 9 command = function () vim.highlight.on_yank() end,
11 12 auto 'disable_columns_in_special_buffers' {
12 13 description = 'Hide columns in buffers, that do not show source code.',
13 14 events = { 'FileType', },

neovim/lua/bugabinga/plugins/cmp.lua

Modified
7 7 command = function () prequire 'cmp'.complete() end,
10 ---TODO: use facade
11 10 vim.api.nvim_create_user_command( 'CmpInfo', function ()
12 11 prequire 'cmp'.status()
13 12 end, {} )

neovim/lua/bugabinga/plugins/fidget.lua

Modified
6 6 event = 'VeryLazy',
7 7 opts = {
8 8 progress = {
9 - suppress_on_insert = true, -- Suppress new messages while in insert mode
9 + poll_rate = 500, -- How and when to poll for progress messages
10 + suppress_on_insert = true, -- Suppress new messages while in insert mode
10 11 lsp = {
11 - log_handler = debug.get, -- Log `$/progress` handler invocations (for debugging)
12 + log_handler = debug.get(), -- Log `$/progress` handler invocations (for debugging)
14 15 notification = {
15 - filter = debug.get and vim.log.levels.DEBUG,
16 - override_vim_notify = false, -- Automatically override vim.notify() with Fidget
16 + filter = debug.get() and vim.log.levels.DEBUG or vim.log.levels.INFO,
17 + override_vim_notify = true, -- Automatically override vim.notify() with Fidget

neovim/lua/bugabinga/plugins/spectre.lua

Modified
61 61 local spectre_oxi_dir = vim.fs.joinpath( plugin_spec.dir, 'spectre_oxi' )
62 - vim.uv.chdir( spectre_oxi_dir )
64 - local cargo_build_proc = vim.system( { 'cargo', 'build', '--release', }, { text = true, } ):wait()
63 + local cargo_build_proc = vim.system(
64 + { 'cargo', 'build', '--release', },
65 + { text = true, cwd = spectre_oxi_dir, }
66 + ):wait()
65 67 if cargo_build_proc.code ~= 0 then error( cargo_build_proc.stderr ) end
67 - local cp_proc = vim.system( copy_cmd, { text = true, } ):wait()
69 + local cp_proc = vim.system(
70 + copy_cmd,
71 + { text = true, cwd = spectre_oxi_dir, }
72 + ):wait()
68 73 if cp_proc.code ~= 0 then error( cp_proc.stderr ) end
70 - local rm_proc = vim.system( { 'rm', '-r', '-f', 'target', }, { text = true, } ):wait()
75 + local rm_proc = vim.system(
76 + { 'rm', '-r', '-f', 'target', },
77 + { text = true, cwd = spectre_oxi_dir, }
78 + ):wait()
71 79 if rm_proc.code ~= 0 then error( rm_proc.stderr ) end
73 81 vim.print 'Building oxi done'

neovim/lua/bugabinga/plugins/ssr.lua

Modified
9 9 command = open_ssr,
12 ---FIXME: use custom facade
13 12 vim.api.nvim_create_user_command( 'StructuralSearchAndReplace', open_ssr, { bang = true, } )
15 14 return {

neovim/lua/bugabinga/plugins/tasks.lua

Modified
1 ---FIXME: own this and integrate
2 -return {
3 - {
4 - 'stevearc/resession.nvim',
5 - lazy = true,
6 - opts = {
7 - extensions = {
8 - overseer = {
9 - status = { 'RUNNING', },
10 - },
11 - },
12 - },
13 - },
14 - {
15 - 'stevearc/overseer.nvim',
16 - cmd = {
17 - 'Grep',
18 - 'Make',
19 - 'OverseerDebugParser',
20 - 'OverseerInfo',
21 - 'OverseerOpen',
22 - 'OverseerRun',
23 - 'OverseerRunCmd',
24 - 'OverseerToggle',
25 - },
26 - keys = {
27 - { '<leader>oo', '<cmd>OverseerToggle<CR>', mode = 'n', },
28 - { '<leader>or', '<cmd>OverseerRun<CR>', mode = 'n', },
29 - { '<leader>oc', '<cmd>OverseerRunCmd<CR>', mode = 'n', },
30 - { '<leader>ol', '<cmd>OverseerLoadBundle<CR>', mode = 'n', },
31 - { '<leader>ob', '<cmd>OverseerToggle! bottom<CR>', mode = 'n', },
32 - { '<leader>od', '<cmd>OverseerQuickAction<CR>', mode = 'n', },
33 - { '<leader>os', '<cmd>OverseerTaskAction<CR>', mode = 'n', },
34 - },
35 - opts = {
36 - templates = { builtin = true, },
37 - strategy = { 'jobstart', },
38 - dap = false,
39 - log = {
40 - {
41 - type = 'echo',
42 - level = vim.log.levels.WARN,
43 - },
44 - {
45 - type = 'file',
46 - filename = 'overseer.log',
47 - level = vim.log.levels.DEBUG,
48 - },
49 - },
50 - task_launcher = {
51 - bindings = {
52 - n = {
53 - ['<leader>c'] = 'Cancel',
54 - },
55 - },
56 - },
57 - component_aliases = {
58 - default = {
59 - {
60 - 'display_duration',
61 - detail_level = 2,
62 - },
63 - 'on_output_summarize',
64 - 'on_exit_set_status',
65 - { 'on_complete_notify', system = 'unfocused', },
66 - 'on_complete_dispose',
67 - },
68 - default_neotest = {
69 - 'unique',
70 - { 'on_complete_notify', system = 'unfocused', on_change = true, },
71 - 'default',
72 - },
73 - },
74 - post_setup = {},
75 - },
76 - config = function ( _, opts )
77 - opts.templates = vim.tbl_keys( opts.templates )
78 - local overseer = require 'overseer'
79 - overseer.setup( opts )
80 - for _, cb in pairs( opts.post_setup ) do
81 - cb()
82 - end
83 - vim.api.nvim_create_user_command( 'OverseerDebugParser', 'lua require("overseer").debug_parser()', {} )
84 - vim.api.nvim_create_user_command( 'Grep', function ( params )
85 - local args = vim.fn.expandcmd( params.args )
86 - -- Insert args at the '$*' in the grepprg
87 - local cmd, num_subs = vim.o.grepprg:gsub( '%$%*', args )
88 - if num_subs == 0 then
89 - cmd = cmd .. ' ' .. args
90 - end
91 - local cwd
92 - local has_oil, oil = pcall( require, 'oil' )
93 - if has_oil then
94 - cwd = oil.get_current_dir()
95 - end
96 - local task = overseer.new_task {
97 - cmd = cmd,
98 - cwd = cwd,
99 - name = 'grep ' .. args,
100 - components = {
101 - {
102 - 'on_output_quickfix',
103 - errorformat = vim.o.grepformat,
104 - open = not params.bang,
105 - open_height = 8,
106 - items_only = true,
107 - },
108 - -- We don't care to keep this around as long as most tasks
109 - { 'on_complete_dispose', timeout = 30, },
110 - 'default',
111 - },
112 - }
113 - task:start()
114 - end, { nargs = '*', bang = true, bar = true, complete = 'file', } )
1 +local map = require 'std.map'
2 +local user_command = require 'std.user_command'
116 - vim.api.nvim_create_user_command( 'Make', function ( params )
117 - -- Insert args at the '$*' in the makeprg
118 - local cmd, num_subs = vim.o.makeprg:gsub( '%$%*', params.args )
119 - if num_subs == 0 then
120 - cmd = cmd .. ' ' .. params.args
121 - end
122 - local task = require 'overseer'.new_task {
123 - cmd = vim.fn.expandcmd( cmd ),
124 - components = {
125 - { 'on_output_quickfix', open = not params.bang, open_height = 8, },
126 - 'unique',
127 - 'default',
128 - },
129 - }
130 - task:start()
131 - end, {
132 - desc = 'Run your makeprg as an Overseer task',
133 - nargs = '*',
134 - bang = true,
135 - } )
136 - end,
137 - }, }
4 +map.normal {
5 + description = 'Toggle task view',
6 + category = 'tasks',
7 + keys = '<leader>99',
8 + command = function () prequire 'overseer'.toggle { enter = true, direction = 'right', } end,
9 +}
11 +map.normal {
12 + description = 'Run task',
13 + category = 'tasks',
14 + keys = '<leader>9r',
15 + command = function () prequire 'overseer'._run_template() end,
18 +map.normal {
19 + description = 'Run any command as task',
20 + category = 'tasks',
21 + keys = '<leader>9c',
22 + command = function () prequire 'overseer'._run_command() end,
25 +map.normal {
26 + description = 'Load task bundle',
27 + category = 'tasks',
28 + keys = '<leader>9r',
29 + command = function () prequire 'overseer'._load_bundle() end,
32 +map.normal {
33 + description = 'Run an action on the most recent task, or the task under the cursor',
34 + category = 'tasks',
35 + keys = '<leader>9d',
36 + command = function () prequire 'overseer'._quick_action() end,
39 +map.normal {
40 + description = 'Select a task to run an action on',
41 + category = 'tasks',
42 + keys = '<leader>9s',
43 + command = function () prequire 'overseer'._task_action() end,
46 +map.normal {
47 + description = 'Display diagnostic information about overseer',
48 + category = 'tasks',
49 + keys = '<leader>9i',
50 + command = function () prequire 'overseer'._info() end,
53 +user_command.OverseerDebugParser
54 +'Open a tab with windows laid out for debugging a parser' (
55 + function ()
56 + prequire 'overseer'.debug_parser()
57 + end
58 + )
60 +user_command.Grep
61 +'Run your grepprg as an Overseer task'
62 + { nargs = '*', bang = true, bar = true, complete = 'file', } (
63 + function ( params )
64 + local args = vim.fn.expandcmd( params.args )
65 + -- Insert args at the '$*' in the grepprg
66 + local cmd, num_subs = vim.o.grepprg:gsub( '%$%*', args )
67 + if num_subs == 0 then
68 + cmd = cmd .. ' ' .. args
69 + end
70 + local cwd
71 + prequire( 'oil', function ( oil )
72 + cwd = oil.get_current_dir()
73 + end )
74 + local task = prequire 'overseer'.new_task {
75 + cmd = cmd,
76 + cwd = cwd,
77 + name = 'grep ' .. args,
78 + components = {
79 + {
80 + 'on_output_quickfix',
81 + errorformat = vim.o.grepformat,
82 + open = not params.bang,
83 + open_height = 8,
84 + items_only = true,
85 + },
86 + -- We don't care to keep this around as long as most tasks
87 + { 'on_complete_dispose', timeout = 30, },
88 + 'default',
89 + },
90 + }
91 + task:start()
92 + end
93 + )
95 +user_command.Make
96 +'Run your makeprg as an Overseer task'
97 + { nargs = '*', bang = true, } (
98 + function ( params )
99 + -- Insert args at the '$*' in the makeprg
100 + local cmd, num_subs = vim.o.makeprg:gsub( '%$%*', params.args )
101 + if num_subs == 0 then
102 + cmd = cmd .. ' ' .. params.args
103 + end
104 + local task = prequire 'overseer'.new_task {
105 + cmd = vim.fn.expandcmd( cmd ),
106 + components = {
107 + { 'on_output_quickfix', open = not params.bang, open_height = 8, },
108 + 'unique',
109 + 'default',
110 + },
112 + task:start()
113 + end
116 +return {
118 + 'stevearc/resession.nvim',
119 + lazy = true,
120 + opts = {
121 + extensions = {
122 + overseer = {
123 + status = { 'RUNNING', },
124 + },
125 + },
126 + },
127 + },
129 + 'stevearc/overseer.nvim',
130 + opts = {
131 + strategy = { 'jobstart', },
132 + dap = false,
133 + log = {
135 + type = 'echo',
136 + level = vim.log.levels.WARN,
137 + },
139 + type = 'file',
140 + filename = 'overseer.log',
141 + level = vim.log.levels.DEBUG,
142 + },
143 + },
144 + component_aliases = {
145 + default = {
147 + 'display_duration',
148 + detail_level = 2,
149 + },
150 + 'on_output_summarize',
151 + 'on_exit_set_status',
152 + { 'on_complete_notify', system = 'unfocused', },
153 + 'on_complete_dispose',
154 + },
155 + default_neotest = {
156 + 'unique',
157 + { 'on_complete_notify', system = 'unfocused', on_change = true, },
158 + 'default',
159 + },
160 + },
161 + },
162 + }, }

neovim/lua/bugabinga/plugins/telescope.lua

Modified
1 1 require 'bugabinga.health'.add_dependency
3 - name = 'ripgrep',
4 - name_of_executable = 'rg',
3 + name = 'ripgrep',
4 + name_of_executable = 'rg',
6 - {
7 - name = 'find-fd',
8 - name_of_executable = 'fd',
9 - }
6 + {
7 + name = 'find-fd',
8 + name_of_executable = 'fd',
9 + }
10 + {
11 + name = 'CMake',
12 + name_of_executable = 'cmake',
13 + }
11 15 local map = require 'std.map'
12 16 local icon = require 'std.icon'
14 18 map.normal {
15 - description = 'Switch to recently used folders',
16 - category = 'navigation',
17 - keys = '<c-p><c-z>',
18 - command = function () require 'telescope'.extensions.zoxide.list() end,
19 + description = 'Switch to recently used folders',
20 + category = 'navigation',
21 + keys = '<c-p><c-z>',
22 + command = function () require 'telescope'.extensions.zoxide.list() end,
21 25 map.normal.visual.terminal {
22 - description = 'Search help files',
23 - category = 'help',
24 - keys = '<F1>',
25 - command = function () require 'telescope.builtin'.help_tags() end,
26 + description = 'Search help files',
27 + category = 'help',
28 + keys = '<F1>',
29 + command = function () require 'telescope.builtin'.help_tags() end,
28 32 map.normal {
29 - description = 'Open last search...',
30 - category = 'plugins',
31 - keys = '<c-p>',
32 - command = function () require 'telescope.builtin'.resume() end,
33 + description = 'Open last search...',
34 + category = 'plugins',
35 + keys = '<c-p>',
36 + command = function () require 'telescope.builtin'.resume() end,
35 39 map.normal {
36 - description = 'Open search for all files...',
37 - category = 'search',
38 - keys = '<c-p><c-p>',
39 - command = function () require 'telescope.builtin'.find_files() end,
40 + description = 'Open search for all files...',
41 + category = 'search',
42 + keys = '<c-p><c-p>',
43 + command = function () require 'telescope.builtin'.find_files() end,
42 46 map.normal {
43 - description = 'Open search for keymaps...',
44 - category = 'search',
45 - keys = '<c-p><c-k>',
46 - command = function () require 'telescope.builtin'.keymaps() end,
47 + description = 'Open search for keymaps...',
48 + category = 'search',
49 + keys = '<c-p><c-k>',
50 + command = function () require 'telescope.builtin'.keymaps() end,
49 53 map.normal {
50 - description = 'Open search for symbols...',
51 - category = 'search',
52 - keys = '<c-p><c-s>',
53 - command = function () require 'telescope.builtin'.symbols() end,
54 + description = 'Open search for symbols...',
55 + category = 'search',
56 + keys = '<c-p><c-s>',
57 + command = function () require 'telescope.builtin'.symbols() end,
56 60 map.normal {
57 - description = 'Open search for all file contents...',
58 - category = 'search',
59 - keys = '<c-p><c-g>',
60 - command = function () require 'telescope.builtin'.live_grep() end,
61 + description = 'Open search for all file contents...',
62 + category = 'search',
63 + keys = '<c-p><c-g>',
64 + command = function () require 'telescope.builtin'.live_grep() end,
63 67 map.normal {
64 - description = 'Open search for current buffer content...',
65 - category = 'search',
66 - keys = '<c-p><c-/>',
67 - command = function () require 'telescope.builtin'.current_buffer_fuzzy_find() end,
68 + description = 'Open search for current buffer content...',
69 + category = 'search',
70 + keys = '<c-p><c-/>',
71 + command = function () require 'telescope.builtin'.current_buffer_fuzzy_find() end,
70 74 map.normal {
71 - description = 'Open search for buffers...',
72 - category = 'search',
73 - keys = '<c-e>',
74 - command = function () require 'telescope.builtin'.buffers() end,
75 + description = 'Open search for buffers...',
76 + category = 'search',
77 + keys = '<c-e>',
78 + command = function () require 'telescope.builtin'.buffers() end,
77 81 return {
78 - 'nvim-telescope/telescope.nvim',
79 - version = '0.*',
80 - cmd = 'Telescope',
81 - event = 'VeryLazy',
82 - dependencies = {
83 - 'nvim-lua/plenary.nvim',
84 - 'nvim-tree/nvim-web-devicons',
85 - 'nvim-telescope/telescope-symbols.nvim',
86 - 'jvgrootveld/telescope-zoxide',
87 - },
88 - config = function ()
89 - local telescope = require 'telescope'
90 - local actions = require 'telescope.actions'
91 - local themes = require 'telescope.themes'
82 + 'nvim-telescope/telescope.nvim',
83 + version = '0.*',
84 + cmd = 'Telescope',
85 + event = 'VeryLazy',
86 + dependencies = {
87 + {
88 + 'nvim-telescope/telescope-fzf-native.nvim',
89 + build =
90 + function ( plugin_spec )
91 + local result
92 + result = vim.system( { 'cmake', '-S.', '-Bbuild', '-DCMAKE_BUILD_TYPE=Release', },
93 + { text = true, cwd = plugin_spec.dir, } ):wait()
94 + if result.code ~= 0 then error( result.stderr ) end
95 + result = vim.system( { 'cmake', '--build', 'build', '--config', 'Release', },
96 + { text = true, cwd = plugin_spec.dir, } ):wait()
97 + if result.code ~= 0 then error( result.stderr ) end
98 + result = vim.system( { 'cmake', '--install', 'build', '--prefix', 'build', },
99 + { text = true, cwd = plugin_spec.dir, } ):wait()
100 + if result.code ~= 0 then error( result.stderr ) end
101 + end,
102 + },
103 + 'nvim-lua/plenary.nvim',
104 + 'nvim-tree/nvim-web-devicons',
105 + 'nvim-telescope/telescope-symbols.nvim',
106 + 'jvgrootveld/telescope-zoxide',
107 + },
108 + config = function ()
109 + local telescope = require 'telescope'
110 + local actions = require 'telescope.actions'
111 + local themes = require 'telescope.themes'
93 - local ivy = themes.get_ivy { hidden = true, layout_config = { preview_width = 0.69, }, }
94 - local dropdown = themes.get_dropdown { layout_config = { width = 0.69, }, }
95 - local cursor = themes.get_cursor { layout_config = { preview_width = 0.42, width = 0.69, }, }
113 + local ivy = themes.get_ivy { hidden = true, layout_config = { preview_width = 0.69, }, }
114 + local dropdown = themes.get_dropdown { layout_config = { width = 0.69, }, }
115 + local cursor = themes.get_cursor { layout_config = { preview_width = 0.42, width = 0.69, }, }
97 - telescope.setup {
98 - defaults = {
99 - layout_config = {
100 - horizontal = { prompt_position = 'bottom', preview_width = 0.69, },
101 - vertical = { mirror = false, },
102 - width = 0.69,
103 - height = 0.42,
104 - preview_cutoff = 124,
105 - },
106 - prompt_prefix = icon.telescope .. ' ',
107 - selection_caret = icon.arrow_right .. ' ',
108 - file_ignore_patterns = {
109 - '.git/',
110 - '.svn/',
111 - '.cache',
112 - '%.o',
113 - '%.a',
114 - '%.out',
115 - '%.class',
116 - '%.pdf',
117 - '%.mkv',
118 - '%.mp4',
119 - '%.zip',
120 - '%.spl',
121 - },
122 - mappings = {
123 - i = {
124 - ['<c-j>'] = actions.cycle_history_next,
125 - ['<c-k>'] = actions.cycle_history_prev,
126 - ['<c-n>'] = actions.move_selection_next,
127 - ['<c-p>'] = actions.move_selection_previous,
128 - ['<c-s>'] = actions.file_split,
129 - },
130 - n = { q = actions.close, },
131 - },
132 - },
133 - -- FIXME: some thems have an issue, where filtered results do not get selected and are thuis not in view
134 - pickers = {
135 - find_files = ivy,
136 - fd = ivy,
137 - keymaps = dropdown,
138 - diagnostics = dropdown,
139 - -- symbols = cursor,
140 - live_grep = ivy,
141 - current_buffer_fuzzy_find = cursor,
142 - buffers = cursor,
143 - -- help_tags = dropdown,
144 - },
145 - extensions = {
146 - zoxide = { prompt_title = 'Navigate deez nuts!', },
147 - },
148 - }
117 + telescope.setup {
118 + defaults = {
119 + selection_strategy = 'reset',
120 + hidden = true,
121 + scroll_strategy = 'limit',
122 + wrap_results = true,
123 + layout_config = {
124 + horizontal = { prompt_position = 'bottom', preview_width = 0.69, },
125 + vertical = { mirror = false, },
126 + width = 0.69,
127 + height = 0.42,
128 + preview_cutoff = 124,
129 + },
130 + prompt_prefix = icon.telescope .. ' ',
131 + selection_caret = icon.arrow_right .. ' ',
132 + file_ignore_patterns = {
133 + '.git/',
134 + '.svn/',
135 + '.cache',
136 + '%.o',
137 + '%.a',
138 + '%.out',
139 + '%.class',
140 + '%.pdf',
141 + '%.mkv',
142 + '%.mp4',
143 + '%.zip',
144 + '%.spl',
145 + },
146 + mappings = {
147 + i = {
148 + ['<c-j>'] = actions.cycle_history_next,
149 + ['<c-k>'] = actions.cycle_history_prev,
150 + ['<c-n>'] = actions.move_selection_next,
151 + ['<c-p>'] = actions.move_selection_previous,
152 + ['<c-s>'] = actions.file_split,
153 + ['g?'] = actions.which_key,
154 + },
155 + n = { q = actions.close, },
156 + },
157 + },
158 + -- FIXME: some themes have an issue, where filtered results do not get
159 + -- selected and are not in view
160 + pickers = {
161 + find_files = ivy,
162 + fd = ivy,
163 + keymaps = dropdown,
164 + diagnostics = dropdown,
165 + symbols = cursor,
166 + live_grep = ivy,
167 + current_buffer_fuzzy_find = cursor,
168 + buffers = cursor,
169 + help_tags = dropdown,
170 + },
171 + extensions = {
172 + zoxide = { prompt_title = 'Navigate deez nuts!', },
173 + },
150 - telescope.load_extension 'zoxide'
151 - end,
176 + telescope.load_extension 'fzf'
177 + telescope.load_extension 'zoxide'
178 + end,

neovim/lua/bugabinga/plugins/tests.lua

Modified
1 --- FIXME: own this
1 +local debug = require 'std.debug'
2 +local icon = require 'std.icon'
3 +local map = require 'std.map'
5 +map.normal {
6 + description = 'Run all tests',
7 + category = 'test',
8 + keys = '<leader>7n',
9 + command = function () prequire 'neotest'.run.run {} end,
12 +map.normal {
13 + description = 'Run all tests',
14 + category = 'test',
15 + keys = '<leader>7n',
16 + command = function () prequire 'neotest'.run.run {} end,
19 +map.normal {
20 + description = 'Run tests for current file',
21 + category = 'test',
22 + keys = '<leader>7t',
23 + command = function () prequire 'neotest'.run.run { vim.api.nvim_buf_get_name( 0 ), } end,
26 +map.normal {
27 + description = 'Run all test suites',
28 + category = 'test',
29 + keys = '<leader>7a',
30 + command = function ()
31 + for _, adapter_id in ipairs( require 'neotest'.run.adapters() ) do
32 + prequire 'neotest'.run.run { suite = true, adapter = adapter_id, }
33 + end
34 + end,
37 +map.normal {
38 + description = 'Run last test',
39 + category = 'test',
40 + keys = '<leader>7l',
41 + command = function () prequire 'neotest'.run.run_last() end,
44 +map.normal {
45 + description = 'Run all tests in debugger',
46 + category = 'test',
47 + keys = '<leader>7d',
48 + command = function () prequire 'neotest'.run.run { strategy = 'dap', } end,
51 +map.normal {
52 + description = 'Show test summary',
53 + category = 'test',
54 + keys = '<leader>7p',
55 + command = function () prequire 'neotest'.summary.toggle() end,
58 +map.normal {
59 + description = 'Show test output',
60 + category = 'test',
61 + keys = '<leader>7o',
62 + command = function () prequire 'neotest'.output.open { short = true, } end,
3 --- Todo:
4 --- * Bug: Running tests on directory doesn't work if directory not in tree (but tree has subdirectories)
5 --- * Bug: No output or debug info if test fails to run (e.g. try running tests in cpython)
6 --- * Bug: Sometimes issues with running python tests (dir position stuck in running state)
7 --- * Bug: Files shouldn't appear in summary if they contain no tests (e.g. python file named 'test_*.py')
8 --- * Bug: dir/file/namespace status should be set by children
9 --- * Bug: Run last test doesn't work with marked tests (if ran all marked last)
10 --- * Feat: If summary tree only has a single (file/dir) child, merge the display
11 --- * Feat: Different bindings for expand/collapse
12 --- * Feat: Can collapse tree on a child node
13 --- * Feat: Can't rerun failed tests
14 --- * Feat: Configure adapters & discovery on a per-directory basis
15 65 -- Investigate:
16 66 -- * Does neotest have ability to throttle groups of individual test runs?
17 67 -- * Tangential, but also check out https://github.com/andythigpen/nvim-coverage
23 73 'nvim-neotest/nvim-nio',
24 74 'stevearc/overseer.nvim',
26 - keys = {
27 - {
28 - '<leader>tn',
29 - function () require 'neotest'.run.run {} end,
30 - mode = 'n',
31 - },
32 - {
33 - '<leader>tt',
34 - function () require 'neotest'.run.run { vim.api.nvim_buf_get_name( 0 ), } end,
35 - mode = 'n',
36 - },
37 - {
38 - '<leader>ta',
39 - function ()
40 - for _, adapter_id in ipairs( require 'neotest'.run.adapters() ) do
41 - require 'neotest'.run.run { suite = true, adapter = adapter_id, }
42 - end
43 - end,
44 - mode = 'n',
45 - },
46 - {
47 - '<leader>tl',
48 - function () require 'neotest'.run.run_last() end,
49 - mode = 'n',
50 - },
51 - {
52 - '<leader>td',
53 - function () require 'neotest'.run.run { strategy = 'dap', } end,
54 - mode = 'n',
55 - },
56 - {
57 - '<leader>tp',
58 - function () require 'neotest'.summary.toggle() end,
59 - mode = 'n',
60 - },
61 - {
62 - '<leader>to',
63 - function () require 'neotest'.output.open { short = true, } end,
64 - mode = 'n',
65 - },
66 - },
67 77 config = function ()
68 78 local neotest = require 'neotest'
69 - -- require("neotest.logging"):set_level("trace")
79 + if debug.get() then
80 + require 'neotest.logging':set_level 'trace'
81 + end
70 82 neotest.setup {
71 83 adapters = {
72 - require 'neotest-python' {
73 - dap = { justMyCode = false, },
74 - },
75 84 require 'neotest-plenary',
76 - require 'neotest-go',
77 - require 'neotest-jest' {
78 - cwd = require 'neotest-jest'.root,
79 - },
81 86 discovery = {
82 87 enabled = false,
84 89 consumers = {
85 - overseer = require 'neotest.consumers.overseer',
90 + overseer = prequire 'neotest.consumers.overseer',
87 92 summary = {
88 93 mappings = {
99 104 icons = {
100 - passed = ' ',
101 - running = ' ',
102 - failed = ' ',
103 - unknown = ' ',
105 + passed = icon.passed,
106 + running = icon.running,
107 + failed = icon.failed,
108 + unknown = icon.unknown,
104 109 running_animated = vim.tbl_map(
105 110 function ( s ) return s .. ' ' end,
106 - { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏', }
112 + icon.progress_0,
113 + icon.progress_1,
114 + icon.progress_2,
115 + icon.progress_3,
116 + icon.progress_4,
117 + icon.progress_5,
118 + icon.progress_6,
119 + icon.progress_7,
120 + icon.progress_8,
121 + icon.progress_9,
109 125 diagnostic = {
117 133 enabled = true,
120 - vim.keymap.set( 'n', '<leader>tn', function () neotest.run.run {} end )
121 - vim.keymap.set( 'n', '<leader>tt', function () neotest.run.run { vim.api.nvim_buf_get_name( 0 ), } end )
122 - vim.keymap.set( 'n', '<leader>ta', function ()
123 - for _, adapter_id in ipairs( neotest.run.adapters() ) do
124 - neotest.run.run { suite = true, adapter = adapter_id, }
125 - end
126 - end )
127 - vim.keymap.set( 'n', '<leader>tl', function () neotest.run.run_last() end )
128 - vim.keymap.set( 'n', '<leader>td', function () neotest.run.run { strategy = 'dap', } end )
129 - vim.keymap.set( 'n', '<leader>tp', function () neotest.summary.toggle() end )
130 - vim.keymap.set( 'n', '<leader>to', function () neotest.output.open { short = true, } end )

neovim/lua/bugabinga/plugins/treesj.lua

Modified
1 -local map = require("std.map")
1 +local map = require 'std.map'
3 -map.normal({
4 - description = "Toggle Tree Join/Split",
5 - category = "editing",
6 - -- WARN: <C-j> produces the same keycode as <C-enter> on some terminals
7 - keys = "<C-j>",
8 - command = function()
9 - require("treesj").toggle()
3 +map.normal {
4 + description = 'Toggle Tree Join/Split',
5 + category = 'editing',
6 + -- WARN: <C-j> produces the same key code as <C-enter> on some terminals
7 + keys = '<C-j>',
8 + command = function ()
9 + require 'treesj'.toggle()
10 10 end,
11 -})
13 13 return {
14 - "Wansmer/treesj",
15 - dependencies = { "nvim-treesitter/nvim-treesitter" },
16 - opts = { use_default_keymaps = false },
14 + 'Wansmer/treesj',
15 + dependencies = { 'nvim-treesitter/nvim-treesitter', },
16 + opts = {
17 + use_default_keymaps = false,
18 + ---@type number If line after join will be longer than max value, node will not be formatted
19 + max_join_length = vim.opt.textwidth:get(),
20 + },

neovim/lua/bugabinga/plugins/whichkey.lua

Modified
40 40 -- use category as prefix?
41 41 wk.register {
42 42 ['<leader>'] = {
43 + ['7'] = { name = 'tests', _ = 'which_key_ignore', },
43 44 m = { name = '|m|ark', _ = 'which_key_ignore', },
44 45 h = { name = '|h|unk', _ = 'which_key_ignore', },
45 46 f = { name = '|f|iles', _ = 'which_key_ignore', },
46 47 g = { name = '|g|enerate', _ = 'which_key_ignore', },
48 + d = { name = '|d|ebug', _ = 'which_key_ignore', },
47 49 v = { name = '|v|ersion control', _ = 'which_key_ignore', },
48 50 s = { name = '|s|essions', _ = 'which_key_ignore', },
49 51 r = { name = '|r|efactor', _ = 'which_key_ignore', },

neovim/lua/bugabinga/plugins/window.lua

Modified
7 7 command = function () require 'nvim-window'.pick() end,
10 --- TODO: use facade
11 10 vim.api.nvim_create_user_command( 'PickWindow', function () require 'nvim-window'.pick() end, { bang = true, } )
13 12 return {

neovim/lua/bugabinga/save_actions.lua

Modified
22 22 vim.cmd [[wa]]
25 ---TODO: use facade
26 25 vim.api.nvim_create_user_command( 'SaveActions', apply_save_actions, { bang = true, } )
28 27 map.normal.visual {

neovim/lua/std/debug.lua

Modified
18 18 vim.notify( 'Toggled debug mode to ' .. tostring( is_debug_mode() ) )
21 ---TODO: use facade
22 21 vim.api.nvim_create_user_command( 'Debug', toggle_debug_mode, {} )
24 23 return {

neovim/lua/std/icon.lua

Modified
4 4 return {
5 5 ['function'] = '󰡱',
6 6 ['local'] = '󱥕',
7 7 ['table'] = '',
8 8 arrow_left = '',
9 9 arrow_right = '',
10 + backspace_key = '',
11 + block = '█',
10 12 branch = '',
11 13 carriage_return = '␍',
12 14 checkbox_mark = '',
13 15 checkbox_unmark = '',
14 - command = '󰘳',
15 16 close = '',
16 - block = '█',
17 + command = '󰘳',
17 18 data = '',
18 19 diagnostic = '⊙',
19 20 diff_add = '',
18 19 diff_remove = '',
19 20 eol = '↴',
20 21 error = '󰇷',
22 + esc_key = '󱊷',
21 23 exclaim = '',
22 24 extends = '❯',
25 + failed = ' ',
23 26 file = '',
24 27 folder = '',
25 28 git = '',
30 33 info = '󰩖',
31 34 insert = '',
32 35 lazy = '󰄻',
36 + leader_key = '󱁐',
33 37 linehighlight = '󰘤',
34 38 linenumber = '󰉻',
35 39 lock = '',
36 40 lsp = '',
37 41 macro = '',
42 + middle_ellipsis = '⋯',
38 43 modified = '',
39 44 nbsp = '␣',
40 45 newline = '␤',
41 46 normal = 'Ν',
47 + passed = ' ',
42 48 pending = '',
43 49 precedes = '❮',
50 + progress_0 = '⠋',
51 + progress_1 = '⠙',
52 + progress_2 = '⠹',
53 + progress_3 = '⠸',
54 + progress_4 = '⠼',
55 + progress_5 = '⠴',
56 + progress_6 = '⠦',
57 + progress_7 = '⠧',
58 + progress_8 = '⠇',
59 + progress_9 = '⠏',
44 60 quot_left = '"',
45 61 quot_right = '"',
46 62 replace = '',
63 + return_key = '',
64 + running = ' ',
47 65 select = '󰒉',
66 + slant_left = '▟',
67 + slant_right = '▙',
48 68 space = '·',
69 + space_key = '󱁐',
49 70 spelling = '󰓆',
71 + start = '',
50 72 subversion = '󰳗',
51 73 tab = '󰌒',
52 - middle_ellipsis = '⋯',
74 + tab_key = '',
75 + telescope = '🔭',
53 76 terminal = '',
54 77 thread = '󱇫',
55 78 toggle_off = '',
56 79 toggle_on = '',
57 80 trail = '•',
81 + unknown = ' ',
58 82 user = ' ',
59 83 vertical_bar = '│',
60 84 vim = '',
61 85 virtual = '󰢔',
62 86 visual = '󰒉',
63 87 warn = '󰱯',
64 - space_key = '󱁐',
65 - return_key = '',
66 - tab_key = '',
67 - esc_key = '󱊷',
68 - backspace_key = '',
69 - leader_key = '󱁐',
70 - start = '',
71 - slant_left = '▟',
72 - slant_right = '▙',
73 - telescope = '🔭',

neovim/lua/std/user_command.lua

Added
new file mode 100644
1 +--- Creates a new user command
2 +--- @param user_command table Necessary data to create a new user command.
3 +local create_user_command = function ( user_command )
4 + local options = { desc = user_command.description, }
5 + local merged_options = vim.tbl_deep_extend( 'force', options, user_command.options or {} )
6 + vim.api.nvim_create_user_command(
7 + user_command.name,
8 + user_command.command,
9 + merged_options
10 + )
11 +end
13 +--- Sets the field `command` in `self` to given value in `command`
14 +--- Then creates a new user command with data in `self`.
15 +--- @param self table any table.
16 +--- @param command function command to be executed when the user command is run.
17 +--- @return function deleter A function that deletes the created user command.
18 +local set_command = function ( self, command )
19 + self.command = command
20 + create_user_command( self )
21 + --- Deletes the created user command
22 + return function () vim.api.nvim_del_user_command( self.name ) end
23 +end
25 +--- meta table, that sets the function value, when called, to a field named `command`
26 +local COMMAND_SETTER = {
27 + __call = function ( self, command )
28 + vim.validate { command = { command, 'function', }, }
29 + return set_command( self, command )
30 + end,
33 +--- meta table, that either sets the table value to a field named `options`,
34 +--- or the function value to a field named `command`, when called.
35 +local OPTIONS_OR_COMMAND_SETTER = {
36 + __call = function ( self, options_or_command )
37 + vim.validate { options_or_command = { options_or_command, { 'table', 'function', }, }, }
38 + if type( options_or_command ) == 'table' then
39 + self.options = options_or_command
40 + return setmetatable( self, COMMAND_SETTER )
41 + end
42 + return set_command( self, options_or_command )
43 + end,
46 +--- meta table, that sets the string value to a field named `description`, when called.
47 +local DESCRIPTION_SETTER = {
48 + __call = function ( self, description )
49 + vim.validate { description = { description, 'string', }, }
50 + self.description = description
51 + return setmetatable( self, OPTIONS_OR_COMMAND_SETTER )
52 + end,
55 +--- meta table, that sets the string value to a field named `name`, when indexed into.
56 +local COMMAND_NAME_SETTER = {
57 + __index = function ( _, command_name )
58 + vim.validate { command_name = { command_name, 'string', }, }
59 + local new_user_command = { name = command_name, }
60 + return setmetatable( new_user_command, DESCRIPTION_SETTER )
61 + end,
64 +--TODO: think about how to create buffer commands
66 +return setmetatable( {}, COMMAND_NAME_SETTER )

neovim/neovim.yml

Deleted
deleted file mode 100644
1 ----
2 -base: lua51
3 -name: neovim
4 -globals:
5 - after_each:
6 - args:
7 - - type: function
8 - assert:
9 - args:
10 - - type: bool
11 - - required: false
12 - type: string
13 - before_each:
14 - args:
15 - - type: function
16 - describe:
17 - args:
18 - - type: string
19 - - type: function
20 - it:
21 - args:
22 - - type: string
23 - - type: function
24 - vim:
25 - any: true
26 - bit:
27 - any: true
28 - prequire:
29 - args:
30 - - type: string
31 - - type: function

neovim/spell/nerd.utf-8.add

Modified
52 52 stylua
54 +kool
55 +grepprg
56 +makeprg

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

Modified

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

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