repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: preparing config and plugins for big switch

87e2dbe930d52fab18f1f7119bb6611ad19f3ac7

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

unsigned

Browse filesCompare with HEAD

Changed files (29)

neovim/Untitled

Added
new file mode 100644

No text changes.

neovim/init.lua

Modified
19 19 require 'patches'
21 21 require 'bugabinga.options'
22 +require 'bugabinga.lazy'
23 +require 'bugabinga.sessions'
24 +require 'bugabinga.treesitter'
25 +require 'bugabinga.lsp'
22 26 require 'bugabinga.editorconfig'
23 27 require 'bugabinga.save_actions'
24 -require 'bugabinga.sessions'
25 -require 'bugabinga.lazy'
26 28 require 'bugabinga.diagnostic'
27 -require 'bugabinga.lsp'
29 +require 'bugabinga.in-and-out'
30 +require 'bugabinga.mkdir'

neovim/justfile

Modified
1 -set shell := ['nu', '--commands']
3 -# List available recipes.
4 -default:
5 - @just --list
7 -# Reproduce some neovim issue
8 -repro:
9 - nvim -u repro.lua
11 -# update nvim plugins
12 -update:
13 - nvim --headless "+Lazy! sync" +qa
15 -# TODO install treesitter parser for neovim to use
16 -treesitter:
17 - luarocks \
18 - --lua-version=5.1 \
19 - --tree=$HOME/.local/share/nvim/rocks \
20 - install --dev \
21 - tree-sitter-rust
23 -# delete all current neovim state, cache and other ephemeral data. does NOT delete the configs
24 -nuke:
25 - rm -r (run-external --redirect-combine nvim "--headless" "-n" "-R" +'lua = vim.fn.stdpath[[data]]' +:q | lines | last)
26 - rm -r (run-external --redirect-combine nvim "--headless" "-n" "-R" +'lua = vim.fn.stdpath[[cache]]' +:q | lines | last)
27 - rm -r (run-external --redirect-combine nvim "--headless" "-n" "-R" +'lua = vim.fn.stdpath[[state]]' +:q | lines | last)
1 +set shell := ['nu', '--commands']
3 +# List available recipes.
4 +default:
5 + @just --list
7 +# Reproduce some neovim issue
8 +repro:
9 + nvim -u repro.lua
11 +# delete all current neovim state, cache and other ephemeral data. does NOT delete the configs
12 +nuke:
13 + rm --interactive --recursive --force (nvim "--headless" "--clean" +'lua print(vim.fn.stdpath[[data]])' +q | complete | get stderr)
14 + rm --interactive --recursive --force (nvim "--headless" "--clean" +'lua print(vim.fn.stdpath[[cache]])' +q | complete | get stderr)
15 + rm --interactive --recursive --force (nvim "--headless" "--clean" +'lua print(vim.fn.stdpath[[state]])' +q | complete | get stderr)

neovim/lazy-lock.json

Modified
5 5 "fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" },
6 6 "glance.nvim": { "branch": "master", "commit": "17ee84e29ac33e7e5d91609f675cee8477586bda" },
7 7 "heirline.nvim": { "branch": "master", "commit": "cc359b628266cb9a84b2d71c883f2b99e16473a0" },
8 - "in-and-out.nvim": { "branch": "master", "commit": "ab24cafadc3418dffb0c7e9b0621cff60b9ac551" },
9 - "iswap.nvim": { "branch": "master", "commit": "e02cc91f2a8feb5c5a595767d208c54b6e3258ec" },
10 8 "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" },
11 - "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" },
12 - "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
9 + "mini.align": { "branch": "main", "commit": "26111a737494bc39576ad67b52bbc2638ca23553" },
13 10 "mini.bracketed": { "branch": "main", "commit": "833d66df6e0588222312a963780c6ec42ed7437d" },
14 11 "mini.cursorword": { "branch": "main", "commit": "7d1b38a17834acbbc4feff8e42aedc4ed0c6ff06" },
15 12 "mini.diff": { "branch": "main", "commit": "24d46798be8a358d38d3adc92c7ebcbb2d6f67e0" },
13 + "mini.icons": { "branch": "main", "commit": "a2742459f0ee32806c2438ca06b4d8b331f3f4d4" },
16 14 "mini.jump2d": { "branch": "main", "commit": "b0963aa2ec80b4b1ed1c7f93d9c969bb3f4b65b6" },
17 - "mini.misc": { "branch": "main", "commit": "428da688126b320194a944233f9f8dfc46669307" },
18 15 "mini.operators": { "branch": "main", "commit": "35b12f54bd5acb860f4297fd6d12fd07b1b065e2" },
19 - "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
20 16 "nvim-autopairs": { "branch": "master", "commit": "f158dcb865c36f72c92358f87787dab2c272eaf3" },
21 17 "nvim-docs-view": { "branch": "master", "commit": "365593534e0acd762bfddce6e8313315ffa4fa36" },
22 18 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
23 19 "nvim-highlight-colors": { "branch": "main", "commit": "a411550ef85cae467b889ba7d1a96bd78332d90e" },
24 20 "nvim-lint": { "branch": "master", "commit": "968a35d54b3a4c1ce66609cf80b14d4ae44fe77f" },
25 21 "nvim-rulebook": { "branch": "main", "commit": "528857a6e522396c2ded41cb24e694fb3f177429" },
26 - "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
27 - "nvim-treesitter": { "branch": "master", "commit": "02f8777252fe089c9ea19aa8e19745b505512655" },
28 - "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" },
29 - "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
22 + "nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" },
23 + "nvim-treesitter": { "branch": "main", "commit": "fc940eaf106981a92829518e977e46ad4f306472" },
30 24 "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
31 - "nvim-web-devicons": { "branch": "master", "commit": "edbe0a65cfacbbfff6a4a1e98ddd60c28c560509" },
32 25 "oil.nvim": { "branch": "master", "commit": "50c4bd4ee216f08907f64d0295c0663a69e58ffb" },
33 26 "refjump.nvim": { "branch": "main", "commit": "92ec869724b949c40efbea54a560a835680d3de2" },
34 27 "specs.nvim": { "branch": "main", "commit": "8a108c8b37dec1b184a1d3d76c6cf867bfbe9636" },
35 28 "symbol-usage.nvim": { "branch": "main", "commit": "0f9b3da014b7e41559b643e7461fcabb2a7dc83a" },
36 - "tree-sitter-nu": { "branch": "main", "commit": "74e6037383ce3a77ed6fdb8281bbd69316c723a4" },
37 29 "treesj": { "branch": "main", "commit": "03415ac60791d48e120a80d37e080744faf3ac15" },
38 - "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" },
39 - "wezterm-types": { "branch": "main", "commit": "1518752906ba3fac0060d9efab6e4d3ec15d4b5a" }
30 + "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }

neovim/lua/bugabinga/in-and-out.lua

Added
new file mode 100644
1 +-- Stolen from https://github.com/ysmb-wtsg/in-and-out.nvim
4 +local map = require 'std.map'
6 +local function escape_lua_pattern( s )
7 + local matches = {
8 + ['^'] = '%^',
9 + ['$'] = '%$',
10 + ['('] = '%(',
11 + [')'] = '%)',
12 + ['%'] = '%%',
13 + ['.'] = '%.',
14 + ['['] = '%[',
15 + [']'] = '%]',
16 + ['*'] = '%*',
17 + ['+'] = '%+',
18 + ['-'] = '%-',
19 + ['?'] = '%?',
20 + }
21 + return s:gsub( '.', matches )
22 +end
24 +local targets = { '"', "'", '(', ')', '{', '}', '[', ']', '`' }
26 +local in_and_out = function ()
27 + local current_row, current_col = unpack( vim.api.nvim_win_get_cursor( 0 ) )
28 + local lines_in_buf = vim.api.nvim_buf_get_lines( 0, current_row - 1, -1, false )
30 + local target_row = 0
31 + local target_col = nil
32 + for i, line in ipairs( lines_in_buf ) do
33 + for _, char in ipairs( targets ) do
34 + local found_col = string.find( line, escape_lua_pattern( char ), current_col + 1 )
35 + if found_col and (not target_col or found_col < target_col) then
36 + -- If char is a multibyte character, we need to take into account the extra bytes.
37 + target_col = found_col + vim.fn.strlen( char ) - 1
38 + end
39 + end
40 + if target_col then
41 + target_row = current_row + i - 1
42 + break
43 + end
44 + current_col = 0
45 + end
46 + if target_col then
47 + vim.api.nvim_win_set_cursor( 0, { target_row, target_col } )
48 + end
49 +end
51 +map.insert {
52 + description = 'Moves in or out of balanced tokens',
53 + category = 'editing',
54 + keys = '<C-CR>',
55 + command = in_and_out,

neovim/lua/bugabinga/lsp/init.lua

Modified
232 -local old_formatexpr
233 -local old_omnifunc
234 -local old_tagfunc
236 -local keybinds = {}
237 -local add = function ( client_id, keybind_remover )
238 - vim.validate {
239 - client_id = { client_id, 'number' },
240 - keybind_remover = { keybind_remover, 'function' },
241 - }
242 - if not table.contains( keybinds, client_id ) then
243 - keybinds[client_id] = {}
244 - end
245 - table.insert( keybinds[client_id], keybind_remover )
246 -end
248 233 -- FIXME: move to own file with LspAttach instead, so that those settings are
249 234 -- applied to all LSPs, not only those managed by my configs.
250 -local lsp_attach = function ( args )
235 +local lsp_attach = function ( args )
251 236 local bufnr = args.buf
252 237 local client_id = args.data.client_id
253 238 local client = vim.lsp.get_client_by_id( client_id )
256 241 dbg.print( client.server_capabilities )
258 243 if client.server_capabilities.definitionProvider then
259 - old_tagfunc = vim.bo[bufnr].tagfunc
260 244 vim.bo[bufnr].tagfunc = 'v:lua.vim.lsp.tagfunc'
263 247 if client.server_capabilities.documentFormattingProvider then
264 - old_formatexpr = vim.bo[bufnr].formatexpr
265 248 vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr'
268 251 if client.server_capabilities.completionProvider then
269 - old_omnifunc = vim.bo[bufnr].omnifunc
270 252 vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
273 255 if client.server_capabilities.inlayHintProvider then
274 - add( client_id, map.normal {
256 + map.normal {
275 257 description = 'Toggle inlay hints',
276 258 category = 'lsp',
277 259 buffer = bufnr,
279 261 command = function ()
280 262 vim.lsp.inlay_hint.enable( not vim.lsp.inlay_hint.is_enabled() )
282 - } )
285 - add( client_id, map.normal {
267 + map.normal {
286 268 description = 'Show hover documentation above cursor.',
287 269 category = 'lsp',
288 270 buffer = bufnr,
289 271 keys = { 'K', '<leader>lk' },
290 272 command = vim.lsp.buf.hover,
291 - } )
293 - add( client_id, map.insert {
275 + map.insert {
294 276 description = 'Show signature help under cursor.',
295 277 category = 'lsp',
296 278 buffer = bufnr,
297 279 keys = { '<C-h>' },
298 280 command = vim.lsp.buf.signature_help,
299 - } )
301 - add( client_id, map.normal {
283 + map.normal {
302 284 description = 'Show available code actions on current line.',
303 285 category = 'lsp',
304 286 buffer = bufnr,
305 287 keys = '<leader>la',
306 288 command = vim.lsp.buf.code_action,
307 - } )
309 - add( client_id, map.normal {
291 + map.normal {
310 292 description = 'Goto to definition of symbol under cursor.',
311 293 category = 'lsp',
312 294 buffer = bufnr,
313 295 keys = '<leader>ld',
314 296 command = vim.lsp.buf.definition,
315 - } )
317 - add( client_id, map.normal {
299 + map.normal {
318 300 description = 'Show implementations of symbol under cursor.',
319 301 category = 'lsp',
320 302 buffer = bufnr,
321 303 keys = '<leader>li',
322 304 command = vim.lsp.buf.implementation,
323 - } )
325 - add( client_id, map.normal {
307 + map.normal {
326 308 description = 'Show incoming calls of symbol under cursor.',
327 309 category = 'lsp',
328 310 buffer = bufnr,
329 311 keys = '<leader>lc',
330 312 command = vim.lsp.buf.incoming_calls,
331 - } )
333 - add( client_id, map.normal {
315 + map.normal {
334 316 description = 'Show outgoing calls of symbol under cursor.',
335 317 category = 'lsp',
336 318 buffer = bufnr,
337 319 keys = '<leader>lC',
338 320 command = vim.lsp.buf.outgoing_calls,
339 - } )
341 - add( client_id, map.normal {
323 + map.normal {
342 324 description = 'Show references of symbol under cursor.',
343 325 category = 'lsp',
344 326 buffer = bufnr,
345 327 keys = '<leader>ln',
346 328 command = vim.lsp.buf.references,
347 - } )
349 - add( client_id, map.normal {
331 + map.normal {
350 332 description = 'Rename symbol under cursor.',
351 333 category = 'lsp',
352 334 buffer = bufnr,
353 335 keys = { '<f2>', '<leader>lr' },
354 336 command = vim.lsp.buf.rename,
355 - } )
356 -end
358 -local lsp_detach = function ( args )
359 - dbg.print( 'DETACH LSP', args )
361 - local bufnr = args.buf
362 - local client_id = args.data.client_id
363 - local client = vim.lsp.get_client_by_id( client_id )
364 - if not client then return end
366 - if client.server_capabilities.definitionProvider then
367 - vim.bo[bufnr].tagfunc = old_tagfunc
368 - end
370 - if client.server_capabilities.documentFormattingProvider then
371 - vim.bo[bufnr].formatexpr = old_formatexpr
372 - end
374 - if client.server_capabilities.completionProvider then
375 - vim.bo[bufnr].omnifunc = old_omnifunc
376 - end
378 - if table.contains( keybinds, client_id ) then
379 - for _, keybind_delete in ipairs( keybinds[client_id] ) do
380 - keybind_delete()
381 - end
382 - end
385 340 auto 'lsp' {
393 348 events = 'LspAttach',
394 349 command = lsp_attach,
396 - {
397 - description = 'Hook: LSP client detached from buffer',
398 - events = 'LspDetach',
399 - command = lsp_detach,
400 - },
402 352 description = 'Semantic Tokens from the LSP',
403 353 events = 'LspTokenUpdate',

neovim/lua/bugabinga/mkdir.lua

Added
new file mode 100644
1 +-- Stolen from https://github.com/jghauser/mkdir.nvim
3 +local auto = require 'std.auto'
5 +local mkdir = function ()
6 + local dir = vim.fn.expand '<afile>:p:h'
8 + -- This handles URLs using netrw. See ':help netrw-transparent' for details.
9 + if dir:find '%l+://' == 1 then
10 + return
11 + end
13 + if vim.fn.isdirectory( dir ) == 0 then
14 + vim.fn.mkdir( dir, 'p' )
15 + end
16 +end
18 +auto 'mkdir_buffer' {
19 + description = 'Mkdir for current buffer, if it does not exist.',
20 + events = 'BufWritePre',
21 + pattern = '*',
22 + command = mkdir,

neovim/lua/bugabinga/options/behaviour.lua

Modified
18 18 description = 'Hide columns in buffers, that do not show source code.',
19 19 events = { 'FileType' },
20 20 pattern = ignored.filetypes,
21 - command = function ()
22 - vim.notify 'Hiding columns in buffers without source code'
21 + command = function ( data )
23 22 vim.opt_local.colorcolumn = {}
24 23 vim.opt_local.signcolumn = 'no'
25 24 vim.opt_local.foldcolumn = '0'
36 35 vim.cmd.colorscheme 'nugu'
37 36 end,
39 +-- Stolen from mini.misc plugin at https://github.com/echasnovski/mini.misc
41 +local restore_cursor = function ()
42 + -- Stop if not a normal buffer
43 + if vim.bo.buftype ~= '' then return end
45 + -- Stop if filetype is ignored
46 + if vim.tbl_contains( ignored.filetypes, vim.bo.filetype ) then return end
48 + -- Stop if line is already specified (like during start with `nvim file +num`)
49 + local cursor_line = vim.api.nvim_win_get_cursor( 0 )[1]
50 + if cursor_line > 1 then return end
52 + -- Stop if can't restore proper line for some reason
53 + local mark_line = vim.api.nvim_buf_get_mark( 0, [["]] )[1]
54 + local n_lines = vim.api.nvim_buf_line_count( 0 )
55 + if not (1 <= mark_line and mark_line <= n_lines) then return end
57 + -- Restore cursor and open just enough folds
58 + vim.cmd [[normal! g`"zv]]
60 + -- Center window
61 + vim.cmd 'normal! zz'
62 +end
64 +-- Create autocommand which runs once on `FileType` for every new buffer
65 +auto 'restore_cursor_position_setup' {
66 + description = 'Setup function to restore cursor position',
67 + events = 'BufReadPre',
68 + command = function ( data )
69 + auto 'restore_cursor_position' {
70 + description = 'Restores last known cursor position when opening a buffer.',
71 + events = 'FileType',
72 + buffer = data.buf,
73 + once = true,
74 + command = restore_cursor,
75 + }
76 + end,

neovim/lua/bugabinga/plugins/align.lua

Added
new file mode 100644
1 +return {
2 + 'echasnovski/mini.align',
3 + version = 'v0.*',
4 + lazy = false,
5 + opts = {},
6 +}

neovim/lua/bugabinga/plugins/cursorword.lua

Modified
30 30 'prequire',
31 31 'then',
32 32 'end',
33 + 'not',
33 34 'elseif',
35 36 elseif filetype == 'java' then

neovim/lua/bugabinga/plugins/devicons.lua

Modified
1 1 return {
2 - 'nvim-tree/nvim-web-devicons',
3 - opts = {
4 - -- instead of creating a highlight for every single icon, use only the
5 - -- DefaultDevIcon highlight for all
6 - color_icons = false,
7 - },
2 + 'echasnovski/mini.icons',
3 + version = 'v0.*',
4 + lazy = false,
5 + opts = {},

neovim/lua/bugabinga/plugins/in-and-out.lua

Deleted
deleted file mode 100644
1 -local map = require 'std.map'
3 -map.insert {
4 - description = 'Moves in or out of balanced tokens',
5 - category = 'editing',
6 - keys = '<c-space>',
7 - command = function () require 'in-and-out'.in_and_out() end,
8 -}
10 -return {
11 - 'ysmb-wtsg/in-and-out.nvim',
12 - commit = 'ab24cafadc3418dffb0c7e9b0621cff60b9ac551',
13 - event = 'VeryLazy',
14 -}

neovim/lua/bugabinga/plugins/incubator.lua

Modified
103 103 enabled = FUCK_STABILITY,
105 105 -------------------------------------------------------------------------------
106 - {
107 - 'folke/lazydev.nvim',
108 - dependencies = { 'justinsgithub/wezterm-types' },
109 - ft = 'lua', -- only load on lua files
110 - opts = {
111 - library = {
112 - -- Or relative, which means they will be resolved from the plugin dir.
113 - 'lazy.nvim',
114 - -- It can also be a table with trigger words / mods
115 - -- Only load luvit types when the `vim.uv` word is found
116 - { path = 'luvit-meta/library', words = { 'vim%.uv' } },
117 - -- Load the wezterm types when the `wezterm` module is required
118 - -- Needs `justinsgithub/wezterm-types` to be installed
119 - { path = 'wezterm-types', mods = { 'wezterm' } },
120 - },
121 - },
122 - enabled = FUCK_STABILITY,
123 - },
124 - -------------------------------------------------------------------------------
125 - --- fix highlights for nugu
126 - {
127 - 'mizlan/iswap.nvim',
128 - keys = {
129 - { '<leader>ii', '<CMD>ISwapWith<CR>', { silent = true }, desc = 'Swap object with another', mode = 'n' },
130 - },
131 - event = 'VeryLazy',
132 - enabled = FUCK_STABILITY,
133 - },
134 - -------------------------------------------------------------------------------
135 106 --- fix nugu highlights (also snippet highlights)
136 107 --- configure with custom snippets?

neovim/lua/bugabinga/plugins/mason.lua

Deleted
deleted file mode 100644
1 -return {
2 - 'williamboman/mason.nvim',
3 - version = '1.*',
4 - lazy = false,
5 - opts = {
6 - ui = {
7 - border = vim.g.border_style,
8 - icons = {
9 - -- TODO: use my icons
10 - package_installed = '✓',
11 - package_pending = '➜',
12 - package_uninstalled = '✗',
13 - },
14 - },
15 - },
16 -}

neovim/lua/bugabinga/plugins/misc.lua

Deleted
deleted file mode 100644
1 -local ignored = require 'std.ignored'
3 -return {
4 - 'echasnovski/mini.misc',
5 - version = '0.*',
6 - lazy = false,
7 - opts = { make_global = {} },
8 - config = function ( _, opts )
9 - local misc = require 'mini.misc'
10 - misc.setup( opts )
11 - -- misc.setup_termbg_sync()
12 - misc.setup_restore_cursor { ignore_filetype = ignored.filetypes }
13 - end,
14 -}

neovim/lua/bugabinga/plugins/mkdir.lua

Deleted
deleted file mode 100644
1 -return {
2 - 'jghauser/mkdir.nvim',
3 - commit = 'c55d1dee4f099528a1853b28bb28caa802eba217',
4 - event = 'BufWritePre',
5 -}

neovim/lua/bugabinga/plugins/oil.lua

Modified
20 20 lazy = false,
21 21 version = '2.*',
22 22 cmd = { 'Oil' },
23 - dependencies = { 'nvim-tree/nvim-web-devicons' },
24 23 opts = {
25 24 -- default_file_explorer = true,
26 25 -- Set to true to watch the filesystem for changes and reload oil

neovim/lua/bugabinga/plugins/parsers.lua

Added
new file mode 100644
1 +require 'bugabinga.health'.add_dependency
2 +{ name_of_executable = 'zig' }
3 + { name = 'TreeSitter CLI', name_of_executable = 'tree-sitter' }
4 + { name_of_executable = 'tar' }
5 + { name_of_executable = 'curl' }
7 +return {
8 + 'nvim-treesitter/nvim-treesitter',
9 + branch = 'main',
10 + lazy = false,
11 + build = ':TSUpdate',
12 + opts = {},

neovim/lua/bugabinga/plugins/specs.lua

Modified
20 20 return {
21 21 'KevinSilvester/specs.nvim',
22 22 commit = '8a108c8b37dec1b184a1d3d76c6cf867bfbe9636',
23 + lazy = false,
23 24 opts = function ()
24 25 return {
25 26 show_jumps = true,
26 - min_jump = 30,
27 + min_jump = 10,
27 28 popup = {
28 29 delay_ms = 10, -- delay before popup displays
29 30 inc_ms = 10, -- time increments used for fade/resize effects
36 37 ignore_filetypes = ignored.filetypes_kv,
37 38 ignore_buftypes = ignored.buftypes_kv,
39 - end
40 - ,
40 + end,

neovim/lua/bugabinga/plugins/statusbar.lua

Modified
10 10 'rebelot/heirline.nvim',
11 11 version = '2.*',
12 12 lazy = false,
13 - dependencies = {
14 - 'nvim-tree/nvim-web-devicons',
15 - },
16 13 config = function ()
17 14 local heirline = require 'heirline'
18 15 local conditions = require 'heirline.conditions'
111 108 init = function ( self )
112 109 local filename = self.filename
113 110 local extension = vim.fn.fnamemodify( filename, ':e' )
114 - self.icon = require 'nvim-web-devicons'.get_icon_color( filename, extension, { default = true } )
111 + self.icon = MiniIcons.get( 'file', filename )
116 113 provider = function ( self )
117 114 return self.icon and (self.icon .. ' ')

neovim/lua/bugabinga/plugins/surround.lua

Modified
12 12 normal = 'sa',
13 13 normal_line = 'sA',
14 - normal_cur = 'sa',
14 + normal_cur = 'sc',
15 15 normal_cur_line = 'sC',
17 17 visual = 'sa',

neovim/lua/bugabinga/plugins/textobjects.lua

Deleted
deleted file mode 100644
1 -return {
2 - 'nvim-treesitter/nvim-treesitter-textobjects',
3 - branch = 'master',
4 - event = 'VeryLazy',
5 - dependencies = 'nvim-treesitter/nvim-treesitter',
6 - config = function ()
7 - ---@diagnostic disable-next-line: missing-fields
8 - require 'nvim-treesitter.configs'.setup {
9 - textobjects = {
10 - select = {
11 - enable = true,
12 - lookahead = true,
13 - keymaps = {
14 - ['af'] = { query = '@call.outer', desc = 'outer function call' },
15 - ['if'] = { query = '@call.inner', desc = 'inner function call' },
17 - ['am'] = { query = '@function.outer', desc = 'outer function definition' },
18 - ['im'] = { query = '@function.inner', desc = 'inner function definition' },
20 - ['ai'] = { query = '@conditional.outer', desc = 'outer conditional' },
21 - ['ii'] = { query = '@conditional.inner', desc = 'inner conditional' },
23 - ['aa'] = { query = '@parameter.outer', desc = 'outer parameter' },
24 - ['ia'] = { query = '@parameter.inner', desc = 'inner parameter' },
26 - ['ac'] = { query = '@comment.outer', desc = 'outer comment' },
27 - ['ic'] = { query = '@comment.inner', desc = 'inner comment' },
28 - },
29 - selection_modes = {
30 - ['@parameter.outer'] = 'v',
31 - ['@function.outer'] = 'v',
32 - ['@class.outer'] = '<c-v>',
33 - ['@scope'] = 'v',
34 - },
35 - include_surroundig_whitespace = true,
36 - },
38 - move = {
39 - enable = true,
40 - set_jumps = true,
41 - goto_next = {
42 - [']m'] = { query = '@function.outer', desc = 'goto next function definition' },
43 - },
44 - goto_previous = {
45 - ['[m'] = { query = '@function.outer', desc = 'goto previous function definition' },
46 - },
47 - },
48 - },
49 - }
50 - end,
51 -}

neovim/lua/bugabinga/plugins/textobjects.lua.todo

Added
new file mode 100644
1 +return {
2 + 'nvim-treesitter/nvim-treesitter-textobjects',
3 + branch = 'master',
4 + event = 'VeryLazy',
5 + dependencies = 'nvim-treesitter/nvim-treesitter',
6 + config = function ()
7 + ---@diagnostic disable-next-line: missing-fields
8 + require 'nvim-treesitter.configs'.setup {
9 + textobjects = {
10 + select = {
11 + enable = true,
12 + lookahead = true,
13 + keymaps = {
14 + ['af'] = { query = '@call.outer', desc = 'outer function call' },
15 + ['if'] = { query = '@call.inner', desc = 'inner function call' },
17 + ['am'] = { query = '@function.outer', desc = 'outer function definition' },
18 + ['im'] = { query = '@function.inner', desc = 'inner function definition' },
20 + ['ai'] = { query = '@conditional.outer', desc = 'outer conditional' },
21 + ['ii'] = { query = '@conditional.inner', desc = 'inner conditional' },
23 + ['aa'] = { query = '@parameter.outer', desc = 'outer parameter' },
24 + ['ia'] = { query = '@parameter.inner', desc = 'inner parameter' },
26 + ['ac'] = { query = '@comment.outer', desc = 'outer comment' },
27 + ['ic'] = { query = '@comment.inner', desc = 'inner comment' },
29 + ['aS'] = { query = '@statement.outer', desc = 'outer statement' },
30 + ['iS'] = { query = '@statement.inner', desc = 'inner statement' },
32 + -- Nushell only
33 + ['aP'] = { query = '@pipeline.outer', desc = 'outer pipeline' },
34 + ['iP'] = { query = '@pipeline.inner', desc = 'inner pipeline' },
35 + },
36 + selection_modes = {
37 + ['@parameter.outer'] = 'v',
38 + ['@function.outer'] = 'v',
39 + ['@class.outer'] = '<c-v>',
40 + ['@scope'] = 'v',
41 + },
42 + include_surroundig_whitespace = true,
43 + },
45 + move = {
46 + enable = true,
47 + set_jumps = true,
48 + goto_next = {
49 + [']m'] = { query = '@function.outer', desc = 'goto next function definition' },
50 + },
51 + goto_previous = {
52 + ['[m'] = { query = '@function.outer', desc = 'goto previous function definition' },
53 + },
54 + },
55 + },
56 + }
57 + end,

neovim/lua/bugabinga/plugins/treesitter.lua

Deleted
deleted file mode 100644
1 -require 'bugabinga.health'.add_dependency
2 -{ name = 'CMake', name_of_executable = 'cmake' }
3 - { name_of_executable = 'make' }
4 - { name_of_executable = 'zig' }
5 - { name = 'TreeSitter CLI', name_of_executable = 'tree-sitter' }
6 - { name_of_executable = 'tar' }
8 -return {
9 - 'nvim-treesitter/nvim-treesitter',
10 - branch = 'master',
11 - lazy = false,
12 - build = function ()
13 - require 'nvim-treesitter.install'.update { with_sync = true }
14 - end,
15 - dependencies = {
16 - -- FIXME: move nvim-treesitter modules out into normal config to prepare for main branch
17 - 'RRethy/nvim-treesitter-endwise',
18 - 'nushell/tree-sitter-nu',
19 - },
20 - config = function ()
21 - local install = require 'nvim-treesitter.install'
22 - local configs = require 'nvim-treesitter.configs'
24 - install.prefer_git = false
25 - -- install.compilers = { 'zig cc', 'clang', 'gcc', 'cl', 'cc', vim.fn.getenv 'CC' }
27 - ---@diagnostic disable-next-line: missing-fields
28 - configs.setup {
29 - sync_install = false,
30 - ignore_install = { 'oil' },
31 - auto_install = true,
33 - endwise = { enable = true },
35 - highlight = {
36 - enable = true,
37 - additional_vim_regex_highlighting = false,
38 - },
40 - indent = { enable = true },
41 - }
42 - end,
43 -}

neovim/lua/bugabinga/restore_cursor_position.lua

Added
new file mode 100644
1 +-- Stolen from mini.misc plugin at https://github.com/echasnovski/mini.misc
3 +local ignored = require 'std.ignored'
4 +local auto = require 'std.auto'
6 +local restore_cursor = function ()
7 + -- Stop if not a normal buffer
8 + if vim.bo.buftype ~= '' then return end
10 + -- Stop if filetype is ignored
11 + if vim.tbl_contains( ignored.filetypes, vim.bo.filetype ) then return end
13 + -- Stop if line is already specified (like during start with `nvim file +num`)
14 + local cursor_line = vim.api.nvim_win_get_cursor( 0 )[1]
15 + if cursor_line > 1 then return end
17 + -- Stop if can't restore proper line for some reason
18 + local mark_line = vim.api.nvim_buf_get_mark( 0, [["]] )[1]
19 + local n_lines = vim.api.nvim_buf_line_count( 0 )
20 + if not (1 <= mark_line and mark_line <= n_lines) then return end
22 + -- Restore cursor and open just enough folds
23 + vim.cmd [[normal! g`"zv]]
24 +end
26 +-- Create autocommand which runs once on `FileType` for every new buffer
27 +auto 'restore_cursor_position_setup' {
28 + description = 'Setup function to restore cursor position',
29 + events = 'BufReadPre',
30 + command = function ( data )
31 + auto 'restore_cursor_position' {
32 + description = 'Restores last known cursor position when opening a buffer.',
33 + event = 'FileType',
34 + buffer = data.buf,
35 + once = true,
36 + command = restore_cursor,
37 + }
38 + end,

neovim/lua/bugabinga/treesitter.lua

Added
new file mode 100644
1 +local auto = require 'std.auto'
2 +local ignored = require 'std.ignored'
3 +local table = require 'std.table'
5 +auto 'look_for_treesitter_parser' {
6 + description = 'Try loading a treesitter parser, if available.',
7 + events = 'FileType',
8 + pattern = '*',
9 + command = function ( data )
10 + local match = data.match
11 + if table.contains( ignored.filetypes, match ) then
12 + vim.notify( 'Ingore ' .. match .. ' for treesitter.' )
13 + return
14 + end
15 + -- try highlights
16 + local ok, err = pcall( vim.treesitter.start )
17 + if not ok then
18 + local available = require 'nvim-treesitter.parsers'
19 + local potential_parser = available[match]
20 + if potential_parser then
21 + vim.notify( 'Found potential treesitter parser for current filetype. Trying to install it. ' .. match )
22 + -- TSInstall/TSUpdate seems borked?
23 + -- vim.cmd.TSInstall( match )
24 + else
25 + vim.notify( err, vim.log.levels.ERROR )
26 + end
27 + return
28 + end
29 + -- indents
30 + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
31 + -- folds, even though i do not care...
32 + vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
33 + end,
36 +-- old code from nvim-treesitter master
37 +--
38 +-- if config.auto_install then
39 +-- vim.api.nvim_create_autocmd('FileType', {
40 +-- callback = function(args)
41 +-- local buf = args.buf --- @type integer
42 +-- local ft = vim.bo[buf].filetype
43 +-- local lang = vim.treesitter.language.get_lang(ft) or ft
44 +-- if
45 +-- require('nvim-treesitter.parsers')[lang]
46 +-- and not vim.list_contains(M.installed_parsers(), lang)
47 +-- and not vim.list_contains(config.ignore_install, lang)
48 +-- then
49 +-- require('nvim-treesitter.install').install(lang, nil, function()
50 +-- -- Need to pcall since 'FileType' can be triggered multiple times
51 +-- -- per buffer
52 +-- pcall(vim.treesitter.start, buf, lang)
53 +-- end)
54 +-- end
55 +-- end,
56 +-- })
57 +-- end

neovim/lua/std/ignored.lua

Modified
12 12 'oil',
13 13 'qf',
14 14 'svn',
15 + 'fidget',
17 18 local buftypes = {

neovim/puk.nu

Modified
1 1 #!/usr/bin/env nu
3 +# TODO:
4 +# treesj for nushell
5 +# setup new nvim-treesitter and nvim-treesitter-textobjects
6 +# clean unspecified plugins
7 +# XXX use rss feeds of forges to find latest commit
3 9 # an out-of-band plugin manager for neovim.
4 10 # cannot do a lot, compared to "normal" neovim plugin managers, but:
5 11 # - it does not depend on git, only on tar and curl (and nushell right now, but that could change)

neovim/puk.plugins.nuon

Modified
1 +# vim: ft=nu
2 3 [name, source, repo, commit, build];
5 + ## IMPORTANT ONES
6 + [nvim-treesitter, github, 'nvim-treesitter/nvim-treesitter', "fc940eaf106981a92829518e977e46ad4f306472", null],
7 + [nvim-treesitter-textobjects, github, 'nvim-treesitter/nvim-treesitter-textobjects', "e0a7b5a6b7f18a5d508d05ca8853273db7bcbe50", null],
8 + [nvim-ts-autotag, github, 'windwp/nvim-ts-autotag', "e239a560f338be31337e7abc3ee42515daf23f5e", null],
9 + ["oil", github, 'stevearc/oil.nvim', "3c2de37accead0240fbe812f5ccdedfe0b973557", null],
4 10 [blink, github, 'Saghen/blink.cmp', '180be7ba574033baa30fa8af0db4f59db7353584', [cargo build '--release'] ],
11 + [ivy, github, 'AdeAttwood/ivy.nvim', 'cfa7e29ae4d955508d4f7f2ef08cc0c51ee745ed', [cargo build '--release'] ],
5 12 [nvim-surround, github, 'kylechui/nvim-surround', 'dca2e998ff26681ee422b92c6ed39b3d2908d8a9', null ],
6 - [ivy, github, 'AdeAttwood/ivy.nvim', 'cfa7e29ae4d955508d4f7f2ef08cc0c51ee745ed', null ],
7 - [in-and-out, github, 'ysmb-wtsg/in-and-out.nvim', 'ab24cafadc3418dffb0c7e9b0621cff60b9ac551', null ],
8 13 [neoterm, github, 'itmecho/neoterm.nvim', '23a780136892b1128485f20d772a771e528b651b', null ],
14 + ["conform", github, 'stevearc/conform.nvim', "6239d9986f51ca93ded99ecdb1af0e287eabb651", null],
15 + ["fidget", github, 'j-hui/fidget.nvim', "ef99df04a1c53a453602421bc0f756997edc8289", null],
16 + ["heirline", github, "rebelot/heirline.nvim", "cc359b628266cb9a84b2d71c883f2b99e16473a0", null],
17 + ["mini.bracketed", github, 'echasnovski/mini.bracketed', "833d66df6e0588222312a963780c6ec42ed7437d", null],
18 + ["mini.align", github, 'echasnovski/mini.align', "26111a737494bc39576ad67b52bbc2638ca23553", null],
19 + ["mini.cursorword",github, "echasnovski/mini.cursorword", "7d1b38a17834acbbc4feff8e42aedc4ed0c6ff06", null],
20 + ["mini.diff",github, "echasnovski/mini.diff", "24d46798be8a358d38d3adc92c7ebcbb2d6f67e0", null],
21 + ["mini.jump2d",github, "echasnovski/mini.jump2d", "b0963aa2ec80b4b1ed1c7f93d9c969bb3f4b65b6", null],
22 + ["mini.operators",github, "echasnovski/mini.operators", "35b12f54bd5acb860f4297fd6d12fd07b1b065e2", null],
23 + ['mini.move', github, 'echasnovski/mini.move', "4caa1c212f5ca3d1633d21cfb184808090ed74b1", null],
24 + ['mini.icons', github, 'echasnovski/mini.icons', "54686be7d58807906cb2c8c2216e0bf9c044f19a", null],
25 + [nvim-autopairs, github, 'windwp/nvim-autopairs', "f158dcb865c36f72c92358f87787dab2c272eaf3", null],
26 + [nvim-highlight-colors, github, 'brenoprata10/nvim-highlight-colors', "e967e2ba13fd4ca731b41d0e5cc1ac2edcd6e25e", null],
27 + [lint, github, 'mfussenegger/nvim-lint', "968a35d54b3a4c1ce66609cf80b14d4ae44fe77f", null],
28 + [treesj, github, 'Wansmer/treesj', "03415ac60791d48e120a80d37e080744faf3ac15", null],
29 + ["virt-column", github, 'lukas-reineke/virt-column.nvim', "b87e3e0864211a32724a2ebf3be37e24e9e2fa99", null],
30 + ["specs", github, 'edluffy/specs.nvim', "2743e412bbe21c9d73954c403d01e8de7377890d", null],
32 + ## INLINING CANDIDATES
34 + ## INCUBATOR
35 + ["decisive", github, 'emmanueltouzery/decisive.nvim', "a7251adebccbc9c899cff39a524b20d06e2b78b5", null],
36 + ["glance", github, 'DNLHC/glance.nvim', "17ee84e29ac33e7e5d91609f675cee8477586bda", null],
37 + ["iswap", github, "mizlan/iswap.nvim", "e02cc91f2a8feb5c5a595767d208c54b6e3258ec", null],
38 + [docs-view, github, 'amrbashir/nvim-docs-view',"365593534e0acd762bfddce6e8313315ffa4fa36", null],
39 + [rulebook, github, 'chrisgrieser/nvim-rulebook', "528857a6e522396c2ded41cb24e694fb3f177429", null],
40 + ["symbol-usage", github, 'Wansmer/symbol-usage.nvim', "0f9b3da014b7e41559b643e7461fcabb2a7dc83a", null],