repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: removed `want` module

cce9046c27852155cd18b0e11900e318604545e0

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (22)

+410 / −381 text lines

Diff layout

neovim/init.lua

Modified

+1 / −0 text lines

1818require 'bugabinga.lsp'
2020 -- TODO:
21-- [ ] pandoc with lua filters for diagrams for generating documents and previewing --> https://github.com/tex/vimpreviewpandoc
2122-- [ ] think about mini.colors
2223-- [ ] setup spell checking for code (english + german)
2324-- [ ] learn marks and refac mark.lua

neovim/lazy-lock.json

Modified

+4 / −4 text lines

66 "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
77 "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
88 "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
9 "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
9 "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
1010 "diffview.nvim": { "branch": "main", "commit": "0437ef8bfdd67156d87140d692840a3c2824fa20" },
1111 "dressing.nvim": { "branch": "master", "commit": "59fe7ef1aeeed499b983614fcfff89206bf0d5ce" },
1212 "flash.nvim": { "branch": "main", "commit": "f219066f1976c781780e2c317d52d515bc0e588b" },
1717 "heirline.nvim": { "branch": "master", "commit": "7f1e805dfc001d5dbb7d894105063f463f6c7dcc" },
1818 "hlargs.nvim": { "branch": "main", "commit": "6218a401824c5733ac50b264991b62d064e85ab2" },
1919 "indent-blankline.nvim": { "branch": "master", "commit": "877c1db2bf957300097dd5348a665666a4d900cb" },
20 "lazy.nvim": { "branch": "main", "commit": "9102d051a8e27298f4c913e3017ac44f151ae820" },
20 "lazy.nvim": { "branch": "main", "commit": "0d9989d46cd2ae624858b94e529ee3e9d07773fd" },
2121 "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
2222 "lush.nvim": { "branch": "main", "commit": "966aad1accd47fa11fbe2539234f81f678fef2de" },
2323 "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
3939 "nvim-neoclip.lua": { "branch": "main", "commit": "4e406ae0f759262518731538f2585abb9d269bac" },
4040 "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
4141 "nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" },
42 "nvim-treesitter": { "branch": "master", "commit": "a102053352bd958d84a3e1be3de0203d2af92984" },
42 "nvim-treesitter": { "branch": "master", "commit": "1d1c32b64b17b866152f29a3676a719cb6078028" },
4343 "nvim-treesitter-textobjects": { "branch": "master", "commit": "76c7a89b41de77a4f83fb77fa072c5ad7605fe3b" },
4444 "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
4545 "nvim-ts-context-commentstring": { "branch": "main", "commit": "7241635869b7a8115893ffa67bab3907756caf4f" },
46 "nvim-web-devicons": { "branch": "master", "commit": "56b3a6ce6d69329cbf603dd38ac59fb4d7774b01" },
46 "nvim-web-devicons": { "branch": "master", "commit": "a1e6268779411048a87f767a27380089362a0ce2" },
4747 "oil.nvim": { "branch": "stevearc-trash", "commit": "b62f680059fffcf7ff89fd88126fbca12418df20" },
4848 "persistence.nvim": { "branch": "main", "commit": "adcf6913693a0434665d162ee45a186230496f8a" },
4949 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },

neovim/lua/bugabinga/diagnostic.lua

Modified

+8 / −10 text lines

1local want = require 'std.want'
21local map = require 'std.map'
32local auto = require 'std.auto'
43local icon = require 'std.icon'
9695local show_diagnostics_in_buffer = function ()
97 want { 'telescope.builtin', 'telescope.themes' } (
98 function ( builtin, themes )
99 builtin.diagnostics( themes.get_dropdown { bufnr = 0, layout_config = { width = 0.69 } } )
100 end )
96 local builtin = require 'telescope.builtin'
97 local themes = require 'telescope.themes'
98 builtin.diagnostics( themes.get_dropdown { bufnr = 0, layout_config = { width = 0.69 } } )
10199end
103101map.normal {
110108local show_diagnostics_in_workspace = function ()
111 want { 'telescope.builtin', 'telescope.themes' } (
112 function ( builtin, themes )
113 builtin.diagnostics( themes.get_dropdown { layout_config = { width = 0.69 } } )
114 end )
109 local builtin = require 'telescope.builtin'
110 local themes = require 'telescope.themes'
111 builtin.diagnostics( themes.get_dropdown { layout_config = { width = 0.69 } } )
115112end
117114map.normal {
160157 dia( vim.diagnostic.severity.HINT, 4 )
161158end
163vim.g.send_dia = send_diaNo final newline
160vim.g.send_dia = send_dia

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

Modified

+2 / −8 text lines

11local table = require 'std.table'
22local project = require 'std.project'
3local want = require 'std.want'
43local auto = require 'std.auto'
54local map = require'std.map'
5352end
5554local create_jdtls_command = function ( syntax_server )
56 local mason_packages_base_path = want 'mason-core.package' (
57 function ( mason ) return mason:get_install_path() end,
58 function () return '/home/oli/Programs' end
59 )
61 local jdtls_package_path = vim.fs.joinpath( mason_packages_base_path, 'jdtls' )
55 local mason_registry = require 'mason-registry'
56 local jdtls_package_path = mason_registry.get_package('jdtls'):get_install_path()
6257 local shared_config_path = create_shared_config_path( jdtls_package_path, syntax_server )
6358 local launcher_jar = find_launcher_jar( jdtls_package_path )
6459 local data_dir = create_data_dir()
168163 return ext
169164end
171-- TODO:
172166local on_attach = function ()
173167 local jdtls = require 'jdtls'
174168 vim.lsp.codelens.refresh()

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

Modified

+6 / −7 text lines

1local project = require'std.project'
2local want = require'std.want'
1local project = require 'std.project'
43return {
54 name = 'jsonls',
1312 },
1413 settings = {
1514 json = {
16 schemas = want'schemastore'(function(schemastore) return schemastore.json.schemas {
15 schemas = require 'schemastore'.json.schemas {
1716 extra = {
1817 description = 'Settings for lua-language-server',
19 name = "LuaLS Settings",
20 url = "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
21 fileMatch = { ".luarc.json", ".luarc.jsonc" },
18 name = 'LuaLS Settings',
19 url = 'https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json',
20 fileMatch = { '.luarc.json', '.luarc.jsonc' },
2221 }
23 } end, {}),
22 },
2423 validate = { enable = true },
2524 },
2625 },

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

Modified

+0 / −1 text lines

11local project = require 'std.project'
2local want = require'std.want'
43return {
54 name = 'LuaLS',

neovim/lua/bugabinga/lsp/init.lua

Modified

+6 / −7 text lines

33local defer = require 'std.defer'
44local map = require 'std.map'
55local auto = require 'std.auto'
6local want = require 'std.want'
76local ui = require 'bugabinga.ui'
87local table = require 'std.table'
98local ignored = require 'std.ignored'
5655 if vim.iter( matches_to_ignore ):find( match ) then return end
5857 local bufnr = file_type_event.buf
59 local buftype = vim.api.nvim_get_option_value('buftype', { buf = bufnr })
58 local buftype = vim.api.nvim_get_option_value( 'buftype', { buf = bufnr } )
6059 if buftype ~= '' then return end
6261 local buffer_path = vim.api.nvim_buf_get_name( bufnr )
108107 for _, config in ipairs( potential_client_configs ) do
109108 local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
110109 local capabilities = vim.lsp.protocol.make_client_capabilities()
111 local cmp_capabilities = want 'cmp_nvim_lsp' ( function ( cmp ) return cmp.default_capabilities() end, {} )
110 local cmp_capabilities = require 'cmp_nvim_lsp'.default_capabilities()
112111 capabilities = table.extend( 'force', capabilities, cmp_capabilities, config.capabilities )
113112 -- vim.print( 'lsp capabilities', capabilities, config.capabilities, cmp_capabilities )
161160 local new_root_raw = new_config.root_dir or nil
162161 local existing_root_raw = existing_client.workspace_folders and #existing_client.workspace_folders >= 1 and
163 existing_client.workspace_folders[1].name or nil
162 existing_client.workspace_folders[1].name or nil
165164 if not (new_root_raw and existing_root_raw) then return false end
235234 end
237236 if client.server_capabilities.inlayHintProvider then
238 -- TODO: how to prevent the UI from jittering
239237 add( map.normal {
240238 description = 'Toggle inlay hints',
241239 category = 'lsp',
242240 buffer = bufnr,
243241 keys = '<leader>ti',
244 command = function () vim.lsp.inlay_hint( bufnr, nil ) end,
242 command = function ()
243 vim.lsp.inlay_hint( bufnr, nil )
244 end,
245245 } )
246246 end
250250 category = 'lsp',
251251 buffer = bufnr,
252252 keys = '<c-s>',
253 --TODO: save actions
254253 command = vim.lsp.buf.format,
255254 } )

neovim/lua/bugabinga/mark.lua

Modified

+1 / −1 text lines

115115 vim.api.nvim_buf_set_keymap( bufnr, 'n', '<leader>dM', '', {
116116 desc = 'Delete all buffer marks',
117117 callback = function ()
118 -- NOTE: This will delete the builtin marks too, but I'll restore
118 -- This will delete the builtin marks too, but I'll restore
119119 -- them on cursor move so whatever.
120120 marks[bufnr] = {}
121121 vim.fn.sign_unplace( sign_group_name, { buffer = bufnr } )

neovim/lua/bugabinga/nugu/init.lua

Modified

+3 / −4 text lines

188188 LspReferenceText { sp = content_unfocus, gui = 'underline' },
189189 LspReferenceRead { LspReferenceText },
190190 LspReferenceWrite { LspReferenceText },
191 LspInlayHint { fg = ui_minor, bg = ui_unfocus },
191 LspInlayHint { fg = content_minor, bg = content_backdrop },
193193 -- Tree-Sitter syntax groups.
194194 --
447447 GitSignsDeletePreview { GitSignsDelete },
449449 GitSignsCurrentLineBlame { Debug },
451450 GitSignsAddInline { GitSignsAdd },
452451 GitSignsDeleteInline { GitSignsDelete },
453452 GitSignsChangeInline { GitSignsChange },
475474 Hlargs { fg = ui_important_local },
477 MiniStarterCurrent { bg = content_accent }, -- current item.
476 MiniStarterCurrent { fg = ui_accent.readable(), bg = ui_accent }, -- current item.
478477 MiniStarterFooter { Keyword }, -- footer units.
479478 MiniStarterHeader { Comment }, -- header units.
480479 MiniStarterInactive { fg = content_unfocus }, -- inactive item.
482481 MiniStarterItemBullet { Whitespace }, -- units from |MiniStarter.gen_hook.adding_bullet|.
483482 MiniStarterItemPrefix { fg = content_focus, gui = '' }, -- unique query for item.
484483 MiniStarterSection { fg = content_important_global, gui = 'underline' }, -- section units.
485 MiniStarterQuery { bg = content_accent }, -- current query in active items.
484 MiniStarterQuery { fg = content_accent.readable(), bg = content_accent }, -- current query in active items.
486485 }
487486end )

neovim/lua/bugabinga/options/keymaps.lua

Modified

+126 / −116 text lines

11local map = require 'std.map'
2local want = require 'std.want'
43-- set <SPACE> as leader key
54map {
6 keys = '<space>',
7 command = '<nop>',
5 keys = '<space>',
6 command = '<nop>',
87}
109vim.g.mapleader = ' '
1312-- disable default ENTER binding
1413map {
15 keys = '<enter>',
16 command = '<nop>',
14 keys = '<enter>',
15 command = '<nop>',
1918-- insert newline under or above in normal mode
2019map.normal {
21 description = 'Insert newline under cursor',
22 category = 'editing',
23 keys = '<C-enter>',
24 command = function()
25 local current_buffer = 0
26 local current_line = vim.api.nvim_win_get_cursor(current_buffer)[1]
27 local strict_indexing = false
28 local newline = { '' }
29 vim.api.nvim_buf_set_lines(current_buffer, current_line, current_line, strict_indexing, newline)
30 end,
20 description = 'Insert newline under cursor',
21 category = 'editing',
22 keys = '<C-enter>',
23 command = function ()
24 local current_buffer = 0
25 local current_line = vim.api.nvim_win_get_cursor( current_buffer )[1]
26 local strict_indexing = false
27 local newline = { '' }
28 vim.api.nvim_buf_set_lines( current_buffer, current_line, current_line, strict_indexing, newline )
29 end,
3332map.normal {
34 description = 'Insert newline above cursor',
35 category = 'editing',
36 keys = '<C-S-enter>',
37 command = function()
38 local current_buffer = 0
39 local current_line = vim.api.nvim_win_get_cursor(current_buffer)[1] - 1
40 local strict_indexing = false
41 local newline = { '' }
42 vim.api.nvim_buf_set_lines(current_buffer, current_line, current_line, strict_indexing, newline)
43 end,
33 description = 'Insert newline above cursor',
34 category = 'editing',
35 keys = '<C-S-enter>',
36 command = function ()
37 local current_buffer = 0
38 local current_line = vim.api.nvim_win_get_cursor( current_buffer )[1] - 1
39 local strict_indexing = false
40 local newline = { '' }
41 vim.api.nvim_buf_set_lines( current_buffer, current_line, current_line, strict_indexing, newline )
42 end,
4645-- disable command history keymap, because i fatfinger it too often
4746map {
48 keys = 'q:',
49 command = '<nop>',
47 keys = 'q:',
48 command = '<nop>',
5251map {
53 keys = 'Q:',
54 command = '<nop>',
52 keys = 'Q:',
53 command = '<nop>',
5756map {
58 keys = 'q/',
59 command = '<nop>',
57 keys = 'q/',
58 command = '<nop>',
6261map {
63 keys = 'Q',
64 command = '<nop>',
62 keys = 'Q',
63 command = '<nop>',
6766-- disable them evil arrows
6867map {
69 keys = '<up>',
70 command = '<nop>',
68 keys = '<up>',
69 command = '<nop>',
7372map {
74 keys = '<down>',
75 command = '<nop>',
73 keys = '<down>',
74 command = '<nop>',
7877map {
79 keys = '<left>',
80 command = '<nop>',
78 keys = '<left>',
79 command = '<nop>',
8382map {
84 keys = '<right>',
85 command = '<nop>',
83 keys = '<right>',
84 command = '<nop>',
8887-- system clipboard copy and paste
8988map.normal.visual {
90 description = 'yank into system clipboard',
91 category = 'editing',
92 keys = '<leader>y',
93 command = '"+y',
89 description = 'yank into system clipboard',
90 category = 'editing',
91 keys = '<leader>y',
92 command = '"+y',
9695map.normal.visual {
97 description = 'yank line into system clipboard',
98 category = 'editing',
99 keys = '<leader>yy',
100 command = '"+Y',
96 description = 'yank line into system clipboard',
97 category = 'editing',
98 keys = '<leader>yy',
99 command = '"+Y',
103102map.normal.visual {
104 description = 'paste before from system clipboard',
105 category = 'editing',
106 keys = '<leader>p',
107 command = '"+p',
103 description = 'paste before from system clipboard',
104 category = 'editing',
105 keys = '<leader>p',
106 command = '"+p',
110109map.normal.visual {
111 description = 'paste after from system clipboard',
112 category = 'editing',
113 keys = '<leader>P',
114 command = '"+P',
110 description = 'paste after from system clipboard',
111 category = 'editing',
112 keys = '<leader>P',
113 command = '"+P',
117116map.insert {
118 description = 'Cycle through autocomplete popup',
119 category = 'editing',
120 keys = '<tab>',
121 options = { expr = true },
122 command = function() return vim.fn.pumvisible() == 1 and '<C-n>' or '<tab>' end,
117 description = 'Cycle through autocomplete popup',
118 category = 'editing',
119 keys = '<tab>',
120 options = { expr = true },
121 command = function () return vim.fn.pumvisible() == 1 and '<C-n>' or '<tab>' end,
125124local function open_link_under_cursor()
126 ---@diagnostic disable-next-line: missing-parameter
127 local file_under_cursor = vim.fn.expand '<cfile>'
128 --check that it vaguely resembles an URI
129 if file_under_cursor and file_under_cursor:match '%a+://.+' then
130 local Job = require 'plenary.job'
131 local job = Job:new {
132 command = 'firefox',
133 args = { file_under_cursor },
134 on_exit = function()
135 vim.schedule(function() vim.notify('Openend ' .. file_under_cursor) end)
136 end,
137 }
138 job:start()
139 end
125 ---@diagnostic disable-next-line: missing-parameter
126 local file_under_cursor = vim.fn.expand '<cfile>'
127 --check that it vaguely resembles an URI
128 ---@diagnostic disable-next-line: param-type-mismatch
129 if file_under_cursor and file_under_cursor:match '%a+://.+' then
130 vim.system(
131 ---@diagnostic disable-next-line: assign-type-mismatch
132 { 'firefox', file_under_cursor },
133 { text = true },
134 function ( completed )
135 if completed.code == 0 then
136 vim.notify( 'Openend ' .. file_under_cursor )
137 else
138 error( 'Failed to open ' .. file_under_cursor .. ' because: ' .. completed.stderr )
139 end
140 end
141 )
142 end
140143end
142145map.normal {
143 description = 'Open web link under cursor in browser',
144 category = 'navigation',
145 keys = 'gx',
146 command = open_link_under_cursor,
146 description = 'Open web link under cursor in browser',
147 category = 'navigation',
148 keys = 'gx',
149 command = open_link_under_cursor,
149152map.normal {
150 description = 'Dismiss current search highlight',
151 category = 'search',
152 keys = '<esc><esc>',
153 command = function() vim.cmd [[ nohlsearch ]] end,
153 description = 'Grep search for word under cursor',
154 category = 'search',
155 keys = 'gw',
156 command = '<cmd>grep <cword> . <cr>',
156159map.normal {
157 description = 'Toggle dark/light theme variant',
158 category = 'ui',
159 keys = '<leader>tt',
160 command = function()
161 if vim.opt.background:get() == 'dark' then
162 vim.opt.background = 'light'
163 else
164 vim.opt.background = 'dark'
165 end
166 vim.notify('Toggled background to ' .. vim.opt.background:get() .. '.')
167 end,
160 description = 'Dismiss current search highlight',
161 category = 'search',
162 keys = '<esc><esc>',
163 command = function () vim.cmd [[ nohlsearch ]] end,
164}
166map.normal {
167 description = 'Toggle dark/light theme variant',
168 category = 'ui',
169 keys = '<leader>tt',
170 command = function ()
171 if vim.opt.background:get() == 'dark' then
172 vim.opt.background = 'light'
173 else
174 vim.opt.background = 'dark'
175 end
176 vim.notify( 'Toggled background to ' .. vim.opt.background:get() .. '.' )
177 end,
170180map.insert {
171 description = 'Exit normal mode',
172 category = 'vim',
173 keys = 'jj',
174 command = '<C-c>',
181 description = 'Exit normal mode',
182 category = 'vim',
183 keys = 'jj',
184 command = '<C-c>',
177187map.normal {
178 description = 'Goto matching bracket',
179 category = 'navigation',
180 keys = 'mm',
181 command = '%',
188 description = 'Goto matching bracket',
189 category = 'navigation',
190 keys = 'mm',
191 command = '%',
184194map.normal {
185 description = 'Redo undone operation',
186 category = 'history',
187 keys = 'U',
188 command = vim.cmd.redo,
195 description = 'Redo undone operation',
196 category = 'history',
197 keys = 'U',
198 command = vim.cmd.redo,
191201map {
196206map.normal {
197 description = 'Move next in quickfix list',
198 category = 'navigation',
199 keys = '<A-bs>',
200 command = '<cmd>cnext<cr>',
207 description = 'Move next in quickfix list',
208 category = 'navigation',
209 keys = '<A-bs>',
210 command = '<cmd>cnext<cr>',
203213map.normal {
204 description = 'Move back in quickfix list',
205 category = 'navigation',
206 keys = '<bs>',
207 command = '<cmd>cprevious<cr>',
214 description = 'Move back in quickfix list',
215 category = 'navigation',
216 keys = '<bs>',
217 command = '<cmd>cprevious<cr>',
210220map.normal {
218228 description = 'Open nvim configuration',
219229 category = 'config',
220230 keys = '<F2><F2>',
221 command = '<cmd>tabedit ' .. vim.fn.stdpath'config' .. '<cr>',
231 command = '<cmd>tabedit ' .. vim.fn.stdpath 'config' .. '<cr>',
224234map.normal {

neovim/lua/bugabinga/options/ui.lua

Modified

+2 / −1 text lines

113113-- font
114114vim.opt.guifont = 'BlexMono_Nerd_Font:h13:#e-subpixelantialias:#h-full'
115-- TODO: neovide font config is not as powerful as wezterm right now
115-- NOTE: neovide font config is not as powerful as wezterm right now
116116-- characters for box drawing do not seem to line up. try different font for now?
117vim.opt.linespace = -3
118119-- neovide only options
119120if vim.g.neovide then

neovim/lua/bugabinga/plugins/gitsigns.lua

Modified

+125 / −34 text lines

1local map = require 'std.map'
2
13return {
24 'lewis6991/gitsigns.nvim',
35 -- branch='main',
2022 ignore_whitespace = true,
2123 },
2224 current_line_blame_formatter = '<author>(<author_time:%d.%m.%Y>): <summary>',
23 --FIXME: refactor the suggested config code
2425 on_attach = function ( bufnr )
25 local gs = package.loaded.gitsigns
26 local gitsigns = require 'gitsigns'
27 local function map( mode, l, r, opts )
28 opts = opts or {}
29 opts.buffer = bufnr
30 vim.keymap.set( mode, l, r, opts )
31 end
28 map.normal {
29 description = 'Goto next hunk',
30 category = 'git',
31 keys = ']h',
32 buffer = bufnr,
33 command = gitsigns.next_hunk,
34 }
33 -- Navigation
34 map( 'n', ']c', function ()
35 if vim.wo.diff then return ']c' end
36 vim.schedule( function () gs.next_hunk() end )
37 return '<Ignore>'
38 end, { expr = true } )
36 map.normal {
37 description = 'Goto previous hunk',
38 category = 'git',
39 keys = '[h',
40 buffer = bufnr,
41 command = gitsigns.prev_hunk,
42 }
40 map( 'n', '[c', function ()
41 if vim.wo.diff then return '[c' end
42 vim.schedule( function () gs.prev_hunk() end )
43 return '<Ignore>'
44 end, { expr = true } )
44 map.normal {
45 description = 'Stage hunk',
46 category = 'git',
47 keys = '<leader>hs',
48 buffer = bufnr,
49 command = gitsigns.stage_hunk,
50 }
46 -- Actions
47 map( 'n', '<leader>hs', gs.stage_hunk )
48 map( 'n', '<leader>hr', gs.reset_hunk )
49 map( 'v', '<leader>hs', function () gs.stage_hunk { vim.fn.line '.' , vim.fn.line 'v' } end )
50 map( 'v', '<leader>hr', function () gs.reset_hunk { vim.fn.line '.' , vim.fn.line 'v' } end )
51 map( 'n', '<leader>hS', gs.stage_buffer )
52 map( 'n', '<leader>hu', gs.undo_stage_hunk )
53 map( 'n', '<leader>hR', gs.reset_buffer )
54 map( 'n', '<leader>hp', gs.preview_hunk )
55 map( 'n', '<leader>hb', function () gs.blame_line { full = true } end )
56 map( 'n', '<leader>hd', gs.diffthis )
57 map( 'n', '<leader>hD', function () gs.diffthis '~' end )
52 map.visual_select {
53 description = 'Stage hunk',
54 category = 'git',
55 keys = '<leader>hs',
56 buffer = bufnr,
57 command = function () gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end,
58 }
59 map( 'n', '<leader>tb', gs.toggle_current_line_blame )
60 map( 'n', '<leader>td', gs.toggle_deleted )
60 map.normal {
61 description = 'Reset hunk',
62 category = 'git',
63 keys = '<leader>hr',
64 buffer = bufnr,
65 command = gitsigns.reset_hunk,
66 }
62 -- Text object
63 map( { 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>' )
68 map.visual_select {
69 description = 'Reset hunk',
70 category = 'git',
71 keys = '<leader>hr',
72 buffer = bufnr,
73 command = function () gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end,
74 }
76 map.normal {
77 description = 'Undo stage hunk',
78 category = 'git',
79 keys = '<leader>hu',
80 buffer = bufnr,
81 command = gitsigns.undo_stage_hunk,
82 }
84 map.normal {
85 description = 'Stage buffer',
86 category = 'git',
87 keys = '<leader>hS',
88 buffer = bufnr,
89 command = gitsigns.stage_buffer,
90 }
92 map.normal {
93 description = 'Reset buffer',
94 category = 'git',
95 keys = '<leader>hR',
96 buffer = bufnr,
97 command = gitsigns.reset_buffer,
98 }
100 map.normal {
101 description = 'Preview hunk',
102 category = 'git',
103 keys = '<leader>hp',
104 buffer = bufnr,
105 command = gitsigns.preview_hunk,
106 }
108 map.normal {
109 description = 'Blame line',
110 category = 'git',
111 keys = '<leader>hb',
112 buffer = bufnr,
113 command = function () gitsigns.blame_line { full = true } end,
114 }
116 map.normal {
117 description = 'Diff this',
118 category = 'git',
119 keys = '<leader>hd',
120 buffer = bufnr,
121 command = gitsigns.diffthis,
122 }
124 map.normal {
125 description = 'Diff this ~',
126 category = 'git',
127 keys = '<leader>hD',
128 buffer = bufnr,
129 command = function () gitsigns.diffthis '~' end,
130 }
132 map.normal {
133 description = 'Toggle current line blame',
134 category = 'git',
135 keys = '<leader>tb',
136 buffer = bufnr,
137 command = gitsigns.toggle_current_line_blame,
138 }
140 map.normal {
141 description = 'Toggle deleted',
142 category = 'git',
143 keys = '<leader>td',
144 buffer = bufnr,
145 command = gitsigns.toggle_deleted,
146 }
148 map.operator_pending.visual {
149 description = 'select hunk',
150 category = 'git',
151 keys = 'ih',
152 buffer = bufnr,
153 command = ':<C-U>Gitsigns select_hunk<CR>'
154 }
64155 end

neovim/lua/bugabinga/plugins/noice.lua

Modified

+67 / −70 text lines

1local map = require'std.map'
2local ignored = require'std.ignored'
1local map = require 'std.map'
2local ignored = require 'std.ignored'
44return {
5 {
6 'folke/noice.nvim',
7 event = 'VeryLazy',
8 dependencies = {
9 'MunifTanjim/nui.nvim',
10 'rcarriga/nvim-notify',
11 },
12 opts = {
13 cmdline = {
14 view = 'cmdline', -- cmdline on bottom
15 },
16 lsp = {
17 -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
18 override = {
19 ['vim.lsp.util.convert_input_to_markdown_lines'] = true,
20 ['vim.lsp.util.stylize_markdown'] = true,
21 ['cmp.entry.get_documentation'] = true,
22 },
23 },
24 smart_move = { excluded_filetypes = ignored.filetypes },
25 presets = {
26 inc_rename = true, -- enables an input dialog for inc-rename.nvim
27 },
28 views = {
29 vsplit = {
30 size = { width = 'auto', height = 'auto'},
5 {
6 'folke/noice.nvim',
7 event = 'VeryLazy',
8 dependencies = {
9 'MunifTanjim/nui.nvim',
10 'rcarriga/nvim-notify',
11 },
12 opts = {
13 cmdline = {
14 view = 'cmdline', -- cmdline on bottom
15 },
16 lsp = {
17 -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
18 override = {
19 ['vim.lsp.util.convert_input_to_markdown_lines'] = true,
20 ['vim.lsp.util.stylize_markdown'] = true,
21 ['cmp.entry.get_documentation'] = true,
3122 },
32 popupmenu = {
33 border = { style = vim.g.border_style},
23 },
24 smart_move = { excluded_filetypes = ignored.filetypes },
25 presets = {
26 inc_rename = true, -- enables an input dialog for inc-rename.nvim
27 },
28 views = {
29 vsplit = {
30 size = { width = 'auto', height = 'auto' },
3431 },
35 popup = {
36 border = { style = vim.g.border_style},
32 popupmenu = {
33 border = { style = vim.g.border_style },
3734 },
38 hover = {
39 border = { style = vim.g.border_style},
35 popup = {
36 border = { style = vim.g.border_style },
37 },
38 hover = {
39 border = { style = vim.g.border_style },
4040 position = { row = -2, col = 2 },
4141 },
42 -- does not seem to play well with other popups?
43 cmdline = {
44 relative = "cursor",
42 -- does not seem to play well with other popups?
43 cmdline = {
44 relative = 'cursor',
4545 position = { row = 0, col = 0 },
46 size = { min_width = 42, width = 'auto', height = 'auto'},
47 border = { style = vim.g.border_style},
46 size = { min_width = 42, width = 'auto', height = 'auto' },
47 border = { style = vim.g.border_style },
4848 },
4949 cmdline_popupmenu = {
50 relative = "cursor",
50 relative = 'cursor',
5151 position = { row = 1, col = 0 },
52 size = { min_width = 42, width = "auto", height = 'auto' },
52 size = { min_width = 42, width = 'auto', height = 'auto' },
5353 border = { style = vim.g.border_style, padding = { 0, 1 } },
54 win_options = { winhighlight = { Normal = "Normal", FloatBorder = "NoiceCmdlinePopupBorder" } },
54 win_options = { winhighlight = { Normal = 'Normal', FloatBorder = 'NoiceCmdlinePopupBorder' } },
5555 },
5656 },
5757 routes = {
6060 opts = { skip = true },
6161 },
6262 {
63 filter = { event = "msg_show", find = "E42" },
63 filter = { event = 'msg_show', find = 'E42' },
6464 opts = { skip = true },
6565 },
6666 {
67 filter = { event = "msg_show", kind = "", find = '^".*" %[.*%]', },
67 filter = { event = 'msg_show', kind = '', find = '^".*" %[.*%]', },
6868 opts = { skip = true },
6969 },
7070 {
71 filter = { event = "notify", min_height = 15 },
72 view = "split",
71 filter = { event = 'notify', min_height = 15 },
72 view = 'split',
7373 },
7474 {
75 filter = { cmdline = "^:%s*!" },
76 --TODO: pipe external commands to terminal?
77 --terminal view does not exist, right?
78 view = "vsplit"
75 filter = { cmdline = '^:%s*!' },
76 view = 'vsplit'
7977 },
8078 {
8179 filter = { cmdline = true, min_height = 2 },
82 view = "cmdline_output",
80 view = 'cmdline_output',
8381 },
8482 {
85 filter = { any = { { cmdline = "^:%s*lua%s+"}, { cmdline = "^:%s*lua%s*=%s*"}, { cmdline = "^:%s*=%s*"}, } },
83 filter = { any = { { cmdline = '^:%s*lua%s+' }, { cmdline = '^:%s*lua%s*=%s*' }, { cmdline = '^:%s*=%s*' }, } },
8684 view = 'cmdline_output',
8785 }
8886 },
8987 },
90 config = function(_, opts)
91 local noice = require'noice'
92 noice.setup(opts)
88 config = function ( _, opts )
89 local noice = require 'noice'
90 noice.setup( opts )
9492 map.normal {
9593 description = 'Open search for notifications...',
9694 category = 'search',
9795 keys = '<C-n><C-n>',
98 command = function() noice.cmd'history' end,
96 command = function () noice.cmd 'history' end,
9997 }
10199 map.command_line {
102100 description = 'Redirect Cmdline',
103101 category = 'ui',
104102 keys = '<S-cr>',
105 command = function() noice.redirect(vim.fn.getcmdline()) end,
103 command = function () noice.redirect( vim.fn.getcmdline() ) end,
106104 }
108106 map.normal {
109107 description = 'Dismiss current notifications',
110108 category = 'notify',
111109 keys = '<esc>',
112 command = function() noice.cmd 'dismiss' end,
110 command = function () noice.cmd 'dismiss' end,
113111 }
115 local noice_lsp = require'noice.lsp'
113 local noice_lsp = require 'noice.lsp'
117115 map.normal {
118116 description = 'Scroll up in documentation popup',
119117 category = 'ui',
120118 keys = '<C-f>',
121 command = function()
122 if not noice_lsp.scroll(-4) then return '<C-f>' end
119 command = function ()
120 if not noice_lsp.scroll( -4 ) then return '<C-f>' end
123121 end,
124122 options = { expr = true },
125123 }
128126 description = 'Scroll down in documentation popup',
129127 category = 'ui',
130128 keys = '<C-b>',
131 command = function()
132 if not noice_lsp.scroll(4) then return '<C-b>' end
129 command = function ()
130 if not noice_lsp.scroll( 4 ) then return '<C-b>' end
133131 end,
134132 options = { expr = true },
135133 }
137134 end,
138135 },
139136 {
140137 'rcarriga/nvim-notify',
141 config = function()
142 local notify = require'notify'
143 local fade = require'notify.stages.fade'('bottom_up')
138 config = function ()
139 local notify = require 'notify'
140 local fade = require 'notify.stages.fade' 'bottom_up'
145 local shadow_fade = function(...)
146 local opts = fade[1](...)
142 local shadow_fade = function ( ... )
143 local opts = fade[1]( ... )
147144 if opts then
148145 opts.border = vim.g.border_style
149146 opts.row = opts.row - 1
152149 end
154151 notify.setup {
155 stages = { shadow_fade, unpack(fade, 2) },
152 stages = { shadow_fade, unpack( fade, 2 ) },
156153 render = 'compact',
157154 timeout = 2500,
158155 fps = 60,

neovim/lua/bugabinga/plugins/nrpattern.lua

Modified

+1 / −1 text lines

33 keys = { '<C-a>', '<C-x>' },
44 config = function()
55 local nrpattern = require'nrpattern'
6 -- NOTE: this plugin overrides all its settiungs if empty map is given
6 -- this plugin overrides all its settiungs if empty map is given
77 nrpattern.setup()
88 end,
99}}

neovim/lua/bugabinga/plugins/starter.lua

Modified

+5 / −1 text lines

2727 -- gs = replace all % with /
2828 -- ~ = relative to home
2929 local name = vim.fn.fnamemodify( session_path, ':t:r:gs_%_/_:~' )
30 local action = 'silent! source ' .. vim.fn.fnameescape( session_path )
30 local session_restore = 'silent! source ' .. vim.fn.fnameescape( session_path )
31 local action = function()
32 vim.cmd (session_restore)
33 vim.notify('Restored session: ' .. name)
34 end
3135 local section = 'Sessions'
3337 return { name = name, action = action, section = section }

neovim/lua/bugabinga/plugins/surround.lua

Modified

+4 / −6 text lines

44 lazy = false,
55 opts = {
66 keymaps = {
7 insert = '<C-g>s',
8 insert_line = '<C-g>S',
97 normal = 'ms',
108 normal_cur = 'mss',
119 normal_line = 'mS',
1210 normal_cur_line = 'mSS',
13 visual = 'S',
14 visual_line = 'gS',
11 visual = 'ms',
12 visual_line = 'mS',
1513 delete = 'md',
16 change = 'mr',
17 change_line = 'mR',
14 change = 'mc',
15 change_line = 'mC',
1816 },
1917 },
2018 dependencies = {

neovim/lua/bugabinga/plugins/todo-comments.lua

Modified

+1 / −0 text lines

11return {
22 'folke/todo-comments.nvim',
3 dependencies = { 'nvim-lua/plenary.nvim' },
34 event = 'BufReadPost',
45 opts = {},
56}

neovim/lua/bugabinga/plugins/treesitter.lua

Modified

+3 / −21 text lines

134134 ['aa'] = { query = '@assignment.outer', desc = 'outer assignment' },
135135 ['ia'] = { query = '@assignment.inner', desc = 'inner assignment' },
137 ['la'] = { query = '@assignment.lhs', desc = 'left hand side of assignment'},
138 ['ra'] = { query = '@assignment.rhs', desc = 'right hand side of assignment'},
137 -- l overwrites builtin. i have no good idea for better binding. use ia instead.
138 -- ['la'] = { query = '@assignment.lhs', desc = 'left hand side of assignment'},
139 -- ['ra'] = { query = '@assignment.rhs', desc = 'right hand side of assignment'},
140141 ['ac'] = { query = '@class.outer', desc = 'outer class' },
141142 ['ic'] = { query = '@class.inner' , desc = 'inner class' },
206207 }
207208 }
209 local ts_repeat_move = require 'nvim-treesitter.textobjects.repeatable_move'
211 -- FIXME: use ; and , to repeat movement, just like built-ins.
212 -- needs to fix f, F and t, T
213 -- does flash still work then?
214 map.normal.visual.operator_pending {
215 description = 'This repeats the last query with always previous direction and to the start of the range.',
216 keys = '<PageUp>',
217 category = 'textobjects',
218 command = function () ts_repeat_move.repeat_last_move { forward = false } end
219 }
221 map.normal.visual.operator_pending {
222 description = 'This repeats the last query with always next direction and to the end of the range.',
223 keys = '<PageDown>',
224 category = 'textobjects',
225 command = function () ts_repeat_move.repeat_last_move { forward = true } end
226 }
228210 ---@diagnostic disable-next-line: inject-field
229211 parsers.get_parser_configs().just = {
230212 install_info = {

neovim/lua/bugabinga/plugins/whichkey.lua

Modified

+3 / −6 text lines

11local ignored = require 'std.ignored'
2local icon = require'std.icon'
34return {
45 'folke/which-key.nvim',
56 event = 'VeryLazy',
67 init = function ()
78 vim.o.timeout = true
8 vim.o.timeoutlen = 300
9 vim.o.timeoutlen = 250
910 end,
1011 opts = {
11 operators = {
12 -- TODO: make surround bind more logical and add here
13 ms = 'Surround',
14 },
1512 icons = {
16 group = ' '
13 group = icon.group,
1714 },
1815 window = {
1916 border = vim.g.border_style,

neovim/lua/bugabinga/ui.lua

Modified

+42 / −50 text lines

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

neovim/lua/std/project.lua

Modified

+0 / −1 text lines

206206 return find_root( path, java_markers )
207207end
209-- TODO: how to get a marker for luarocks stuff?
210209local lua_markers = {
211210 { name = '.luarc.json', weight = 1 },
212211 { name = '.luarc.jsonc', weight = 1 },

neovim/lua/std/want.lua

Deleted
deleted file mode 100644

+0 / −32 text lines

1-- FIXME: remove this, use pcall instead
2
3--- attempts to import modules with the given names.
4---@param module_names string|table name or list of names, or a function that returns those
5---@return function function that takes a function that takes in the modules listed by `module_names`
6---@deprecated use pcall instead
7return function ( module_names )
8 return function ( block, error_handler )
9 local loaded_modules = {}
10 local failed_modules = {}
11 if type( module_names ) == 'string' then
12 module_names = { module_names }
13 end
14 for _, name in pairs( module_names ) do
15 local status_ok, module = pcall( require, name )
16 if status_ok then
17 table.insert( loaded_modules, module )
18 else
19 table.insert( failed_modules, module )
20 end
21 end
22 if #failed_modules > 0 then
23 return error_handler and type( error_handler ) == 'function' and error_handler( unpack( failed_modules ) ) or
24 error_handler
25 else
26 for _, module in pairs( failed_modules ) do
27 vim.notify( 'A wanted module failed to load: ' .. module, 'error' )
28 end
29 end
30 return block and block( unpack( loaded_modules ) )
31 end
32end