repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: new command to highlight group names in buffer

307d93ffbfc7689151f12e51c90c65acba385023

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (23)

neovim/README.md

Modified
32 32 # todo
34 +* Move to treesitter main branch
35 +* check out `vim.snippet`
36 +* use `vim.base64` in wezterm plugin
34 37 * Bug: LuaLS is getting crazy diagnosing non-stop...
35 38 * integrate language tool?
36 39 * ]s [s to jump to spelling mistakes
40 +* try Termdebug with gdb
37 41 * adapt config to respect `vim.g.nerdfont` (std.constants?)
38 42 * make lsp config extensible, so that plugin configs can hook into it (e.g. on_attach)
39 -* write plugin to parse lsp settings locally and apply them
40 43 * pandoc with lua filters for diagrams for generating documents and previewing --> https://github.com/tex/vimpreviewpandoc
41 -* once a terminal was open, i cannot quit with :wqa anymore...
42 44 * create facade over vim.api.nvim_create_user_command
43 45 * use ltex-ls for markdown, code comments and commit messages
44 46 * learn from <https://github.com/stevearc/dotfiles/blob/master/.config/nvim/plugin/exrc.lua> and maybe adapt `std.localrc`

neovim/ftplugin/lua.lua

Modified
12 12 description = 'Wrap word under cursor with require call',
13 13 keys = '<leader>rq',
14 14 category = 'refactor',
15 - -- sourround word with '
15 + -- surround word with '
16 16 -- insert `require`
17 17 -- move 3 words
18 18 command = "ebi'<esc>ea'<esc>bbirequire <esc>www",

neovim/ftplugin/oil.lua

Added
new file mode 100644
1 +vim.opt_local.syntax = 'on'

neovim/init.lua

Modified
51 51 -- visualize marks in signcolumn
52 52 ok, loaded = pcall( require, 'bugabinga.mark' )
53 53 if not ok then
54 -vim.print( 'error while loading mark', loaded )
54 + vim.print( 'error while loading mark', loaded )
55 +end
57 +-- configure builtin terminal
58 +ok, loaded = pcall( require, 'bugabinga.terminal' )
59 +if not ok then
60 + vim.print( 'error while loading terminal', loaded )
57 63 -- setup lsp clients

neovim/lazy-lock.json

Modified
11 11 "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
12 12 "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
13 13 "colorizer.nvim": { "branch": "master", "commit": "107719885290366c893e1c1c58b7474cbeabfef6" },
14 - "conform.nvim": { "branch": "master", "commit": "bf109f061fc3cd75394b7823923187ae045cbf22" },
14 + "conform.nvim": { "branch": "master", "commit": "f9523f75134614fc0eff29c2377ed36603a1b0aa" },
15 15 "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
16 16 "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
17 17 "fidget.nvim": { "branch": "main", "commit": "4e854f3299e21d1c18279add340428a97520fc44" },
20 20 "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
21 21 "heirline.nvim": { "branch": "master", "commit": "03cff30d7e7d3ba6fdc00925f015822f79cef908" },
22 22 "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
23 - "lazy.nvim": { "branch": "main", "commit": "08954f723bf2d442ea020551e3acc956f4dc6dc7" },
23 + "lazy.nvim": { "branch": "main", "commit": "d37a76b87137c777f3d778ed03729d7f332a85f0" },
24 24 "lsp_signature.nvim": { "branch": "master", "commit": "c6aeb2f1d2538bbdfdaab1664d9d4c3c75aa9db8" },
25 25 "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
26 + "lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" },
26 27 "mason-tool-installer.nvim": { "branch": "main", "commit": "1212fb6082b7177dde17ea65e429e027835aeb40" },
27 28 "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
28 29 "mini.bracketed": { "branch": "main", "commit": "65c7dfb51e832de9e279e5d5b0741e7af6755ab5" },
29 30 "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
30 31 "neogen": { "branch": "main", "commit": "0daffcec249bf42275e322361fe55b89a05ff278" },
31 - "neorg": { "branch": "main", "commit": "df755b5f5cf837743b78392fa90fd8d993263ca1" },
32 + "neorg": { "branch": "main", "commit": "d2d2167a5562d133723ba9ac0cf7f3e991df8a30" },
32 33 "neotest": { "branch": "master", "commit": "e07fe8241112274aae9947b98d255763738a1d52" },
33 34 "neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" },
34 35 "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" },
35 - "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
36 + "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
36 37 "nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" },
37 38 "nvim-cmp": { "branch": "main", "commit": "97dc716fc914c46577a4f254035ebef1aa72558a" },
38 - "nvim-dap": { "branch": "master", "commit": "c1695e500c7d552a0a19953a9aefcc89178fb1af" },
39 + "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
39 40 "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
40 41 "nvim-dap-virtual-text": { "branch": "master", "commit": "baa5b0dc6663284cce32e0d00ac1f2511b13496f" },
41 42 "nvim-genghis": { "branch": "main", "commit": "8613fc1b43db6cc761733b3630eabff9e86296f7" },
47 48 "nvim-navbuddy": { "branch": "master", "commit": "f34237e8a41ebc6e2716af2ebf49854d8c5289c8" },
48 49 "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
49 50 "nvim-neoclip.lua": { "branch": "main", "commit": "798cd0592a81c185465db3a091a0ff8a21af60fd" },
50 - "nvim-nio": { "branch": "master", "commit": "33c62b3eadd8154169e42144de16ba4db6784bec" },
51 + "nvim-nio": { "branch": "master", "commit": "5a3a06e5df34f1b4fc1500622b10620c49c60da6" },
51 52 "nvim-spectre": { "branch": "master", "commit": "31f62d7fc30257b2a5c5327ff7b47719da37a1b4" },
52 53 "nvim-surround": { "branch": "main", "commit": "84a26afce16cffa7e3322cfa80a42cddf60616eb" },
53 54 "nvim-tree.lua": { "branch": "master", "commit": "85c502e9076d9c82e2f04addabb3614846ae7558" },
54 - "nvim-treesitter": { "branch": "master", "commit": "33c9db832b6f25446f7bd2dd3353f7737a3476c4" },
55 + "nvim-treesitter": { "branch": "master", "commit": "7f3179315959bd762abd0f8dbe0361db805fb2d4" },
56 + "nvim-treesitter-endwise": { "branch": "master", "commit": "60e8c288e011403f248b5f6478dde12bed8a6c55" },
55 57 "nvim-treesitter-textobjects": { "branch": "master", "commit": "d2a4ffc22d9d38d44edb73da007b3cf43451e9b4" },
56 58 "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
57 59 "nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
58 - "nvim-web-devicons": { "branch": "master", "commit": "6662f059bf78e6092ba90cd1929599625f448f55" },
60 + "nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" },
59 61 "nvim-window": { "branch": "main", "commit": "e7f5d60eeec8ff37af7be4c9a99f65edf67fc574" },
60 62 "oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
61 63 "overseer.nvim": { "branch": "master", "commit": "b04b0b105c07b4f02b3073ea3a98d6eca90bf152" },
64 + "pair-ls.nvim": { "branch": "master", "commit": "e7a8f55f54a6a1956b782ddefba79dc6bb308d1d" },
62 65 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
63 - "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
66 + "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
64 67 "qf_helper.nvim": { "branch": "master", "commit": "91dad029c11d1c39b0d1276eda52616f651072be" },
65 68 "resession.nvim": { "branch": "master", "commit": "dc8825439c619030925543a444c4186a2487c200" },
66 - "schemastore.nvim": { "branch": "main", "commit": "290e692d568e55be475f6af4579fea434e20ba0c" },
69 + "schemastore.nvim": { "branch": "main", "commit": "65f07cde64d9123eab8639c1a3f7aa7939060cde" },
67 70 "specs.nvim": { "branch": "main", "commit": "e929006d3f6bb8e43f03e13ac364c67236eb5299" },
68 71 "speedtyper.nvim": { "branch": "main", "commit": "2d158eed4c753995b0501a3a7a72464fbb213e3d" },
69 72 "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
70 - "stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" },
71 73 "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
72 74 "suda.vim": { "branch": "master", "commit": "66727b416837836712975e748bc8a19fb6cf4ec3" },
73 75 "telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
75 77 "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
76 78 "tint.nvim": { "branch": "master", "commit": "862835626941d263466754b9c8e2ce2cb004f5ac" },
77 79 "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" },
78 - "toggleterm.nvim": { "branch": "main", "commit": "193786e0371e3286d3bc9aa0079da1cd41beaa62" },
79 80 "tree-sitter-nu": { "branch": "main", "commit": "c5b7816043992b1cdc1462a889bc74dc08576fa6" },
80 81 "treesj": { "branch": "main", "commit": "60e27280030f9cd8dfb6ceb335922c6ff76682cc" },
81 82 "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },

neovim/lua/bugabinga/nugu/init.lua

Modified
42 42 vim.g.terminal_color_14 = ui_important_global -- aqua
43 43 vim.g.terminal_color_15 = ui_normal -- white
45 46 local set_group_properties = function ( self, properties )
46 - vim.validate {
47 - properties = { properties, 'table', },
48 - -- • fg (or foreground): color name or "#RRGGBB", see note.
49 - ['properties.fg'] = { properties.fg, 'string', true, },
50 - -- • bg (or background): color name or "#RRGGBB", see note.
51 - ['properties.bg'] = { properties.bg, 'string', true, },
52 - -- • sp (or special): color name or "#RRGGBB"
53 - ['properties.sp'] = { properties.sp, 'string', true, },
54 - -- • blend: integer between 0 and 100
55 - ['properties.blend'] = { properties.blend, 'number', true, },
56 - -- • bold: boolean
57 - ['properties.bold'] = { properties.bold, 'boolean', true, },
58 - -- • standout: boolean
59 - ['properties.standout'] = { properties.standout, 'boolean', true, },
60 - -- • underline: boolean
61 - ['properties.underline'] = { properties.underline, 'boolean', true, },
62 - -- • undercurl: boolean
63 - ['properties.undercurl'] = { properties.undercurl, 'boolean', true, },
64 - -- • underdotted: boolean
65 - ['properties.underdotted'] = { properties.underdotted, 'boolean', true, },
66 - -- • underdashed: boolean
67 - ['properties.underdashed'] = { properties.underdashed, 'boolean', true, },
68 - -- • strikethrough: boolean
69 - ['properties.strikethrough'] = { properties.strikethrough, 'boolean', true, },
70 - -- • italic: boolean
71 - ['properties.italic'] = { properties.italic, 'boolean', true, },
72 - -- • reverse: boolean
73 - ['properties.reverse'] = { properties.reverse, 'boolean', true, },
74 - -- • nocombine: boolean
75 - ['properties.nocombine'] = { properties.nocombine, 'boolean', true, },
76 - -- • default: Don't override existing definition |:hi-default|
77 - ['properties.default'] = { properties.default, 'boolean', true, },
78 - -- • ctermfg: Sets foreground of cterm color |ctermfg|
79 - ['properties.ctermfg'] = { properties.ctermfg, 'string', true, },
80 - -- • ctermbg: Sets background of cterm color |ctermbg|
81 - ['properties.ctermbg'] = { properties.ctermbg, 'string', true, },
82 - -- • cterm: cterm attribute map, like |highlight-args|. If not set, cterm attributes will match those from the attribute map documented above.
83 - ['properties.cterm'] = { properties.cterm, 'table', true, },
84 - -- • force: if true force update the highlight group when it exists.
85 - ['properties.force'] = { properties.force, 'boolean', true, },
86 - }
87 - -- vim.print( 'SET GROUP PROPERTIES', self, properties )
88 - for key, value in pairs( properties ) do
89 - self[key] = value
90 - end
47 + vim.validate {
48 + properties = { properties, 'table', },
49 + -- • fg (or foreground): color name or "#RRGGBB", see note.
50 + ['properties.fg'] = { properties.fg, 'string', true, },
51 + -- • bg (or background): color name or "#RRGGBB", see note.
52 + ['properties.bg'] = { properties.bg, 'string', true, },
53 + -- • sp (or special): color name or "#RRGGBB"
54 + ['properties.sp'] = { properties.sp, 'string', true, },
55 + -- • blend: integer between 0 and 100
56 + ['properties.blend'] = { properties.blend, 'number', true, },
57 + -- • bold: boolean
58 + ['properties.bold'] = { properties.bold, 'boolean', true, },
59 + -- • standout: boolean
60 + ['properties.standout'] = { properties.standout, 'boolean', true, },
61 + -- • underline: boolean
62 + ['properties.underline'] = { properties.underline, 'boolean', true, },
63 + -- • undercurl: boolean
64 + ['properties.undercurl'] = { properties.undercurl, 'boolean', true, },
65 + -- • underdotted: boolean
66 + ['properties.underdotted'] = { properties.underdotted, 'boolean', true, },
67 + -- • underdashed: boolean
68 + ['properties.underdashed'] = { properties.underdashed, 'boolean', true, },
69 + -- • strikethrough: boolean
70 + ['properties.strikethrough'] = { properties.strikethrough, 'boolean', true, },
71 + -- • italic: boolean
72 + ['properties.italic'] = { properties.italic, 'boolean', true, },
73 + -- • reverse: boolean
74 + ['properties.reverse'] = { properties.reverse, 'boolean', true, },
75 + -- • nocombine: boolean
76 + ['properties.nocombine'] = { properties.nocombine, 'boolean', true, },
77 + -- • default: Don't override existing definition |:hi-default|
78 + ['properties.default'] = { properties.default, 'boolean', true, },
79 + -- • ctermfg: Sets foreground of cterm color |ctermfg|
80 + ['properties.ctermfg'] = { properties.ctermfg, 'string', true, },
81 + -- • ctermbg: Sets background of cterm color |ctermbg|
82 + ['properties.ctermbg'] = { properties.ctermbg, 'string', true, },
83 + -- • cterm: cterm attribute map, like |highlight-args|. If not set, cterm attributes will match those from the attribute map documented above.
84 + ['properties.cterm'] = { properties.cterm, 'table', true, },
85 + -- • force: if true force update the highlight group when it exists.
86 + ['properties.force'] = { properties.force, 'boolean', true, },
87 + }
88 + -- vim.print( 'SET GROUP PROPERTIES', self, properties )
89 + for key, value in pairs( properties ) do
90 + self[key] = value
91 + end
93 94 local new_group = function ()
94 - return setmetatable( {}, {
95 - __call = set_group_properties,
96 - } )
95 + return setmetatable( {}, {
96 + __call = set_group_properties,
97 + } )
99 100 local add_group = function ( self, key )
100 - if not self.groups[key] then
101 - self.groups[key] = new_group()
102 - end
103 - return self.groups[key]
101 + if not self.groups[key] then
102 + self.groups[key] = new_group()
103 + end
104 + return self.groups[key]
106 107 local link_group = function ( self, key, value )
107 - -- vim.print( 'linking group', self, key, value )
108 - local group = add_group( self, key )
109 - for name, link_group in pairs( self.groups ) do
110 - if link_group == value then
111 - -- vim.print( 'found group to link ' .. name .. ' to ' .. key )
112 - group.link = name
113 - return group
114 - end
115 - end
108 + -- vim.print( 'linking group', self, key, value )
109 + local group = add_group( self, key )
110 + for name, link_group in pairs( self.groups ) do
111 + if link_group == value then
112 + -- vim.print( 'found group to link ' .. name .. ' to ' .. key )
113 + group.link = name
114 + return group
115 + end
116 + end
118 119 local _ = setmetatable( { groups = {}, }, {
119 - __index = add_group,
120 - __newindex = link_group,
120 + __index = add_group,
121 + __newindex = link_group,
123 124 _.Debug { fg = ui_normal, bg = debug, bold = true, }
124 125 _.Normal { fg = content_normal, bg = content_backdrop, }
125 -_.NotifyBackground { bg = ui_backdrop, }
126 126 _.Comment { fg = content_important_global, }
127 +_.NotifyBackground { bg = ui_backdrop, }
127 128 _.LineNr { fg = ui_minor, bg = content_backdrop, }
128 129 _.CursorLineNr { fg = ui_focus, bg = ui_backdrop, }
129 130 _.Search { bg = content_unfocus, }
533 534 --TODO: Oil highlights
535 536 return function ()
536 - preview.setup()
537 - local namespace = 0
538 - for name, group in pairs( _.groups ) do
539 - vim.api.nvim_set_hl( namespace, name, group )
540 - end
537 + preview.setup()
538 + local namespace = 0
539 + for name, group in pairs( _.groups ) do
540 + vim.api.nvim_set_hl( namespace, name, group )
541 + end

neovim/lua/bugabinga/options/commands.lua

Added
new file mode 100644
1 +local light_up = require 'std.light_up'
3 +local light_up_current_buffer = function ()
4 + local group_names = light_up.get_vim_highlight_groups()
5 + light_up.buffer( 0, group_names )
6 +end
8 +--TODO: use facade
9 +vim.api.nvim_create_user_command(
10 + 'LightUp',
11 + light_up_current_buffer,
12 + {}

neovim/lua/bugabinga/options/init.lua

Modified
5 5 require 'bugabinga.options.file'
6 6 require 'bugabinga.options.keymaps'
7 7 require 'bugabinga.options.spelling'
8 +require 'bugabinga.options.commands'
9 10 -- disable some runtime providers that i will not use.
10 11 -- keeps checkhealth clean

neovim/lua/bugabinga/options/ui.lua

Modified
23 23 -- show trailing whitespace
24 24 vim.opt.list = true
25 25 vim.opt.listchars = {
26 - space = icon.space,
27 - eol = icon.eol,
26 + -- space = icon.space,
27 + -- eol = icon.eol,
28 28 tab = icon.tab .. icon.middle_ellipsis,
29 29 trail = icon.trail,
30 30 extends = icon.extends,
69 69 -- better have no syntax highlighting than regex based, treesitter will take over later
70 -vim.cmd.syntax 'off'
70 +vim.opt.syntax = 'off'
72 72 -- hide output of insert completion popup in status
73 73 vim.opt.shortmess:append 'c'

neovim/lua/bugabinga/plugins/buffers.lua

Deleted
deleted file mode 100644
1 ---FIXME: own this
2 -return {
3 - 'stevearc/stickybuf.nvim',
4 - cmd = { 'PinBuffer', 'PinBuftype', 'PinFiletype', },
5 - opts = {},
6 -}

neovim/lua/bugabinga/plugins/cmp.lua

Modified
1 ---FIXME: own this
1 +local map = require 'std.map'
3 +map.insert {
4 + description = 'Trigger cmp autocomplete',
5 + category = 'completion',
6 + keys = '<c-x><c-o>',
7 + command = function () prequire 'cmp'.complete() end,
8 +}
10 +--TODO: use facade
11 +vim.api.nvim_create_user_command( 'CmpInfo', function ()
12 + prequire 'cmp'.status()
13 + end, {} )
2 15 return {
3 - "hrsh7th/nvim-cmp",
16 + 'hrsh7th/nvim-cmp',
4 17 dependencies = {
5 - "hrsh7th/cmp-nvim-lsp",
6 - "hrsh7th/cmp-buffer",
7 - "hrsh7th/cmp-path",
8 - "hrsh7th/cmp-nvim-lua",
9 - "saadparwaiz1/cmp_luasnip",
10 - "onsails/lspkind.nvim",
11 - "L3MON4D3/LuaSnip",
18 + 'hrsh7th/cmp-nvim-lsp',
19 + 'hrsh7th/cmp-buffer',
20 + 'hrsh7th/cmp-path',
21 + 'hrsh7th/cmp-nvim-lua',
22 + 'saadparwaiz1/cmp_luasnip',
23 + 'onsails/lspkind.nvim',
24 + 'L3MON4D3/LuaSnip',
13 - cmd = { "CmpInfo" },
14 - event = "InsertEnter *",
15 - config = function()
16 - local cmp = require("cmp")
17 - local luasnip = require("luasnip")
26 + config = function ()
27 + local cmp = require 'cmp'
28 + local luasnip = require 'luasnip'
18 29 local MAX_INDEX_FILE_SIZE = 4000
20 - local has_words_before = function()
21 - local line, col = unpack(vim.api.nvim_win_get_cursor(0))
22 - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
31 + local has_words_before = function ()
32 + local line, col = unpack( vim.api.nvim_win_get_cursor( 0 ) )
33 + return col ~= 0 and vim.api.nvim_buf_get_lines( 0, line - 1, line, true )[1]:sub( col, col ):match '%s' == nil
25 - local mapping = cmp.mapping.preset.insert({
26 - ["<C-d>"] = cmp.mapping.scroll_docs(-4),
27 - ["<C-f>"] = cmp.mapping.scroll_docs(4),
28 - ["<C-e>"] = cmp.mapping.close(),
29 - ["<C-y>"] = cmp.mapping.confirm({
30 - behavior = cmp.ConfirmBehavior.Replace,
31 - select = true,
32 - }),
36 + local snippet_next = function ( fallback )
37 + if luasnip.expand_or_jumpable() then
38 + luasnip.expand_or_jump()
39 + elseif cmp.visible() then
40 + cmp.select_next_item()
41 + elseif has_words_before() then
42 + cmp.complete()
43 + else
44 + fallback()
45 + end
46 + end
34 - ["<C-space>"] = cmp.mapping.complete(),
35 - ["<Tab>"] = cmp.mapping(function(fallback)
36 - if luasnip.expand_or_jumpable() then
37 - luasnip.expand_or_jump()
38 - elseif cmp.visible() then
39 - cmp.select_next_item()
40 - elseif has_words_before() then
41 - cmp.complete()
42 - else
43 - fallback()
44 - end
45 - end, {
46 - "i",
47 - "s",
48 - }),
49 - ["<S-Tab>"] = cmp.mapping(function(fallback)
50 - if luasnip.jumpable(-1) then
51 - luasnip.jump(-1)
52 - elseif cmp.visible() then
53 - cmp.select_prev_item()
54 - else
55 - fallback()
56 - end
57 - end, {
58 - "i",
59 - "s",
60 - }),
61 - })
48 + local snippet_prev = function ( fallback )
49 + if luasnip.jumpable( -1 ) then
50 + luasnip.jump( -1 )
51 + elseif cmp.visible() then
52 + cmp.select_prev_item()
53 + else
54 + fallback()
55 + end
56 + end
58 + local mapping = cmp.mapping.preset.insert {
59 + ['<C-d>'] = cmp.mapping.scroll_docs( -4 ),
60 + ['<C-f>'] = cmp.mapping.scroll_docs( 4 ),
61 + ['<C-e>'] = cmp.mapping.close(),
62 + ['<C-y>'] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, },
63 + ['<C-space>'] = cmp.mapping.complete(),
64 + ['<Tab>'] = cmp.mapping( snippet_next, { 'i', 's', } ),
65 + ['<S-Tab>'] = cmp.mapping( snippet_prev, { 'i', 's', } ),
66 + }
68 + --TODO: use custom icons
63 69 local formatting = {}
64 - local ok, lspkind = pcall(require, "lspkind")
70 + local ok, lspkind = pcall( require, 'lspkind' )
65 71 if ok then
66 - formatting.format = lspkind.cmp_format({
67 - mode = "symbol",
72 + formatting.format = lspkind.cmp_format {
73 + mode = 'symbol',
68 74 symbol_map = {
69 - Copilot = " ",
70 - Class = "󰆧 ",
71 - Color = "󰏘 ",
72 - Constant = "󰏿 ",
73 - Constructor = " ",
74 - Enum = " ",
75 - EnumMember = " ",
76 - Event = "",
77 - Field = " ",
78 - File = "󰈙 ",
79 - Folder = "󰉋 ",
80 - Function = "󰊕 ",
81 - Interface = " ",
82 - Keyword = "󰌋 ",
83 - Method = "󰊕 ",
84 - Module = " ",
85 - Operator = "󰆕 ",
86 - Property = " ",
87 - Reference = "󰈇 ",
88 - Snippet = " ",
89 - Struct = "󰆼 ",
90 - Text = "󰉿 ",
91 - TypeParameter = "󰉿 ",
92 - Unit = "󰑭",
93 - Value = "󰎠 ",
94 - Variable = "󰀫 ",
75 + Copilot = ' ',
76 + Class = '󰆧 ',
77 + Color = '󰏘 ',
78 + Constant = '󰏿 ',
79 + Constructor = ' ',
80 + Enum = ' ',
81 + EnumMember = ' ',
82 + Event = '',
83 + Field = ' ',
84 + File = '󰈙 ',
85 + Folder = '󰉋 ',
86 + Function = '󰊕 ',
87 + Interface = ' ',
88 + Keyword = '󰌋 ',
89 + Method = '󰊕 ',
90 + Module = ' ',
91 + Operator = '󰆕 ',
92 + Property = ' ',
93 + Reference = '󰈇 ',
94 + Snippet = ' ',
95 + Struct = '󰆼 ',
96 + Text = '󰉿 ',
97 + TypeParameter = '󰉿 ',
98 + Unit = '󰑭',
99 + Value = '󰎠 ',
100 + Variable = '󰀫 ',
96 102 menu = {
97 - buffer = "[buf]",
98 - nvim_lsp = "[LSP]",
99 - nvim_lua = "[api]",
100 - path = "[path]",
101 - luasnip = "[snip]",
103 + buffer = '[buf]',
104 + nvim_lsp = '[LSP]',
105 + nvim_lua = '[nvim]',
106 + path = '[path]',
107 + luasnip = '[snip]',
103 - })
106 - cmp.setup({
107 - mapping = mapping,
108 - formatting = formatting,
110 - sources = {
111 - { name = "nvim_lua" },
112 - { name = "nvim_lsp" },
113 - { name = "path" },
114 - { name = "luasnip" },
115 - { name = "neorg" },
116 - {
117 - name = "buffer",
118 - keyword_length = 4,
119 - options = {
120 - get_bufnrs = function()
121 - local bufs = {}
122 - for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
123 - -- Don't index giant files
124 - if vim.api.nvim_buf_is_loaded(bufnr) and vim.api.nvim_buf_line_count(bufnr) < MAX_INDEX_FILE_SIZE then
125 - table.insert(bufs, bufnr)
126 - end
112 + local sources = {
113 + { name = 'nvim_lua', },
114 + { name = 'nvim_lsp', },
115 + { name = 'path', },
116 + { name = 'luasnip', },
117 + { name = 'neorg', },
119 + name = 'buffer',
120 + keyword_length = 4,
121 + options = {
122 + get_bufnrs = function ()
123 + local bufs = {}
124 + for _, bufnr in ipairs( vim.api.nvim_list_bufs() ) do
125 + -- Don't index giant files
126 + if vim.api.nvim_buf_is_loaded( bufnr ) and vim.api.nvim_buf_line_count( bufnr ) < MAX_INDEX_FILE_SIZE then
127 + table.insert( bufs, bufnr )
128 - return bufs
129 - end,
130 - },
129 + end
130 + return bufs
131 + end,
136 + cmp.setup {
137 + mapping = mapping,
138 + formatting = formatting,
139 + sources = sources,
141 + completion = { autocomplete = false, },
134 142 snippet = {
135 - expand = function(args)
136 - luasnip.lsp_expand(args.body)
143 + expand = function ( args )
144 + luasnip.lsp_expand( args.body )
140 - experimental = {
141 - native_menu = false,
142 - },
143 - })
145 - vim.api.nvim_create_user_command("CmpInfo", function()
146 - cmp.status()
147 - end, {})
148 + -- experimental = { native_menu = false, },

neovim/lua/bugabinga/plugins/format.lua

Modified
2 2 local debug = require 'std.debug'
3 3 local map = require 'std.map'
5 5 local format = function ()
6 - require 'conform'.format( { async = false, lsp_fallback = true, }, function ( err )
6 + prequire 'conform'.format( { async = false, lsp_fallback = true, }, function ( err )
7 7 if err and debug.get() then
8 8 vim.print( 'Format failed', err )
31 31 sh = { 'shfmt', },
32 32 just = { 'just', },
33 33 zig = { 'zigfmt', },
34 - -- Use the "*" filetype to run formatters on all filetypes.
34 + -- Use the "*" file type to run formatters on all file types.
35 35 ['*'] = { 'injected', 'typos', },
36 - -- Use the "_" filetype to run formatters on filetypes that don't
36 + -- Use the "_" file type to run formatters on file types that don't
37 37 -- have other formatters configured.
38 38 ['_'] = { 'trim_whitespace', 'trim_newlines', },

neovim/lua/bugabinga/plugins/last-place.lua

Modified
3 3 local ignored = require 'std.ignored'
5 5 return {
7 7 'ethanholz/nvim-lastplace',
8 - event = { 'VimEnter' },
8 + event = { 'VimEnter', 'SessionLoadPost', },
9 9 opts = {
10 10 lastplace_ignore_buftype = ignored.buftypes,
11 11 lastplace_ignore_filetype = ignored.filetypes,

neovim/lua/bugabinga/plugins/neorg.lua

Modified
1 ---FIXME: own this
2 1 return {
3 2 'nvim-neorg/neorg',
4 - dependencies = { 'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter', 'jbyuki/venn.nvim', },
5 - build = ':Neorg sync-parsers',
6 - keys = {
7 - { '<CR>', ':VBox<CR>', mode = 'v', },
3 + version = '8.*',
4 + dependencies = {
5 + { 'nvim-lua/plenary.nvim', version = '0.1.4', },
6 + { 'nvim-neorg/lua-utils.nvim', version = '1.0.2', },
7 + { 'nvim-neotest/nvim-nio', version = '1.7.*', },
8 + { 'MunifTanjim/nui.nvim', version = '0.3.0', },
9 + { 'nvim-treesitter/nvim-treesitter', },
11 + build = function ()
12 + package.loaded['neorg'] = nil
14 + require 'neorg'.setup_after_build()
15 + pcall( vim.cmd.Neorg, 'sync-parsers' )
16 + end,
9 17 ft = 'norg',
10 18 cmd = 'Neorg',
11 19 opts = {
27 35 engine = 'nvim-cmp',
30 - -- This is deleting the non-empty contents of files
31 - -- ["core.esupports.metagen"] = {
32 - -- config = {
33 - -- type = "auto",
34 - -- },
35 - -- },
36 38 ['core.presenter'] = {
37 39 config = {
38 40 zen_mode = 'zen-mode',
41 - ['core.keybinds'] = {
42 - config = {
43 - hook = function ( keybinds )
44 - keybinds.unmap( 'norg', 'n', '<CR>' )
46 - keybinds.unmap( 'presenter', 'n', 'l' )
47 - keybinds.unmap( 'presenter', 'n', 'h' )
48 - keybinds.unmap( 'presenter', 'n', '<CR>' )
49 - keybinds.unmap( 'presenter', 'n', 'q' )
51 - -- Unmaps any Neorg key from the `norg` mode
52 - keybinds.remap_event( 'presenter', 'n', '<Right>', 'core.presenter.next_page' )
53 - keybinds.remap_event( 'presenter', 'n', '<C-j>', 'core.presenter.next_page' )
54 - keybinds.remap_event( 'presenter', 'n', '<Left>', 'core.presenter.previous_page' )
55 - keybinds.remap_event( 'presenter', 'n', '<C-k>', 'core.presenter.previous_page' )
56 - keybinds.remap_event( 'presenter', 'n', '<Down>', 'core.presenter.close' )
57 - keybinds.map( 'norg', 'n', '<Up>', '<CMD>Neorg presenter start<CR>' )
58 - end,
59 - },
60 - },
63 - config = function ( _, opts )
64 - local neorg = require 'neorg'
65 - neorg.setup( opts )
68 - local ok, quick_action = pcall( require, 'quick_action' )
69 - if ok then
70 - quick_action.add( 'menu', {
71 - name = 'Toggle todo status',
72 - condition = function ()
73 - if vim.bo.filetype ~= 'norg' then
74 - return false
75 - end
76 - local lnum = vim.api.nvim_win_get_cursor( 0 )[1] - 1
77 - local todo_module = neorg.modules.get_module 'core.qol.todo_items'
78 - local item = todo_module and todo_module.get_todo_item_from_cursor( 0, lnum )
79 - local row = item and item:start()
80 - return row == lnum
81 - end,
82 - action = function ()
83 - vim.cmd 'Neorg keybind norg core.qol.todo_items.todo.task_cycle'
84 - end,
85 - } )
86 - end
87 - end,

neovim/lua/bugabinga/plugins/pair-ls.lua

Added
new file mode 100644
1 +return {
2 + 'stevearc/pair-ls.nvim',
3 + cmd = { 'Pair', 'PairConnect', },
4 + opts = {
5 + cmd = { 'pair-ls', 'lsp', },
6 + -- cmd = { "pair-ls", "lsp", "-port", "8080" },
7 + -- cmd = { "pair-ls", "lsp", "-port", "8081" },
8 + -- cmd = { "pair-ls", "lsp", "-signal", "wss://localhost:8080" },
9 + -- cmd = { "pair-ls", "lsp", "-forward", "wss://localhost:8080" },
10 + },

neovim/lua/bugabinga/plugins/toggleterm.lua

Deleted
deleted file mode 100644
1 -local map = require 'std.map'
2 -local auto = require 'std.auto'
4 -return {
5 - 'akinsho/toggleterm.nvim',
6 - version = '2.*',
7 - keys = {
8 - '<F7>',
9 - },
10 - cmd = {
11 - 'ToggleTerm',
12 - 'TermExec',
13 - },
14 - opts = {
15 - open_mapping = '<F7>',
16 - direction = 'float',
17 - float_opts = {
18 - border = vim.g.border_style,
19 - },
20 - size = function ( term )
21 - if term.direction == 'horizontal' then
22 - return 18
23 - elseif term.direction == 'vertical' then
24 - return vim.o.columns * 0.42
25 - end
26 - end,
27 - },
28 - config = function ( _, opts )
29 - local toggleterm = require 'toggleterm'
30 - toggleterm.setup( opts )
32 - local set_terminal_keymaps = function ()
33 - map.terminal {
34 - description = 'Quit insert mode',
35 - category = 'terminal',
36 - keys = '<esc>',
37 - buffer = true,
38 - command = [[ <C-\><C-n> ]],
39 - }
41 - vim.opt_local.spell = false
42 - end
44 - auto 'normalize_terminal_windows' {
45 - description = 'Make terminal windows behave more normally.',
46 - events = 'TermOpen',
47 - pattern = 'term://*',
48 - command = set_terminal_keymaps,
49 - }
50 - end,
51 -}

neovim/lua/bugabinga/plugins/treesitter.lua

Modified
20 20 return {
21 21 'nvim-treesitter/nvim-treesitter',
22 - -- version = '0.*',
22 + -- version = '0.9.*',
23 23 branch = 'master',
24 24 -- restoring session throws errors, if this is lazy
25 25 lazy = false,
27 27 require 'nvim-treesitter.install'.update { with_sync = true, }
29 29 dependencies = {
30 - 'windwp/nvim-ts-autotag',
31 30 'nvim-treesitter/playground',
32 31 'nvim-treesitter/nvim-treesitter-textobjects',
32 + 'windwp/nvim-ts-autotag',
33 + 'RRethy/nvim-treesitter-endwise',
33 34 'nushell/tree-sitter-nu',
35 36 config = function ()
36 37 local install = require 'nvim-treesitter.install'
37 38 local configs = require 'nvim-treesitter.configs'
38 - local parsers = require 'nvim-treesitter.parsers'
40 40 install.prefer_git = false
41 41 install.compilers = { 'zig', 'clang', 'gcc', 'cl', 'cc', vim.fn.getenv 'CC', }
64 64 'gitcommit',
65 65 'gitignore',
66 66 'java',
67 + 'just',
67 68 'jsonc',
68 69 'markdown',
69 70 'markdown_inline',
78 79 'zig',
81 - ignore_install = { 'oil', disable = should_disable, },
82 + ignore_install = { 'oil', },
83 84 auto_install = true,
85 86 autotag = { enable = true, disable = should_disable, },
87 + ewndwise = { enable = true, disable = should_disable, },
87 89 highlight = {
88 90 enable = true,
95 97 disable = should_disable,
96 98 keymaps = {
97 99 init_selection = '<up>',
98 - node_incremental = '<right>',
100 + node_incremental = '<up>',
99 101 node_decremental = '<down>',
100 - scope_incremental = '<up>',
102 + scope_incremental = '<right>',
106 108 playground = {
107 109 enable = true,
108 110 disable = should_disable,
109 - disable = {},
110 111 updatetime = 25,
111 112 persist_queries = false,
112 113 keybindings = {
215 - ---@diagnostic disable-next-line: inject-field
216 - parsers.get_parser_configs().just = {
217 - install_info = {
218 - url = 'https://github.com/IndianBoy42/tree-sitter-just', -- local path or git repo
219 - files = { 'src/parser.c', 'src/scanner.c', },
220 - branch = 'main',
221 - },
222 - maintainers = { '@IndianBoy42', },
223 - }

neovim/lua/bugabinga/plugins/venn.lua

Added
new file mode 100644
1 +local map = require 'std.map'
3 +map.visual {
4 + description = 'Enable box drawing mode',
5 + category = 'draw',
6 + keys = '<leader>b',
7 + command = function () vim.cmd.VBox() end,
8 +}
10 +return {
11 + 'jbyuki/venn.nvim',
12 + cmd = 'VBox',

neovim/lua/bugabinga/terminal.lua

Added
new file mode 100644
1 +local map = require 'std.map'
2 +local auto = require 'std.auto'
4 +map.normal {
5 + description = 'Open terminal in a split',
6 + category = 'terminal',
7 + keys = '<F7>',
8 + command = function ()
9 + local cwd = vim.uv.cwd()
10 + ---@diagnostic disable-next-line: undefined-field
11 + local shell = vim.opt.shell:get()
12 + local open_term_cmd = string.format( 'split term://%s//%s', cwd, shell )
13 + vim.cmd( open_term_cmd )
14 + end,
17 +local terminal_settings = function ()
18 + map.terminal {
19 + description = 'Quit insert mode via <esc>',
20 + category = 'terminal',
21 + keys = '<esc>',
22 + buffer = true,
23 + command = [[ <C-\><C-n> ]],
24 + }
26 + map.terminal {
27 + description = 'Close current terminal',
28 + category = 'terminal',
29 + keys = '<F7>',
30 + buffer = true,
31 + command = [[ <C-\><C-n><cmd>q<cr> ]],
32 + }
34 + vim.opt_local.spell = false
36 + vim.cmd.startinsert()
37 +end
39 +auto 'normalize_terminal_windows' {
40 + description = 'Make terminal windows behave more normally.',
41 + events = 'TermOpen',
42 + pattern = 'term://*',
43 + command = terminal_settings,

neovim/lua/std/light_up.lua

Added
new file mode 100644
1 +local _ = {}
3 +--- Highlights given words in a buffer.
4 +--- Word matching is case sensitive.
5 +--- @param bufnr number Number of buffer to highlight. If 0, current buffer is used.
6 +--- @param words table Word to highlight group name mapping. Every occurrence with keys in this table, will be
7 +--- highlighted with its mapped value, which is expected to be a highlight group name.
8 +_.buffer = function ( bufnr, words )
9 + vim.validate {
10 + bufnr = { bufnr, 'number', },
11 + words = { words, 'table', },
12 + }
14 + local namespace = vim.api.nvim_create_namespace 'light_up_ns'
15 + vim.api.nvim_buf_clear_namespace( bufnr, namespace, 0, -1 )
17 + local handler = function ( event, buffer_handle, tick, first_line, last_line_changed, last_line_updated, bytes )
18 + -- vim.print( event, buffer_handle, tick, first_line, last_line_changed, last_line_updated, bytes )
19 + assert( event == 'lines', 'this handler is for `on_lines` notification' )
21 + local last = math.max( last_line_updated, last_line_changed )
22 + local lines = vim.api.nvim_buf_get_lines( bufnr, first_line, last, true )
23 + --NOTE: dubbel loop. can we faster?
24 + for index, line in ipairs( lines ) do
25 + local current_line = first_line + index - 1 -- adjust for 0-based indexing
26 + for word, highlight_group in pairs( words ) do
27 + -- NOTE: the way find is used here, we can only ever match one word per line
28 + -- vim.print( 'looking for word ', word, line )
29 + local start_offset, end_offset = line:find( '[%s%.](' .. word .. ')[%s$]' )
30 + if start_offset then
31 + -- vim.print( 'marking line ' .. current_line, start_offset, end_offset, highlight_group )
32 + vim.api.nvim_buf_set_extmark( bufnr, namespace, current_line, start_offset, {
33 + end_col = end_offset - 1,
34 + hl_group = highlight_group,
35 + } )
36 + break
37 + end
38 + end
39 + end
40 + end
42 + local ok = vim.api.nvim_buf_attach( bufnr, false, { on_lines = handler, } )
43 + if not ok then error( 'unable to attach to buffer ' .. bufnr ) end
45 + -- initial scan of whole buffer
46 + handler( 'lines', bufnr, nil, 0, -1, -1, nil )
47 +end
49 +--- @return table groups A map of all highlight group names, mapping to themselves g:match('^([%w@%._]+)%s').
50 +_.get_vim_highlight_groups = function ()
51 + local groups = {}
53 + local highlight_command_output = vim.fn.execute 'highlight'
54 + for line in highlight_command_output:gmatch '[^\n]+' do
55 + -- Delimiter xxx guifg=#727272
56 + -- @punctuation.special xxx links to Special
57 + -- Match anything that could be a valid highlight name
58 + local match = line:match '^([%w@%._]+)%s'
59 + if match then groups[match] = match end
60 + end
62 + return groups
63 +end
65 +return _

neovim/lua/std/prequire.lua

Modified
7 7 --- foo.setup{arg = bar}
8 8 --- end)
9 9 ---@see pcall
10 ----@param ... 1 or more module names. The last argument may optionally be a function, consuming all modules
10 +---@param ... ... or more module names. The last argument may optionally be a function, consuming all modules
11 11 ---previously given.
12 ----@return any The first module, when loaded successfully. Otherwise a proxy object, that does nothing when called or
12 +---@return any module The first module, when loaded successfully. Otherwise a proxy object, that does nothing when called or
13 13 ---indexed into. This prevents nil dereferencing errors when using the pattern `require('std.prequire')('this mod does
14 14 ---not exist').setup()`.
15 -return function(...)
16 - local args = { ... }
15 +return function ( ... )
16 + local args = { ..., }
17 17 local mods = {}
18 18 local first_mod
19 - for _, arg in ipairs(args) do
20 - if type(arg) == "function" then
21 - arg(unpack(mods))
19 + for _, arg in ipairs( args ) do
20 + if type( arg ) == 'function' then
21 + arg( unpack( mods ) )
22 22 break
24 - local ok, mod = pcall(require, arg)
24 + local ok, mod = pcall( require, arg )
25 25 if ok then
26 26 if not first_mod then
27 27 first_mod = mod
29 - table.insert(mods, mod)
29 + table.insert( mods, mod )
30 30 else
31 - vim.notify_once(string.format("Missing module: %s", arg), vim.log.levels.WARN)
31 + vim.notify_once( string.format( 'Missing module: %s', arg ), vim.log.levels.WARN )
32 32 -- Return a proxy item that returns itself, so we can do things like
33 33 -- grace("module").setup()
34 34 local proxy = {}
35 - setmetatable(proxy, {
36 - __call = function()
35 + setmetatable( proxy, {
36 + __call = function ()
37 37 return proxy
38 38 end,
39 - __index = function()
39 + __index = function ()
40 40 return proxy
41 41 end,
42 - })
42 + } )
43 43 return proxy

neovim/spell/nerd.utf-8.add

Modified
49 49 fullscreen
50 50 checkhealth
52 +stylua
53 +eol

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

Modified

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

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