repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk

557801caa2dd612f4fcffb0351d77b422d245307

Oliver Krylow <o.krylow@isp-insoft.de> ·

unsigned

Browse filesCompare with HEAD

Changed files (61)

helix/config.toml

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

helix/languages.toml

Modified
1 -[[language]]
1 +[[languages]]
2 2 name = "nasm"
3 3 language-server = { command = "asm-lsp" }
5 -[[language]]
5 +[[languages]]
6 6 name = "xml"
7 7 auto-format = false
8 8 language-server = { command = "lemminx" }

neovim/.luarc.jsonc

Added
new file mode 100644
1 +{
2 + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
3 + "runtime": {
4 + "version": "LuaJIT"
5 + },
6 + "diagnostics": {
7 + "globals": {
8 + "vim"
9 + }
10 + },
11 + "workspace": {
12 + "checkThirdParty": false,
13 + },
14 + "runtime": {
15 + "version": "LuaJIT",
16 + "pathStrict": true,
17 + "special": {
18 + "want": "require",
19 + }
20 + }

neovim/colors/nugu.lua

Modified
3 3 if vim.g.colors_name == nil then
4 4 -- Get the current hour
5 5 local current_hour = tonumber(os.date('%H'))
7 7 -- Set the background based on the time of day
8 - if current_hour >= 9 and current_hour < 21 then
8 + if current_hour >= 9 and current_hour < 19 then
9 9 vim.opt.background = 'light'
10 10 else
11 11 vim.opt.background = 'dark'

neovim/init.lua

Modified
14 14 -- configures the vim diagnostic subsystem
15 15 require'bugabinga.diagnostic'
16 16 require'bugabinga.trim'
17 +require'bugabinga.mark'
17 18 require'bugabinga.lsp'
19 20 -- TODO:
21 +-- [ ] highlight return keyword
20 22 -- [ ] use ltex-ls for markdown, code comments and commit messages
21 --- [ ] use nvimjdtls
22 23 -- [ ] DAP
23 --- [ ] nugu theme
24 24 -- [ ] add nu-check to nvim-lint
25 +-- [ ] replace hydra with normal mapping + whcihkey

neovim/lazy-lock.json

Modified
2 2 "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
3 + "LuaSnip": { "branch": "master", "commit": "0b4950a237ce441a6a3a947d501622453f6860ea" },
3 4 "better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" },
4 - "cmp-omni": { "branch": "main", "commit": "9436e6cdd7c5dfa24a99a60d9280b24dbdea3649" },
5 - "diffview.nvim": { "branch": "main", "commit": "7e5a85c186027cab1e825d018f07c350177077fc" },
5 + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
6 + "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
7 + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
8 + "cmp-omni": { "branch": "main", "commit": "4ef610bbd85a5ee4e97e09450c0daecbdc60de86" },
9 + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
10 + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
11 + "diffview.nvim": { "branch": "main", "commit": "a111d19ccceac6530448d329c63f998f77b5626e" },
6 12 "dressing.nvim": { "branch": "master", "commit": "59fe7ef1aeeed499b983614fcfff89206bf0d5ce" },
7 13 "flash.nvim": { "branch": "main", "commit": "e5a7bd96d0bb7e0806bfc18adea5ab148165bd62" },
14 + "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
8 15 "gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
9 16 "glow.nvim": { "branch": "main", "commit": "cf2177a514859fa3c55837b46de91d93b24cf488" },
10 17 "heirline.nvim": { "branch": "master", "commit": "7f1e805dfc001d5dbb7d894105063f463f6c7dcc" },
11 - "hlargs.nvim": { "branch": "main", "commit": "cfc9beab4e176a13311efe03e38e6b6fed5df4f6" },
18 + "hlargs.nvim": { "branch": "main", "commit": "6218a401824c5733ac50b264991b62d064e85ab2" },
19 + "hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" },
12 20 "inc-rename.nvim": { "branch": "main", "commit": "ed0f6f2b917cac4eb3259f907da0a481b27a3b7e" },
13 21 "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
14 22 "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
15 - "lush.nvim": { "branch": "main", "commit": "a8f0f7b9f837887f13a61d67b40ae26188fe4d62" },
16 - "mason.nvim": { "branch": "main", "commit": "4a8deb615a477029a549cea5cef69d90e4d1f850" },
23 + "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
24 + "lush.nvim": { "branch": "main", "commit": "966aad1accd47fa11fbe2539234f81f678fef2de" },
25 + "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
26 + "multicursors.nvim": { "branch": "main", "commit": "b7a837496da6f5b39b610a7cbd6c3f7d05526d6e" },
17 27 "neodev.nvim": { "branch": "main", "commit": "da1562e1e3df0e994ddc52cb4ba22376a5d7f2fc" },
18 28 "neogen": { "branch": "main", "commit": "cb1f384df804c1bf729332c4f728253fe17962d4" },
19 - "noice.nvim": { "branch": "main", "commit": "791c7adda821fd03529f995df2ee284ad591dabd" },
29 + "noice.nvim": { "branch": "main", "commit": "396f9146529130904e07c45e90ecdbfa607534f3" },
20 30 "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" },
21 31 "nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" },
22 - "nvim-autopairs": { "branch": "master", "commit": "35493556b895f54c129918aca43ae9a63af42a1f" },
32 + "nvim-autopairs": { "branch": "master", "commit": "de4f7138a68d5d5063170f2182fd27faf06b0b54" },
23 33 "nvim-cmp": { "branch": "main", "commit": "983453e32cb35533a119725883c04436d16c0120" },
24 34 "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
25 - "nvim-genghis": { "branch": "main", "commit": "683b42294410001e84ec50d93024bbe14c738db4" },
35 + "nvim-genghis": { "branch": "main", "commit": "b15d7d0c37f7739a5723f20dfae9e501b9952b08" },
26 36 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
27 37 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
28 38 "nvim-neoclip.lua": { "branch": "main", "commit": "4e406ae0f759262518731538f2585abb9d269bac" },
29 39 "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
30 - "nvim-spectre": { "branch": "master", "commit": "be7ff1d29ddf2de59b3dc293988d110c2c00ac84" },
31 40 "nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" },
32 - "nvim-treesitter": { "branch": "master", "commit": "95d02cdafe704fa5b86eac81f2eb1de3d8f52330" },
41 + "nvim-treesitter": { "branch": "master", "commit": "f3fb301b267e85e4cbc725561da4a82b1c3089c8" },
42 + "nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" },
33 43 "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
34 - "nvim-ts-context-commentstring": { "branch": "main", "commit": "9bff161dfece6ecf3459e6e46ca42e49f9ed939f" },
35 - "nvim-web-devicons": { "branch": "master", "commit": "bc11ee2498de2310de5776477dd9dce65d03b464" },
36 - "oil.nvim": { "branch": "master", "commit": "c12a12c34da2a04465308f410095bcbe47996f0b" },
44 + "nvim-ts-context-commentstring": { "branch": "main", "commit": "95e9ba9de4289d221666b66fd930d157c7ca08c6" },
45 + "nvim-web-devicons": { "branch": "master", "commit": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82" },
46 + "oil.nvim": { "branch": "master", "commit": "fdb50dc5c57524c4b0b05b593abff4d4f7a099f6" },
37 47 "persistence.nvim": { "branch": "main", "commit": "adcf6913693a0434665d162ee45a186230496f8a" },
38 - "playground": { "branch": "master", "commit": "429f3e76cbb1c59fe000b690f7a5bea617b890c0" },
48 + "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
39 49 "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
40 - "refactoring.nvim": { "branch": "master", "commit": "2ec9bc0fb5f3c8c6a0f776f0159dd2a3b1663554" },
41 50 "schemastore.nvim": { "branch": "main", "commit": "ce624332e6ba5a9a0c8f311a114ac179c5e72f62" },
42 51 "specs.nvim": { "branch": "main", "commit": "2743e412bbe21c9d73954c403d01e8de7377890d" },
43 52 "substitute.nvim": { "branch": "main", "commit": "42d09f1e6324d98aa2e5b765b64528e0aefe72b0" },
44 53 "telescope-symbols.nvim": { "branch": "master", "commit": "f2060117d965df4a626f068a4ebbd8ee051aa076" },
45 - "telescope.nvim": { "branch": "0.1.x", "commit": "9a9ca52206c2f39d2145c8c5458ddd2f6ef6e706" },
54 + "telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
55 + "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" },
56 + "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" },
46 57 "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" },
47 - "toggleterm.nvim": { "branch": "main", "commit": "b90a1381e9b5b8596f49070ee86c71db267ac868" },
58 + "toggleterm.nvim": { "branch": "main", "commit": "faee9d60428afc7857e0927fdc18daa6c409fa64" },
48 59 "treesj": { "branch": "main", "commit": "bff8c32b826e188fa558e94c7c93ac17a8ef0365" },
49 60 "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
50 - "virt-column.nvim": { "branch": "master", "commit": "1917bfb519729dea7b4f5d13aa9c810c9579b0ea" },
61 + "virt-column.nvim": { "branch": "master", "commit": "5fc72873dc3175eddbdbbedea8071919c99ad755" },
62 + "which-key.nvim": { "branch": "main", "commit": "bf09a25bdc9a83bcc69d2cf078e680368676513b" },
51 63 "zen-mode.nvim": { "branch": "main", "commit": "6e6c963d70a8e47854fa656987666bfb863f9c4e" }
52 -}

neovim/lua/bugabinga/diagnostic.lua

Modified
1 1 local want = require 'std.want'
2 -local map = require 'std.keymap'
3 -local auto = require'std.auto'
4 -local icon = require'std.icon'
2 +local map = require 'std.map'
3 +local auto = require 'std.auto'
4 +local icon = require 'std.icon'
6 6 local icon = { icon.error, icon.warn, icon.info, icon.hint }
7 7 icon.error = icon[1]
10 10 icon.hint = icon[4]
12 12 local display_name = {
13 - 'Error',
14 - 'Warning',
15 - 'Information',
16 - 'Hint',
13 + 'Error',
14 + 'Warning',
15 + 'Information',
16 + 'Hint',
19 19 local diagnostic = vim.diagnostic
20 -diagnostic.disable(0)
20 +diagnostic.disable( 0 )
22 -auto 'disable_diagnostic_initially'{
22 +auto 'disable_diagnostic_initially' {
23 23 description = 'Disable Diagnostics initially, when attaching an LSP client to a buffer',
24 24 events = 'LspAttach',
25 - command = function() diagnostic.disable(0) end,
25 + command = function () diagnostic.disable( 0 ) end,
28 -local diagnostic_format = function(context)
29 - return string.format('%s: %s', display_name[context.severity], context.message)
28 +local diagnostic_format = function ( context )
29 + return string.format( '%s: %s', display_name[context.severity], context.message )
32 -local prefix_format = function(context, index, total)
33 - return string.format('%s/%s %s %s ', index, total, context.source, icon[context.severity]), 'DiagnosticVirtualText'.. display_name[context.severity]
32 +local prefix_format = function ( context, index, total )
33 + return string.format( '%s/%s %s %s ', index, total, context.source, icon[context.severity] ),
34 + 'DiagnosticVirtualText' .. display_name[context.severity]
36 37 diagnostic.config {
37 38 underline = true,
38 39 virtual_text = {
39 - severity = { min = diagnostic.severity.WARN },
40 + severity = { min = diagnostic.severity.WARN },
40 41 source = false,
41 42 spacing = 2,
42 43 prefix = '⦿ ',
55 56 severity_sort = true,
58 -local sign = function(options)
59 - vim.fn.sign_define(options.name, {
59 +local sign = function ( options )
60 + vim.fn.sign_define( options.name, {
60 61 text = options.text,
61 62 texthl = options.name,
62 63 numhl = nil,
63 64 culhl = nil,
64 65 linehl = nil,
65 - })
66 + } )
68 69 sign { name = 'DiagnosticSignError', text = icon.error }
71 72 sign { name = 'DiagnosticSignInfo', text = icon.info }
73 74 map.normal {
74 - name = 'Toggle diagnostics',
75 + description = 'Toggle diagnostics',
75 76 category = 'diagnostic',
76 77 keys = '<F6><F6>',
77 - command = function()
78 - if diagnostic.is_disabled(0) then
79 - diagnostic.enable(0)
78 + command = function ()
79 + if diagnostic.is_disabled( 0 ) then
80 + diagnostic.enable( 0 )
80 81 vim.notify 'Enabling Diagnostics'
82 - diagnostic.disable(0)
83 + diagnostic.disable( 0 )
83 84 vim.notify 'Disabling Diagnostics'
88 89 map.normal {
89 - name = 'Show diagnostics under cursor',
90 + description = 'Show diagnostics under cursor',
90 91 category = 'diagnostic',
91 92 keys = 'H',
92 93 command = diagnostic.open_float,
95 -local show_diagnostics_in_buffer = function()
96 - want{ 'telescope.builtin', 'telescope.themes' }(
97 - function(builtin, themes)
98 - builtin.diagnostics(themes.get_dropdown{ bufnr=0 })
99 - end)
96 +local 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 )
102 103 map.normal {
103 - name = 'Show all diagnostics in buffer',
104 + description = 'Show all diagnostics in buffer',
104 105 category = 'diagnostic',
105 106 keys = '<F6>',
106 107 command = show_diagnostics_in_buffer,
109 -local show_diagnostics_in_workspace = function()
110 - want{ 'telescope.builtin', 'telescope.themes' }(
111 - function(builtin, themes)
112 - builtin.diagnostics(themes.get_dropdown{})
113 - end)
110 +local 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 )
116 117 map.normal {
117 - name = 'Show all diagnostics in workspace',
118 + description = 'Show all diagnostics in workspace',
118 119 category = 'diagnostic',
119 120 keys = '<leader><F6>',
120 121 command = show_diagnostics_in_workspace,
123 124 map.normal {
124 - name = 'Go to previous diagnostic',
125 + description = 'Go to previous diagnostic',
125 126 category = 'diagnostic',
126 127 keys = '<C-.>',
127 128 command = diagnostic.goto_prev,
130 131 map.normal {
131 - name = 'Go to next diagnostic',
132 + description = 'Go to next diagnostic',
132 133 category = 'diagnostic',
133 134 keys = '<C-,>',
134 135 command = diagnostic.goto_next,
137 138 -- a little debug helper to show all kinds of diagnostics
139 -local dia = function( severity, line )
140 - local ns = vim.api.nvim_create_namespace('test'.. tostring(severity))
140 +local dia = function ( severity, line )
141 + local ns = vim.api.nvim_create_namespace( 'test' .. tostring( severity ) )
141 142 local bufnr = vim.api.nvim_get_current_buf()
142 143 local options = {
143 144 bufnr = bufnr,
145 146 end_lnum = line,
146 147 col = 0,
147 148 severity = severity,
148 - message = 'This is a test ' .. tostring(severity) .. ' diagnostic',
149 + message = 'This is a test ' .. tostring( severity ) .. ' diagnostic',
151 - vim.diagnostic.set(ns, bufnr, {options})
152 - vim.diagnostic.show(ns, bufnr, {options})
152 + vim.diagnostic.set( ns, bufnr, { options } )
153 + vim.diagnostic.show( ns, bufnr, { options } )
155 -local send_dia = function()
156 - dia(vim.diagnostic.severity.ERROR, 1)
157 - dia(vim.diagnostic.severity.WARN, 2)
158 - dia(vim.diagnostic.severity.INFO, 3)
159 - dia(vim.diagnostic.severity.HINT, 4)
156 +local send_dia = function ()
157 + dia( vim.diagnostic.severity.ERROR, 1 )
158 + dia( vim.diagnostic.severity.WARN, 2 )
159 + dia( vim.diagnostic.severity.INFO, 3 )
160 + dia( vim.diagnostic.severity.HINT, 4 )
162 -vim.g.send_dia = send_dia
163 +vim.g.send_dia = send_dia

neovim/lua/bugabinga/lazy.lua

Modified
25 25 version = '*',
27 27 install = {
28 - missing = true,
28 + missing = false,
29 29 colorscheme = { 'nugu', 'quiet' },
31 31 checker = {
44 44 custom_keys = false,
45 - concurrency = 8,
45 + change_detection = { notify = false },
46 46 performance = {
47 47 rtp = {
48 48 disabled_plugins = {
80 -local map = require 'std.keymap'
80 +local map = require 'std.map'
82 82 local lazy_cmds = vim.iter {
83 83 { 'Show', '' , lazy.show } ,
101 101 keys = base_key .. cmd[2],
102 102 command = cmd[3],
104 -end)
104 +end)

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +return {
4 + name = 'pkgbuild-language-server',
5 + command = 'pkgbuild-language-server',
6 + filetypes = { 'PKGBUILD' },
7 + root_dir = project.find_vcs_project_root,
8 + single_file_support = true,
9 + workspaces = false,

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +return {
4 + name = 'asm-lsp',
5 + command = 'asm-lsp',
6 + filetypes = { 'asm', 'vmasm' },
7 + root_dir = project.find_vcs_project_root,
8 + single_file_support = true,
9 + workspaces = false,

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +return {
4 + name = 'bash-lsp',
5 + command = { 'bash-language-server', 'start' } ,
6 + filetypes = { 'sh' },
7 + root_dir = project.find_vcs_project_root,
8 + single_file_support = true,
9 + workspaces = false,
10 + settings = {
11 + bashIde = {
12 + -- Glob pattern for finding and parsing shell script files in the workspace.
13 + -- Used by the background analysis features across files.
15 + -- Prevent recursive scanning which will cause issues when opening a file
16 + -- directly in the home directory (e.g. ~/foo.sh).
17 + --
18 + -- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)".
19 + globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)',
20 + },
21 + },

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +return {
4 + name = 'clangd',
5 + command = 'clangd',
6 + filetypes = 'c',
7 + root_dir = project.find_vcs_project_root,
8 + single_file_support = true,
9 + workspaces = true,
10 + capabilities = {
11 + textDocument = {
12 + completion = {
13 + editsNearCursor = true,
14 + },
15 + },
16 + offsetEncoding = { 'utf-8', 'utf-16' },
17 + },

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +return {
4 + name = 'dot-lsp',
5 + command = { 'dot-language-server', '--stdio'},
6 + filetypes = 'dot',
7 + root_dir = project.find_vcs_project_root,
8 + single_file_support = true,
9 + workspaces = false,

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

Modified
1 -local lua = require'bugabinga.lsp.clients.lua'
2 --- NOTE: The order of clients is implicitly priorization.
3 --- Put "more specific" clients first
4 1 return {
5 - lua.nvim_lua_ls,
6 - lua.lua_ls,
2 + require'bugabinga.lsp.clients.java',
3 + require'bugabinga.lsp.clients.lua',
7 4 require'bugabinga.lsp.clients.json',
5 + require'bugabinga.lsp.clients.archlinux',
6 + require'bugabinga.lsp.clients.asm',
7 + require'bugabinga.lsp.clients.bash',
8 + require'bugabinga.lsp.clients.c',
9 + require'bugabinga.lsp.clients.graphviz',
10 + require'bugabinga.lsp.clients.markdown',
11 + require'bugabinga.lsp.clients.rust',
12 + require'bugabinga.lsp.clients.toml',
13 + require'bugabinga.lsp.clients.vim',
14 + require'bugabinga.lsp.clients.xml',
15 + require'bugabinga.lsp.clients.zig',

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

Added
new file mode 100644
1 +local table = require 'std.table'
2 +local project = require 'std.project'
4 +local create_shared_config_path = function(base_path, syntax_server)
5 + local os_config
6 + if vim.fn.has('linux') == 1 then
7 + os_config = syntax_server and 'config_linux' or 'config_ss_linux'
8 + elseif vim.fn.has('mac') == 1 then
9 + os_config = syntax_server and 'config_mac' or 'config_ss_mac'
10 + else
11 + os_config = syntax_server and 'config_win' or 'config_ss_win'
12 + end
13 + return vim.fs.joinpath(base_path, os_config)
14 +end
16 +local find_launcher_jar = function(base_path)
17 + local plugins_dir = vim.fs.joinpath(base_path, 'plugins')
18 + local launchers = vim.fn.globpath(plugins_dir, 'org.eclipse.equinox.launcher_*.jar', false, true)
20 + if table.is_empty(launchers) then
21 + vim.error('Could not find jdtls launcher jar in ' .. plugins_dir)
22 + end
24 + -- vim.print('found launcher jars', launchers)
25 + return launchers[1]
26 +end
28 +local create_data_dir = function()
29 + local cwd = vim.uv.cwd() or ''
30 + local data_name = vim.fn.sha256(cwd)
31 + local cache = vim.fn.stdpath 'cache'
32 + cache = type(cache) == 'table' and cache[1] or cache
34 + return vim.fs.joinpath(cache, 'jdtls_data', data_name)
35 +end
37 +local create_jdtls_command = function(syntax_server)
38 + local mason_packages_base_path = require 'mason-core.package':get_install_path()
39 + local jdtls_package_path = vim.fs.joinpath(mason_packages_base_path, 'jdtls')
40 + local shared_config_path = create_shared_config_path(jdtls_package_path, syntax_server)
41 + local launcher_jar = find_launcher_jar(jdtls_package_path)
42 + local data_dir = create_data_dir()
44 + local ss_option = syntax_server and '-Dsyntaxserver=true' or ''
46 + return {
47 + 'java',
48 + '-Declipse.application=org.eclipse.jdt.ls.core.id1',
49 + '-Dosgi.bundles.defaultStartLevel=4',
50 + '-Declipse.product=org.eclipse.jdt.ls.core.product',
51 + '-Dlog.protocol=true',
52 + '-Dlog.level=ALL',
53 + "-Dosgi.checkConfiguration=true",
54 + "-Dosgi.sharedConfiguration.area=" .. shared_config_path,
55 + "-Dosgi.sharedConfiguration.area.readOnly=true",
56 + "-Dosgi.configuration.cascaded=true",
57 + ss_option,
58 + '--add-modules=ALL-SYSTEM',
59 + '--add-opens', 'java.base/java.util=ALL-UNNAMED',
60 + '--add-opens', 'java.base/java.lang=ALL-UNNAMED',
61 + '-jar', launcher_jar,
62 + '-data', data_dir,
63 + }
64 +end
66 +local find_jdks = function()
67 + local host = vim.uv.os_gethostname()
68 + local jdk11 = {
69 + name = "JavaSE-11",
70 + }
71 + local jdk17 = {
72 + name = "JavaSE-17",
73 + }
74 + local jdk19 = {
75 + name = "JavaSE-19",
76 + }
78 + if host == 'pop-os' then
79 + jdk11.path = '/usr/lib/jvm/openjdk-11'
80 + jdk17.path = '/usr/lib/jvm/openjdk-17'
81 + jdk19.path = '/usr/lib/jvm/openjdk-19'
82 + else
83 + vim.notify 'missing jdk paths in java settings for lsp'
84 + end
86 + return { jdk11, jdk17, jdk19 }
87 +end
89 +local java_settings = {
90 + signatureHelp = { enabled = true },
91 + sources = {
92 + organizeImports = {
93 + starThreshold = 9999,
94 + staticStarThreshold = 9999,
95 + },
96 + },
97 + configuration = { runtimes = find_jdks(), },
100 +local jdtls_lsp_start = function(config, opts)
101 + -- vim.print('jdtls lsp start', config, opts)
102 + require 'jdtls'.start_or_attach(config, opts)
103 +end
105 +return {
106 + name = 'jdtls',
107 + custom_start = jdtls_lsp_start,
108 + filetypes = 'java',
109 + command = create_jdtls_command(true),
110 + root_dir = project.find_java_project_root,
111 + single_file_support = true,
112 + workspaces = false,
113 + settings = { java = java_settings },

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

Added
new file mode 100644
1 +-- TODO
2 +return {}

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

Modified
1 -local project = require'std.project'
1 +local project = require 'std.project'
3 -local lua_ls =
4 -{
3 +return {
5 4 name = 'LuaLS',
6 5 filetypes = 'lua',
7 6 command = 'lua-language-server',
8 - root_dir = project.find_lua_project_root,
7 + root_dir = function ( path )
8 + return project.find_lua_nvim_project_root( path ) or project.find_lua_project_root( path )
9 + end,
9 10 single_file_support = true,
10 11 workspaces = true,
11 - settings = {
12 - Lua = {
13 - addonManager = { enable = false },
14 - completion = { callSnippet = 'Both', postfix = '.' },
15 - diagnostics = { workspaceRate = 50 },
16 - hint = { enable = true, setType = true },
17 - runtime = {
18 - version = "Lua 5.4",
19 - pathStrict = true,
20 - },
21 - telemetry = { enable = true },
22 - window = { progressBar = false, statusBar = false },
23 - workspace = { checkThirdParty = false, }
24 - },
25 - }
26 -}
28 -local nvim_lua_ls =
29 -{
30 - name = 'LuaLS(nvim)',
31 - filetypes = 'lua',
32 - command = 'lua-language-server',
33 - root_dir = project.find_lua_nvim_project_root,
34 - single_file_support = false,
35 - workspaces = true,
36 12 settings = {
37 13 Lua = {
38 14 addonManager = { enable = false },
39 15 completion = { callSnippet = 'Both', postfix = '.' },
40 16 diagnostics = { globals = { 'vim' }, workspaceRate = 50 },
41 17 hint = { enable = true, setType = true },
42 - runtime = {
43 - version = 'LuaJIT',
44 - pathStrict = true,
45 - special = {
46 - want = 'require',
47 - },
48 - },
49 - telemetry = { enable = true },
18 + telemetry = { enable = false },
50 19 window = { progressBar = false, statusBar = false },
51 20 workspace = { checkThirdParty = false, }
54 - before_init = require"neodev.lsp".before_init,
55 -}
57 -return {
58 - lua_ls = lua_ls,
59 - nvim_lua_ls = nvim_lua_ls,
23 + before_init = require 'neodev.lsp'.before_init,

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +return {
4 + name = 'marksman',
5 + command = { 'marksman', 'server' },
6 + filetypes = 'markdown',
7 + root_dir = function(path)
8 + local markers = {
9 + { name = '.marksman.toml', weight = 10 }
10 + }
11 + return project.find_project_root(path, markers)
12 + end,
13 + single_file_support = true,
14 + workspaces = false,

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +local function is_library(path)
4 + local cargo_home = os.getenv 'CARGO_HOME' or util.path.join(vim.env.HOME, '.cargo')
5 + local registry = vim.fs.joinpath(cargo_home, 'registry', 'src')
7 + local rustup_home = os.getenv 'RUSTUP_HOME' or util.path.join(vim.env.HOME, '.rustup')
8 + for _, item in ipairs { toolchains, registry } do
9 + if path:sub(1, #item) == item then
10 + local clients = vim.lsp.get_active_clients { name = 'rust_analyzer' }
11 + return #clients > 0 and clients[#clients].config.root_dir or nil
12 + end
13 + end
14 +end
17 +return {
18 + name = 'rust-analyzer',
19 + command = 'rust-analyzer',
20 + filetypes = 'rust',
21 + root_dir = function(path)
22 + local library_root = is_library(path)
23 + if library_root then return library_root end
24 + return project.find_rust_project_root(path)
25 + end,
26 + capabilities = {
27 + experimental = {
28 + serverStatusNotification = true,
29 + },
30 + },

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +return {
4 + name = 'taplo',
5 + command = { 'taplo', 'lsp', 'stdio' },
6 + root_dir = project.find_vcs_project_root,
7 + filetypes = 'toml',
8 + single_file_support = true,
9 + workspaces = false,

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +return {
4 + name = 'vim-lsp',
5 + command = { 'vim-language-server', '--stdio' },
6 + filetypes = 'vim',
7 + root_dir = project.find_vcs_project_root,
8 + single_file_support = true,
9 + init_options = {
10 + isNeovim = true,
11 + iskeyword = '@,48-57,_,192-255,-#',
12 + vimruntime = '',
13 + runtimepath = '',
14 + diagnostic = { enable = true },
15 + indexes = {
16 + runtimepath = true,
17 + gap = 100,
18 + count = 3,
19 + projectRootPatterns = { 'runtime', 'nvim', '.git', 'autoload', 'plugin' },
20 + },
21 + suggest = { fromVimruntime = true, fromRuntimepath = true },
22 + },

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +return {
4 + name = 'lemminx',
5 + command = 'lemminx',
6 + filetypes = { 'xml', 'xsd', 'xsl', 'xslt', 'svg' },
7 + root_dir = project.find_vcs_project_root,
8 + single_file_support = true,
9 +}

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +return {
4 + name = 'zls',
5 + command = 'zls',
6 + filetypes = { 'zig', 'zir' },
7 + root_dir = project.find_zig_project_root,
8 + single_file_support = true,
9 + workspaces = true,

neovim/lua/bugabinga/lsp/init.lua

Modified
1 --- TODO: setup neodev + jsonls for neovim plugins ans config
2 --- TODO: setup nvimjdtls + lemminx for java/maven
3 --- TODO: setup marksman + ltex for markdown
4 --- TODO: setup mason for "less important" lsps
5 --- TODO: some snippet plugins seems necessary for some LSPs
1 +require 'bugabinga.lsp.lightbulb'
7 -local map = require 'std.keymap'
3 +local defer = require 'std.defer'
4 +local map = require 'std.map'
8 5 local auto = require 'std.auto'
6 +local want = require 'std.want'
9 7 local ui = require 'bugabinga.ui'
10 8 local table = require 'std.table'
11 9 local ignored = require 'std.ignored'
10 +local user_command = vim.api.nvim_create_user_command
13 11 local lsp_client_configs = require 'bugabinga.lsp.clients'
15 12 local _ = {}
17 14 local token_update = function ( lsp_client )
30 27 --* closures that capture something
33 -local expand_path = function(path)
34 - if vim.fn.executable(path) == 1 then
35 - return vim.fn.exepath(path)
30 +local expand_path = function ( path )
31 + if vim.fn.executable( path ) == 1 then
32 + return vim.fn.exepath( path )
37 34 return path
41 -local expand_command = function(command)
42 - vim.validate{ command = { command, { 'string', 'table' } }}
38 +local expand_command = function ( command )
39 + vim.validate { command = { command, { 'string', 'table' } } }
44 - if type(command) == 'table' then
45 - command[1] = expand_path(command[1])
46 - return command
41 + -- vim.print( 'expanding command', command )
43 + if type( command ) == 'table' then
44 + command[1] = expand_path( command[1] )
45 + return command
49 - return expand_path(command)
48 + return expand_path( command )
52 51 local lsp_start = function ( file_type_event )
52 + -- vim.print("LSP START", file_type_event)
53 54 local match = file_type_event.match
55 56 local matches_to_ignore = ignored.filetypes
57 + -- vim.print('filetypes to ignore', matches_to_ignore)
56 58 if vim.iter( matches_to_ignore ):find( match ) then return end
58 - -- vim.print("LSP START", file_type_event)
60 60 local bufnr = file_type_event.buf
61 61 local buffer_path = vim.api.nvim_buf_get_name( bufnr )
65 65 local potential_client_configs = vim.iter( lsp_client_configs )
66 66 :map( function ( config )
67 67 vim.validate {
68 - config = { config, 'table' },
68 + ['config'] = { config, 'table' },
69 69 ['config.name'] = { config.name, 'string' },
70 70 ['config.filetypes'] = { config.filetypes, { 'string', 'table' } },
71 71 ['config.command'] = { config.command, { 'string', 'table' } },
72 72 ['config.environment'] = { config.environment, 'table', true },
73 73 ['config.root_dir'] = { config.root_dir, 'function', 'string' },
74 - ['config.single_file_support'] = { config.single_file_support, 'boolean' },
74 + ['config.single_file_support'] = { config.single_file_support, 'boolean', true },
75 75 ['config.settings'] = { config.settings, 'table', true },
76 - ['config.workspaces'] = { config.workspaces, 'boolean' },
76 + ['config.workspaces'] = { config.workspaces, 'boolean', true },
77 77 ['config.before_init'] = { config.before_init, 'function', true },
78 78 ['config.init_options'] = { config.init_options, 'table', true },
79 79 ['config.capabilities'] = { config.capabilities, 'table', true },
80 + ['config.custom_start'] = { config.custom_start, 'function', true },
81 82 -- normalize scalar values to its vector alternative for easier processing later on
82 83 -- this mutates the lsp client configs! careful!
83 - config.command = type( config.command ) == 'string' and { expand_command(config.command) } or expand_command(config.command)
84 + config.command = type( config.command ) == 'string' and { expand_command( config.command ) } or
85 + expand_command( config.command )
86 + config.environment = config.environment or {}
84 87 config.filetypes = type( config.filetypes ) == 'string' and { config.filetypes } or config.filetypes
88 + config.single_file_support = config.single_file_support == nil and false or config.single_file_support
89 + config.workspaces = config.workspaces == nil and false or config.workspaces
85 90 config.capabilities = config.capabilities or {}
86 91 config.init_options = config.init_options or {}
92 97 end )
93 98 :totable()
95 - -- vim.print("POTENTIAL CLIENTS", #potential_client_configs)
100 + -- vim.print("POTENTIAL CLIENTS", vim.iter(potential_client_configs):map(function(config) return { name = config.name, command = config.command } end):totable())
97 - -- find clients, that returns some root_dir for this buffer
98 - local config = vim.iter( potential_client_configs ):find(
99 - function ( _ ) return _.root_dir( buffer_path ) ~= nil end
100 - )
102 - -- if no client can open this buffer as part of a project (root_dir), then look
103 - -- for a client with single file support
104 - -- FIXME: root_dir needs to change if single file mode
105 - config = config or vim.iter( potential_client_configs ):find(
106 - function ( _ ) return _.single_file_support end
107 - )
109 - if not config then
110 - vim.print('FOUND NO LSP CLIENT FOR', buffer_path)
102 + if table.is_empty( potential_client_configs ) then
103 + -- vim.notify( 'found no lsp client for', buffer_path )
111 104 return
114 - assert( config, 'a matching LSP client config shoud have been found by now!' )
107 + for _, config in ipairs( potential_client_configs ) do
108 + local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
109 + local capabilities = vim.lsp.protocol.make_client_capabilities()
110 + local cmp_capabilities = want 'cmp_nvim_lsp' ( function ( cmp )
111 + return cmp.default_capabilities()
112 + end, {} )
113 + capabilities = table.extend( 'force', capabilities, cmp_capabilities, config.capabilities )
114 + -- vim.print( 'lsp capabilities', capabilities, config.capabilities, cmp_capabilities )
116 - local root_dir = type(config.root_dir) == "string" and config.root_dir or config.root_dir( buffer_path )
117 - local capabilities = vim.lsp.protocol.make_client_capabilities()
118 - capabilities = table.extend("force", capabilities, config.capabilities)
116 + local start_config = {
117 + cmd = config.command,
118 + cmd_cwd = root_dir,
119 + -- cmd_env = config.environment,
120 + detached = false, -- do i want this?
121 + -- 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?
122 + capabilities = capabilities,
123 + -- handlers = vim.lsp.handlers,
124 + settings = config.settings,
125 + -- commands = nil, -- what is this?
126 + init_options = config.init_options,
127 + name = config.name,
128 + -- get_language_id = nil,
129 + -- offset_encoding = nil,
130 + on_error = function ( code, ... ) vim.print( 'LSP ERROR', code, ... ) end,
131 + before_init = config.before_init,
132 + -- on_init = nil, -- should i send workspace/didChangeConfiguration here?
133 + -- on_exit = function(code, signal, client_id) vim.print("LSP CLIENT EXIT", code, signal, client_id) end,
134 + -- on_attach = function(client, bufnr) vim.print("LSP CLIENT ATTACH", client.data.client_id, bufnr) end,
135 + trace = 'off',
136 + flags = { allow_incremental_sync = true, debounce_text_changes = 250, exit_timeout = 200 },
137 + root_dir = root_dir,
120 - local start_config = {
121 - cmd = config.command,
122 - cmd_cwd = root_dir,
123 - -- cmd_env = config.environment,
124 - detached = false, -- do i want this?
125 - -- 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?
126 - capabilities = capabilities,
127 - -- handlers = vim.lsp.handlers,
128 - settings = config.settings,
129 - -- commands = nil, -- what is this?
130 - init_options = config.init_options,
131 - name = config.name,
132 - -- get_language_id = nil,
133 - -- offset_encoding = nil,
134 - on_error = function ( code, ... ) vim.print( 'LSP ERROR', code, ... ) end,
135 - before_init = config.before_init,
136 - -- on_init = nil, -- should i send workspace/didChangeConfiguration here?
137 - -- on_exit = function(code, signal, client_id) vim.print("LSP CLIENT EXIT", code, signal, client_id) end,
138 - -- on_attach = function(client, bufnr) vim.print("LSP CLIENT ATTACH", client.data.client_id, bufnr) end,
139 - trace = 'off',
140 - flags = { allow_incremental_sync = true, debounce_text_changes = 50, exit_timeout = 200 },
141 - root_dir = root_dir,
142 - }
140 + local lsp_starter = config.custom_start or vim.lsp.start
144 - local client_id = vim.lsp.start( start_config, {
145 - bufnr = bufnr,
146 - -- TODO: reuse if workspaces
147 - -- local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
148 - -- reuse_client = function(existing_client, config)end,
149 - } )
142 + -- vim.print( 'starting lsp', start_config.name, root_dir )
151 - vim.print("ATTACHING LSP CLIENT", client_id)
144 + lsp_starter( start_config, {
145 + bufnr = bufnr,
146 + -- TODO: reuse if workspaces
147 + -- local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
148 + -- reuse_client = function ( existing_client, new_config )
149 + -- --TODO lsps with single file or worksopaces support do not need smame root dir. instead add_workspace_folder
150 + -- local same_name_and_root = existing_client.name == new_config.name and
151 + -- existing_client.workspace_folders[1] == new_config.root_dir;
152 + -- -- vim.print( 'resuing lsp client?', same_name_and_root )
153 + -- return same_name_and_root;
154 + -- end,
155 + } )
157 + -- vim.print("ATTACHING LSP CLIENT", client_id)
158 + end
154 161 local old_formatexpr
155 162 local old_omnifunc
156 163 local old_tagfunc
165 +local keybinds = {}
166 +local add = function ( keybind )
167 + table.insert( keybinds, keybind )
168 +end
158 170 local lsp_attach = function ( args )
159 171 local bufnr = args.buf
160 172 local client = vim.lsp.get_client_by_id( args.data.client_id )
177 189 vim.bo[bufnr].omnifunc = 'v:vim.lsp.omnifunc'
180 - -- TODO: create register/unregister abstraction for lsp features
181 - -- TODO: show available code actions as diagnostics (must be filtered)
182 - -- TODO: use nicer guis for lsp interactive features
183 - map.normal {
184 - name = 'Show available code actions on current line.',
185 - category = 'lsp',
186 - keys = '<c-1>',
187 - command = vim.lsp.buf.code_action,
188 - }
190 - map.normal {
191 - name = 'Goto to definition of symbol under cursor.',
192 - category = 'lsp',
193 - keys = '<c-2>',
194 - command = vim.lsp.buf.definition,
195 - }
196 - map.normal {
197 - name = 'Goto to definition of symbol under cursor.',
198 - category = 'telescope',
199 - keys = '<c-2><c-2>',
200 - command = '<cmd>Telescope lsp_definitions<cr>',
201 - }
203 192 if client.server_capabilities.documentHighlightProvider then
193 + -- the timer has application lifetime. no need to close
194 + local delay = 300
195 + local debounced_highlight = defer.debounce_leading( vim.lsp.buf.document_highlight, delay )
196 + local debounced_clear = defer.debounce_leading( vim.lsp.buf.clear_references, delay )
204 198 auto 'document_highlight' {
206 200 description = 'Highlight symbol under cursor on hold',
207 201 events = 'CursorHold',
208 - pattern = '<buffer>',
209 - command = vim.lsp.buf.document_highlight,
202 + buffer = bufnr,
203 + command = debounced_highlight,
211 - --TODO: debounce cursormoved events
213 206 description = 'Remove highlight from symbol under cursor on move',
214 207 events = { 'CursorMoved', 'InsertEnter' },
215 - pattern = '<buffer>',
216 - command = vim.lsp.buf.clear_references,
208 + buffer = bufnr,
209 + command = debounced_clear,
221 - --TODO: what can we do with those?
222 - --maybe: LspCommand <command> <args>
223 - -- map to <c-3>
224 - if client.server_capabilities.executeCommandProvider then
225 - -- [1] ≔ 󰝗 lua.removeSpace 󰉾,
226 - -- [2] ≔ 󰝗 lua.solve 󰉾,
227 - -- [3] ≔ 󰝗 lua.jsonToLua 󰉾,
228 - -- [4] ≔ 󰝗 lua.setConfig 󰉾,
229 - -- [5] ≔ 󰝗 lua.getConfig 󰉾,
230 - -- [6] ≔ 󰝗 lua.autoRequire 󰉾,
231 - end
214 + -- if client.server_capabilities.inlayHintProvider then
215 + -- TODO: how to prevent the UI from jittering
216 + -- vim.lsp.inlay_hint( bufnr, true )
217 + -- end
233 - map.normal {
234 - name = 'Format current buffer',
219 + add(map.normal {
220 + description = 'Format current buffer',
235 221 category = 'lsp',
236 - keys = '<c-F>',
222 + buffer = bufnr,
223 + keys = '<c-s>',
224 + --TODO: save actions
237 225 command = vim.lsp.buf.format,
238 - }
226 + })
240 - map.normal {
241 - name = 'Show hover documentation above cursor.',
228 + add(map.normal {
229 + description = 'Show hover documentation above cursor.',
242 230 category = 'lsp',
243 - keys = '<c-q>',
231 + buffer = bufnr,
232 + keys = { 'K', '<leader>lk' },
244 233 command = vim.lsp.buf.hover,
245 - }
234 + })
247 - map.normal {
248 - name = 'Show implementations of symbol under cursor.',
236 + add(map.normal {
237 + description = 'Show signature help under cursor.',
249 238 category = 'lsp',
250 - keys = '<c-4>',
251 - command = vim.lsp.buf.implementation,
252 - }
253 - map.normal {
254 - name = 'Show implementations of symbol under cursor.',
255 - category = 'telescope',
256 - keys = '<c-4><c-4>',
257 - command = '<cmd>Telescope lsp_implementations<cr>',
258 - }
260 - map.normal {
261 - name = 'Show incoming calls of symbol under cursor.',
262 - category = 'lsp',
263 - keys = '<c-5>',
264 - command = vim.lsp.buf.incoming_calls,
265 - }
266 - map.normal {
267 - name = 'Show incoming calls of symbol under cursor.',
268 - category = 'telescope',
269 - keys = '<c-5><c-5>',
270 - command = '<cmd>Telescope lsp_incoming_calls<cr>',
271 - }
272 - map.normal {
273 - name = 'Show outgoing calls of symbol under cursor.',
274 - category = 'lsp',
275 - keys = '<c-s-5>',
276 - command = vim.lsp.buf.outgoing_calls,
277 - }
278 - map.normal {
279 - name = 'Show outgoing calls of symbol under cursor.',
280 - category = 'telescope',
281 - keys = '<c-s-5><c-s-5>',
282 - command = '<cmd>Telescope lsp_outgoing_calls<cr>',
283 - }
285 - map.normal {
286 - name = 'Show references of symbol under cursor.',
287 - category = 'lsp',
288 - keys = '<c-6>',
289 - command = vim.lsp.buf.references,
290 - }
291 - map.normal {
292 - name = 'Show references of symbol under cursor.',
293 - category = 'telescope',
294 - keys = '<c-6><c-6>',
295 - command = vim.lsp.buf.references,
296 - }
298 - map.normal {
299 - name = 'Rename symbol under cursor.',
300 - category = 'lsp',
301 - keys = '<c-R>',
302 - command = vim.lsp.buf.rename,
303 - }
305 - map.normal {
306 - name = 'Show signature help under cursor.',
307 - category = 'lsp',
308 - keys = '<c-7>',
239 + buffer = bufnr,
240 + keys = '<leader>ls',
309 241 command = vim.lsp.buf.signature_help,
310 - }
242 + })
312 - map.normal {
313 - name = 'Show signature help under cursor.',
314 - category = 'telescope',
315 - keys = '<c-7><c-7>',
316 - command = '<cmd>Telescope lsp_signature_help<cr>',
317 - }
244 + add(map.normal {
245 + description = 'Show available code actions on current line.',
246 + category = 'lsp',
247 + buffer = bufnr,
248 + keys = '<leader>la',
249 + command = vim.lsp.buf.code_action,
250 + })
252 + add(map.normal {
253 + description = 'Goto to definition of symbol under cursor.',
254 + category = 'lsp',
255 + buffer = bufnr,
256 + keys = '<leader>ld',
257 + command = vim.lsp.buf.definition,
258 + })
260 + add(map.normal {
261 + description = 'Show implementations of symbol under cursor.',
262 + category = 'lsp',
263 + buffer = bufnr,
264 + keys = '<leader>li',
265 + command = vim.lsp.buf.implementation,
266 + })
268 + add(map.normal {
269 + description = 'Show incoming calls of symbol under cursor.',
270 + category = 'lsp',
271 + buffer = bufnr,
272 + keys = '<leader>lci',
273 + command = vim.lsp.buf.incoming_calls,
274 + })
276 + add(map.normal {
277 + description = 'Show outgoing calls of symbol under cursor.',
278 + category = 'lsp',
279 + buffer = bufnr,
280 + keys = '<leader>lco',
281 + command = vim.lsp.buf.outgoing_calls,
282 + })
284 + add(map.normal {
285 + description = 'Show references of symbol under cursor.',
286 + category = 'lsp',
287 + buffer = bufnr,
288 + keys = '<leader>lr',
289 + command = vim.lsp.buf.references,
290 + })
292 + add(map.normal {
293 + description = 'Rename symbol under cursor.',
294 + category = 'lsp',
295 + buffer = bufnr,
296 + keys = { '<f2>', '<leader>ln' },
297 + command = vim.lsp.buf.rename,
298 + })
320 301 local lsp_detach = function ( args )
335 316 if client.server_capabilities.completionProvider then
336 317 vim.bo[bufnr].omnifunc = old_omnifunc
320 + for _, keybind_delete in ipairs(keybinds) do
321 + keybind_delete()
322 + end
340 326 auto 'lsp' {
363 349 local lsp_info = function ( command )
364 350 local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0 }
365 - local active_clients = vim.lsp.get_clients( all_or_current )
351 + local active_clients = vim.lsp.get_active_clients( all_or_current )
367 353 local infos = vim.iter( active_clients )
368 354 :map( function ( client )
395 381 ui.show_tree( active_clients )
398 -vim.api.nvim_create_user_command( 'LspInfo',
399 - lsp_info,
400 - {
401 - nargs = '?',
402 - complete = function () return { 'all' } end,
403 - desc = 'Shows basic information about running LSP clients.',
404 - } )
384 +user_command( 'LspInfo', lsp_info, {
385 + nargs = '?',
386 + complete = function () return { 'all' } end,
387 + desc = 'Shows basic information about running LSP clients.',
388 +} )
390 +user_command( 'LspInfoExtended', lsp_info_extended, {
391 + nargs = '?',
392 + complete = function () return { 'all' } end,
393 + desc = 'Shows detailed information about running LSP clients.',
394 +} )
406 -vim.api.nvim_create_user_command( 'LspInfoExtended',
407 - lsp_info_extended,
408 - {
409 - nargs = '?',
410 - complete = function () return { 'all' } end,
411 - desc = 'Shows detailed information about running LSP clients.',
412 - } )
413 396 return setmetatable( _, {} )

neovim/lua/bugabinga/lsp/lightbulb.lua

Added
new file mode 100644
1 +--VSCode-like lightbulb.
2 +--Implementation inspired from https://github.com/nvimdev/lspsaga.nvim/blob/c9b17bc7dc694bdbeb3788a583518073a30a6de2/lua/lspsaga/codeaction/lightbulb.lua
4 +local lb_name = 'mariasolos/lightbulb'
5 +local lb_namespace = vim.api.nvim_create_namespace( lb_name )
6 +local lb_icon = require 'std.icon'.hint
7 +local lb_group = vim.api.nvim_create_augroup( lb_name, { clear = true } )
8 +local code_action_method = vim.lsp.protocol.Methods.textDocument_codeAction
9 +local timer = vim.uv.new_timer()
10 +local updated_bufnr = nil
12 +---Updates the current lightbulb.
13 +---@param bufnr number?
14 +---@param line number?
15 +local function update_extmark( bufnr, line )
16 + if not bufnr or not vim.api.nvim_buf_is_valid( bufnr ) then
17 + return
18 + end
20 + vim.api.nvim_buf_clear_namespace( bufnr, lb_namespace, 0, -1 )
22 + -- Extra check for not being in insert mode here because sometimes the autocommand
23 + -- fails with motions from Comment.nvim.
24 + if not line or vim.api.nvim_get_mode().mode:sub( 1, 1 ) == 'i' then
25 + return
26 + end
28 + vim.api.nvim_buf_set_extmark( bufnr, lb_namespace, line, -1, {
29 + virt_text = { { ' ' .. lb_icon, 'DiagnosticSignHint' } },
30 + hl_mode = 'combine',
31 + } )
33 + updated_bufnr = bufnr
34 +end
36 +---Queries the LSP servers for code actions and updates the lightbulb
37 +---accordingly.
38 +---@param bufnr number
39 +local function render( bufnr )
40 + local line = vim.api.nvim_win_get_cursor( 0 )[1] - 1
41 + local diagnostics = vim.diagnostic.get( bufnr, { lnum = line } )
43 + -- If there are hints in the current line, don't show yet another lightbulb.
44 + if
45 + vim.iter( diagnostics ):any( function ( diag )
46 + return diag.severity == vim.diagnostic.severity.HINT
47 + end )
48 + then
49 + update_extmark( bufnr, nil )
50 + return
51 + end
53 + local params = vim.lsp.util.make_range_params()
54 + params.context = {
55 + diagnostics = diagnostics,
56 + triggerKind = vim.lsp.protocol.CodeActionTriggerKind.Automatic,
57 + }
59 + vim.lsp.buf_request( bufnr, code_action_method, params, function ( _, res, _ )
60 + if vim.api.nvim_get_current_buf() ~= bufnr then
61 + return
62 + end
64 + update_extmark( bufnr, (res and #res > 0 and line) or nil )
65 + end )
66 +end
68 +-- I don't fully understand how this works, kind of just copy-pasted it
69 +-- from lspsaga.
70 +---@param bufnr number
71 +local function update( bufnr )
72 + assert( timer, 'Timer is not initialized' )
74 + timer:stop()
75 + update_extmark( updated_bufnr )
76 + timer:start( 100, 0, function ()
77 + timer:stop()
78 + vim.schedule( function ()
79 + if vim.api.nvim_buf_is_valid( bufnr ) and vim.api.nvim_get_current_buf() == bufnr then
80 + render( bufnr )
81 + end
82 + end )
83 + end )
84 +end
86 +vim.api.nvim_create_autocmd( 'LspAttach', {
87 + group = lb_group,
88 + desc = 'Configure code action lightbulb',
89 + callback = function ( event )
90 + local buf = event.buf
91 + local client = vim.lsp.get_client_by_id( event.data.client_id )
93 + if not client or not client.supports_method( code_action_method ) then
94 + return
95 + end
97 + local buf_group_name = lb_name .. tostring( buf )
98 + if pcall( vim.api.nvim_get_autocmds, { group = buf_group_name, buffer = buf } ) then
99 + return
100 + end
102 + local lb_buf_group = vim.api.nvim_create_augroup( buf_group_name, { clear = true } )
103 + vim.api.nvim_create_autocmd( 'CursorMoved', {
104 + group = lb_buf_group,
105 + desc = 'Update lightbulb when moving the cursor in normal/visual mode',
106 + buffer = buf,
107 + callback = function ()
108 + update( buf )
109 + end,
110 + } )
112 + vim.api.nvim_create_autocmd( { 'InsertEnter', 'BufLeave' }, {
113 + group = lb_buf_group,
114 + desc = 'Update lightbulb when entering insert mode or leaving the buffer',
115 + buffer = event.buf,
116 + callback = function ()
117 + update_extmark( buf, nil )
118 + end,
119 + } )
120 + end,
121 +} )
123 +vim.api.nvim_create_autocmd( 'LspDetach', {
124 + group = lb_group,
125 + desc = 'Detach code action lightbulb',
126 + callback = function ( event )
127 + pcall( vim.api.nvim_del_augroup_by_name, lb_name .. tostring( event.buf ) )
128 + end,
129 +} )

neovim/lua/bugabinga/mark.lua

Added
new file mode 100644
1 +-- Custom mark API.
2 +-- Implementation slightly inspired by https://github.com/chentoast/marks.nvim, but this is
3 +-- much simpler.
5 +---Map of mark information per buffer.
6 +---@type table<integer, table<string, {line: integer, id: integer}>>
7 +local marks = {}
9 +---Keeps track of the signs I've already created.
10 +---@type table<string, boolean>
11 +local sign_cache = {}
13 +---The sign and autocommand group name.
14 +local sign_group_name = 'MarksSigns'
16 +---@param mark string
17 +local function is_lowercase_mark( mark )
18 + return 97 <= mark:byte() and mark:byte() <= 122
19 +end
21 +---@param mark string
22 +local function is_uppercase_mark( mark )
23 + return 65 <= mark:byte() and mark:byte() <= 90
24 +end
26 +---@param mark string
27 +local function is_letter_mark( mark )
28 + return is_lowercase_mark( mark ) or is_uppercase_mark( mark )
29 +end
31 +---@param mark string
32 +---@param bufnr integer
33 +local function delete_mark( mark, bufnr )
34 + local buffer_marks = marks[bufnr]
36 + if not buffer_marks or not buffer_marks[mark] then
37 + return
38 + end
40 + vim.fn.sign_unplace( sign_group_name, { buffer = bufnr, id = buffer_marks[mark].id } )
41 + buffer_marks[mark] = nil
43 + if is_letter_mark( mark ) then
44 + vim.cmd( 'delmarks ' .. mark )
45 + end
46 +end
48 +---@param mark string
49 +---@param bufnr integer
50 +---@param line? integer
51 +local function register_mark( mark, bufnr, line )
52 + local buffer_marks = marks[bufnr]
54 + if not buffer_marks then
55 + return
56 + end
58 + if buffer_marks[mark] then
59 + -- Mark already exists, remove it first.
60 + delete_mark( mark, bufnr )
61 + end
63 + -- Add the sign to the tracking table.
64 + local id = mark:byte() * 100
65 + line = line or vim.api.nvim_win_get_cursor( 0 )[1]
66 + buffer_marks[mark] = { line = line, id = id }
68 + -- Create the sign.
69 + local sign_name = 'Marks_' .. mark
70 + if not sign_cache[sign_name] then
71 + vim.fn.sign_define( sign_name, { text = mark, texthl = 'GitSignsChange' } )
72 + sign_cache[sign_name] = true
73 + end
74 + vim.fn.sign_place( id, sign_group_name, sign_name, bufnr, {
75 + lnum = line,
76 + priority = 10,
77 + } )
78 +end
80 +---@param bufnr integer
81 +local function set_keymaps( bufnr )
82 + vim.api.nvim_buf_set_keymap( bufnr, 'n', '<leader>m', '', {
83 + desc = 'Add mark',
84 + callback = function ()
85 + local ok, mark = pcall( function ()
86 + return vim.fn.getcharstr()
87 + end )
88 + if not ok then
89 + return
90 + end
92 + if is_letter_mark( mark ) then
93 + register_mark( mark, bufnr )
94 + vim.cmd( 'normal! m' .. mark )
95 + end
96 + end,
97 + } )
99 + vim.api.nvim_buf_set_keymap( bufnr, 'n', '<leader>dm', '', {
100 + desc = 'Delete mark',
101 + callback = function ()
102 + local ok, mark = pcall( function ()
103 + return vim.fn.getcharstr()
104 + end )
105 + if not ok then
106 + return
107 + end
109 + if is_letter_mark( mark ) then
110 + delete_mark( mark, bufnr )
111 + end
112 + end,
113 + } )
115 + vim.api.nvim_buf_set_keymap( bufnr, 'n', '<leader>dM', '', {
116 + desc = 'Delete all buffer marks',
117 + callback = function ()
118 + -- NOTE: This will delete the builtin marks too, but I'll restore
119 + -- them on cursor move so whatever.
120 + marks[bufnr] = {}
121 + vim.fn.sign_unplace( sign_group_name, { buffer = bufnr } )
122 + vim.cmd 'delmarks!'
123 + end,
124 + } )
125 +end
127 +---@param bufnr integer
128 +local function refresh_builtin_marks( bufnr )
129 + for _, builtin_mark in ipairs { '.', '`' } do
130 + local pos = vim.fn.getpos( "'" .. builtin_mark )
131 + local cached_mark = marks[bufnr][builtin_mark]
132 + if (pos[1] == 0 or pos[1] == bufnr) and pos[2] ~= 0 and (not cached_mark or pos[2] ~= cached_mark.line) then
133 + register_mark( builtin_mark, bufnr, pos[2] )
134 + end
135 + end
136 +end
138 +vim.api.nvim_create_autocmd( 'BufWinEnter', {
139 + group = vim.api.nvim_create_augroup( sign_group_name, { clear = true } ),
140 + desc = 'Configure mark signs',
141 + callback = function ( event )
142 + local bufnr = event.buf
143 + -- Only handle normal buffers.
144 + if vim.bo[bufnr].bt ~= '' then
145 + return
146 + end
148 + -- Set custom mappings.
149 + set_keymaps( bufnr )
151 + if not marks[bufnr] then
152 + marks[bufnr] = {}
153 + end
155 + -- Remove all marks that were deleted.
156 + for mark, _ in pairs( marks[bufnr] ) do
157 + if vim.api.nvim_buf_get_mark( bufnr, mark )[1] == 0 then
158 + delete_mark( mark, bufnr )
159 + end
160 + end
162 + -- Register the letter marks.
163 + for _, data in ipairs( vim.fn.getmarklist() ) do
164 + local mark = data.mark:sub( 2, 3 )
165 + local pos = data.pos
166 + local cached_mark = marks[bufnr][mark]
168 + if is_uppercase_mark( mark ) and pos[1] == bufnr and (not cached_mark or pos[2] ~= cached_mark.line) then
169 + register_mark( mark, bufnr, pos[2] )
170 + end
171 + end
172 + for _, data in ipairs( vim.fn.getmarklist '%' ) do
173 + local mark = data.mark:sub( 2, 3 )
174 + local pos = data.pos
175 + local cached_mark = marks[bufnr][mark]
177 + if is_lowercase_mark( mark ) and (not cached_mark or pos[2] ~= cached_mark.line) then
178 + register_mark( mark, bufnr, pos[2] )
179 + end
180 + end
182 + local buf_group_name = sign_group_name .. tostring( bufnr )
183 + if pcall( vim.api.nvim_get_autocmds, { group = buf_group_name, buffer = bufnr } ) then
184 + return
185 + end
186 + refresh_builtin_marks( bufnr )
187 + local marks_buf_group = vim.api.nvim_create_augroup( buf_group_name, { clear = true } )
188 + vim.api.nvim_create_autocmd( 'CursorMoved', {
189 + group = marks_buf_group,
190 + desc = 'Refresh signs for builtin marks',
191 + buffer = bufnr,
192 + callback = function ()
193 + refresh_builtin_marks( bufnr )
194 + end,
195 + } )
196 + end,
197 +} )

neovim/lua/bugabinga/nugu/init.lua

Modified
1 +---@diagnostic disable: undefined-global
1 2 local palette = require 'bugabinga.nugu.palette'
2 3 local lush = require 'lush'
3 4 local hsl = lush.hsluv
169 170 DiagnosticSignHint { DiagnosticHint },
170 171 DiagnosticSignOk { DiagnosticOk },
172 - LspReferenceText { bg = content_unfocus },
173 + LspReferenceText { fg = content_focus, bg = content_unfocus },
173 174 LspReferenceRead { LspReferenceText },
174 175 LspReferenceWrite { LspReferenceText },
176 + LspInlayHint { fg = content_minor, bg = ui_unfocus },
176 178 -- hlargs.nvim
177 - Hlargs { fg = ui_important_local, gui = 'bold underdotted' },
179 + Hlargs { fg = ui_important_local },
179 181 -- Tree-Sitter syntax groups.
194 196 -- For more information see https://github.com/rktjmp/lush.nvim/issues/109
196 - -- sym"@text.literal" { }, -- Comment
197 - -- sym"@text.reference" { }, -- Identifier
198 - -- sym"@text.title" { }, -- Title
199 - -- sym"@text.uri" { }, -- Underlined
200 - -- sym"@text.underline" { }, -- Underlined
201 - -- sym"@text.todo" { }, -- Todo
202 - -- sym"@comment" { }, -- Comment
203 - -- sym"@punctuation" { }, -- Delimiter
204 - -- sym"@constant" { }, -- Constant
205 - -- sym"@constant.builtin" { }, -- Special
206 - -- sym"@constant.macro" { }, -- Define
207 - -- sym"@define" { }, -- Define
208 - -- sym"@macro" { }, -- Macro
209 - -- sym"@string" { }, -- String
210 - -- sym"@string.escape" { }, -- SpecialChar
211 - -- sym"@string.special" { }, -- SpecialChar
212 - -- sym"@character" { }, -- Character
213 - -- sym"@character.special" { }, -- SpecialChar
214 - -- sym"@number" { }, -- Number
215 - -- sym"@boolean" { }, -- Boolean
216 - -- sym"@float" { }, -- Float
217 - -- sym"@function" { }, -- Function
218 - -- sym"@function.builtin" { }, -- Special
219 - -- sym"@function.macro" { }, -- Macro
220 - -- sym"@parameter" { }, -- Identifier
221 - -- sym"@method" { }, -- Function
222 - -- sym"@field" { }, -- Identifier
223 - -- sym"@property" { }, -- Identifier
224 - -- sym"@constructor" { }, -- Special
225 - -- sym"@conditional" { }, -- Conditional
226 - -- sym"@repeat" { }, -- Repeat
227 - -- sym"@label" { }, -- Label
228 - -- sym"@operator" { }, -- Operator
229 - -- sym"@keyword" { }, -- Keyword
230 - -- sym"@exception" { }, -- Exception
231 - -- sym"@variable" { }, -- Identifier
232 - -- sym"@type" { }, -- Type
233 - -- sym"@type.definition" { }, -- Typedef
234 - -- sym"@storageclass" { }, -- StorageClass
235 - -- sym"@structure" { }, -- Structure
236 - -- sym"@namespace" { }, -- Identifier
237 - -- sym"@include" { }, -- Include
238 - -- sym"@preproc" { }, -- PreProc
239 - -- sym"@debug" { }, -- Debug
240 - -- sym"@tag" { }, -- Tag
198 + sym '@text.literal' { Comment },
199 + sym '@text.reference' { Identifier },
200 + sym '@text.title' { Title },
201 + sym '@text.underline' { Underlined },
202 + sym '@text.todo' { Todo },
203 + sym '@comment' { Comment },
204 + sym '@punctuation' { Delimiter },
205 + sym '@constant' { Constant },
206 + sym '@constant.builtin' { Special },
207 + sym '@constant.macro' { Define },
208 + sym '@define' { Define },
209 + sym '@macro' { Macro },
210 + sym '@string' { String },
211 + sym '@string.escape' { SpecialChar },
212 + sym '@string.special' { SpecialChar },
213 + sym '@character' { Character },
214 + sym '@character.special' { SpecialChar },
215 + sym '@number' { Number },
216 + sym '@boolean' { Boolean },
217 + sym '@float' { Float },
218 + sym '@function' { Function },
219 + sym '@function.builtin' { Special },
220 + sym '@function.macro' { Macro },
221 + sym '@parameter' { Identifier },
222 + sym '@method' { Function },
223 + sym '@field' { Identifier },
224 + sym '@property' { Identifier },
225 + sym '@constructor' { Special },
226 + sym '@conditional' { Conditional },
227 + sym '@repeat' { Repeat },
228 + sym '@label' { Label },
229 + sym '@operator' { Operator },
230 + sym '@keyword' { Keyword },
231 + sym '@exception' { Exception },
232 + sym '@variable' { Identifier },
233 + sym '@type' { Type },
234 + sym '@type.definition' { Typedef },
235 + sym '@storageclass' { StorageClass },
236 + sym '@structure' { Structure },
237 + sym '@namespace' { Identifier },
238 + sym '@include' { Include },
239 + sym '@preproc' { PreProc },
240 + sym '@debug' { Debug },
241 + sym '@tag' { Tag },
243 + sym '@lsp.type.namespace' { sym '@namespace' },
244 + sym '@lsp.type.type' { sym '@type' },
245 + sym '@lsp.type.class' { sym '@type' },
246 + sym '@lsp.type.enum' { sym '@type' },
247 + sym '@lsp.type.interface' { sym '@type' },
248 + sym '@lsp.type.struct' { sym '@structure' },
249 + sym '@lsp.type.parameter' { sym '@parameter' },
250 + sym '@lsp.type.variable' { sym '@variable' },
251 + sym '@lsp.type.property' { sym '@property' },
252 + sym '@lsp.type.enumMember' { sym '@constant' },
253 + sym '@lsp.type.function' { sym '@function' },
254 + sym '@lsp.type.method' { sym '@method' },
255 + sym '@lsp.type.macro' { sym '@macro' },
256 + sym '@lsp.type.decorator' { sym '@function' },
242 258 -- lazy.nvim
243 259 LazyButton { NormalFloat, sp = NormalFloat.fg, gui = 'bold' },
393 409 TelescopeMultiSelection { fg = PmenuSel.fg, bg = ui_important_local },
395 411 FlashBackdrop {},
396 - FlashMatch { Search },
397 - FlashCurrent { IncSearch },
398 - FlashLabel { gui = 'reverse' },
412 + FlashMatch { bg = content_unfocus },
413 + FlashCurrent { fg = content_accent, bg = content_unfocus },
414 + FlashLabel { fg = Search.bg, bg = Search.fg },
400 416 GitSignsAdd { fg = DiffAdd.fg, bg = ui_backdrop },
401 417 GitSignsChange { fg = DiffChange.fg, bg = ui_backdrop },
434 450 GitSignsDeleteVirtLn { GitSignsDelete },
435 451 GitSignsDeleteVirtLnInLine { DiffText },
436 452 GitSignsVirtLnum { fg = LineNr.fg },
454 + WhichKey { fg = ui_important_global }, -- the key
455 + WhichKeyGroup { fg = ui_important_local }, -- a group
456 + WhichKeySeparator { fg = ui_minor }, -- the separator between the key and its label
457 + WhichKeyDesc { fg = ui_normal }, -- the label of the key
458 + WhichKeyFloat { NormalFloat }, -- Normal in the popup window
459 + WhichKeyBorder { FloatBorder }, -- Normal in the popup window
460 + WhichKeyValue { Comment }, -- used by plugins that provide values

neovim/lua/bugabinga/options/keymaps.lua

Modified
1 -local map = require 'std.keymap'
1 +local map = require 'std.map'
2 2 local want = require 'std.want'
4 4 -- set <SPACE> as leader key
19 19 -- insert newline under or above in normal mode
20 20 map.normal {
21 - name = 'Insert newline under cursor',
21 + description = 'Insert newline under cursor',
22 22 category = 'editing',
23 23 keys = '<C-enter>',
24 24 command = function()
33 33 map.normal {
34 - name = 'Insert newline above cursor',
34 + description = 'Insert newline above cursor',
35 35 category = 'editing',
36 36 keys = '<C-S-enter>',
37 37 command = function()
88 88 -- system clipboard copy and paste
89 89 map.normal.visual {
90 - name = 'yank into system clipboard',
90 + description = 'yank into system clipboard',
91 91 category = 'editing',
92 92 keys = '<leader>y',
93 93 command = '"+y',
96 96 map.normal.visual {
97 - name = 'yank line into system clipboard',
97 + description = 'yank line into system clipboard',
98 98 category = 'editing',
99 99 keys = '<leader>yy',
100 100 command = '"+Y',
103 103 map.normal.visual {
104 - name = 'paste before from system clipboard',
104 + description = 'paste before from system clipboard',
105 105 category = 'editing',
106 106 keys = '<leader>p',
107 107 command = '"+p',
110 110 map.normal.visual {
111 - name = 'paste after from system clipboard',
111 + description = 'paste after from system clipboard',
112 112 category = 'editing',
113 113 keys = '<leader>P',
114 114 command = '"+P',
117 117 map.insert {
118 - name = 'Cycle through autocomplete popup',
118 + description = 'Cycle through autocomplete popup',
119 119 category = 'editing',
120 120 keys = '<tab>',
121 121 options = { expr = true },
142 142 map.normal {
143 - name = 'Open web link under cursor in browser',
143 + description = 'Open web link under cursor in browser',
144 144 category = 'navigation',
145 145 keys = 'gx',
146 146 command = open_link_under_cursor,
149 149 map.normal {
150 - name = 'Dismiss current search highlight',
150 + description = 'Dismiss current search highlight',
151 151 category = 'search',
152 152 keys = '<esc><esc>',
153 153 command = function() vim.cmd [[ nohlsearch ]] end,
170 170 map.insert {
171 - name = 'Exit normal mode',
171 + description = 'Exit normal mode',
172 172 category = 'vim',
173 173 keys = 'jj',
174 174 command = '<C-c>',
177 177 map.normal {
178 - name = 'Goto matching bracket',
178 + description = 'Goto matching bracket',
179 179 category = 'navigation',
180 180 keys = 'mm',
181 181 command = '%',
184 184 map.normal {
185 - name = 'Redo undone operation',
185 + description = 'Redo undone operation',
186 186 category = 'history',
187 187 keys = 'U',
188 188 command = vim.cmd.redo,
196 196 map.normal {
197 - name = 'Move next in quickfix list',
197 + description = 'Move next in quickfix list',
198 198 category = 'navigation',
199 199 keys = '<A-bs>',
200 200 command = '<cmd>cnext<cr>',
203 203 map.normal {
204 - name = 'Move back in quickfix list',
204 + description = 'Move back in quickfix list',
205 205 category = 'navigation',
206 206 keys = '<bs>',
207 207 command = '<cmd>cprevious<cr>',
210 210 map.normal {
211 - name = 'Open quickfix list',
211 + description = 'Open quickfix list',
212 212 category = 'navigation',
213 213 keys = '<bs><bs>',
214 214 command = '<cmd>copen<cr>',
217 217 map.normal {
218 - name = 'Open nvim configuration',
218 + description = 'Open nvim configuration',
219 219 category = 'config',
220 220 keys = '<F2><F2>',
221 221 command = '<cmd>tabedit ' .. vim.fn.stdpath'config' .. '<cr>',
224 224 map.normal {
225 - name = 'Execute current line as lua in neovim',
225 + description = 'Execute current line as lua in neovim',
226 226 category = 'config',
227 227 keys = '<cr><cr>',
228 228 command = '<cmd>lua <c-r><c-l><cr>'

neovim/lua/bugabinga/options/ui.lua

Modified
60 60 vim.opt.pumheight = 10
62 62 -- transparent popups and floating windows
63 -vim.opt.pumblend = 5
64 -vim.opt.winblend = 5
63 +vim.opt.pumblend = 8
64 +vim.opt.winblend = 8
66 66 vim.g.border_style = 'shadow'
84 84 -- neovide only options
85 85 if vim.g.neovide then
86 - vim.g.neovide_floating_blur_amount_x = 4.0
86 + vim.g.neovide_floating_blur_amount_x = 8.0
87 87 vim.g.neovide_floating_blur_amount_y = 4.0
88 88 vim.g.neovide_scroll_animation_length = 0.42
89 89 -- vim.g.neovide_fullscreen = true
90 90 vim.g.neovide_remember_window_size = true
91 91 vim.g.neovide_profiler = false
92 92 vim.g.neovide_cursor_animation_length = 0.11
93 - vim.g.neovide_cursor_trail_length = 0.69
93 + vim.g.neovide_cursor_trail_length = 1.69
94 94 vim.g.neovide_cursor_vfx_mode = 'pixiedust'
95 95 vim.g.neovide_cursor_unfocused_outline_width = 0.125
96 96 vim.g.neovide_cursor_antialiasing = true
98 98 vim.g.neovide_padding_bottom = 0
99 99 vim.g.neovide_padding_right = 1
100 100 vim.g.neovide_padding_left = 1
101 - vim.g.neovide_hide_mouse_when_typing = false
101 + vim.g.neovide_hide_mouse_when_typing = true
102 102 vim.g.neovide_theme = 'auto'
103 - vim.g.neovide_refresh_rate = 60
103 + vim.g.neovide_refresh_rate = vim.uv.os_gethostname() == 'pop-os' and 144 or 60
104 104 vim.g.neovide_refresh_rate_idle = 5

neovim/lua/bugabinga/plugins/cmp.lua

Added
new file mode 100644
1 +---@diagnostic disable: missing-fields
3 +return {
4 + 'hrsh7th/nvim-cmp',
5 + event = 'InsertEnter',
6 + dependencies = {
7 + 'hrsh7th/cmp-buffer',
8 + 'hrsh7th/cmp-nvim-lsp',
9 + 'hrsh7th/cmp-cmdline',
10 + 'hrsh7th/cmp-path',
11 + { 'L3MON4D3/LuaSnip', version = '2.*', build = 'make install_jsregexp' },
12 + 'saadparwaiz1/cmp_luasnip',
13 + 'rafamadriz/friendly-snippets',
14 + 'onsails/lspkind.nvim',
15 + },
16 + config = function ()
17 + local cmp = require 'cmp'
18 + local luasnip = require 'luasnip'
19 + local lspkind = require 'lspkind'
21 + require 'luasnip.loaders.from_vscode'.lazy_load()
23 + cmp.setup {
24 + completion = {
25 + autocomplete = false,
26 + completeopt = 'menu,menuone,preview,noselect',
27 + },
28 + formatting = {
29 + format = lspkind.cmp_format {
30 + mode = 'symbol',
31 + maxwidth = 75,
32 + ellipsis_char = '…',
33 + },
34 + },
35 + snippet = { expand = function ( args ) luasnip.lsp_expand( args.body ) end },
36 + mapping = {
37 + ['<c-p>'] = cmp.mapping.select_prev_item(),
38 + ['<c-n>'] = cmp.mapping.select_next_item(),
39 + ['<c-k>'] = cmp.mapping.select_prev_item(),
40 + ['<c-j>'] = cmp.mapping.select_next_item(),
41 + ['<s-tab>'] = cmp.mapping.select_prev_item(),
42 + ['<tab>'] = cmp.mapping.select_next_item(),
43 + ['<c-b>'] = cmp.mapping.scroll_docs( -2 ),
44 + ['<c-f>'] = cmp.mapping.scroll_docs( 2 ),
45 + ['<c-u>'] = cmp.mapping.scroll_docs( -4 ),
46 + ['<c-d>'] = cmp.mapping.scroll_docs( 4 ),
47 + ['<c-space>'] = cmp.mapping.complete {},
48 + ['<esc>'] = cmp.mapping.abort(),
49 + ['<cr>'] = cmp.mapping.confirm { select = false }
50 + },
51 + sources = cmp.config.sources {
52 + { name = 'luasnip' },
53 + { name = 'nvim_lsp' },
54 + { name = 'buffer' },
55 + { name = 'path' },
56 + }
57 + }
59 + cmp.setup.filetype( 'gitcommit', {
60 + sources = cmp.config.sources {
61 + { name = 'git' },
62 + },
63 + {
64 + { name = 'buffer' },
65 + { name = 'path' },
66 + }
67 + } )
69 + cmp.setup.cmdline( '/', {
70 + mapping = cmp.mapping.preset.cmdline(),
71 + sources = {
72 + { name = 'buffer' }
73 + }
74 + } )
76 + cmp.setup.cmdline( '?', {
77 + mapping = cmp.mapping.preset.cmdline(),
78 + sources = {
79 + { name = 'buffer' }
80 + }
81 + } )
83 + cmp.setup.cmdline( ':', {
84 + mapping = cmp.mapping.preset.cmdline(),
85 + sources = cmp.config.sources {
86 + { name = 'path' }
87 + },
88 + {
89 + { name = 'cmdline' }
90 + }
91 + } )
92 + end,

neovim/lua/bugabinga/plugins/flash.lua

Modified
1 1 return {
2 2 'folke/flash.nvim',
3 - event = "VeryLazy",
4 - opts = {},
3 + event = 'VeryLazy',
4 + opts = {
5 + highlight = { backdrop = false },
6 + modes = { char = { highlight = { backdrop = false, } },
7 + },
8 + },
5 9 keys = {
6 - { "<cr>", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
7 - { "<s-cr>", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
8 - { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
9 - { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
10 - { "<cr><cr>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
10 + {
11 + '<cr>',
12 + mode = { 'n', 'x', 'o' },
13 + function () require 'flash'.jump() end,
14 + desc = 'Flash',
15 + },
16 + {
17 + '<s-cr>',
18 + mode = { 'n', 'o', 'x' },
19 + function () require 'flash'.treesitter() end,
20 + desc =
21 + 'Flash Treesitter'
22 + },

neovim/lua/bugabinga/plugins/genghis.lua

Modified
1 1 return {
3 3 'chrisgrieser/nvim-genghis',
4 + dependencies = {
5 + 'stevearc/dressing.nvim',
6 + 'hrsh7th/nvim-cmp',
7 + 'hrsh7th/cmp-omni',
8 + 'anuvyklack/hydra.nvim',
9 + },
10 + keys = { '<leader>g' },
4 11 cmd = {
5 12 'New',
6 13 'Duplicate',
12 19 'CopyFilepath',
13 20 'Chmodx',
15 - config = function()
16 - -- TODO: setup cmp integration
22 + config = function ()
23 + local genghis = require 'genghis'
24 + local cmp = require 'cmp'
25 + local hydra = require 'hydra'
18 - -- TODO: setup keymaps with hydra
19 - -- local keymap = vim.keymap.set
20 - -- local genghis = require("genghis")
21 - -- keymap("n", "<leader>yp", genghis.copyFilepath)
22 - -- keymap("n", "<leader>yn", genghis.copyFilename)
23 - -- keymap("n", "<leader>cx", genghis.chmodx)
24 - -- keymap("n", "<leader>rf", genghis.renameFile)
25 - -- keymap("n", "<leader>mf", genghis.moveAndRenameFile)
26 - -- keymap("n", "<leader>nf", genghis.createNewFile)
27 - -- keymap("n", "<leader>yf", genghis.duplicateFile)
28 - -- keymap("n", "<leader>df", function () genghis.trashFile{trashLocation = "your/path"} end) -- default: "$HOME/.Trash".
29 - -- keymap("x", "<leader>x", genghis.moveSelectionToNewFile)
27 + cmp.setup.filetype( 'DressingInput', {
28 + sources = cmp.config.sources { { name = 'omni' } },
29 + } )
31 + local hint = [[
32 +^ Ghenigs
34 +_yp_ copy filepath
35 +_yn_ copy filename
36 +_cx_ set executable permission
37 +_rf_ rename file
38 +_mf_ move and rename file
39 +_nf_ create new file
40 +_df_ duplicate file
41 +_tf_ trash file
42 +_ms_ move selection to new file
44 +_<esc>_ quit
45 +]]
47 + hydra {
48 + name = 'Genghis',
49 + hint = hint,
50 + config = {
51 + color = 'teal',
52 + invoke_on_body = true,
53 + buffer = true,
54 + hint = {
55 + type = 'window',
56 + border = vim.g.border_style,
57 + position = 'middle',
58 + }
59 + },
60 + mode = { 'n', 'x' },
61 + body = '<leader>g',
62 + heads = {
63 + { 'yp', genghis.copyFilepath, },
64 + { 'yn', genghis.copyFilename, },
65 + { 'cx', genghis.chmodx, },
66 + { 'rf', genghis.renameFile, },
67 + { 'mf', genghis.moveAndRenameFile, },
68 + { 'nf', genghis.createNewFile, },
69 + { 'df', genghis.duplicateFile, },
70 + { 'tf', genghis.trashFile, },
71 + { 'ms', genghis.moveSelectionToNewFile },
72 + { '<esc>', nil },
73 + },
74 + }
30 75 end,
31 - dependencies = {
32 - 'stevearc/dressing.nvim',
33 - 'hrsh7th/nvim-cmp',
34 - 'hrsh7th/cmp-omni',
35 - },

neovim/lua/bugabinga/plugins/gomove.lua

Modified
1 -local map = require 'std.keymap'
1 +local map = require 'std.map'
3 3 return {
39 39 -- NORMAL MOVE
40 40 map.normal {
41 - name = 'Move character left',
41 + description = 'Move character left',
42 42 category = 'editing',
43 43 keys = '<A-h>',
44 44 options = options,
45 45 command = '<Plug>GoNSMLeft',
47 47 map.normal {
48 - name = 'Move line down',
48 + description = 'Move line down',
49 49 category = 'editing',
50 50 keys = '<A-j>',
51 51 options = options,
52 52 command = '<Plug>GoNSMDown',
54 54 map.normal {
55 - name = 'Move line up',
55 + description = 'Move line up',
56 56 category = 'editing',
57 57 keys = '<A-k>',
58 58 options = options,
59 59 command = '<Plug>GoNSMUp',
61 61 map.normal {
62 - name = 'Move character right',
62 + description = 'Move character right',
63 63 category = 'editing',
64 64 keys = '<A-l>',
65 65 options = options,
69 69 -- VISUAL MOVE
70 70 map.visual {
71 - name = 'Move block left',
71 + description = 'Move block left',
72 72 category = 'editing',
73 73 keys = '<A-h>',
74 74 options = options,
75 75 command = '<Plug>GoVSMLeft',
77 77 map.visual {
78 - name = 'Move block down',
78 + description = 'Move block down',
79 79 category = 'editing',
80 80 keys = '<A-j>',
81 81 options = options,
82 82 command = '<Plug>GoVSMDown',
84 84 map.visual {
85 - name = 'Move block up',
85 + description = 'Move block up',
86 86 category = 'editing',
87 87 keys = '<A-k>',
88 88 options = options,
89 89 command = '<Plug>GoVSMUp',
91 91 map.visual {
92 - name = 'Move block right',
92 + description = 'Move block right',
93 93 category = 'editing',
94 94 keys = '<A-l>',
95 95 options = options,
99 99 -- NORMAL DUPLICATE
100 100 map.normal {
101 - name = 'Duplicate character left',
101 + description = 'Duplicate character left',
102 102 category = 'editing',
103 103 keys = '<A-H>',
104 104 options = options,
105 105 command = '<Plug>GoNSDLeft',
107 107 map.normal {
108 - name = 'Duplicate line down',
108 + description = 'Duplicate line down',
109 109 category = 'editing',
110 110 keys = '<A-J>',
111 111 options = options,
112 112 command = '<Plug>GoNSDDown',
114 114 map.normal {
115 - name = 'Duplicate line up',
115 + description = 'Duplicate line up',
116 116 category = 'editing',
117 117 keys = '<A-K>',
118 118 options = options,
119 119 command = '<Plug>GoNSDUp',
121 121 map.normal {
122 - name = 'Duplicate character right',
122 + description = 'Duplicate character right',
123 123 category = 'editing',
124 124 keys = '<A-L>',
125 125 options = options,
129 129 -- VISUAL DUPLICATE
130 130 map.visual {
131 - name = 'Duplicate block left',
131 + description = 'Duplicate block left',
132 132 category = 'editing',
133 133 keys = '<A-H>',
134 134 options = options,
135 135 command = '<Plug>GoVSDLeft',
137 137 map.visual {
138 - name = 'Duplicate block down',
138 + description = 'Duplicate block down',
139 139 category = 'editing',
140 140 keys = '<A-J>',
141 141 options = options,
142 142 command = '<Plug>GoVSDDown',
144 144 map.visual {
145 - name = 'Duplicate block up',
145 + description = 'Duplicate block up',
146 146 category = 'editing',
147 147 keys = '<A-K>',
148 148 options = options,
149 149 command = '<Plug>GoVSDUp',
151 151 map.visual {
152 - name = 'Duplicate block right',
152 + description = 'Duplicate block right',
153 153 category = 'editing',
154 154 keys = '<A-L>',
155 155 options = options,

neovim/lua/bugabinga/plugins/mason.lua

Modified
1 1 return {
2 2 "williamboman/mason.nvim",
3 + -- needs to be loaded early, so that LSP can find programs in PATH
4 + lazy = false,
3 5 cmd = { 'Mason', 'MasonUpdate', 'MasonInstall', 'MasonUninstall', 'MasonUninstallAll', 'MasonLog' },
4 6 opts = {
5 7 ui = {

neovim/lua/bugabinga/plugins/multicursors.lua

Added
new file mode 100644
1 +return {
2 + 'smoka7/multicursors.nvim',
3 + event = 'VeryLazy',
4 + dependencies = {
5 + 'nvim-treesitter/nvim-treesitter',
6 + 'anuvyklack/hydra.nvim',
7 + },
8 + opts = {
9 + hint_config = {
10 + border = vim.g.border_style,
11 + },
12 + generate_hints = {
13 + normal = true,
14 + insert = false,
15 + extend = false,
16 + }
17 + },
18 + cmd = { 'MCstart', 'MCvisual', 'MCclear', 'MCpattern', 'MCvisualPattern', 'MCunderCursor' },
19 + keys = {
20 + {
21 + mode = { 'v', 'n' },
22 + '<c-n>',
23 + '<cmd>MCstart<cr>',
24 + desc = 'Create a selection for selected text or word under the cursor',
25 + },
26 + },

neovim/lua/bugabinga/plugins/neoclip.lua

Modified
1 -local map = require'std.keymap'
1 +local map = require'std.map'
3 3 return {
4 4 'AckslD/nvim-neoclip.lua',
17 17 telescope.load_extension'neoclip'
19 19 map.normal {
20 - name = 'Open clipboard history...',
20 + description = 'Open clipboard history...',
21 21 category = 'history',
22 22 keys = '<C-v><C-v>',
23 23 command = function() telescope.extensions.neoclip.default(cursor) end,
26 26 end,
27 -}

neovim/lua/bugabinga/plugins/neogen.lua

Modified
1 -local map = require'std.keymap'
1 +local map = require'std.map'
3 3 return {
4 4 'danymat/neogen',
10 10 neogen.setup { }
12 12 map.normal {
13 - name = 'Generate doc comment for outer element',
13 + description = 'Generate doc comment for outer element',
14 14 category = 'editing',
15 15 keys = '<A-enter>',
16 16 command = neogen.generate,
26 26 map.normal {
27 - name = 'Generate Doc Comment for File',
27 + description = 'Generate Doc Comment for File',
28 28 category = "editing",
29 29 keys = '<A-enter>' .. 'F',
30 30 command = function() neogen.generate { type = 'file' } end,
33 33 map.normal {
34 - name = 'Generate Doc Comment for Class',
34 + description = 'Generate Doc Comment for Class',
35 35 category = "editing",
36 36 keys = '<A-enter>' .. 'c',
37 37 command = function() neogen.generate { type = 'class' } end,
40 40 end,
41 -}

neovim/lua/bugabinga/plugins/noice.lua

Modified
1 -local map = require'std.keymap'
1 +local map = require'std.map'
3 3 return {
90 90 noice.setup(opts)
92 92 map.normal {
93 - name = 'Open search for notifications...',
93 + description = 'Open search for notifications...',
94 94 category = 'search',
95 95 keys = '<C-n><C-n>',
96 96 command = function() noice.cmd'history' end,
99 99 map.command_line {
100 - name = 'Redirect Cmdline',
100 + description = 'Redirect Cmdline',
101 101 category = 'ui',
102 102 keys = '<S-cr>',
103 103 command = function() noice.redirect(vim.fn.getcmdline()) end,
106 106 map.normal {
107 - name = 'Dismiss current notifications',
107 + description = 'Dismiss current notifications',
108 108 category = 'notify',
109 109 keys = '<esc>',
110 110 command = function() noice.cmd 'dismiss' end,
113 113 local noice_lsp = require'noice.lsp'
115 115 map.normal {
116 - name = 'Scroll up in documentation popup',
116 + description = 'Scroll up in documentation popup',
117 117 category = 'ui',
118 118 keys = '<C-f>',
119 119 command = function()
125 125 map.normal {
126 - name = 'Scroll down in documentation popup',
126 + description = 'Scroll down in documentation popup',
127 127 category = 'ui',
128 128 keys = '<C-b>',
129 129 command = function()

neovim/lua/bugabinga/plugins/nvim-jdtls.lua

Added
new file mode 100644
1 +return {
2 + 'bugabinga/nvim-jdtls',
3 + ft = { 'java' },
4 +}

neovim/lua/bugabinga/plugins/oil.lua

Modified
1 -local map = require'std.keymap'
1 +local map = require'std.map'
3 3 return {
4 4 'stevearc/oil.nvim',
31 31 float = {
32 32 border = vim.g.border_style,
33 33 padding = 2,
34 - win_options = { winblend = 10 },
34 + win_options = { winblend = vim.o.winblend },
38 38 map.normal {
39 - name = 'Open parent directory in buffer.',
39 + description = 'Open parent directory in buffer.',
40 40 category = 'files',
41 41 keys = '-',
42 - command = oil.open,
43 - -- command = oil.open_float,
42 + -- command = oil.open,
43 + command = oil.open_float,
45 45 end,

neovim/lua/bugabinga/plugins/persistence.lua

Modified
1 -local map = require'std.keymap'
1 +local map = require'std.map'
3 3 return {
4 4 'folke/persistence.nvim',
9 9 persistence.setup(opts)
11 11 map.normal {
12 - name = 'Restore session for current directory',
12 + description = 'Restore session for current directory',
13 13 category = 'history',
14 14 keys = '<F4>',
15 15 command = function() persistence.load() end,
18 18 map.normal {
19 - name = 'Restore last session',
19 + description = 'Restore last session',
20 20 category = 'history',
21 21 keys = '<F4><F4>',
22 22 command = function() persistence.load{last= true} end,
25 25 end,
26 -}

neovim/lua/bugabinga/plugins/specs.lua

Modified
1 -local map = require'std.keymap'
1 +local map = require'std.map'
2 2 local ignored = require'std.ignored'
4 4 return {{
26 26 map.normal {
27 - name = 'Find cursor!',
27 + description = 'Find cursor!',
28 28 category = 'fun',
29 29 keys = '<leader><leader>',
30 30 command = specs.show_specs,
33 33 map.normal {
34 - name = 'Find cursor, for real!',
34 + description = 'Find cursor, for real!',
35 35 category = 'fun',
36 36 keys = '<leader><leader><leader>',
37 37 command = function()
39 39 end,
41 41 end,
42 -}}
42 +}}

neovim/lua/bugabinga/plugins/spectre.lua

Modified
1 -require'bugabinga.health'.add_dependency
1 +local map = require 'std.map'
3 +require 'bugabinga.health'.add_dependency
3 5 name_of_executable = 'rg'
13 15 opts = {
14 16 live_update = true,
15 - line_sep_start = '▛▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔',
16 - result_padding = '▎',
17 - line_sep = '▙▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁',
18 - default = { replace = { cmd = 'oxi' } }
17 + default = { replace = { cmd = 'oxi' } },
19 + config = function ( _, opts )
20 + local spectre = require 'spectre'
21 + spectre.setup( opts )
23 + map.normal {
24 + description = 'Open Spectre',
25 + category = 'search',
26 + keys = '<leader>s',
27 + command = function () spectre.open() end,
28 + }
30 + map.normal {
31 + description = 'Search current word',
32 + category = 'search',
33 + keys = '<leader>sw',
34 + command = function () spectre.open_visual { select_word = true } end,
35 + }
37 + map.visual {
38 + description = 'Search current word',
39 + category = 'search',
40 + keys = '<leader>sw',
41 + command = function () spectre.open_visual() end,
42 + }
44 + map.normal {
45 + description = 'Search on current file',
46 + category = 'search',
47 + keys = '<leader>sp',
48 + command = function () spectre.open_file_search { select_word = true } end,
49 + }
50 + end,

neovim/lua/bugabinga/plugins/substitute.lua

Modified
1 -local map = require'std.keymap'
1 +local map = require'std.map'
3 3 return {{
4 4 "gbprod/substitute.nvim",
8 8 substitute.setup{}
10 10 map.normal {
11 - name = 'substitution motion',
11 + description = 'substitution motion',
12 12 category = 'editing',
13 13 keys = 's',
14 14 command = substitute.operator,
17 17 map.normal {
18 - name = 'substitution of current line',
18 + description = 'substitution of current line',
19 19 category = 'editing',
20 20 keys = 'ss',
21 21 command = substitute.line,
24 24 map.normal {
25 - name = 'substitution until end of line',
25 + description = 'substitution until end of line',
26 26 category = 'editing',
27 27 keys = 'S',
28 28 command = substitute.eol,
35 35 command = substitute.visual,
37 37 end,
38 -}}
38 +}}

neovim/lua/bugabinga/plugins/telescope.lua

Modified
1 -local map = require 'std.keymap'
1 +local map = require 'std.map'
3 -require'bugabinga.health'.add_dependency
3 +require 'bugabinga.health'.add_dependency
5 - name = 'ripgrep',
6 - name_of_executable = 'rg'
7 -}
8 -{
9 - name = 'find-fd',
10 - name_of_executable = 'fd'
5 + name = 'ripgrep',
6 + name_of_executable = 'rg'
8 + {
9 + name = 'find-fd',
10 + name_of_executable = 'fd'
11 + }
13 13 return {
14 - 'nvim-telescope/telescope.nvim',
15 - branch = '0.1.x',
16 - cmd = 'Telescope',
17 - keys = { '<C-p><C-n>', '<C-e>', '<C-p><C-b>', '<C-p><C-g>', '<C-p><C-s>', '<C-p><C-k>', '<C-p><C-p>', '<C-p>', '<F1>' },
18 - dependencies = {
19 - 'nvim-lua/plenary.nvim',
20 - 'nvim-tree/nvim-web-devicons',
21 - 'nvim-telescope/telescope-symbols.nvim',
22 - },
23 - config = function()
24 - local telescope = require 'telescope'
25 - local builtin = require 'telescope.builtin'
26 - local actions = require 'telescope.actions'
27 - local themes = require 'telescope.themes'
28 - local ivy = themes.get_ivy { hidden = true, layout_config = { preview_width = 0.69 } }
29 - local dropdown = themes.get_dropdown { layout_config = { width = 0.69 } }
30 - local cursor = themes.get_cursor { layout_config = { preview_width = 0.42, width = 0.69 } }
14 + 'nvim-telescope/telescope.nvim',
15 + branch = '0.1.x',
16 + cmd = 'Telescope',
17 + event = 'VeryLazy',
18 + dependencies = {
19 + 'nvim-lua/plenary.nvim',
20 + 'nvim-tree/nvim-web-devicons',
21 + 'nvim-telescope/telescope-symbols.nvim',
22 + 'nvim-telescope/telescope-ui-select.nvim',
23 + 'jvgrootveld/telescope-zoxide',
24 + },
25 + config = function()
26 + local telescope = require 'telescope'
27 + local builtin = require 'telescope.builtin'
28 + local actions = require 'telescope.actions'
29 + local themes = require 'telescope.themes'
30 + local ivy = themes.get_ivy { hidden = true, layout_config = { preview_width = 0.69 } }
31 + local dropdown = themes.get_dropdown { layout_config = { width = 0.69 } }
32 + local cursor = themes.get_cursor { layout_config = { preview_width = 0.42, width = 0.69 } }
32 - telescope.setup {
33 - defaults = {
34 - path_display = { 'truncate' },
35 - sorting_strategy = 'ascending',
36 - layout_config = {
37 - horizontal = { prompt_position = 'bottom', preview_width = 0.69 },
38 - vertical = { mirror = false },
39 - width = 0.69,
40 - height = 0.42,
41 - preview_cutoff = 124,
42 - },
43 - mappings = {
44 - i = {
45 - ['<C-j>'] = actions.cycle_history_next,
46 - ['<C-k>'] = actions.cycle_history_prev,
47 - ['<C-n>'] = actions.move_selection_next,
48 - ['<C-p>'] = actions.move_selection_previous,
49 - },
50 - n = { q = actions.close },
51 - },
52 - },
53 - }
34 + telescope.setup {
35 + defaults = {
36 + path_display = { 'truncate' },
37 + sorting_strategy = 'ascending',
38 + layout_config = {
39 + horizontal = { prompt_position = 'bottom', preview_width = 0.69 },
40 + vertical = { mirror = false },
41 + width = 0.69,
42 + height = 0.42,
43 + preview_cutoff = 124,
44 + },
45 + file_ignore_patterns = {
46 + ".git/",
47 + ".cache",
48 + "%.o",
49 + "%.a",
50 + "%.out",
51 + "%.class",
52 + "%.pdf",
53 + "%.mkv",
54 + "%.mp4",
55 + "%.zip",
56 + },
57 + mappings = {
58 + i = {
59 + ['<C-j>'] = actions.cycle_history_next,
60 + ['<C-k>'] = actions.cycle_history_prev,
61 + ['<C-n>'] = actions.move_selection_next,
62 + ['<C-p>'] = actions.move_selection_previous,
63 + ['<C-s>'] = actions.file_split,
64 + },
65 + n = { q = actions.close },
66 + },
67 + },
68 + extensions = {
69 + ['ui-select'] = { cursor },
70 + zoxide = {
71 + ivy,
72 + prompt_title = 'Navigate deez nuts!',
73 + },
74 + },
75 + }
55 - map.normal.visual.terminal {
56 - name = 'Search help files',
57 - category = 'help',
58 - keys = '<F1>',
59 - command = function() builtin.help_tags(dropdown) end,
60 - }
77 + telescope.load_extension 'ui-select'
78 + telescope.load_extension 'zoxide'
62 - map.normal {
63 - name = 'Open global search...',
64 - category = 'plugins',
65 - keys = '<C-p>',
66 - command = function() builtin.builtin() end,
67 - }
80 + map.normal {
81 + description = 'Switch to recently used folders',
82 + category = 'navigation',
83 + keys = '<c-z>',
84 + command = telescope.extensions.zoxide.list,
85 + }
69 - map.normal {
70 - name = 'Open search for all files...',
71 - category = 'search',
72 - keys = '<C-p><C-p>',
73 - command = function() builtin.find_files(ivy) end,
74 - }
87 + map.normal.visual.terminal {
88 + description = 'Search help files',
89 + category = 'help',
90 + keys = '<F1>',
91 + command = function() builtin.help_tags(dropdown) end,
92 + }
76 - map.normal {
77 - name = 'Open search for keymaps...',
78 - category = 'search',
79 - keys = '<C-p><C-k>',
80 - command = function() builtin.keymaps(dropdown) end,
81 - }
94 + map.normal {
95 + description = 'Open search for commands...',
96 + category = 'plugins',
97 + keys = '<C-p>',
98 + command = function() builtin.commands() end,
99 + }
83 - map.normal {
84 - name = 'Open search for symbols...',
85 - category = 'search',
86 - keys = '<C-p><C-s>',
87 - command = function() builtin.symbols(cursor) end,
88 - }
101 + map.normal {
102 + description = 'Open search for all files...',
103 + category = 'search',
104 + keys = '<C-p><C-p>',
105 + command = function() builtin.find_files(ivy) end,
90 - map.normal {
91 - name = 'Open search for all file contents...',
92 - category = 'search',
93 - keys = '<C-p><C-g>',
94 - command = function() builtin.live_grep(ivy) end,
95 - }
108 + map.normal {
109 + description = 'Open search for all recent files...',
110 + category = 'search',
111 + keys = '<C-p><C-o>',
112 + command = function() builtin.oldfiles(ivy) end,
97 - map.normal {
98 - name = 'Open search for current buffer content...',
99 - category = 'search',
100 - keys = '<C-p><C-b>',
101 - command = function() builtin.current_buffer_fuzzy_find(ivy) end,
102 - }
115 + map.normal {
116 + description = 'Open search for keymaps...',
117 + category = 'search',
118 + keys = '<C-p><C-k>',
119 + command = function() builtin.keymaps(dropdown) end,
104 - map.normal {
105 - name = 'Open search for buffers...',
106 - category = 'search',
107 - keys = '<C-e>',
108 - command = function() builtin.buffers(cursor) end,
109 - }
122 + map.normal {
123 + description = 'Open search for symbols...',
124 + category = 'search',
125 + keys = '<C-p><C-s>',
126 + command = function() builtin.symbols(cursor) end,
111 - end,
129 + map.normal {
130 + description = 'Open search for all file contents...',
131 + category = 'search',
132 + keys = '<C-p><C-g>',
133 + command = function() builtin.live_grep(ivy) end,
136 + map.normal {
137 + description = 'Open search for current buffer content...',
138 + category = 'search',
139 + keys = '<C-p><C-b>',
140 + command = function() builtin.current_buffer_fuzzy_find(ivy) end,
143 + map.normal {
144 + description = 'Open search for buffers...',
145 + category = 'search',
146 + keys = '<C-e>',
147 + command = function() builtin.buffers(cursor) end,
149 + end,

neovim/lua/bugabinga/plugins/toggleterm.lua

Modified
1 -local map = require'std.keymap'
2 -local auto = require'std.auto'
1 +local map = require 'std.map'
2 +local auto = require 'std.auto'
4 -require'bugabinga.health'.add_dependency
4 +require 'bugabinga.health'.add_dependency
6 - name_of_executable = 'gitui',
7 -}
8 -{
9 - name_of_executable = 'mdcat',
12 - name_of_executable = 'dot'
6 + name_of_executable = 'gitui',
8 + {
9 + name_of_executable = 'mdcat',
10 + }
11 + {
12 + name_of_executable = 'dot'
13 + }
15 -return {
16 - "akinsho/toggleterm.nvim",
17 - keys = {
18 - '<F7>',
19 - '<F8>',
20 - '<F9>',
21 - '<F10>',
22 - },
23 - cmd = {
24 - "ToggleTerm",
25 - "TermExec",
26 - 'Gitui',
27 - 'Mdcat',
28 - 'Graphviz',
29 - 'Graphviz',
30 - },
31 - opts = {
32 - open_mapping = '<F7>',
33 - direction = "float",
34 - float_opts = {
35 - border = vim.g.border_style,
36 - winblend = 10,
37 - },
38 - size = function(term)
39 - if term.direction == "horizontal" then
40 - return 18
41 - elseif term.direction == "vertical" then
42 - return vim.o.columns * 0.42
43 - end
44 - end,
45 - },
46 - config = function(_, opts)
47 - local toggleterm = require'toggleterm'
48 - toggleterm.setup(opts)
15 +return {
16 + 'akinsho/toggleterm.nvim',
17 + keys = {
18 + '<F7>',
19 + '<F8>',
20 + '<F9>',
21 + '<F10>',
22 + },
23 + cmd = {
24 + 'ToggleTerm',
25 + 'TermExec',
26 + 'Gitui',
27 + 'Mdcat',
28 + 'Graphviz',
29 + 'Graphviz',
30 + },
31 + opts = {
32 + open_mapping = '<F7>',
33 + direction = 'float',
34 + float_opts = {
35 + border = vim.g.border_style,
36 + winblend = vim.o.winblend,
37 + },
38 + size = function ( term )
39 + if term.direction == 'horizontal' then
40 + return 18
41 + elseif term.direction == 'vertical' then
42 + return vim.o.columns * 0.42
43 + end
44 + end,
45 + },
46 + config = function ( _, opts )
47 + local toggleterm = require 'toggleterm'
48 + toggleterm.setup( opts )
50 - local set_terminal_keymaps = function()
51 - local local_to_buffer = { buffer = 0 }
52 - map.terminal {
53 - name = 'Quit insert mode',
54 - category = 'terminal',
55 - keys = '<esc>',
56 - options = local_to_buffer,
57 - command = [[ <C-\><C-n> ]],
58 - }
59 - end
50 + local set_terminal_keymaps = function ()
51 + local local_to_buffer = { buffer = 0 }
52 + map.terminal {
53 + description = 'Quit insert mode',
54 + category = 'terminal',
55 + keys = '<esc>',
56 + options = local_to_buffer,
57 + command = [[ <C-\><C-n> ]],
58 + }
59 + end
61 - auto'normalize_terminal_windows'{
62 - description = 'Make terminal windows behave more normally.',
63 - events = 'TermOpen',
64 - pattern = 'term://*',
65 - command = set_terminal_keymaps,
66 - }
61 + auto 'normalize_terminal_windows' {
62 + description = 'Make terminal windows behave more normally.',
63 + events = 'TermOpen',
64 + pattern = 'term://*',
65 + command = set_terminal_keymaps,
66 + }
68 - local Terminal = require'toggleterm.terminal'.Terminal
68 + map.normal {
69 + description = 'Open vertical Terminal',
70 + category = 'terminal',
71 + keys = '<F8>',
72 + command = '<CMD>exe v:count1 . "ToggleTerm size=60 direction=vertical"<CR>'
73 + }
70 - --[ GITUI ]
75 + map.normal {
76 + description = 'Open horizontal Terminal',
77 + category = 'terminal',
78 + keys = '<F9>',
79 + command = '<CMD>exe v:count1 . "ToggleTerm size=20 direction=horizontal"<CR>'
80 + }
72 - local gitui = Terminal:new{
73 - hidden = true,
74 - cmd = 'gitui',
75 - dir = 'git_dir',
76 - direction = 'tab',
77 - }
82 + local Terminal = require 'toggleterm.terminal'.Terminal
79 - _G.Gitui = function() gitui:toggle() end
84 + --[ GITUI ]
81 - map.normal.terminal.insert {
82 - name = 'Toggle gitui terminal in tab',
83 - category = 'terminal',
84 - keys = '<F8>',
85 - command = Gitui,
86 - }
86 + local gitui = Terminal:new {
87 + hidden = true,
88 + cmd = 'gitui',
89 + dir = 'git_dir',
90 + direction = 'tab',
91 + }
88 - vim.cmd[[ command! Gitui lua Gitui() ]]
93 + _G.Gitui = function () gitui:toggle() end
90 - --[ MDCAT ]
95 + map.normal.terminal.insert {
96 + description = 'Toggle gitui terminal in tab',
97 + category = 'terminal',
98 + keys = '<F10>',
99 + command = Gitui,
92 - local mdcat = Terminal:new {
93 - hidden = true,
94 - direction = 'vertical',
95 - }
102 + vim.cmd [[ command! Gitui lua Gitui() ]]
97 - _G.Mdcat = function()
98 - local window = vim.api.nvim_get_current_win()
99 - local current_file = vim.api.nvim_buf_get_name(0)
100 - mdcat.cmd = 'watch ' .. current_file .. ' { clear; mdcat ' .. current_file ..' }'
101 - mdcat:toggle()
102 - vim.api.nvim_set_current_win(window)
103 - end
104 + --[ MDCAT ]
105 - map.normal.terminal.insert {
106 - name = 'Toggle markdown preview via mdcat',
107 - category = 'terminal',
108 - keys = '<F9>',
109 - command = Mdcat,
110 - }
106 + local mdcat = Terminal:new {
107 + hidden = true,
108 + direction = 'vertical',
109 + cmd = '',
112 - vim.cmd [[ command! Mdcat lua Mdcat() ]]
112 + _G.Mdcat = function ()
113 + local window = vim.api.nvim_get_current_win()
114 + local current_file = vim.api.nvim_buf_get_name( 0 )
115 + mdcat.cmd = 'watch ' .. current_file .. ' { clear; mdcat ' .. current_file .. ' }'
116 + mdcat:toggle()
117 + vim.api.nvim_set_current_win( window )
118 + end
114 - -- [ GRAPHVIZ ]
120 + vim.cmd [[ command! Mdcat lua Mdcat() ]]
116 - local graphviz = Terminal:new {
117 - hidden = true,
118 - direction = 'vertical',
119 - }
122 + -- [ GRAPHVIZ ]
121 - _G.Graphviz = function()
122 - local window = vim.api.nvim_get_current_win()
123 - local current_file = vim.api.nvim_buf_get_name(0)
124 - graphviz.cmd = 'watch ' .. current_file .. ' { clear; dot -O -Tpng ' .. current_file .. ' ; viu --blocks ' .. current_file .. '.png }'
125 - graphviz:toggle()
126 - vim.api.nvim_set_current_win(window)
127 - end
124 + local graphviz = Terminal:new {
125 + hidden = true,
126 + direction = 'vertical',
127 + cmd = '',
129 - map.normal.terminal.insert {
130 - name = 'Toggle graphviz preview via viu',
131 - category = 'terminal',
132 - keys = '<F10>',
133 - command = Graphviz,
134 - }
130 + _G.Graphviz = function ()
131 + local window = vim.api.nvim_get_current_win()
132 + local current_file = vim.api.nvim_buf_get_name( 0 )
133 + graphviz.cmd = 'watch ' ..
134 + current_file .. ' { clear; dot -O -Tpng ' .. current_file .. ' ; viu --blocks ' .. current_file .. '.png }'
135 + graphviz:toggle()
136 + vim.api.nvim_set_current_win( window )
137 + end
136 - vim.cmd [[ command! Graphviz lua Graphviz() ]]
137 - end
139 + vim.cmd [[ command! Graphviz lua Graphviz() ]]
140 + end

neovim/lua/bugabinga/plugins/treesitter.lua

Modified
1 -local map = require 'std.keymap'
2 -local auto = require 'std.auto'
3 -local want = require 'std.want'
1 +local map = require 'std.map'
5 -require'bugabinga.health'.add_dependency
3 +require 'bugabinga.health'.add_dependency
7 - name = 'CMake',
8 - name_of_executable = 'cmake'
9 -}
11 - name_of_executable = 'make'
14 - name_of_executable = 'zig'
17 - name = 'TreeSitter CLI',
18 - name_of_executable = 'tree-sitter'
21 - name_of_executable = 'tar'
5 + name = 'CMake',
6 + name_of_executable = 'cmake'
8 + {
9 + name_of_executable = 'make'
10 + }
11 + {
12 + name_of_executable = 'zig'
13 + }
14 + {
15 + name = 'TreeSitter CLI',
16 + name_of_executable = 'tree-sitter'
17 + }
18 + {
19 + name_of_executable = 'tar'
20 + }
24 22 return {
25 - 'nvim-treesitter/nvim-treesitter',
26 - branch = "master",
27 - event = "BufRead",
28 - cmd = {
29 - "TSBufDisable",
30 - "TSBufEnable",
31 - "TSBufToggle",
32 - "TSDisable",
33 - "TSEnable",
34 - "TSToggle",
35 - "TSInstall",
36 - "TSInstallInfo",
37 - "TSInstallSync",
38 - "TSModuleInfo",
39 - "TSUninstall",
40 - "TSUpdate",
41 - "TSUpdateSync",
42 - 'TSPlaygroundToggle',
43 - 'TSHighlightCapturesUnderCursor',
44 - 'TSNodeUnderCursor',
45 - },
46 - build = function()
47 - require'nvim-treesitter.install'.update{ with_sync = true }
48 - end,
49 - dependencies = {
50 - "JoosepAlviste/nvim-ts-context-commentstring",
51 - "windwp/nvim-ts-autotag",
52 - 'nvim-treesitter/playground',
53 - 'ThePrimeagen/refactoring.nvim',
54 - },
55 - config = function()
56 - local install = require'nvim-treesitter.install'
57 - local configs = require'nvim-treesitter.configs'
58 - local parsers = require'nvim-treesitter.parsers'
23 + 'nvim-treesitter/nvim-treesitter',
24 + branch = 'master',
25 + event = 'BufRead',
26 + cmd = {
27 + 'TSBufDisable',
28 + 'TSBufEnable',
29 + 'TSBufToggle',
30 + 'TSDisable',
31 + 'TSEnable',
32 + 'TSToggle',
33 + 'TSInstall',
34 + 'TSInstallInfo',
35 + 'TSInstallSync',
36 + 'TSModuleInfo',
37 + 'TSUninstall',
38 + 'TSUpdate',
39 + 'TSUpdateSync',
40 + 'TSPlaygroundToggle',
41 + 'TSHighlightCapturesUnderCursor',
42 + 'TSNodeUnderCursor',
43 + },
44 + build = function ()
45 + require 'nvim-treesitter.install'.update { with_sync = true }
46 + end,
47 + dependencies = {
48 + 'JoosepAlviste/nvim-ts-context-commentstring',
49 + 'windwp/nvim-ts-autotag',
50 + 'nvim-treesitter/playground',
51 + 'nvim-treesitter/nvim-treesitter-textobjects',
52 + },
53 + config = function ()
54 + local install = require 'nvim-treesitter.install'
55 + local configs = require 'nvim-treesitter.configs'
56 + local parsers = require 'nvim-treesitter.parsers'
60 - install.prefer_git = false
61 - install.compilers = { 'zig', 'clang', 'gcc', 'cl', 'cc', vim.fn.getenv 'CC' }
58 + install.prefer_git = false
59 + install.compilers = { 'zig', 'clang', 'gcc', 'cl', 'cc', vim.fn.getenv 'CC' }
63 - configs.setup {
61 + ---@diagnostic disable-next-line: missing-fields
62 + configs.setup {
65 - ensure_installed = {
66 - 'bash',
67 - "c",
68 - 'comment',
69 - 'diff',
70 - 'dot',
71 - 'git_config',
72 - 'gitcommit',
73 - 'gitignore',
74 - 'java',
75 - 'jsonc',
76 - 'markdown',
77 - 'markdown_inline',
78 - "lua",
79 - 'luap',
80 - 'luadoc',
81 - 'regex',
82 - "vim",
83 - "vimdoc",
84 - "query",
85 - 'zig',
86 - },
64 + sync_install = false,
88 - ignore_install = { 'oil' },
66 + ensure_installed = {
67 + 'bash',
68 + 'c',
69 + -- https://github.com/nvim-treesitter/nvim-treesitter/issues/5389
70 + -- 'comment',
71 + 'diff',
72 + 'dot',
73 + 'git_config',
74 + 'gitcommit',
75 + 'gitignore',
76 + 'java',
77 + 'jsonc',
78 + 'markdown',
79 + 'markdown_inline',
80 + 'lua',
81 + 'luap',
82 + 'luadoc',
83 + 'regex',
84 + 'vim',
85 + 'vimdoc',
86 + 'query',
87 + 'zig',
88 + },
90 - auto_install = true,
90 + ignore_install = { 'oil' },
92 - autotag = { enable = true },
92 + auto_install = true,
94 - -- TODO: configure this
95 - refactor = 'all',
94 + autotag = { enable = true },
97 - context_commentstring = { enable = true, enable_autocmd = false },
96 + context_commentstring = { enable = true, enable_autocmd = false },
99 - highlight = {
100 - enable = true,
101 - disable = function(lang, buf)
102 - local max_filesize = 1000 * 1024 -- 1000 KiB
103 - local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
104 - if ok and stats and stats.size > max_filesize then
105 - return true
106 - end
107 - end,
108 - additional_vim_regex_highlighting = false,
109 - },
98 + highlight = {
99 + enable = true,
100 + disable = function ( _, buf )
101 + local max_filesize = 1000 * 1024 -- 1000 KiB
102 + local ok, stats = pcall( vim.loop.fs_stat, vim.api.nvim_buf_get_name( buf ) )
103 + if ok and stats and stats.size > max_filesize then
104 + return true
105 + end
106 + end,
107 + additional_vim_regex_highlighting = false,
108 + },
111 - incremental_selection = {
112 - enable = true,
113 - keymaps = {
114 - init_selection = "<up>",
115 - node_incremental = "<right>",
116 - node_decremental = "<left>",
117 - scope_incremental = false,
118 - },
119 - },
110 + incremental_selection = {
111 + enable = true,
112 + keymaps = {
113 + init_selection = '<up>',
114 + node_incremental = '<right>',
115 + node_decremental = '<left>',
116 + scope_incremental = false,
117 + },
118 + },
121 - indent = { enable = true },
120 + indent = { enable = true },
123 - playground = {
124 - enable = true,
125 - disable = {},
126 - updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
127 - persist_queries = false, -- Whether the query persists across vim sessions
128 - keybindings = {
129 - toggle_query_editor = 'o',
130 - toggle_hl_groups = 'i',
131 - toggle_injected_languages = 't',
132 - toggle_anonymous_nodes = 'a',
133 - toggle_language_display = 'I',
134 - focus_language = 'f',
135 - unfocus_language = 'F',
136 - update = 'R',
137 - goto_node = '<cr>',
138 - show_help = '?',
139 - },
140 - },
141 - }
122 + playground = {
123 + enable = true,
124 + disable = {},
125 + updatetime = 25,
126 + persist_queries = false,
127 + keybindings = {
128 + toggle_query_editor = 'o',
129 + toggle_hl_groups = 'i',
130 + toggle_injected_languages = 't',
131 + toggle_anonymous_nodes = 'a',
132 + toggle_language_display = 'I',
133 + focus_language = 'f',
134 + unfocus_language = 'F',
135 + update = 'R',
136 + goto_node = '<cr>',
137 + show_help = '?',
138 + },
139 + },
143 - parsers.get_parser_configs().just = {
144 - install_info = {
145 - url = 'https://github.com/IndianBoy42/tree-sitter-just', -- local path or git repo
146 - files = { 'src/parser.c', 'src/scanner.cc' },
147 - branch = 'main',
148 - },
149 - maintainers = { '@IndianBoy42' },
150 - }
151 - end,
141 + textobjects = {
142 + select = {
143 + enable = true,
144 + lookahead = true,
145 + keymaps = {
146 + ['af'] = { query = '@function.outer', desc = 'Select outer function' },
147 + ['if'] = { query = '@function.inner', desc = 'Select inner function' },
149 + ['ac'] = { query = '@class.outer', desc = 'Select outer class' },
150 + ['ic'] = { query = '@class.inner' , desc = 'Select inner class' },
152 + ['at'] = { query = '@comment.outer' , desc = 'Select outer comment' },
154 + ['as'] = { query = '@scope', query_group = 'locals', desc = 'Select language scope' },
155 + },
156 + selection_modes = {
157 + ['@parameter.outer'] = 'v',
158 + ['@function.outer'] = 'v',
159 + ['@class.outer'] = '<c-v>',
160 + ['@scope'] = 'V',
161 + },
162 + include_surroundig_whitespace = true,
163 + },
165 + swap = {
166 + enable = true,
167 + swap_next = {
168 + ['<leader>sn'] = { query = '@parameter.inner' , desc = 'Swap parameter with next' },
169 + },
170 + swap_previous = {
171 + ['<leader>sp'] = { query = '@parameter.inner' , desc = 'Swap parameter with previous' },
172 + },
173 + },
175 + lsp_interop = {
176 + enable = true,
177 + border = vim.g.border_style,
178 + floating_preview_opts = {},
179 + peek_definition_code = {
180 + ['<leader>lpf'] = { query = '@function.outer', desc = 'Peek definition of outer function.' },
181 + ['<leader>lpc'] = { query = '@class.outer', desc = 'Peek definition of outer class.' },
182 + },
183 + },
185 + move = {
186 + enable = true,
187 + set_jumps = true,
188 + goto_next = {
189 + [']f'] = { query = '@function.outer' , desc = 'Goto next funtion' },
190 + [']c'] = { query = '@class.outer', desc = 'Goto next class' },
191 + [']s'] = { query = '@scope', query_group = 'locals', desc = 'Goto next scope' },
192 + [']i'] = { query = '@conditional.outer' , desc = 'Goto next conditional' },
193 + [']a'] = { query = '@parameter.outer' , desc = 'Goto next parameter' },
194 + },
195 + goto_previous = {
196 + ['[f'] = { query = '@function.outer' , desc = 'Goto previous function' },
197 + ['[c'] = { query = '@class.outer', desc = 'goto previous class' },
198 + ['[s'] = { query = '@scope', query_group = 'locals', desc = 'Goto previous scope' },
199 + ['[i'] = { query = '@conditional.outer' , desc = 'Goto previous conditional' },
200 + ['[a'] = { query = '@parameter.outer' , desc = 'Goto previous parameter' },
202 + },
206 + local ts_repeat_move = require 'nvim-treesitter.textobjects.repeatable_move'
208 + map.normal.visual.operator_pending {
209 + description = 'This repeats the last query with always previous direction and to the start of the range.',
210 + keys = '<PageUp>',
211 + category = 'textobjects',
212 + command = function () ts_repeat_move.repeat_last_move { forward = false } end
215 + map.normal.visual.operator_pending {
216 + description = 'This repeats the last query with always next direction and to the end of the range.',
217 + keys = '<PageDown>',
218 + category = 'textobjects',
219 + command = function () ts_repeat_move.repeat_last_move { forward = true } end
222 + ---@diagnostic disable-next-line: inject-field
223 + parsers.get_parser_configs().just = {
224 + install_info = {
225 + url = 'https://github.com/IndianBoy42/tree-sitter-just', -- local path or git repo
226 + files = { 'src/parser.c', 'src/scanner.cc' },
227 + branch = 'main',
228 + },
229 + maintainers = { '@IndianBoy42' },
231 + end,

neovim/lua/bugabinga/plugins/treesj.lua

Modified
1 -local map = require'std.keymap'
1 +local map = require'std.map'
3 3 return {
4 4 'Wansmer/treesj',
14 14 map.normal {
15 - name = 'Toggle Tree Join/Split',
15 + description = 'Toggle Tree Join/Split',
16 16 category = 'editing',
17 17 keys = '<C-j>',
18 18 command = treesj.toggle,
20 20 end,
21 -}

neovim/lua/bugabinga/plugins/whichkey.lua

Added
new file mode 100644
1 +local ignored = require 'std.ignored'
3 +--TODO: add which-key highlights in nugu
4 +return {
5 + 'folke/which-key.nvim',
6 + event = 'VeryLazy',
7 + init = function ()
8 + vim.o.timeout = true
9 + vim.o.timeoutlen = 300
10 + end,
11 + opts = {
12 + operators = {
13 + -- TODO: make surround bind more logical and add here
14 + ms = 'Surround',
15 + },
16 + icons = {
17 + group = ' '
18 + },
19 + window = {
20 + border = vim.g.border_style,
21 + winblend = vim.o.winblend,
22 + },
23 + disable = {
24 + buftypes = ignored.buftypes,
25 + }
26 + }

neovim/lua/std/auto.lua

Modified
18 18 vim.api.nvim_create_autocmd(autocommand.events, {
19 19 desc = autocommand.description,
20 20 group = group,
21 + buffer = autocommand.buffer,
21 22 pattern = autocommand.pattern,
22 23 command = command,
23 24 callback = callback,

neovim/lua/std/defer.lua

Added
new file mode 100644
1 +-- taken from https://gist.github.com/runiq/31aa5c4bf00f8e0843cd267880117201
3 +local _ = {}
5 +---Validates args for `throttle()` and `debounce()`.
6 +local function td_validate(fn, ms)
7 + vim.validate{
8 + fn = { fn, 'f' },
9 + ms = {
10 + ms,
11 + function(ms)
12 + return type(ms) == 'number' and ms > 0
13 + end,
14 + "number > 0",
15 + },
16 + }
17 +end
19 +--- Throttles a function on the leading edge. Automatically `schedule_wrap()`s.
20 +---
21 +--@param fn (function) Function to throttle
22 +--@param timeout (number) Timeout in ms
23 +--@returns (function, timer) throttled function and timer. Remember to call
24 +---`timer:close()` at the end or you will leak memory!
25 +function _.throttle_leading(fn, ms)
26 + td_validate(fn, ms)
27 + local timer = vim.loop.new_timer()
28 + local running = false
30 + local function wrapped_fn(...)
31 + if not running then
32 + timer:start(ms, 0, function()
33 + running = false
34 + end)
35 + running = true
36 + pcall(vim.schedule_wrap(fn), select(1, ...))
37 + end
38 + end
39 + return wrapped_fn, timer
40 +end
42 +--- Throttles a function on the trailing edge. Automatically
43 +--- `schedule_wrap()`s.
44 +---
45 +--@param fn (function) Function to throttle
46 +--@param timeout (number) Timeout in ms
47 +--@param last (boolean, optional) Whether to use the arguments of the last
48 +---call to `fn` within the timeframe. Default: Use arguments of the first call.
49 +--@returns (function, timer) Throttled function and timer. Remember to call
50 +---`timer:close()` at the end or you will leak memory!
51 +function _.throttle_trailing(fn, ms, last)
52 + td_validate(fn, ms)
53 + local timer = vim.loop.new_timer()
54 + local running = false
56 + local wrapped_fn
57 + if not last then
58 + function wrapped_fn(...)
59 + if not running then
60 + local argv = {...}
61 + local argc = select('#', ...)
63 + timer:start(ms, 0, function()
64 + running = false
65 + pcall(vim.schedule_wrap(fn), unpack(argv, 1, argc))
66 + end)
67 + running = true
68 + end
69 + end
70 + else
71 + local argv, argc
72 + function wrapped_fn(...)
73 + argv = {...}
74 + argc = select('#', ...)
76 + if not running then
77 + timer:start(ms, 0, function()
78 + running = false
79 + pcall(vim.schedule_wrap(fn), unpack(argv, 1, argc))
80 + end)
81 + running = true
82 + end
83 + end
84 + end
85 + return wrapped_fn, timer
86 +end
88 +--- Debounces a function on the leading edge. Automatically `schedule_wrap()`s.
89 +---
90 +--@param fn (function) Function to debounce
91 +--@param timeout (number) Timeout in ms
92 +--@returns (function, timer) Debounced function and timer. Remember to call
93 +---`timer:close()` at the end or you will leak memory!
94 +function _.debounce_leading(fn, ms)
95 + td_validate(fn, ms)
96 + local timer = vim.loop.new_timer()
97 + local running = false
99 + local function wrapped_fn(...)
100 + timer:start(ms, 0, function()
101 + running = false
102 + end)
104 + if not running then
105 + running = true
106 + pcall(vim.schedule_wrap(fn), select(1, ...))
107 + end
108 + end
109 + return wrapped_fn, timer
110 +end
112 +--- Debounces a function on the trailing edge. Automatically
113 +--- `schedule_wrap()`s.
114 +---
115 +--@param fn (function) Function to debounce
116 +--@param timeout (number) Timeout in ms
117 +--@param first (boolean, optional) Whether to use the arguments of the first
118 +---call to `fn` within the timeframe. Default: Use arguments of the last call.
119 +--@returns (function, timer) Debounced function and timer. Remember to call
120 +---`timer:close()` at the end or you will leak memory!
121 +function _.debounce_trailing(fn, ms, first)
122 + td_validate(fn, ms)
123 + local timer = vim.loop.new_timer()
124 + local wrapped_fn
126 + if not first then
127 + function wrapped_fn(...)
128 + local argv = {...}
129 + local argc = select('#', ...)
131 + timer:start(ms, 0, function()
132 + pcall(vim.schedule_wrap(fn), unpack(argv, 1, argc))
133 + end)
134 + end
135 + else
136 + local argv, argc
137 + function wrapped_fn(...)
138 + argv = argv or {...}
139 + argc = argc or select('#', ...)
141 + timer:start(ms, 0, function()
142 + pcall(vim.schedule_wrap(fn), unpack(argv, 1, argc))
143 + end)
144 + end
145 + end
146 + return wrapped_fn, timer
147 +end
149 +--- Test deferment methods (`{throttle,debounce}_{leading,trailing}()`).
150 +---
151 +--@param bouncer (string) Bouncer function to test
152 +--@param ms (number, optional) Timeout in ms, default 2000.
153 +--@param firstlast (bool, optional) Whether to use the 'other' fn call
154 +---strategy.
155 +function _.test_defer(bouncer, ms, firstlast)
156 + local bouncers = {
157 + tl = _.throttle_leading,
158 + tt = _.throttle_trailing,
159 + dl = _.debounce_leading,
160 + dt = _.debounce_trailing,
163 + local timeout = ms or 2000
165 + local bounced = bouncers[bouncer](
166 + function(i) vim.cmd('echom "' .. bouncer .. ': ' .. i .. '"') end,
167 + timeout,
168 + firstlast
171 + for i, _ in ipairs{1,2,3,4,5} do
172 + bounced(i)
173 + vim.schedule(function () vim.cmd('echom ' .. i) end)
174 + vim.fn.call("wait", {1000, "v:false"})
175 + end
176 +end
178 +return _

neovim/lua/std/icon.lua

Modified
38 38 lazy = '󰄻',
39 39 global = '󱥔',
40 40 ['local'] = '󱥕',
41 - space = '∸',
41 + space = '⋅',
42 42 eol = '↴',
43 43 tab = '󰌒',
44 44 trail = '•',

neovim/lua/std/ignored.lua

Modified
11 11 'toggleterm',
12 12 'lazy',
13 13 'oil',
14 + 'spectre_panel',
15 + 'WhichKey',
16 18 local buftypes = {

neovim/lua/std/keymap.lua

Deleted
deleted file mode 100644
1 -local available_modes = {
2 - normal_visual_select_operator_pending = '',
4 - normal = 'n',
5 - n = 'n',
7 - insert = 'i',
8 - i = 'i',
10 - visual = 'x',
11 - x = 'x',
13 - visual_select = 'v',
14 - v = 'v',
16 - select = 's',
17 - s = 's',
19 - operator_pending = 'o',
20 - o = 'o',
22 - ['!'] = '!',
23 - insert_command_line = '!',
25 - command_line = 'c',
26 - c = 'c',
28 - terminal = 't',
29 - t = 't',
30 -}
32 -local bind = function(self, map)
33 - vim.validate{
34 - map = { map, 'table' },
35 - keys = { map.keys, 'string' },
36 - command = { map.command, { 'function', 'string' }},
37 - }
39 - local keys = map.keys
40 - local command = map.command
42 - map.options = map.options or {}
44 - if map.category and map.description then
45 - map.description = map.category .. ': ' .. map.description
46 - end
48 - local options = vim.tbl_extend('keep', map.options, {
49 - silent = true,
50 - desc = map.description,
51 - })
53 - if vim.tbl_isempty(self.mode) then self.mode[1] = available_modes.normal_visual_select_operator_pending end
54 - vim.keymap.set(self.mode, keys, command, options)
55 - self.mode = {}
57 - return function()
58 - local delete_options = options.buffer and { buffer = options.buffer } or {}
59 - vim.keymap.del(self.mode, keys, delete_options)
60 - end
61 -end
63 -local add_mode = function(self, key)
64 - local new_mode = available_modes[key]
65 - if new_mode == nil then error('unknown keymap mode requested: ' .. key) end
66 - if not self.mode[new_mode] then
67 - table.insert(self.mode, new_mode)
68 - end
69 - return self
70 -end
72 -return setmetatable(
73 -{
74 - mode = {},
75 -},
76 -{
77 - __index = add_mode,
78 - __call = bind,
79 -})

neovim/lua/std/map.lua

Added
new file mode 100644
1 +local available_modes = {
2 + normal_visual_select_operator_pending = '',
4 + normal = 'n',
5 + n = 'n',
7 + insert = 'i',
8 + i = 'i',
10 + visual = 'x',
11 + x = 'x',
13 + visual_select = 'v',
14 + v = 'v',
16 + select = 's',
17 + s = 's',
19 + operator_pending = 'o',
20 + o = 'o',
22 + ['!'] = '!',
23 + insert_command_line = '!',
25 + command_line = 'c',
26 + c = 'c',
28 + terminal = 't',
29 + t = 't',
32 +local bind = function ( self, map )
33 + vim.validate {
34 + map = { map, 'table' },
35 + ['map.keys'] = { map.keys, { 'string', 'table' } },
36 + ['map.command'] = { map.command, { 'function', 'string' } },
37 + }
39 + local keys = map.keys
40 + local command = map.command
42 + map.options = map.options or {}
44 + if map.category and map.description then
45 + map.description = map.category .. ': ' .. map.description
46 + end
48 + local options = vim.tbl_extend( 'keep', map.options, {
49 + silent = true,
50 + desc = map.description,
51 + } )
53 + if vim.tbl_isempty( self.mode ) then self.mode[1] = available_modes.normal_visual_select_operator_pending end
55 + if type( keys ) == 'table' then
56 + for _, key in ipairs( keys ) do
57 + vim.keymap.set( self.mode, key, command, options )
58 + end
59 + else
60 + vim.keymap.set( self.mode, keys, command, options )
61 + end
63 + self.mode = {}
65 + return function ()
66 + local delete_options = options.buffer and { buffer = options.buffer } or {}
67 + if type( keys ) == 'table' then
68 + for _, key in ipairs( keys ) do
69 + vim.keymap.del( self.mode, key, delete_options )
70 + end
71 + else
72 + vim.keymap.del( self.mode, keys, delete_options )
73 + end
74 + end
75 +end
77 +local add_mode = function ( self, key )
78 + local new_mode = available_modes[key]
79 + if new_mode == nil then error( 'unknown keymap mode requested: ' .. key ) end
80 + if not self.mode[new_mode] then
81 + table.insert( self.mode, new_mode )
82 + end
83 + return self
84 +end
86 +return setmetatable(
87 + {
88 + mode = {},
89 + },
90 + {
91 + __index = add_mode,
92 + __call = bind,
93 + } )

neovim/lua/std/project.lua

Modified
1 -local ignored = require'std.ignored'
2 -local table = require'std.table'
1 +local ignored = require 'std.ignored'
2 +local table = require 'std.table'
3 3 local join = table.join
4 4 local dirname = vim.fs.dirname
5 5 local normalize = vim.fs.normalize
68 68 ---directory is used.
69 69 ---@return string? # Directory, that contains the `markers` and lies on the path from `path` to `stop`.
70 70 local function find_root(path, markers, stop)
72 - validate{
73 - path = { path, 'string', true },
74 - markers = { markers, 'table'},
75 - stop = { stop, 'string', true},
76 - }
71 + validate {
72 + path = { path, 'string', true },
73 + markers = { markers, 'table' },
74 + stop = { stop, 'string', true },
75 + }
78 77 path = path or dirname(vim.api.nvim_buf_get_name(0))
79 78 path = normalize(path)
80 79 stop = stop or vim.uv.os_homedir()
81 80 stop = normalize(stop)
83 - if not exists(stop) then error( ( 'the stop directory %s does not exist!' ):format(stop) ) end
82 + if not exists(stop) then error(('the stop directory %s does not exist!'):format(stop)) end
85 84 local cache_hit = cache_get(path, markers)
86 85 if cache_hit then
99 98 -- stop if we reached the user defined stop instead of the file system root
100 99 local current_path = path
101 100 while current_path ~= stop do
102 - if loop_count > MAX_TRAVERSAL_COUNT then error(( 'searching for markers reached the max traversal count for path %s !' ):format(path)) end
101 + if loop_count > MAX_TRAVERSAL_COUNT then
102 + vim.notify(('searching for markers reached the max traversal count for path %s !'):format(path))
103 + break
104 + end
104 106 local score = {
105 107 path = current_path,
129 131 local project_root = nil
130 132 local max_likelyhood = 0
131 133 -- the project root is most likely the directory with the highest marker count
132 - -- and distance to current buffer.
134 + -- and lowest distance to current buffer.
133 135 -- because if there are markers further away from the buffer than other markers,
134 136 -- then it is most likely a nested project structure (multi-module).
135 137 -- in those cases we are looking for the root project folder, instead the nearest
136 138 -- child project root folder.
137 139 for _, score in ipairs(directory_scores) do
138 - local likelihood = score.marker_count + score.distance_to_buffer_file
140 + local likelihood = score.marker_count + 1/score.distance_to_buffer_file
139 141 if likelihood > max_likelyhood then
140 142 max_likelyhood = likelihood
141 143 project_root = score.path
150 152 --- Determines the project root directory of the current buffer file. A "project" is not clearly defined for all programming languages, so this function uses a heuristic approach.
153 +---@param path string? path to start searching from. If `nil`, then path of current buffer is used.
151 154 ---@param markers table<string, number>? list of markers. a marker is a table with `name` and `weight` key. `name` can be a file or directory name, that indicates, that if a file/folder with that name exists in a directory, that directory is likely to be a project root. `weight` is a means to express confidence in that likelihood. Values should be between 1 and 3. Internally, there are some project-agnostic markers defined (e.g. README, LICENSE, .git, ...) that will be merged with `custom_markers`.
153 156 ---@return string? # The project root of the current buffer, or `nil`, if none could be determined.
155 -local function find_project_root(markers)
158 +local function find_project_root(path, markers)
156 159 -- define some language-independent markers
157 160 local default_markers = {
158 - { name = '.git', weight = 1 },
159 - { name = '.gitignore', weight = 1 },
160 - { name = '.svn', weight = 1 },
161 - { name = 'justfile', weight = 1 },
162 - { name = 'Jenkinsfile', weight = 1 },
161 + { name = '.git', weight = 1 },
162 + { name = '.gitignore', weight = 1 },
163 + { name = '.svn', weight = 1 },
164 + { name = 'justfile', weight = 1 },
165 + { name = 'Jenkinsfile', weight = 1 },
163 166 { name = '.editorconfig', weight = 1 },
164 - { name = 'LICENSE', weight = 1 },
165 - { name = 'LICENSE.md', weight = 1 },
166 - { name = 'LICENSE.txt', weight = 1 },
167 - { name = 'COPYING', weight = 1 },
168 - { name = 'README', weight = 1 },
169 - { name = 'README.md', weight = 1 },
170 - { name = 'Makefile', weight = 1 },
171 - { name = 'flake.nix', weight = 1 },
172 - { name = 'flake.nix', weight = 1 },
167 + { name = 'LICENSE', weight = 1 },
168 + { name = 'LICENSE.md', weight = 1 },
169 + { name = 'LICENSE.txt', weight = 1 },
170 + { name = 'COPYING', weight = 1 },
171 + { name = 'README', weight = 1 },
172 + { name = 'README.md', weight = 1 },
173 + { name = 'Makefile', weight = 1 },
174 + { name = 'flake.nix', weight = 1 },
175 + { name = 'flake.nix', weight = 1 },
175 - return find_root(nil, join(default_markers, markers))
178 + return find_root(path, join(default_markers, markers))
178 -local function find_vcs_project_root()
179 - return find_project_root{}
181 +local function find_vcs_project_root(path)
182 + return find_project_root(path, {})
182 -local function find_java_project_root()
185 +local function find_java_project_root(path)
183 186 local java_markers = {
184 - { name = '.idea', weight = 2 },
185 - { name = '.classpath', weight = 2 },
186 - { name = '.settings', weight = 2 },
187 - { name = '.project', weight = 2 },
188 - { name = 'target', weight = 2 },
189 - { name = 'pom.xml', weight = 2 },
190 - { name = 'mvnw', weight = 3 },
191 - { name = '.mvn', weight = 3 },
192 - { name = 'mvnw.cmd', weight = 3 },
193 - { name = 'build.gradle', weight = 2 },
187 + { name = '.idea', weight = 2 },
188 + { name = '.classpath', weight = 2 },
189 + { name = '.settings', weight = 2 },
190 + { name = '.project', weight = 2 },
191 + { name = 'target', weight = 2 },
192 + { name = 'pom.xml', weight = 2 },
193 + { name = 'mvnw', weight = 3 },
194 + { name = '.mvn', weight = 3 },
195 + { name = 'mvnw.cmd', weight = 3 },
196 + { name = 'build.gradle', weight = 2 },
194 197 { name = 'gradle.properties', weight = 3 },
195 - { name = 'settings.gradle', weight = 3 },
196 - { name = 'gradlew', weight = 3 },
197 - { name = 'gradlew.bat', weight = 3 },
198 + { name = 'settings.gradle', weight = 3 },
199 + { name = 'gradlew', weight = 3 },
200 + { name = 'gradlew.bat', weight = 3 },
199 - return find_root(nil, java_markers)
202 + return find_root(path, java_markers)
202 205 -- TODO: how to get a marker for luarocks stuff?
203 206 local lua_markers = {
204 - { name = '.luarc.json', weight = 1 },
207 + { name = '.luarc.json', weight = 1 },
205 208 { name = '.luarc.jsonc', weight = 1 },
206 - { name = '.luacheckrc', weight = 1 },
209 + { name = '.luacheckrc', weight = 1 },
207 210 { name = '.stylua.toml', weight = 1 },
208 - { name = 'stylua.toml', weight = 1 },
209 - { name = 'selene.toml', weight = 1 },
210 - { name = 'selene.yml', weight = 1 },
211 + { name = 'stylua.toml', weight = 1 },
212 + { name = 'selene.toml', weight = 1 },
213 + { name = 'selene.yml', weight = 1 },
213 216 local nvim_lua_markers = {
214 - {name = 'neovim.yml', weight = 1},
215 - {name = 'lua', weight = 1},
217 + { name = 'neovim.yml', weight = 1 },
218 + { name = 'lua', weight = 1 },
218 -local find_lua_project_root = function()
219 - return find_root(nil, lua_markers)
221 +local find_lua_project_root = function(path)
222 + return find_root(path, lua_markers)
222 -local find_lua_nvim_project_root = function()
223 - return find_root(nil, nvim_lua_markers)
225 +local find_lua_nvim_project_root = function(path)
226 + return find_root(path, nvim_lua_markers)
227 +end
229 +local zig_markers = {
230 + { name = 'build.zig', weight = 3 },
231 + { name = 'zls.build.json', weight = 3 },
232 + { name = 'zig-cache', weight = 1 },
233 + { name = 'zig-out', weight = 1 },
236 +local find_zig_project_root = function(path)
237 + return find_root(path, zig_markers)
238 +end
240 +local find_rust_project_root = function(path)
241 + local markers = {
242 + { name = 'Cargo.toml', weight = 3 },
244 + local cargo_crate_dir = find_root(path, markers)
245 + if cargo_crate_dir == nil then return nil end
247 + local cmd = {
248 + 'cargo',
249 + 'metadata',
250 + '--no-deps',
251 + '--format-version',
252 + '1',
253 + '--manifest-path',
254 + vim.fs.joinpath(cargo_crate_dir, 'Cargo.toml'),
257 + local result = vim.system(cmd, { text = true }):wait()
258 + local cargo_workspace_root
260 + if result.code == 0 then
261 + local json = vim.json.decode(result.stdout)
262 + if json['workspace_root'] then
263 + cargo_workspace_root = vim.fs.normalize(json['workspace_root'])
264 + end
265 + end
267 + return cargo_workspace_root or cargo_crate_dir
226 270 return {
227 271 find_root = find_root,
272 + find_project_root = find_project_root,
228 273 find_vcs_project_root = find_vcs_project_root,
229 274 find_java_project_root = find_java_project_root,
230 275 find_lua_project_root = find_lua_project_root,
231 276 find_lua_nvim_project_root = find_lua_nvim_project_root,
277 + find_zig_project_root = find_zig_project_root,
278 + find_rust_project_root = find_rust_project_root,

neovim/lua/std/want.lua

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

neovim/popo.xml

Added
new file mode 100644

No text changes.

nushell/env.nu

Modified
1 1 # GLOBAL VARIABLES
2 +# GLOBAL VARIABLES
3 4 $env.WIN32 = ( $nu.os-info.name =~ "windows" )
4 5 $env.NURC_DIR = ( $nu.config-path | path expand | path dirname )
9 10 $env.TERM = if ($env | get -i TERM_PROGRAM) == WezTerm { "wezterm" } else { "xterm-256color" }
11 12 # theme for ls and other programs, that use LS_COLORS
12 -# $env.LS_COLORS = ( try { vivid generate nord } catch { "" } )
13 +$env.LS_COLORS = (try { vivid generate ayu | into string } catch {""})
14 15 # Specifies how environment variables are:
15 16 # - converted from a string to a value on Nushell startup (from_string)
31 32 ($nu.config-path | path dirname | path join 'modules'),
32 33 ($nu.config-path | path dirname | path join 'completions')
36 +alias cb = flatpak run app.getclipboard.Clipboard
38 +$env.CLIPBOARD_EDITOR = nvim
39 +$env.CLIPBOARD_HISTORY = 100000
40 +$env.CLIPBOARD_PERSISTDIR = /home/oli/Clipboard
41 +$env.CLIPBOARD_NOAUDIO = 1
42 +# $env.CLIPBOARD_NOGUI = 1
43 +$env.CLIPBOARD_THEME = light

nushell/modules/aliases.nu

Modified
1 1 # Semantic aliases
2 2 export alias show = bat
3 3 export def list [] { ls --all --long --du --mime-type | where type == dir | append (ls --all --long --du --mime-type | where type != dir) }
4 -export alias browse = firefox
4 +export alias web = firefox
5 5 export alias edit = hx
6 6 # TODO ewrite bak command
7 7 export alias backup = bak

tools/install_wezterm_terminfo.sh

Modified + mode changed
old mode 100644 new mode 100755
1 1 tempfile=$(mktemp) \
2 - && curl -o $tempfile https://raw.githubusercontent.com/wez/wezterm/main/termwiz/data/wezterm.terminfo \
3 - && tic -x -o ~/.terminfo $tempfile \
4 - && rm $tempfile
2 + && curl -o "$tempfile" https://raw.githubusercontent.com/wez/wezterm/main/termwiz/data/wezterm.terminfo \
3 + && tic -x -o ~/.terminfo "$tempfile" \
4 + && rm "$tempfile"