repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: stevearc enhancements

b711c9d7ced565de1363400e3292464362cc3f2e

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (52)

neovim/.lazy.specs.lua

Added
new file mode 100644
1 +return {
2 + {
3 + 'WhoIsSethDaniel/mason-tool-installer.nvim',
4 + opts = {
5 + ensure_installed = {
6 + 'gitleaks',
7 + 'mdslw',
8 + },
9 + },
10 + },

neovim/README.md

Modified
35 35 ~ Shirou Emiya
37 ----------
39 39 # todo
41 -* replace nugu with nugu_fresh
42 -* use `vim.secure.read` for project local settings
41 +* Bug: LuaLS is getting crazy diagnosing non-stop...
42 +* TAB highlights are borked
43 +* think about formatting. prefer lsp or not?
44 +* once a terminal was open, i cannot quit with :wqa anymore...
45 +* adapt config to respect `vim.g.nerdfont` (std.constants?)
46 +* learn from <https://github.com/stevearc/dotfiles/blob/master/.config/nvim/plugin/exrc.lua> and maybe adapt `std.localrc`
47 +* make lsp config extensible, so that plugin configs can hook into it (e.g. on_attach)
48 +* scavenge stevearc dotfiles for nvim goodies
43 49 * write plugin to parse lsp settings locally and apply them
44 -* is there a use case for a plugin that parses local plugin configuration overrides?
45 -* kill custom lsp stuff in favor of lspconfig and try neoconf + nvim-java
46 -* does status bar fail to display if lsp fails to load?
47 50 * pandoc with lua filters for diagrams for generating documents and previewing --> https://github.com/tex/vimpreviewpandoc
48 -* use gen.ai to generate docs
49 51 * learn marks and refactor mark.lua
50 -* use ltex-ls for markdown, code comments and commit messages
51 -* create a floating window that shows plugins, that have commands, as reminder
52 -* setup DAP
53 -* add nu-check to nvim-lint
54 52 * create facade over vim.api.nvim_create_user_command
55 -* create skeleton-plugin for default file content based on file type
56 -* add support for Java multi line string in autopairs
53 +* use ltex-ls for markdown, code comments and commit messages
54 +* setup DAP
57 55 * nvim spell for camel case words
56 +* add nu-check to nvim-lint
57 +* create skeleton-plugin for default file content based on file type (BufNewFile?)
58 +* add support for Java multi line string in autopairs
59 +* split parts of config into plugins

neovim/ftplugin/lua.lua

Modified
5 5 vim.opt_local.path:append( path .. '/lua' )
6 6 end
7 7 vim.opt_local.suffixesadd:prepend '.lua'
9 +local map = require 'std.map'
11 +map.normal {
12 + description = 'Wrap word under cursor with require call',
13 + keys = '<leader>rq',
14 + category = 'refactor',
15 + -- sourround word with '
16 + -- insert `require`
17 + -- move 3 words
18 + command = "ebi'<esc>ea'<esc>bbirequire <esc>www",
19 + buffer = true,
20 + remap = true,

neovim/lazy-lock.json

Modified
2 2 "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
3 + "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" },
3 4 "actions-preview.nvim": { "branch": "master", "commit": "5072b1b1065a6b22bdd46b5c21780a91d6a08071" },
5 + "aerial.nvim": { "branch": "master", "commit": "993142d49274092c64a2d475aa726df3c323949d" },
4 6 "auto-dark-mode.nvim": { "branch": "master", "commit": "e328dc463d238cb7d690fb4daf068eba732a5a14" },
5 7 "better-escape.nvim": { "branch": "master", "commit": "7e86edafb8c7e73699e0320f225464a298b96d12" },
8 + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
9 + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
10 + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
11 + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
12 + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
6 13 "colorizer.nvim": { "branch": "master", "commit": "107719885290366c893e1c1c58b7474cbeabfef6" },
14 + "conform.nvim": { "branch": "master", "commit": "bf109f061fc3cd75394b7823923187ae045cbf22" },
7 15 "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
8 16 "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
9 17 "fidget.nvim": { "branch": "main", "commit": "4e854f3299e21d1c18279add340428a97520fc44" },
10 18 "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
11 - "gen.nvim": { "branch": "main", "commit": "2cb643b1a827bcdfc665a37d5f8174249d2d5bf5" },
12 - "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
19 + "gitsigns.nvim": { "branch": "main", "commit": "078041e9d060a386b0c9d3a8c7a7b019a35d3fb0" },
13 20 "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
14 21 "heirline.nvim": { "branch": "master", "commit": "03cff30d7e7d3ba6fdc00925f015822f79cef908" },
15 - "hyper.nvim": { "branch": "main", "commit": "b84fb39e703b1dd487d20c4faf028ee51374c88b" },
16 - "indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" },
22 + "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
17 23 "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" },
18 24 "lsp_signature.nvim": { "branch": "master", "commit": "c6aeb2f1d2538bbdfdaab1664d9d4c3c75aa9db8" },
25 + "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
19 26 "mason-tool-installer.nvim": { "branch": "main", "commit": "1212fb6082b7177dde17ea65e429e027835aeb40" },
20 27 "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
21 - "mini.align": { "branch": "main", "commit": "f845218c5fea89e49074e48270dc5e1b9511a0f9" },
22 28 "mini.bracketed": { "branch": "main", "commit": "65c7dfb51e832de9e279e5d5b0741e7af6755ab5" },
23 - "mini.starter": { "branch": "main", "commit": "ce222a5b6de50a9963c1eb62aa16ec6d5efca7ee" },
24 29 "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
25 - "neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" },
26 30 "neogen": { "branch": "main", "commit": "b95347a588401a755eadd17482edc1662876bd58" },
31 + "neorg": { "branch": "main", "commit": "086891d396ac9fccd91faf1520f563b6eb9eb942" },
32 + "neotest": { "branch": "master", "commit": "e07fe8241112274aae9947b98d255763738a1d52" },
33 + "neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" },
27 34 "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" },
28 35 "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
29 36 "nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" },
37 + "nvim-cmp": { "branch": "main", "commit": "43b460a2bd02fd898e67f5f1f65dfd1cce26203a" },
38 + "nvim-dap": { "branch": "master", "commit": "c1695e500c7d552a0a19953a9aefcc89178fb1af" },
39 + "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
40 + "nvim-dap-virtual-text": { "branch": "master", "commit": "baa5b0dc6663284cce32e0d00ac1f2511b13496f" },
30 41 "nvim-genghis": { "branch": "main", "commit": "8613fc1b43db6cc761733b3630eabff9e86296f7" },
31 42 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
32 43 "nvim-jdtls": { "branch": "master", "commit": "a4746791876166dc146eae573a1b49d24a6652e7" },
33 44 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
45 + "nvim-lint": { "branch": "master", "commit": "2669aabb8362fdc36aced5ba864b7135636ea863" },
34 46 "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" },
35 47 "nvim-navbuddy": { "branch": "master", "commit": "f137a3466a6cd1965cdcc5398daff54e66eebbe5" },
36 48 "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
37 49 "nvim-neoclip.lua": { "branch": "main", "commit": "798cd0592a81c185465db3a091a0ff8a21af60fd" },
50 + "nvim-nio": { "branch": "master", "commit": "7054695117581bdb0183b8d27d8d82b4a2ac8958" },
38 51 "nvim-spectre": { "branch": "master", "commit": "1d23be1165c373a6026e42f3b3a5100126eaf81d" },
39 52 "nvim-surround": { "branch": "main", "commit": "84a26afce16cffa7e3322cfa80a42cddf60616eb" },
40 - "nvim-tree.lua": { "branch": "master", "commit": "d35a8d5ec6358ada4b058431b367b32360737466" },
41 - "nvim-treesitter": { "branch": "master", "commit": "f197a15b0d1e8d555263af20add51450e5aaa1f0" },
53 + "nvim-tree.lua": { "branch": "master", "commit": "707b24af91a1d05823099ed8c5450796290466ba" },
54 + "nvim-treesitter": { "branch": "master", "commit": "722617e6726c1508adadf83d531f54987c703be0" },
42 55 "nvim-treesitter-textobjects": { "branch": "master", "commit": "d2a4ffc22d9d38d44edb73da007b3cf43451e9b4" },
43 56 "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
44 57 "nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
45 58 "nvim-web-devicons": { "branch": "master", "commit": "cb0c967c9723a76ccb1be0cc3a9a10e577d2f6ec" },
46 59 "nvim-window": { "branch": "main", "commit": "e7f5d60eeec8ff37af7be4c9a99f65edf67fc574" },
47 60 "oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
48 - "persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" },
61 + "overseer.nvim": { "branch": "master", "commit": "b72f6d23ce47ccd427be2341f389c63448278f17" },
49 62 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
50 63 "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
51 - "schemastore.nvim": { "branch": "main", "commit": "4d798fd5b692c8fce77268aba8f6f926b0c9f835" },
64 + "qf_helper.nvim": { "branch": "master", "commit": "91dad029c11d1c39b0d1276eda52616f651072be" },
65 + "resession.nvim": { "branch": "master", "commit": "dc8825439c619030925543a444c4186a2487c200" },
66 + "schemastore.nvim": { "branch": "main", "commit": "9ad2209d3fe54f99e3df2c26fadd6f4a3ecae44c" },
52 67 "specs.nvim": { "branch": "main", "commit": "e929006d3f6bb8e43f03e13ac364c67236eb5299" },
53 68 "speedtyper.nvim": { "branch": "main", "commit": "2d158eed4c753995b0501a3a7a72464fbb213e3d" },
54 69 "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
70 + "stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" },
55 71 "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
72 + "suda.vim": { "branch": "master", "commit": "66727b416837836712975e748bc8a19fb6cf4ec3" },
56 73 "telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
57 - "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
58 74 "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" },
59 75 "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
76 + "tint.nvim": { "branch": "master", "commit": "862835626941d263466754b9c8e2ce2cb004f5ac" },
60 77 "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" },
61 78 "toggleterm.nvim": { "branch": "main", "commit": "193786e0371e3286d3bc9aa0079da1cd41beaa62" },
62 79 "tree-sitter-nu": { "branch": "main", "commit": "c5b7816043992b1cdc1462a889bc74dc08576fa6" },
63 80 "treesj": { "branch": "main", "commit": "60e27280030f9cd8dfb6ceb335922c6ff76682cc" },
64 81 "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
82 + "venn.nvim": { "branch": "main", "commit": "e4d68341a73dd56c64955058821a58295fb337b1" },
83 + "vim-vscode-snippets": { "branch": "master", "commit": "812e60d1c648f889328761ec71daff09d1eb3177" },
65 84 "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" },
66 85 "which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" },
67 86 "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" }

neovim/lua/bugabinga/lazy.lua

Modified
1 1 local win32 = vim.loop.os_uname().sysname:match 'Win'
2 2 local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
3 3 if not vim.loop.fs_stat( lazypath ) then
4 - vim.fn.system {
5 - 'git',
6 - 'clone',
7 - '--filter=blob:none',
8 - 'https://github.com/folke/lazy.nvim.git',
9 - '--branch=stable', -- latest stable release
10 - lazypath,
11 - }
4 + vim.fn.system {
5 + 'git',
6 + 'clone',
7 + '--filter=blob:none',
8 + 'https://github.com/folke/lazy.nvim.git',
9 + '--branch=stable', -- latest stable release
10 + lazypath,
11 + }
13 13 vim.opt.rtp:prepend( lazypath )
19 19 local lazy = require 'lazy'
20 20 local icon = require 'std.icon'
22 -lazy.setup( 'bugabinga.plugins', {
23 - defaults = {
24 - lazy = true,
25 - -- version = '*',
26 - },
27 - install = {
28 - missing = true,
29 - colorscheme = { 'nugu_fresh', 'quiet', },
30 - },
31 - checker = {
32 - enabled = not win32,
33 - notify = false,
34 - },
35 - ui = {
36 - size = { width = 0.69, heigth = 0.69, },
37 - border = vim.g.border_style,
38 - icons = {
39 - lazy = icon.lazy,
40 - task = icon.terminal,
41 - ft = icon.file,
42 - },
43 - },
44 - custom_keys = {
45 - ['<localleader>l'] = function ( plugin )
46 - require 'lazy.util'.float_term( 'gitui', {
47 - cwd = plugin.dir,
48 - } )
49 - end,
50 - ['<localleader>t'] = function ( plugin )
51 - require 'lazy.util'.float_term( nil, {
52 - cwd = plugin.dir,
53 - } )
54 - end,
55 - },
56 - change_detection = { notify = false, },
57 - performance = {
58 - rtp = {
59 - disabled_plugins = {
60 - 'netrw',
61 - 'netrwPlugin',
62 - 'netrwSettings',
63 - 'netrwFileHandlers',
64 - 'gzip',
65 - 'zip',
66 - 'zipPlugin',
67 - 'tar',
68 - 'tarPlugin',
69 - 'getscript',
70 - 'getscriptPlugin',
71 - 'vimball',
72 - 'vimballPlugin',
73 - '2html_plugin',
74 - 'logipat',
75 - 'rrhelper',
76 - 'spellfile_plugin',
77 - 'matchit',
78 - 'matchparen',
79 - 'tohtml',
80 - 'tutor',
81 - },
82 - },
83 - },
84 - dev = {
85 - fallback = true,
86 - patterns = { 'bugabinga', },
87 - path = win32 and 'W:/' or '~/Workspace',
88 - },
89 -} )
22 +local overrides = require 'std.localrc' '.lazy.specs.lua'
23 +--- a couple of vim events, that collectivly represent "a file has been opened".
24 +--- this is useful for plugins that want to be lazy loaded, when some file is shown in a buffer/window
25 +vim.g.FILE_LOADED_EVENTS = { 'BufRead', 'BufNew', 'SessionLoadPost', }
27 +lazy.setup {
28 + spec = { { import = 'bugabinga.plugins', }, overrides, },
29 + defaults = {
30 + lazy = true,
31 + -- version = '*',
32 + },
33 + install = {
34 + missing = true,
35 + colorscheme = { 'nugu_fresh', 'quiet', },
36 + },
37 + checker = {
38 + enabled = not win32,
39 + notify = false,
40 + },
41 + ui = {
42 + size = { width = 0.69, heigth = 0.69, },
43 + border = vim.g.border_style,
44 + icons = {
45 + lazy = icon.lazy,
46 + task = icon.terminal,
47 + ft = icon.file,
48 + },
49 + custom_keys = {
50 + ['<localleader>l'] = {
51 + function ( plugin )
52 + require 'lazy.util'.float_term( { 'gitui', }, {
53 + cwd = plugin.dir,
54 + } )
55 + end,
56 + desc = 'Open gitui',
57 + },
59 + ['<localleader>t'] = {
60 + function ( plugin )
61 + require 'lazy.util'.float_term( nil, {
62 + cwd = plugin.dir,
63 + } )
64 + end,
65 + desc = 'Open terminal in plugin dir',
66 + },
67 + },
68 + },
69 + diff = { cmd = 'diffview.nvim', },
70 + change_detection = { notify = false, },
71 + performance = {
72 + rtp = {
73 + disabled_plugins = {
74 + 'netrw',
75 + 'netrwPlugin',
76 + 'netrwSettings',
77 + 'netrwFileHandlers',
78 + 'gzip',
79 + 'zip',
80 + 'zipPlugin',
81 + 'tar',
82 + 'tarPlugin',
83 + 'getscript',
84 + 'getscriptPlugin',
85 + 'vimball',
86 + 'vimballPlugin',
87 + '2html_plugin',
88 + 'logipat',
89 + 'rrhelper',
90 + 'spellfile_plugin',
91 + 'matchit',
92 + 'matchparen',
93 + 'tohtml',
94 + 'tutor',
95 + },
96 + },
97 + },
98 + dev = {
99 + fallback = true,
100 + patterns = { 'bugabinga', },
101 + path = win32 and 'W:/' or '~/Workspace',
102 + },
91 105 local map = require 'std.map'
93 107 local lazy_cmds = vim.iter {
94 - { 'Show', '', lazy.show, },
95 - { 'Install', 'i', lazy.install, },
96 - { 'Update', 'u', lazy.update, },
97 - { 'Sync', 's', lazy.sync, },
98 - { 'Clean', 'x', lazy.clean, },
99 - { 'Check', 'c', lazy.check, },
100 - { 'Log', 'l', lazy.log, },
101 - { 'Restore', 'r', lazy.restore, },
102 - { 'Profile', 'p', lazy.profile, },
103 - { 'Debug', 'd', lazy.debug, },
108 + { 'Show', '', lazy.show, },
109 + { 'Install', 'i', lazy.install, },
110 + { 'Update', 'u', lazy.update, },
111 + { 'Sync', 's', lazy.sync, },
112 + { 'Clean', 'x', lazy.clean, },
113 + { 'Check', 'c', lazy.check, },
114 + { 'Log', 'l', lazy.log, },
115 + { 'Restore', 'r', lazy.restore, },
116 + { 'Profile', 'p', lazy.profile, },
117 + { 'Debug', 'd', lazy.debug, },
106 120 local base_key = '<leader>z'
108 122 lazy_cmds:each( function ( cmd )
109 - map.normal {
110 - description = cmd[1],
111 - category = 'plugins',
112 - keys = base_key .. cmd[2],
113 - command = cmd[3],
114 - }
123 + map.normal {
124 + description = cmd[1],
125 + category = 'plugins',
126 + keys = base_key .. cmd[2],
127 + command = cmd[3],
131 +local auto = require 'std.auto'
133 +auto 'display_startup_time' {
134 + description = 'Display startup time on starter screen',
135 + events = 'User',
136 + pattern = 'LazyVimStarted',
137 + once = true,
138 + command = vim.schedule_wrap( function ()
139 + local startuptime = lazy.stats().startuptime
140 + vim.notify( 'neovim started in ' .. startuptime .. 'ms' )
141 + end ),

neovim/lua/bugabinga/lsp/init.lua

Modified
237 237 local navbuddy_ok, navbuddy = pcall( require, 'nvim-navbuddy' )
238 238 if navbuddy_ok then
239 239 navbuddy.attach( client, bufnr )
240 + map.normal {
241 + description = 'Open overview of symbols in current buffer',
242 + category = 'lsp',
243 + keys = '<leader>lo',
244 + command = function () navbuddy.open( bufnr ) end,
245 + buffer = bufnr,
241 248 vim.notify 'nvim-navbuddy not found. could not attach to lsp client.'

neovim/lua/bugabinga/options/behaviour.lua

Modified
58 58 require 'bugabinga.health'.add_dependency
60 60 name = 'Nushell',
61 - name_of_executable = 'nu'
61 + name_of_executable = 'nu',
64 64 -- highlight all search matches
80 80 require 'bugabinga.health'.add_dependency
82 82 name = 'Ripgrep',
83 - name_of_executable = 'rg'
83 + name_of_executable = 'rg',
86 86 -- ask me to force failed commands
89 89 auto 'load_project_if_available' {
90 90 description = 'Loads the project root dir as cwd, if it can be determined from a file path.',
91 - events = { 'FileType' },
91 + events = { 'FileType', },
92 92 pattern = '*',
93 93 command = function ( event )
94 94 local project = require 'std.project'
100 100 if table.contains( ignored.filetypes, filetype ) then return end
101 101 local buftype = vim.api.nvim_buf_get_option( buffer, 'buftype' )
102 102 if table.contains( ignored.buftypes, buftype ) then return end
103 - local root = vim.fs.normalize( project.find_root_by_filetype( file, filetype ) )
103 + local project = project.find_root_by_filetype( file, filetype )
104 + if not project then return end
105 + local root = vim.fs.normalize(project)
104 106 local cwd = vim.fs.normalize( vim.uv.cwd() )
105 107 if root and cwd ~= root then
106 108 vim.uv.chdir( root )

neovim/lua/bugabinga/options/file.lua

Modified
25 25 -- enable persistent undo. save undo history across neovim instances
26 26 vim.opt.undofile = true
28 +vim.filetype.add {
29 + extension = {
30 + norg = 'norg',
31 + },
32 + pattern = {
33 + ['.*/%.vscode/.*%.json'] = 'json5', -- These json files frequently have comments
34 + },

neovim/lua/bugabinga/options/ui.lua

Modified
12 12 auto 'disable_columns_in_special_buffers' {
13 13 description = 'Hide columns in buffers, that do not show source code.',
14 - events = { 'FileType' },
14 + events = { 'FileType', },
15 15 pattern = ignored.filetypes,
16 16 command = function ()
17 17 vim.opt_local.colorcolumn = {}
24 --- TODO: this should probably live in nugu?
26 --- local hl_to_mode = {
27 --- n = { bg = 'black' },
28 --- i = { bg = 'blue' },
29 --- v = { bg = 'green' },
30 --- }
31 ---
32 --- auto 'change_cursor_highlight_based_on_mode' {
33 --- description = 'Changes the highlight of the cursor based on the current mode.',
34 --- events = 'ModeChanged',
35 --- command = function ()
36 --- local current_mode = vim.fn.mode()
37 --- local hl = hl_to_mode[current_mode]
38 --- vim.notify( 'changing Cursor highlight for mode ' .. current_mode .. ' to ' .. vim.inspect( hl ) )
39 --- if hl then
40 --- vim.api.nvim_set_hl( 0, 'Cursor', hl )
41 --- end
42 --- end,
43 --- }
45 24 -- show trailing whitespace
46 25 vim.opt.list = true
47 26 vim.opt.listchars = {
48 - space = icon.space,
27 + -- space = icon.space,
49 28 -- eol = icon.eol,
50 - tab = icon.tab .. ' ',
29 + -- tab = icon.tab .. ' ',
51 30 trail = icon.trail,
52 31 extends = icon.extends,
53 32 precedes = icon.precedes,
62 41 vim.opt.wildmode = 'list:longest'
64 43 -- virtually break lines on border
65 -vim.opt.wrap = true
67 --- always display the signcolumn to avoid jitter
45 +-- always display tme signcolumn to avoid jitter
68 46 vim.opt.signcolumn = 'yes:1'
70 48 -- what is a ruler? me?
109 87 vim.opt.foldenable = false
111 89 -- show visual indicators for lines too long
112 -vim.opt.colorcolumn = { '80', '120', '140' }
90 +vim.opt.colorcolumn = { '80', '120', '140', }
114 92 -- highlight the current line
115 93 vim.opt.cursorline = false
129 107 -- always show tabs, to avoid jitter ui
130 108 vim.opt.showtabline = 2
132 --- Use true colors
133 -vim.opt.termguicolors = true
134 -vim.opt.lazyredraw = false
110 +local is_tty = os.getenv 'XDG_SESSION_TYPE' == 'tty' and os.getenv 'SSH_TTY' == ''
111 +if is_tty then
112 + vim.opt.termguicolors = false
113 + vim.g.nerdfont = false
114 + vim.opt.lazyredraw = true
115 +else
116 + vim.opt.termguicolors = true
117 + vim.g.nerdfont = true
118 + vim.opt.lazyredraw = false
119 +end
136 121 -- scroll by screen lines if buffer is wrapped
137 122 vim.opt.smoothscroll = true
139 124 -- cursor
140 -vim.opt.guicursor = 'n-v-c-sm:block-Cursor,i-ci-ve:ver25-blinkon250,r-cr:hor20,o:hor50'
125 +-- vim.opt.guicursor = 'n-v-c-sm:block-Cursor,i-ci-ve:ver25-blinkon250,r-cr:hor20,o:hor50'
142 127 -- font
143 128 vim.opt.guifont = 'Cousine,Symbols Nerd Font Mono:#e-subpixelantialias:#h-full'

neovim/lua/bugabinga/plugins/aerial.lua

Added
new file mode 100644
1 +--NOTE: this is such a cool idea! let's think about how to apply this more generally
2 +local lazy_aerial = setmetatable( {}, {
3 + __index = function ( _, k )
4 + return function ( ... ) require 'aerial'[k]( ... ) end
5 + end,
6 +} )
7 +--FIXME: own this
8 +return {
9 + {
10 + 'stevearc/resession.nvim',
11 + lazy = true,
12 + opts = {
13 + extensions = {
14 + aerial = {},
15 + },
16 + },
17 + },
18 + {
19 + 'stevearc/aerial.nvim',
20 + dependencies = {
21 + 'nvim-treesitter/nvim-treesitter',
22 + 'nvim-tree/nvim-web-devicons',
23 + -- Hack to ensure that lspkind-nvim is loaded
24 + 'hrsh7th/nvim-cmp',
25 + },
26 + cmd = { 'AerialToggle', 'AerialOpen', 'AerialNext', 'AerialPrev', },
27 + keys = {
28 + { '<leader>a', '<cmd>AerialToggle!<CR>', desc = '[A]erial toggle', mode = 'n', },
29 + { '<leader>A', '<cmd>AerialNavToggle<CR>', desc = '[A]erial nav toggle', mode = 'n', },
30 + { '[s', lazy_aerial.prev, desc = 'Previous aerial symbol', mode = { 'n', 'v', }, },
31 + { ']s', lazy_aerial.next, desc = 'Next aerial symbol', mode = { 'n', 'v', }, },
32 + { '[u', lazy_aerial.prev_up, desc = 'Previous aerial parent symbol', mode = { 'n', 'v', }, },
33 + { ']u', lazy_aerial.next_up, desc = 'Next aerial parent symbol', mode = { 'n', 'v', }, },
34 + },
35 + opts = {
36 + show_guides = true,
37 + layout = {
38 + max_width = { 80, 0.2, },
39 + default_direction = 'prefer_left',
40 + -- placement = "edge",
41 + -- preserve_equality = true,
42 + },
43 + -- attach_mode = "global",
44 + highlight_on_hover = true,
45 + close_automatic_events = {
46 + -- "unfocus",
47 + -- "switch_buffer",
48 + -- "unsupported",
49 + },
50 + -- open_automatic = true,
51 + -- highlight_on_jump = false,
52 + link_folds_to_tree = true,
53 + link_tree_to_folds = true,
54 + manage_folds = {
55 + ['_'] = true,
56 + },
57 + -- nerd_font = vim.g.nerd_font,
59 + -- backends = { "treesitter", "markdown" },
60 + -- backends = { "lsp", "treesitter" },
61 + lazy_load = false,
62 + -- backends = { "lsp", "treesitter", "markdown" },
63 + -- filter_kind = false,
64 + keymaps = {
65 + ['<'] = 'actions.tree_decrease_fold_level',
66 + ['>'] = 'actions.tree_increase_fold_level',
67 + },
68 + treesitter = {
69 + experimental_selection_range = true,
70 + },
71 + },
72 + },

neovim/lua/bugabinga/plugins/auto-dark-mode.lua

Modified
1 1 return {
2 2 'f-person/auto-dark-mode.nvim',
3 3 dev = true,
4 - event = 'VeryLazy',
4 + -- event = 'VeryLazy',
5 + lazy = false,
5 6 opts = {
6 7 -- interval of 0 freezes neovim on quit
7 8 -- update_interval = 0,

neovim/lua/bugabinga/plugins/buffers.lua

Added
new 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

Added
new file mode 100644
1 +--FIXME: own this
2 +return {
3 + "hrsh7th/nvim-cmp",
4 + 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",
12 + },
13 + cmd = { "CmpInfo" },
14 + event = "InsertEnter *",
15 + config = function()
16 + local cmp = require("cmp")
17 + local luasnip = require("luasnip")
18 + 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
23 + end
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 + }),
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 + })
63 + local formatting = {}
64 + local ok, lspkind = pcall(require, "lspkind")
65 + if ok then
66 + formatting.format = lspkind.cmp_format({
67 + mode = "symbol",
68 + 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 = "󰀫 ",
95 + },
96 + menu = {
97 + buffer = "[buf]",
98 + nvim_lsp = "[LSP]",
99 + nvim_lua = "[api]",
100 + path = "[path]",
101 + luasnip = "[snip]",
102 + },
103 + })
104 + end
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" },
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
127 + end
128 + return bufs
129 + end,
130 + },
131 + },
132 + },
134 + snippet = {
135 + expand = function(args)
136 + luasnip.lsp_expand(args.body)
137 + end,
138 + },
140 + experimental = {
141 + native_menu = false,
142 + },
143 + })
145 + vim.api.nvim_create_user_command("CmpInfo", function()
146 + cmp.status()
147 + end, {})
148 + end,

neovim/lua/bugabinga/plugins/colorizer.lua

Modified
1 1 return {
3 3 'JosefLitos/colorizer.nvim',
4 - event = { 'BufReadPost', 'BufNew', },
4 + event = vim.g.FILE_LOADED_EVENTS,
5 5 opts = {
6 6 filetypes = { '*', },
7 7 user_default_options = {

neovim/lua/bugabinga/plugins/dap.lua

Added
new file mode 100644
1 +--FIXME: own this
2 +return {
3 + {
4 + 'mfussenegger/nvim-dap',
5 + dependencies = {
6 + 'rcarriga/nvim-dap-ui',
7 + { 'theHamsta/nvim-dap-virtual-text', config = true, },
8 + { 'stevearc/overseer.nvim', },
9 + },
10 + keys = {
11 + { '<leader>dc', "<cmd>lua require'dap'.continue()<CR>", mode = 'n', desc = '[D]ebug [C]ontinue', },
12 + { '<leader>dj', "<cmd>lua require'dap'.step_over()<CR>", mode = 'n', desc = '[D]ebug step over', },
13 + { '<leader>di', "<cmd>lua require'dap'.step_into()<CR>", mode = 'n', desc = '[D]ebug step [I]nto', },
14 + { '<leader>do', "<cmd>lua require'dap'.step_out()<CR>", mode = 'n', desc = '[D]ebug step [O]ut', },
15 + { '<leader>dl', "<cmd>lua require'dap'.run_last()<CR>", mode = 'n', desc = '[D]ebug run [L]ast', },
16 + { '<leader>dr', "<cmd>lua require'dap'.repl.open()<CR>", mode = 'n', desc = '[D]ebug open [R]epl', },
17 + { '<leader>dq', "<cmd>lua require'dap'.terminate()<CR>", mode = 'n', desc = '[D]ebug [Q]uit', },
18 + { '<leader>db', "<cmd>lua require'dap'.toggle_breakpoint()<CR>", mode = 'n', desc = '[D]ebug set [B]reakpoint', },
19 + {
20 + '<leader>dB',
21 + function ()
22 + vim.ui.input( { prompt = 'Breakpoint condition', }, function ( cond )
23 + if cond then
24 + require 'dap' .set_breakpoint( cond )
25 + end
26 + end )
27 + end,
28 + mode = 'n',
29 + desc = '[D]ebug set conditional [B]reakpoint',
30 + },
31 + },
32 + config = function ()
33 + -- dap.set_log_level("DEBUG")
34 + vim.fn.sign_define( 'DapBreakpoint', { text = '•', texthl = 'DiagnosticError', linehl = '', numhl = '', } )
35 + vim.fn.sign_define( 'DapBreakpointCondition', { text = '?', texthl = 'DiagnosticError', linehl = '', numhl = '', } )
36 + vim.fn.sign_define( 'DapLogPoint', { text = '⁋', texthl = '', linehl = '', numhl = '', } )
37 + vim.fn.sign_define( 'DapStopped', { text = ' ', texthl = 'DiagnosticInfo', linehl = '', numhl = '', } )
38 + vim.fn.sign_define( 'DapBreakpointRejected', { text = 'X', texthl = 'DiagnosticError', linehl = '', numhl = '', } )
40 + local dapui = require 'dapui'
41 + local dap = require 'dap'
42 + dapui.setup()
43 + dap.listeners.after.event_initialized['dapui_config'] = function ()
44 + dapui.open()
45 + end
46 + dap.listeners.before.event_terminated['dapui_config'] = function ()
47 + dapui.close()
48 + end
49 + dap.listeners.before.event_exited['dapui_config'] = function ()
50 + dapui.close()
51 + end
52 + vim.schedule( function ()
53 + require 'dap.ext.vscode' .json_decode = require 'overseer.json' .decode
54 + require 'dap.ext.vscode' .load_launchjs( nil, { node = { 'typescript', 'javascript', }, } )
55 + require 'overseer' .patch_dap( true )
56 + end )
57 + end,
58 + },

neovim/lua/bugabinga/plugins/dressing.lua

Modified
1 +--FIXME: own this. is vim.ui.open shim still necessary?
1 2 return {
2 - 'stevearc/dressing.nvim',
3 + "stevearc/dressing.nvim",
3 4 lazy = false,
4 - opts = {},
5 + opts = {
6 + input = {
7 + insert_only = false,
8 + -- relative = "editor",
9 + win_options = {
10 + sidescrolloff = 4,
11 + },
12 + get_config = function()
13 + if vim.api.nvim_win_get_width(0) < 50 then
14 + return {
15 + relative = "editor",
16 + }
17 + end
18 + end,
19 + },
20 + select = {
21 + backend = { "telescope", "builtin", "fzf_lua" },
22 + },
23 + },
24 + config = function(_, opts)
25 + require("dressing").setup(opts)
27 + -- Shim for vim.ui.open
28 + if vim.ui.open then
29 + return
30 + end
32 + ---Copied from vim.ui.open in Neovim 0.10+
33 + ---@param path string
34 + ---@return nil|string[] cmd
35 + ---@return nil|string error
36 + local function get_open_cmd(path)
37 + if vim.fn.has("mac") == 1 then
38 + return { "open", path }
39 + elseif vim.fn.has("win32") == 1 then
40 + if vim.fn.executable("rundll32") == 1 then
41 + return { "rundll32", "url.dll,FileProtocolHandler", path }
42 + else
43 + return nil, "rundll32 not found"
44 + end
45 + elseif vim.fn.executable("wslview") == 1 then
46 + return { "wslview", path }
47 + elseif vim.fn.executable("xdg-open") == 1 then
48 + return { "xdg-open", path }
49 + else
50 + return nil, "no handler found"
51 + end
52 + end
54 + vim.ui.open = function(path)
55 + local is_uri = path:match("%w+:")
56 + if not is_uri then
57 + path = vim.fn.expand(path)
58 + end
59 + local cmd, err = get_open_cmd(path)
60 + if not cmd or err then
61 + return nil, err
62 + end
63 + local jid = vim.fn.jobstart(cmd, { detach = true })
64 + if jid <= 0 then
65 + return nil, "Failed to start job"
66 + end
67 + end
68 + end,

neovim/lua/bugabinga/plugins/format.lua

Added
new file mode 100644
1 +--FIXME: own this
2 +return {
3 + 'stevearc/conform.nvim',
4 + event = { 'BufWritePre', },
5 + cmd = { 'ConformInfo', },
6 + keys = {
7 + {
8 + '=',
9 + function ()
10 + require 'conform'.format( { async = true, lsp_fallback = true, }, function ( err )
11 + if not err then
12 + if vim.startswith( vim.api.nvim_get_mode().mode:lower(), 'v' ) then
13 + vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( '<Esc>', true, false, true ), 'n', true )
14 + end
15 + end
16 + end )
17 + end,
18 + mode = '',
19 + desc = 'Format buffer',
20 + },
21 + },
22 + opts = {
23 + formatters_by_ft = {
24 + markdown = { 'injected', },
25 + norg = { 'injected', },
26 + lua = { 'stylua', },
27 + go = { 'goimports', 'gofmt', },
28 + sh = { 'shfmt', },
29 + zig = { 'zigfmt', },
30 + ['_'] = { 'trim_whitespace', 'trim_newlines', },
31 + },
32 + formatters = {
33 + injected = {
34 + options = {
35 + lang_to_formatters = {
36 + html = {},
37 + },
38 + },
39 + },
40 + shfmt = {
41 + prepend_args = { '-i', '2', },
42 + },
43 + },
44 + log_level = vim.log.levels.TRACE,
45 + format_after_save = function ( bufnr )
46 + if vim.b[bufnr].disable_autoformat then
47 + return
48 + end
49 + return { timeout_ms = 5000, lsp_fallback = true, }
50 + end,
51 + },
52 + init = function () vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" end,

neovim/lua/bugabinga/plugins/gitsigns.lua

Modified
1 -local map = require 'std.map'
1 +local map = require("std.map")
3 3 return {
4 - 'lewis6991/gitsigns.nvim',
5 - version = '0.*',
6 - event = 'VeryLazy',
4 + "lewis6991/gitsigns.nvim",
5 + version = "0.*",
6 + event = vim.g.FILE_LOADED_EVENTS,
7 7 opts = {
8 8 signs = {
9 - add = { text = '│', },
10 - change = { text = '│', },
11 - delete = { text = '_', },
12 - topdelete = { text = '‾', },
13 - changedelete = { text = '~', },
14 - untracked = { text = '┆', },
9 + add = { text = "│" },
10 + change = { text = "│" },
11 + delete = { text = "_" },
12 + topdelete = { text = "‾" },
13 + changedelete = { text = "~" },
14 + untracked = { text = "┆" },
16 16 preview_config = {
17 17 border = vim.g.border_style,
20 20 current_line_blame_opts = {
21 21 ignore_whitespace = true,
23 - current_line_blame_formatter = '<author>(<author_time:%d.%m.%Y>): <summary>',
24 - on_attach = function ( bufnr )
25 - local gitsigns = require 'gitsigns'
23 + current_line_blame_formatter = "<author>(<author_time:%d.%m.%Y>): <summary>",
24 + on_attach = function(bufnr)
25 + local gitsigns = require("gitsigns")
27 - map.normal {
28 - description = 'Goto next hunk',
29 - category = 'git',
30 - keys = ']h',
27 + map.normal({
28 + description = "Goto next hunk",
29 + category = "git",
30 + keys = "]h",
31 31 buffer = bufnr,
32 32 command = gitsigns.next_hunk,
33 - }
33 + })
35 - map.normal {
36 - description = 'Goto previous hunk',
37 - category = 'git',
38 - keys = '[h',
35 + map.normal({
36 + description = "Goto previous hunk",
37 + category = "git",
38 + keys = "[h",
39 39 buffer = bufnr,
40 40 command = gitsigns.prev_hunk,
41 - }
41 + })
43 - map.normal {
44 - description = 'Stage hunk',
45 - category = 'git',
46 - keys = '<leader>hs',
43 + map.normal({
44 + description = "Stage hunk",
45 + category = "git",
46 + keys = "<leader>hs",
47 47 buffer = bufnr,
48 48 command = gitsigns.stage_hunk,
49 - }
49 + })
51 - map.visual_select {
52 - description = 'Stage hunk',
53 - category = 'git',
54 - keys = '<leader>hs',
51 + map.visual_select({
52 + description = "Stage hunk",
53 + category = "git",
54 + keys = "<leader>hs",
55 55 buffer = bufnr,
56 - command = function () gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v', } end,
57 - }
56 + command = function()
57 + gitsigns.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
58 + end,
59 + })
59 - map.normal {
60 - description = 'Reset hunk',
61 - category = 'git',
62 - keys = '<leader>hr',
61 + map.normal({
62 + description = "Reset hunk",
63 + category = "git",
64 + keys = "<leader>hr",
63 65 buffer = bufnr,
64 66 command = gitsigns.reset_hunk,
65 - }
67 + })
67 - map.visual_select {
68 - description = 'Reset hunk',
69 - category = 'git',
70 - keys = '<leader>hr',
69 + map.visual_select({
70 + description = "Reset hunk",
71 + category = "git",
72 + keys = "<leader>hr",
71 73 buffer = bufnr,
72 - command = function () gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v', } end,
73 - }
74 + command = function()
75 + gitsigns.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
76 + end,
77 + })
75 - map.normal {
76 - description = 'Undo stage hunk',
77 - category = 'git',
78 - keys = '<leader>hu',
79 + map.normal({
80 + description = "Undo stage hunk",
81 + category = "git",
82 + keys = "<leader>hu",
79 83 buffer = bufnr,
80 84 command = gitsigns.undo_stage_hunk,
81 - }
85 + })
83 - map.normal {
84 - description = 'Stage buffer',
85 - category = 'git',
86 - keys = '<leader>hS',
87 + map.normal({
88 + description = "Stage buffer",
89 + category = "git",
90 + keys = "<leader>hS",
87 91 buffer = bufnr,
88 92 command = gitsigns.stage_buffer,
89 - }
93 + })
91 - map.normal {
92 - description = 'Reset buffer',
93 - category = 'git',
94 - keys = '<leader>hR',
95 + map.normal({
96 + description = "Reset buffer",
97 + category = "git",
98 + keys = "<leader>hR",
95 99 buffer = bufnr,
96 100 command = gitsigns.reset_buffer,
97 - }
101 + })
99 - map.normal {
100 - description = 'Preview hunk',
101 - category = 'git',
102 - keys = '<leader>hp',
103 + map.normal({
104 + description = "Preview hunk",
105 + category = "git",
106 + keys = "<leader>hp",
103 107 buffer = bufnr,
104 108 command = gitsigns.preview_hunk,
105 - }
109 + })
107 - map.normal {
108 - description = 'Blame line',
109 - category = 'git',
110 - keys = '<leader>hb',
111 + map.normal({
112 + description = "Blame line",
113 + category = "git",
114 + keys = "<leader>hb",
111 115 buffer = bufnr,
112 - command = function () gitsigns.blame_line { full = true, } end,
113 - }
116 + command = function()
117 + gitsigns.blame_line({ full = true })
118 + end,
119 + })
115 - map.normal {
116 - description = 'Diff this',
117 - category = 'git',
118 - keys = '<leader>hd',
121 + map.normal({
122 + description = "Diff this",
123 + category = "git",
124 + keys = "<leader>hd",
119 125 buffer = bufnr,
120 126 command = gitsigns.diffthis,
121 - }
127 + })
123 - map.normal {
124 - description = 'Diff this ~',
125 - category = 'git',
126 - keys = '<leader>hD',
129 + map.normal({
130 + description = "Diff this ~",
131 + category = "git",
132 + keys = "<leader>hD",
127 133 buffer = bufnr,
128 - command = function () gitsigns.diffthis '~' end,
129 - }
134 + command = function()
135 + gitsigns.diffthis("~")
136 + end,
137 + })
131 - map.normal {
132 - description = 'Toggle current line blame',
133 - category = 'git',
134 - keys = '<leader>tb',
139 + map.normal({
140 + description = "Toggle current line blame",
141 + category = "git",
142 + keys = "<leader>tb",
135 143 buffer = bufnr,
136 144 command = gitsigns.toggle_current_line_blame,
137 - }
145 + })
139 - map.normal {
140 - description = 'Toggle removed lines',
141 - category = 'git',
142 - keys = '<leader>tr',
147 + map.normal({
148 + description = "Toggle removed lines",
149 + category = "git",
150 + keys = "<leader>tr",
143 151 buffer = bufnr,
144 152 command = gitsigns.toggle_deleted,
145 - }
153 + })
147 - map.operator_pending.visual {
148 - description = 'select hunk',
149 - category = 'git',
150 - keys = 'ih',
155 + map.operator_pending.visual({
156 + description = "select hunk",
157 + category = "git",
158 + keys = "ih",
151 159 buffer = bufnr,
152 - command = ':<C-U>Gitsigns select_hunk<CR>',
153 - }
160 + command = ":<C-U>Gitsigns select_hunk<CR>",
161 + })

neovim/lua/bugabinga/plugins/heirline.lua

Modified
1 1 ---@diagnostic disable: param-type-mismatch
2 -local icon = require 'std.icon'
3 -local auto = require 'std.auto'
4 -local ignored = require 'std.ignored'
2 +local icon = require("std.icon")
3 +local auto = require("std.auto")
4 +local ignored = require("std.ignored")
6 -local NEW_FILE = '~untitled~'
6 +local NEW_FILE = "~untitled~"
8 8 return {
10 - 'rebelot/heirline.nvim',
11 - version = '1.*',
12 - event = 'VeryLazy',
10 + "rebelot/heirline.nvim",
11 + version = "1.*",
12 + event = "VeryLazy",
13 13 dependencies = {
14 - 'nvim-tree/nvim-web-devicons',
15 - 'lewis6991/gitsigns.nvim',
16 - 'SmiteshP/nvim-navic',
14 + "nvim-tree/nvim-web-devicons",
15 + { "lewis6991/gitsigns.nvim", lazy = true },
16 + { "SmiteshP/nvim-navic", lazy = true },
18 - config = function ()
19 - local heirline = require 'heirline'
20 - local conditions = require 'heirline.conditions'
21 - local utils = require 'heirline.utils'
18 + config = function()
19 + local heirline = require("heirline")
20 + local conditions = require("heirline.conditions")
21 + local utils = require("heirline.utils")
23 - local nugu = require 'bugabinga.nugu.palette'
24 - heirline.load_colors( nugu )
23 + local nugu = require("bugabinga.nugu.palette")
24 + heirline.load_colors(nugu)
26 - auto 'reload_heirline_colors' {
27 - description = 'Reload dark/light nugu colors for Heirline',
28 - events = 'ColorScheme',
29 - command = function () utils.on_colorscheme( nugu ) end,
30 - }
26 + auto("reload_heirline_colors")({
27 + description = "Reload dark/light nugu colors for Heirline",
28 + events = "ColorScheme",
29 + command = function()
30 + utils.on_colorscheme(nugu)
31 + end,
32 + })
32 - local vi_mode = {
33 - init = function ( self )
34 - self.mode = vim.fn.mode( 1 ) -- :h mode()
34 + local vi_mode = {
35 + init = function(self)
36 + self.mode = vim.fn.mode(1) -- :h mode()
37 39 static = {
38 40 mode_names = {
39 41 n = icon.normal,
40 - no = icon.normal .. '?',
41 - nov = icon.normal .. '?',
42 - noV = icon.normal .. '?',
43 - ['no\22'] = icon.normal .. '?',
44 - niI = icon.normal .. 'i',
45 - niR = icon.normal .. 'r',
46 - niV = icon.normal .. 'v',
47 - nt = icon.normal .. 't',
42 + no = icon.normal .. "?",
43 + nov = icon.normal .. "?",
44 + noV = icon.normal .. "?",
45 + ["no\22"] = icon.normal .. "?",
46 + niI = icon.normal .. "i",
47 + niR = icon.normal .. "r",
48 + niV = icon.normal .. "v",
49 + nt = icon.normal .. "t",
48 50 v = icon.visual,
49 - vs = icon.visual .. 's',
50 - V = icon.visual .. '_',
51 - Vs = icon.visual .. 's',
52 - ['\22'] = '^' .. icon.visual,
53 - ['\22s'] = '^' .. icon.visual,
51 + vs = icon.visual .. "s",
52 + V = icon.visual .. "_",
53 + Vs = icon.visual .. "s",
54 + ["\22"] = "^" .. icon.visual,
55 + ["\22s"] = "^" .. icon.visual,
54 56 s = icon.select,
55 - S = icon.select .. '_',
56 - ['\19'] = '^' .. icon.select,
57 + S = icon.select .. "_",
58 + ["\19"] = "^" .. icon.select,
57 59 i = icon.insert,
58 - ic = icon.insert .. 'c',
59 - ix = icon.insert .. 'x',
60 + ic = icon.insert .. "c",
61 + ix = icon.insert .. "x",
60 62 R = icon.replace,
61 - Rc = icon.replace .. 'c',
62 - Rx = icon.replace .. 'x',
63 - Rv = icon.replace .. 'v',
64 - Rvc = icon.replace .. 'v',
65 - Rvx = icon.replace .. 'v',
63 + Rc = icon.replace .. "c",
64 + Rx = icon.replace .. "x",
65 + Rv = icon.replace .. "v",
66 + Rvc = icon.replace .. "v",
67 + Rvx = icon.replace .. "v",
66 68 c = icon.command,
67 - cv = icon.command .. 'x',
69 + cv = icon.command .. "x",
68 70 r = icon.pending,
69 - rm = icon.pending .. 'm',
70 - ['r?'] = icon.pending .. '?',
71 - ['!'] = icon.exclaim,
71 + rm = icon.pending .. "m",
72 + ["r?"] = icon.pending .. "?",
73 + ["!"] = icon.exclaim,
72 74 t = icon.terminal,
74 76 mode_colors = {
75 - n = 'ui_normal',
76 - i = 'ui_accent',
77 - v = 'ui_important_global',
78 - V = 'ui_important_global',
79 - ['\22'] = 'ui_important_global',
80 - c = 'ui_important_global',
81 - s = 'ui_important_global',
82 - S = 'ui_important_global',
83 - ['\19'] = 'ui_important_global',
84 - R = 'ui_important_global',
85 - r = 'ui_important_global',
86 - ['!'] = 'ui_important_global',
87 - t = 'ui_important_global',
77 + n = "ui_normal",
78 + i = "ui_accent",
79 + v = "ui_important_global",
80 + V = "ui_important_global",
81 + ["\22"] = "ui_important_global",
82 + c = "ui_important_global",
83 + s = "ui_important_global",
84 + S = "ui_important_global",
85 + ["\19"] = "ui_important_global",
86 + R = "ui_important_global",
87 + r = "ui_important_global",
88 + ["!"] = "ui_important_global",
89 + t = "ui_important_global",
91 - provider = function ( self )
93 + provider = function(self)
92 94 local mode_name = self.mode_names[self.mode]
93 - return ' ' .. icon.vim .. ' %3(' .. mode_name .. '%) '
95 + return " " .. icon.vim .. " %3(" .. mode_name .. "%) "
96 - hl = function ( self )
97 - local mode = self.mode:sub( 1, 1 ) -- get only the first mode character
98 - return { fg = self.mode_colors[mode], bold = true, }
98 + hl = function(self)
99 + local mode = self.mode:sub(1, 1) -- get only the first mode character
100 + return { fg = self.mode_colors[mode], bold = true }
101 103 update = {
102 - 'ModeChanged',
103 - pattern = '*:*',
104 - callback = vim.schedule_wrap( function () vim.cmd.redrawstatus() end ),
104 + "ModeChanged",
105 + pattern = "*:*",
106 + callback = vim.schedule_wrap(function()
107 + vim.cmd.redrawstatus()
108 + end),
108 - local file_icon = {
109 - init = function ( self )
112 + local file_icon = {
113 + init = function(self)
110 114 local filename = self.filename
111 - local extension = vim.fn.fnamemodify( filename, ':e' )
112 - self.icon = require 'nvim-web-devicons'.get_icon_color( filename, extension, { default = true, } )
115 + local extension = vim.fn.fnamemodify(filename, ":e")
116 + self.icon = require("nvim-web-devicons").get_icon_color(filename, extension, { default = true })
114 - provider = function ( self )
115 - return self.icon and (self.icon .. ' ')
118 + provider = function(self)
119 + return self.icon and (self.icon .. " ")
117 - hl = 'DefaultIcon',
121 + hl = "DefaultIcon",
120 - local file_name = {
121 - init = function ( self )
122 - self.lfilename = vim.fs.normalize( vim.fn.fnamemodify( self.filename, ':.' ) )
123 - if self.lfilename == '' then self.lfilename = NEW_FILE end
124 + local file_name = {
125 + init = function(self)
126 + self.lfilename = vim.fs.normalize(vim.fn.fnamemodify(self.filename, ":."))
127 + if self.lfilename == "" then
128 + self.lfilename = NEW_FILE
129 + end
126 132 flexible = 2,
129 - provider = function ( self )
135 + provider = function(self)
130 136 return self.lfilename
134 - provider = function ( self )
135 - return vim.fs.normalize( vim.fn.pathshorten( self.lfilename ) )
140 + provider = function(self)
141 + return vim.fs.normalize(vim.fn.pathshorten(self.lfilename))
140 - local file_flags = {
146 + local file_flags = {
142 - condition = function ()
148 + condition = function()
143 149 return vim.bo.modified
145 - provider = string.format( ' %s ', icon.modified ),
146 - hl = 'Comment',
151 + provider = string.format(" %s ", icon.modified),
152 + hl = "Comment",
149 - condition = function ()
155 + condition = function()
150 156 return not vim.bo.modifiable or vim.bo.readonly
152 - provider = string.format( ' %s ', icon.lock ),
153 - hl = 'ErrorMsg',
158 + provider = string.format(" %s ", icon.lock),
159 + hl = "ErrorMsg",
157 - local file_name_block = {
158 - init = function ( self )
159 - self.filename = vim.fs.normalize( vim.api.nvim_buf_get_name( 0 ) )
163 + local file_name_block = {
164 + init = function(self)
165 + self.filename = vim.fs.normalize(vim.api.nvim_buf_get_name(0))
162 168 file_icon,
163 - { provider = ' ', },
169 + { provider = " " },
164 170 file_name,
165 171 file_flags,
166 - { provider = '%<', }, -- this means that the statusline is cut here when there's not enough space
172 + { provider = "%<" }, -- this means that the statusline is cut here when there's not enough space
169 - local file_type = {
170 - provider = function ()
171 - return icon.file .. ' ' .. string.upper( vim.bo.filetype )
175 + local file_type = {
176 + provider = function()
177 + return icon.file .. " " .. string.upper(vim.bo.filetype)
175 - local file_encoding = {
176 - provider = function ()
177 - local enc = (vim.bo.fenc ~= '' and vim.bo.fenc) or vim.o.enc -- :h 'enc'
178 - return enc ~= 'utf-8' and enc:upper()
181 + local file_encoding = {
182 + provider = function()
183 + local enc = (vim.bo.fenc ~= "" and vim.bo.fenc) or vim.o.enc -- :h 'enc'
184 + return enc ~= "utf-8" and enc:upper()
182 - local file_format = {
188 + local file_format = {
183 189 static = {
184 190 dos = icon.newline .. icon.carriage_return,
185 191 unix = icon.newline,
186 192 mac = icon.carriage_return,
188 - provider = function ( self )
194 + provider = function(self)
189 195 local fileformat = vim.bo.fileformat
190 196 return self[fileformat]
194 - local file_size = {
195 - provider = function ()
200 + local file_size = {
201 + provider = function()
196 202 -- stackoverflow, compute human readable file size
197 203 -- i want to see vim opening a 1EiB file 󰱯
198 - local suffix = { 'b', 'k', 'M', 'G', 'T', 'P', 'E', }
199 - local fsize = vim.fn.getfsize( vim.api.nvim_buf_get_name( 0 ) )
204 + local suffix = { "b", "k", "M", "G", "T", "P", "E" }
205 + local fsize = vim.fn.getfsize(vim.api.nvim_buf_get_name(0))
200 206 fsize = (fsize < 0 and 0) or fsize
201 207 if fsize < 1024 then
202 208 return fsize .. suffix[1]
204 - local i = math.floor( (math.log( fsize ) / math.log( 1024 )) )
205 - return string.format( '%.2g%s', fsize / math.pow( 1024, i ), suffix[i + 1] )
210 + local i = math.floor((math.log(fsize) / math.log(1024)))
211 + return string.format("%.2g%s", fsize / math.pow(1024, i), suffix[i + 1])
209 - local file_last_modified = {
210 - provider = function ()
211 - local ftime = vim.fn.getftime( vim.api.nvim_buf_get_name( 0 ) )
215 + local file_last_modified = {
216 + provider = function()
217 + local ftime = vim.fn.getftime(vim.api.nvim_buf_get_name(0))
212 218 if ftime > 0 then
213 - local timeago = require 'std.timeago'
214 - return timeago.format( ftime )
219 + local timeago = require("std.timeago")
220 + return timeago.format(ftime)
219 - local lsp_active = {
225 + local lsp_active = {
220 226 condition = conditions.lsp_attached,
221 227 -- FIXME: updates from parent components do not seem to update children,
222 228 -- if those have their own updates?
223 - update = { 'LspAttach', 'LspDetach', 'BufEnter', 'BufLeave', },
229 + update = { "LspAttach", "LspDetach", "BufEnter", "BufLeave" },
225 - provider = function ()
231 + provider = function()
226 232 local names = {}
227 - for _, client in pairs( vim.lsp.get_clients { bufnr = 0, } ) do
228 - table.insert( names, client.name )
233 + for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do
234 + table.insert(names, client.name)
230 - return icon.lsp .. ' ' .. table.concat( names, ' ' )
236 + return icon.lsp .. " " .. table.concat(names, " ")
234 - local navic = {
235 - condition = function () return require 'nvim-navic'.is_available() end,
240 + local navic = {
241 + condition = function()
242 + local ok, navic = pcall(require, "nvim-navic")
243 + return ok and navic.is_available()
244 + end,
236 245 static = {
237 246 -- create a type highlight map
238 247 type_hl = {
239 - File = 'Directory',
240 - Module = '@include',
241 - Namespace = '@namespace',
242 - Package = '@include',
243 - Class = '@structure',
244 - Method = '@method',
245 - Property = '@property',
246 - Field = '@field',
247 - Constructor = '@constructor',
248 - Enum = '@field',
249 - Interface = '@type',
250 - Function = '@function',
251 - Variable = '@variable',
252 - Constant = '@constant',
253 - String = '@string',
254 - Number = '@number',
255 - Boolean = '@boolean',
256 - Array = '@field',
257 - Object = '@type',
258 - Key = '@keyword',
259 - Null = '@comment',
260 - EnumMember = '@field',
261 - Struct = '@structure',
262 - Event = '@keyword',
263 - Operator = '@operator',
264 - TypeParameter = '@type',
248 + File = "Directory",
249 + Module = "@include",
250 + Namespace = "@namespace",
251 + Package = "@include",
252 + Class = "@structure",
253 + Method = "@method",
254 + Property = "@property",
255 + Field = "@field",
256 + Constructor = "@constructor",
257 + Enum = "@field",
258 + Interface = "@type",
259 + Function = "@function",
260 + Variable = "@variable",
261 + Constant = "@constant",
262 + String = "@string",
263 + Number = "@number",
264 + Boolean = "@boolean",
265 + Array = "@field",
266 + Object = "@type",
267 + Key = "@keyword",
268 + Null = "@comment",
269 + EnumMember = "@field",
270 + Struct = "@structure",
271 + Event = "@keyword",
272 + Operator = "@operator",
273 + TypeParameter = "@type",
266 275 -- bit operation dark magic, see below...
267 - enc = function ( line, col, winnr )
268 - return bit.bor( bit.lshift( line, 16 ), bit.lshift( col, 6 ), winnr )
276 + enc = function(line, col, winnr)
277 + return bit.bor(bit.lshift(line, 16), bit.lshift(col, 6), winnr)
270 279 -- line: 16 bit (65535); col: 10 bit (1023); winnr: 6 bit (63)
271 - dec = function ( c )
272 - local line = bit.rshift( c, 16 )
273 - local col = bit.band( bit.rshift( c, 6 ), 1023 )
274 - local winnr = bit.band( c, 63 )
280 + dec = function(c)
281 + local line = bit.rshift(c, 16)
282 + local col = bit.band(bit.rshift(c, 6), 1023)
283 + local winnr = bit.band(c, 63)
275 284 return line, col, winnr
278 - init = function ( self )
279 - local data = require 'nvim-navic'.get_data() or {}
287 + init = function(self)
288 + local data = require("nvim-navic").get_data() or {}
280 289 local children = {}
281 290 -- create a child for each level
282 - for i, d in ipairs( data ) do
291 + for i, d in ipairs(data) do
283 292 -- encode line and column numbers into a single integer
284 - local pos = self.enc( d.scope.start.line, d.scope.start.character, self.winnr )
293 + local pos = self.enc(d.scope.start.line, d.scope.start.character, self.winnr)
285 294 local child = {
287 296 provider = d.icon,
291 300 -- escape `%`s (elixir) and buggy default separators
292 - provider = d.name:gsub( '%%', '%%%%' ):gsub( '%s*->%s*', '' ),
301 + provider = d.name:gsub("%%", "%%%%"):gsub("%s*->%s*", ""),
293 302 -- highlight icon only or location name as well
294 303 hl = self.type_hl[d.type],
296 305 on_click = {
297 306 -- pass the encoded position through minwid
298 307 minwid = pos,
299 - callback = function ( _, minwid )
308 + callback = function(_, minwid)
300 309 -- decode
301 - local line, col, winnr = self.dec( minwid )
302 - vim.api.nvim_win_set_cursor( vim.fn.win_getid( winnr ), { line, col, } )
310 + local line, col, winnr = self.dec(minwid)
311 + vim.api.nvim_win_set_cursor(vim.fn.win_getid(winnr), { line, col })
304 - name = 'heirline_navic',
313 + name = "heirline_navic",
308 317 -- add a separator only if needed
309 318 if #data > 1 and i < #data then
310 - table.insert( child, {
311 - provider = ' > ',
319 + table.insert(child, {
320 + provider = " > ",
312 321 -- hl = { fg = 'bright_fg', },
313 - } )
322 + })
315 - table.insert( children, child )
324 + table.insert(children, child)
317 326 -- instantiate the new child, overwriting the previous one
318 - self.child = self:new( children, 1 )
327 + self.child = self:new(children, 1)
320 329 -- evaluate the children containing navic components
321 - provider = function ( self )
330 + provider = function(self)
322 331 return self.child:eval()
324 333 -- hl = { fg = 'gray', },
325 - update = 'CursorMoved',
334 + update = "CursorMoved",
328 - local diagnostic_enabled = {
329 - init = function ( self )
337 + local diagnostic_enabled = {
338 + init = function(self)
330 339 self.icon = vim.diagnostic.is_disabled() and icon.toggle_off or icon.toggle_on
332 - provider = function ( self )
333 - return icon.diagnostic .. ' ' .. self.icon
341 + provider = function(self)
342 + return icon.diagnostic .. " " .. self.icon
337 - local diagnostic = {
346 + local diagnostic = {
338 347 condition = conditions.has_diagnostics,
340 349 static = {
344 353 hint_icon = icon.hint,
347 - init = function ( self )
348 - self.errors = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.ERROR, } )
349 - self.warnings = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.WARN, } )
350 - self.hints = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.HINT, } )
351 - self.info = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.INFO, } )
356 + init = function(self)
357 + self.errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
358 + self.warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
359 + self.hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
360 + self.info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
354 - update = { 'DiagnosticChanged', 'BufEnter', 'BufLeave', },
363 + update = { "DiagnosticChanged", "BufEnter", "BufLeave" },
357 - provider = function ( self )
366 + provider = function(self)
358 367 -- 0 is just another output, we can decide to print it or not!
359 - return self.errors > 0 and (self.error_icon .. ' ' .. self.errors .. ' ')
368 + return self.errors > 0 and (self.error_icon .. " " .. self.errors .. " ")
361 - hl = 'DiagnosticError',
370 + hl = "DiagnosticError",
364 - provider = function ( self )
365 - return self.warnings > 0 and (self.warn_icon .. ' ' .. self.warnings .. ' ')
373 + provider = function(self)
374 + return self.warnings > 0 and (self.warn_icon .. " " .. self.warnings .. " ")
367 - hl = 'DiagnosticWarn',
376 + hl = "DiagnosticWarn",
370 - provider = function ( self )
371 - return self.info > 0 and (self.info_icon .. ' ' .. self.info .. ' ')
379 + provider = function(self)
380 + return self.info > 0 and (self.info_icon .. " " .. self.info .. " ")
373 - hl = 'DiagnosticInfo',
382 + hl = "DiagnosticInfo",
376 - provider = function ( self )
377 - return self.hints > 0 and (self.hint_icon .. ' ' .. self.hints)
385 + provider = function(self)
386 + return self.hints > 0 and (self.hint_icon .. " " .. self.hints)
379 - hl = 'DiagnosticHint',
388 + hl = "DiagnosticHint",
383 - local is_svn_repo = function ()
384 - local svn_dir = vim.fs.find( '.svn', {
392 + local is_svn_repo = function()
393 + local svn_dir = vim.fs.find(".svn", {
385 394 upward = true,
386 395 stop = vim.uv.os_homedir(),
387 - path = vim.fs.dirname( vim.api.nvim_buf_get_name( 0 ) ),
388 - type = 'directory',
389 - } )
396 + path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
397 + type = "directory",
398 + })
391 - return not vim.tbl_isempty( svn_dir )
400 + return not vim.tbl_isempty(svn_dir)
394 - local svn_get_relative_url = function ()
403 + local svn_get_relative_url = function()
395 404 -- FIXME: replace with vim.system
396 - local job = require 'plenary.job'
397 - local relative_url = { '[ERR]', }
405 + local job = require("plenary.job")
406 + local relative_url = { "[ERR]" }
399 - job:new {
400 - command = 'svn',
401 - args = { 'info', '--show-item', 'relative-url', '--no-newline', },
402 - on_exit = function ( current_job, exit_code )
403 - if exit_code == 0 then relative_url = current_job:result() end
404 - end,
405 - }:sync()
408 + job
409 + :new({
410 + command = "svn",
411 + args = { "info", "--show-item", "relative-url", "--no-newline" },
412 + on_exit = function(current_job, exit_code)
413 + if exit_code == 0 then
414 + relative_url = current_job:result()
415 + end
416 + end,
417 + })
418 + :sync()
407 420 return relative_url[1]
410 - local svn = {
423 + local svn = {
411 424 condition = is_svn_repo,
413 - update = 'BufEnter',
426 + update = "BufEnter",
415 - init = function ( self )
428 + init = function(self)
416 429 self.relative_url = svn_get_relative_url()
420 - provider = function ( self )
421 - return icon.subversion .. ' ' .. icon.branch .. ' ' .. self.relative_url
433 + provider = function(self)
434 + return icon.subversion .. " " .. icon.branch .. " " .. self.relative_url
427 - local git = {
439 + local git = {
428 440 condition = conditions.is_git_repo,
430 - init = function ( self )
442 + init = function(self)
431 443 self.status_dict = vim.b.gitsigns_status_dict
435 - provider = function ( self )
436 - return icon.git .. ' ' .. icon.branch .. ' ' .. self.status_dict.head .. ' '
447 + provider = function(self)
448 + return icon.git .. " " .. icon.branch .. " " .. self.status_dict.head .. " "
440 - provider = function ( self )
452 + provider = function(self)
441 453 local count = self.status_dict.added or 0
442 - return count > 0 and (icon.diff_add .. ' ' .. count .. ' ')
454 + return count > 0 and (icon.diff_add .. " " .. count .. " ")
444 - hl = 'DiffAdd',
456 + hl = "DiffAdd",
447 - provider = function ( self )
459 + provider = function(self)
448 460 local count = self.status_dict.removed or 0
449 - return count > 0 and (icon.diff_remove .. ' ' .. count .. ' ')
461 + return count > 0 and (icon.diff_remove .. " " .. count .. " ")
451 - hl = 'DiffDelete',
463 + hl = "DiffDelete",
454 - provider = function ( self )
466 + provider = function(self)
455 467 local count = self.status_dict.changed or 0
456 - return count > 0 and (icon.diff_change .. ' ' .. count .. ' ')
468 + return count > 0 and (icon.diff_change .. " " .. count .. " ")
458 - hl = 'DiffChange',
470 + hl = "DiffChange",
462 - local work_dir = {
463 - init = function ( self )
464 - self.icon = (vim.fn.haslocaldir( 0 ) == 1 and icon['local'] or '') .. ' ' .. icon.global .. ' '
465 - self.cwd = vim.fs.normalize( vim.uv.cwd() ):gsub( vim.fs.normalize( vim.uv.os_homedir() ), '~' )
474 + local work_dir = {
475 + init = function(self)
476 + self.icon = (vim.fn.haslocaldir(0) == 1 and icon["local"] or "") .. " " .. icon.global .. " "
477 + self.cwd = vim.fs.normalize(vim.uv.cwd()):gsub(vim.fs.normalize(vim.uv.os_homedir()), "~")
468 480 flexible = 1,
471 - provider = function ( self )
483 + provider = function(self)
472 484 return self.icon .. self.cwd
476 - provider = function ( self )
477 - local cwd = vim.fn.pathshorten( self.cwd )
488 + provider = function(self)
489 + local cwd = vim.fn.pathshorten(self.cwd)
478 490 return self.icon .. cwd
482 - provider = '',
494 + provider = "",
486 - local help_file_name = {
487 - condition = function ()
488 - return vim.bo.filetype == 'help'
498 + local help_file_name = {
499 + condition = function()
500 + return vim.bo.filetype == "help"
490 - provider = function ()
491 - local filename = vim.api.nvim_buf_get_name( 0 )
492 - return vim.fn.fnamemodify( filename, ':t' )
502 + provider = function()
503 + local filename = vim.api.nvim_buf_get_name(0)
504 + return vim.fn.fnamemodify(filename, ":t")
494 - hl = 'Question',
506 + hl = "Question",
497 - local terminal_name = {
498 - provider = function ()
499 - local name, _ = vim.api.nvim_buf_get_name( 0 ):gsub( '.*:', '' )
500 - local basename = vim.fs.basename( name )
501 - return icon.terminal .. ' ' .. (basename or 'noname')
509 + local terminal_name = {
510 + provider = function()
511 + local name, _ = vim.api.nvim_buf_get_name(0):gsub(".*:", "")
512 + local basename = vim.fs.basename(name)
513 + return icon.terminal .. " " .. (basename or "noname")
503 - hl = 'Bold',
515 + hl = "Bold",
506 - local togglers = {
507 - provider = function ()
508 - local togglers = require 'bugabinga.options.togglers'
509 - return tostring( togglers )
518 + local togglers = {
519 + provider = function()
520 + local togglers = require("bugabinga.options.togglers")
521 + return tostring(togglers)
513 - local macro_recording = {
514 - condition = function ()
515 - return vim.fn.reg_recording() ~= '' and vim.o.cmdheight == 0
525 + local macro_recording = {
526 + condition = function()
527 + return vim.fn.reg_recording() ~= "" and vim.o.cmdheight == 0
517 - provider = icon.macro .. ' ',
518 - hl = 'PreProc',
519 - utils.surround( { '░▒▓ ', ' ▓▒░', }, nil, {
520 - provider = function ()
529 + provider = icon.macro .. " ",
530 + hl = "PreProc",
531 + utils.surround({ "░▒▓ ", " ▓▒░" }, nil, {
532 + provider = function()
521 533 return vim.fn.reg_recording()
523 - hl = 'Bold',
524 - } ),
535 + hl = "Bold",
536 + }),
525 537 update = {
526 - 'RecordingEnter',
527 - 'RecordingLeave',
538 + "RecordingEnter",
539 + "RecordingLeave",
531 - local lazy = {
532 - condition = function ()
533 - local ok, lazy_status = pcall( require, 'lazy.status' )
543 + local lazy = {
544 + condition = function()
545 + local ok, lazy_status = pcall(require, "lazy.status")
534 546 return ok and lazy_status.has_updates()
536 - update = { 'User', pattern = 'LazyUpdate', },
537 - provider = function () return ' ' .. icon.lazy .. ' ' .. require 'lazy.status'.updates() .. ' ' end,
548 + update = { "User", pattern = "LazyUpdate" },
549 + provider = function()
550 + return " " .. icon.lazy .. " " .. require("lazy.status").updates() .. " "
551 + end,
538 552 on_click = {
539 - callback = function () require 'lazy'.update() end,
540 - name = 'update_plugins',
553 + callback = function()
554 + require("lazy").update()
555 + end,
556 + name = "update_plugins",
544 - local align = { provider = '%=', }
545 - local space = { provider = ' ', }
560 + local align = { provider = "%=" }
561 + local space = { provider = " " }
547 - local default_statusline = {
548 - vi_mode, macro_recording, work_dir, space, git, svn, align,
549 - diagnostic, space, lsp_active, align,
550 - togglers, space, space, diagnostic_enabled, space, lazy, space,
551 - file_encoding, space, file_format, space, file_type, space, file_size, space, file_last_modified,
563 + local default_statusline = {
564 + vi_mode,
565 + macro_recording,
566 + work_dir,
567 + space,
568 + git,
569 + svn,
570 + align,
571 + diagnostic,
572 + space,
573 + lsp_active,
574 + align,
575 + togglers,
576 + space,
577 + space,
578 + diagnostic_enabled,
579 + space,
580 + lazy,
581 + space,
582 + file_encoding,
583 + space,
584 + file_format,
585 + space,
586 + file_type,
587 + space,
588 + file_size,
589 + space,
590 + file_last_modified,
554 - local special_statusline = {
555 - condition = function ()
556 - return conditions.buffer_matches {
593 + local special_statusline = {
594 + condition = function()
595 + return conditions.buffer_matches({
557 596 buftype = ignored.buftypes,
558 597 filetype = ignored.filetypes,
559 - }
598 + })
562 601 file_type,
565 604 align,
568 - local terminal_statusline = {
607 + local terminal_statusline = {
570 - condition = function ()
571 - return conditions.buffer_matches { buftype = { 'terminal', }, }
609 + condition = function()
610 + return conditions.buffer_matches({ buftype = { "terminal" } })
574 - { condition = conditions.is_active, vi_mode, space, },
613 + { condition = conditions.is_active, vi_mode, space },
575 614 file_type,
576 615 space,
577 616 terminal_name,
578 617 align,
581 - local inactive_statusline = {
620 + local inactive_statusline = {
582 621 condition = conditions.is_not_active,
583 622 file_type,
584 623 space,
586 625 align,
589 - local statuslines = {
590 - hl = function ()
628 + local statuslines = {
629 + hl = function()
591 630 if conditions.is_active() then
592 - return 'StatusLine'
631 + return "StatusLine"
594 - return 'StatusLineNC'
633 + return "StatusLineNC"
603 642 default_statusline,
606 - local winbars = {
607 - hl = function ()
645 + local winbars = {
646 + hl = function()
608 647 if conditions.is_active() then
609 - return 'Winbar'
648 + return "Winbar"
611 - return 'WinbarNC'
650 + return "WinbarNC"
615 654 fallthrough = false,
618 - condition = function ()
619 - return conditions.buffer_matches { buftype = { 'terminal', }, }
657 + condition = function()
658 + return conditions.buffer_matches({ buftype = { "terminal" } })
622 661 file_type,
733 772 -- { provider = ' ' .. icon.arrow_right, hl = 'TabLine', }
736 - local tabpage = {
737 - provider = function ( self )
738 - return '%' .. self.tabnr .. 'T ' .. self.tabpage .. ' %T'
775 + local tabpage = {
776 + provider = function(self)
777 + return "%" .. self.tabnr .. "T " .. self.tabpage .. " %T"
740 - hl = function ( self )
779 + hl = function(self)
741 780 if self.is_active then
742 - return 'TabLineSel'
781 + return "TabLineSel"
744 - return 'TabLine'
783 + return "TabLine"
749 - local tab_pages = {
750 - { provider = '%=', },
751 - utils.make_tablist( tabpage ),
788 + local tab_pages = {
789 + { provider = "%=" },
790 + utils.make_tablist(tabpage),
754 793 -- local tabline = { buffer_line, tab_pages, }
756 795 -- local statuscolumn = {}
758 - heirline.setup {
797 + heirline.setup({
759 798 statusline = statuslines,
760 799 winbar = winbars,
761 800 tabline = tab_pages,
765 804 opts = {
766 805 colors = nugu,
767 - disable_winbar_cb = function ( args )
768 - return conditions.buffer_matches(
769 - {
770 - buftype = ignored.buftypes,
771 - filetype = ignored.filetypes,
772 - },
773 - args.buf )
806 + disable_winbar_cb = function(args)
807 + return conditions.buffer_matches({
808 + buftype = ignored.buftypes,
809 + filetype = ignored.filetypes,
810 + }, args.buf)
776 - }
813 + })

neovim/lua/bugabinga/plugins/indent_blankline.lua

Modified
4 4 local icon = require 'std.icon'
6 6 return {
7 7 'lukas-reineke/indent-blankline.nvim',
8 8 version = '3.*',
9 9 main = 'ibl',
10 - event = { 'BufReadPost', 'BufNew', },
10 + event = vim.g.FILE_LOADED_EVENTS,
11 11 opts = {
12 12 debounce = 250,
13 13 indent = {

neovim/lua/bugabinga/plugins/lint.lua

Added
new file mode 100644
1 +--FIXME: own this
2 +local uv = vim.uv or vim.loop
3 +return {
4 + 'mfussenegger/nvim-lint',
5 + ft = {
6 + 'lua',
7 + 'sh',
8 + 'vim',
9 + },
10 + opts = {
11 + linters_by_ft = {
12 + lua = { 'luacheck', },
13 + sh = { 'shellcheck', },
14 + vim = { 'vint', },
15 + },
16 + linters = {},
17 + },
18 + config = function ( _, opts )
19 + local lint = require 'lint'
20 + lint.linters_by_ft = opts.linters_by_ft
21 + for k, v in pairs( opts.linters ) do
22 + lint.linters[k] = v
23 + end
24 + local timer = assert( uv.new_timer() )
25 + local DEBOUNCE_MS = 500
26 + local aug = vim.api.nvim_create_augroup( 'Lint', { clear = true, } )
27 + vim.api.nvim_create_autocmd( { 'BufEnter', 'BufWritePost', 'TextChanged', 'InsertLeave', }, {
28 + group = aug,
29 + callback = function ()
30 + local bufnr = vim.api.nvim_get_current_buf()
31 + timer:stop()
32 + timer:start(
33 + DEBOUNCE_MS,
34 + 0,
35 + vim.schedule_wrap( function ()
36 + if vim.api.nvim_buf_is_valid( bufnr ) then
37 + vim.api.nvim_buf_call( bufnr, function () lint.try_lint( nil, { ignore_errors = true, } ) end )
38 + end
39 + end )
40 + )
41 + end,
42 + } )
43 + lint.try_lint( nil, { ignore_errors = true, } )
44 + end,

neovim/lua/bugabinga/plugins/neorg.lua

Added
new file mode 100644
1 +--FIXME: own this
2 +return {
3 + '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', },
8 + },
9 + ft = 'norg',
10 + cmd = 'Neorg',
11 + opts = {
12 + load = {
13 + ['core.defaults'] = {}, -- Loads default behaviour
14 + ['core.concealer'] = { -- Adds pretty icons to your documents
15 + config = {
16 + icons = {
17 + todo = {
18 + undone = {
19 + icon = ' ',
20 + },
21 + },
22 + },
23 + },
24 + },
25 + ['core.completion'] = {
26 + config = {
27 + engine = 'nvim-cmp',
28 + },
29 + },
30 + -- This is deleting the non-empty contents of files
31 + -- ["core.esupports.metagen"] = {
32 + -- config = {
33 + -- type = "auto",
34 + -- },
35 + -- },
36 + ['core.presenter'] = {
37 + config = {
38 + zen_mode = 'zen-mode',
39 + },
40 + },
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 + },
61 + },
62 + },
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/oil.lua

Modified
1 1 local map = require 'std.map'
2 +local icon = require 'std.icon'
3 4 map.normal {
4 5 description = 'Open parent directory in buffer.',
11 12 return {
12 13 'stevearc/oil.nvim',
14 + lazy = false,
13 15 cmd = { 'Oil', },
14 16 dependencies = { 'nvim-tree/nvim-web-devicons', },
15 - config = function ()
16 - local oil = require 'oil'
17 - oil.setup {
18 - skip_confirm_for_simple_edits = true,
19 - delete_to_trash = true,
20 - -- TODO: does oil support trash on win32?
21 - -- trash_command = 'rm --trash', --nu command
17 + opts = {
18 + -- default_file_explorer = true,
19 + -- Set to true to watch the filesystem for changes and reload oil
20 + -- experimental_watch_for_changes = true,
21 + skip_confirm_for_simple_edits = true,
22 + prompt_save_on_select_new_entry = false,
23 + delete_to_trash = true,
23 - colums = {
24 - 'icon',
25 - 'permissions',
26 - 'size',
27 - 'mtime',
25 + columns = { 'icon', },
26 + buf_options = {
27 + cursorline = true,
28 + },
29 + keymaps = {
30 + ['q'] = 'actions.close',
31 + ['<C-v>'] = 'actions.select_vsplit',
32 + ['<C-s>'] = 'actions.select_split',
33 + ['`'] = 'actions.tcd',
34 + ['~'] = '<cmd>edit $HOME<CR>',
35 + ['<F7>'] = 'actions.open_terminal',
36 + ['gd'] = {
37 + desc = 'Toggle detail view',
38 + callback = function ()
39 + local oil = require 'oil'
40 + local config = require 'oil.config'
41 + if #config.columns == 1 then
42 + oil.set_columns { 'icon', 'permissions', 'size', { 'mtime', format = '%d/%m/%y %T', }, }
43 + else
44 + oil.set_columns { 'icon', }
45 + end
46 + end,
29 - keymaps = {
30 - ['q'] = 'actions.close',
31 - ['<esc>'] = 'actions.close',
32 - ['g?'] = 'actions.show_help',
33 - ['<C-v>'] = 'actions.select_vsplit',
34 - ['<C-s>'] = 'actions.select_split',
35 - ['<C-h>'] = 'actions.toggle_hidden',
36 - },
37 - float = {
38 - max_width = 69,
39 - min_width = 69,
40 - border = vim.g.border_style,
41 - padding = 2,
42 - },
43 - }
44 - end,
48 + },
49 + float = {
50 + max_width = 69,
51 + min_width = 69,
52 + border = vim.g.border_style,
53 + padding = 2,
54 + },
55 + -- Configuration for the floating keymaps help window
56 + keymaps_help = {
57 + border = vim.g.border_style,
58 + },
59 + view_options = {
60 + is_always_hidden = function ( name, bufnr ) return name == '..' end,
61 + show_hidden = true,
62 + },
63 + },

neovim/lua/bugabinga/plugins/outline.lua

Added
new file mode 100644
1 +local map = require 'std.map'
3 +return {
4 + 'SmiteshP/nvim-navbuddy',
5 + dependencies = {
6 + 'SmiteshP/nvim-navic',
7 + 'MunifTanjim/nui.nvim',
8 + },
9 + opts = {
10 + window = {
11 + border = vim.g.border_style,
12 + },
13 + },

neovim/lua/bugabinga/plugins/persistence.lua

Deleted
deleted file mode 100644
1 -local map = require 'std.map'
3 -return {
4 - 'folke/persistence.nvim',
5 - version = '2.*',
6 - event = 'BufReadPre',
7 - opts = {},
8 - config = function ( _, opts )
9 - local persistence = require 'persistence'
10 - persistence.setup( opts )
12 - map.normal {
13 - description = 'Restore session for current directory',
14 - category = 'history',
15 - keys = '<F4>',
16 - command = function () persistence.load() end,
17 - }
19 - map.normal {
20 - description = 'Restore last session',
21 - category = 'history',
22 - keys = '<F4><F4>',
23 - command = function () persistence.load { last = true, } end,
24 - }
25 - end,
26 -}

neovim/lua/bugabinga/plugins/quickfix.lua

Added
new file mode 100644
1 +--FIXME: use map
2 +return {
3 + 'stevearc/qf_helper.nvim',
4 + ft = 'qf',
5 + cmd = { 'QNext', 'QPrev', 'QFToggle', 'QFOpen', 'LLToggle', },
6 + keys = {
7 + { ']q', '<cmd>QNext<CR>', mode = 'n', },
8 + { '[q', '<cmd>QPrev<CR>', mode = 'n', },
9 + { '<leader>q', '<cmd>QFToggle!<CR>', mode = 'n', },
10 + { '<leader>l', '<cmd>LLToggle!<CR>', mode = 'n', },
11 + },
12 + config = function ()
13 + require 'qf_helper'.setup {
14 + prefer_loclist = false,
15 + }
16 + end,

neovim/lua/bugabinga/plugins/sessions.lua

Added
new file mode 100644
1 +local map = require 'std.map'
2 +local auto = require 'std.auto'
4 +local LAST_SESSION = 'last'
6 +auto 'automatic_session_management' {
7 + {
8 + events = 'VimEnter',
9 + description = 'Load automatically saved session for the CWD',
10 + command = function ()
11 + -- Only load the session if nvim was started with no args
12 + if vim.fn.argc( -1 ) == 0 then
13 + -- Save these to a different directory, so our manual sessions don't get polluted
14 + require 'resession'.load( vim.fn.getcwd(), { dir = 'autosession', silence_errors = true, } )
15 + end
16 + end,
17 + },
18 + {
19 + events = 'VimLeavePre',
20 + description = 'Automatically save sessions for the CWD (tab)',
21 + command = function () require 'resession'.save_tab( vim.fn.getcwd(), { dir = 'autosession', notify = false, } ) end,
22 + },
23 + {
24 + events = 'VimLeavePre',
25 + description = 'Automatically save last session (all tabs)',
26 + command = function () require 'resession'.save( LAST_SESSION ) end,
27 + },
30 +map.normal {
31 + description = 'Restore last session',
32 + category = 'history',
33 + keys = '<leader>sl',
34 + command = function () require 'resession'.load( LAST_SESSION ) end,
37 +map.normal {
38 + description = 'Restore a session',
39 + category = 'history',
40 + keys = '<leader>sL',
41 + command = function () require 'resession'.load() end,
44 +map.normal {
45 + description = 'Delete session',
46 + category = 'history',
47 + keys = '<leader>sd',
48 + command = function () require 'resession'.delete() end,
51 +map.normal {
52 + description = 'Save session (tab)',
53 + category = 'history',
54 + keys = '<leader>ss',
55 + command = function () require 'resession'.save_tab() end,
58 +map.normal {
59 + description = 'Save session (all tabs)',
60 + category = 'history',
61 + keys = '<leader>sS',
62 + command = function () require 'resession'.save() end,
65 +return {
66 + 'stevearc/resession.nvim',
67 + version = '1.*',
68 + event = 'VeryLazy',
69 + opts = {
70 + autosave = { enable = true, },
71 + -- Save and restore these options
72 + options = {
73 + 'binary',
74 + 'bufhidden',
75 + 'buflisted',
76 + 'cmdheight',
77 + 'diff',
78 + 'filetype',
79 + 'modifiable',
80 + 'previewwindow',
81 + 'readonly',
82 + 'scrollbind',
83 + 'winfixheight',
84 + 'winfixwidth',
85 + 'cursorline',
86 + 'virtualedit',
87 + 'number',
88 + 'spell',
89 + },
90 + -- only save buffers that are associated with the cwd of the current tab
91 + tab_buf_filter = function ( tabpage, bufnr )
92 + local dir = vim.fn.getcwd( -1, vim.api.nvim_tabpage_get_number( tabpage ) )
93 + -- ensure dir has trailing /
94 + dir = dir:sub( -1 ) ~= '/' and dir .. '/' or dir
95 + return vim.startswith( vim.api.nvim_buf_get_name( bufnr ), dir )
96 + end,
97 + },

neovim/lua/bugabinga/plugins/snippets.lua

Added
new file mode 100644
1 +--FIXME: own this
2 +return {
3 + 'L3MON4D3/LuaSnip',
4 + dependencies = {
5 + 'stevearc/vim-vscode-snippets',
6 + },
7 + event = 'InsertEnter *',
8 + config = function ()
9 + local luasnip = require 'luasnip'
10 + local has_vim_snippet, snippet = pcall( require, 'vim.snippet' )
11 + require 'luasnip.loaders.from_vscode' .lazy_load()
12 + vim.keymap.set( 's', '<Tab>', '<Plug>luasnip-jump-next' )
13 + vim.keymap.set( 's', '<C-h>', '<Plug>luasnip-jump-prev' )
14 + vim.keymap.set( 's', '<C-l>', '<Plug>luasnip-jump-next' )
15 + vim.keymap.set( { 'i', 's', }, '<C-k>', function () pcall( luasnip.change_choice, -1 ) end )
16 + vim.keymap.set( { 'i', 's', }, '<C-j>', function () pcall( luasnip.change_choice, 1 ) end )
18 + local aug = vim.api.nvim_create_augroup( 'ClearLuasnipSession', { clear = true, } )
19 + -- Can't use InsertLeave here because that fires when we go to select mode
20 + vim.api.nvim_create_autocmd( 'CursorHold', {
21 + desc = 'Deactivate snippet after leaving insert/select mode',
22 + pattern = '*',
23 + group = aug,
24 + callback = function ()
25 + vim.cmd.LuaSnipUnlinkCurrent { mods = { emsg_silent = true, }, }
26 + if has_vim_snippet then
27 + snippet.exit()
28 + end
29 + end,
30 + } )
32 + vim.keymap.set( 'i', '<C-h>', function ()
33 + if luasnip.get_active_snip() then
34 + luasnip.jump( -1 )
35 + elseif has_vim_snippet and snippet.active() then
36 + snippet.jump( -1 )
37 + else
38 + local cur = vim.api.nvim_win_get_cursor( 0 )
39 + pcall( vim.api.nvim_win_set_cursor, 0, { cur[1], cur[2] - 1, } )
40 + end
41 + end )
42 + vim.keymap.set( 'i', '<C-l>', function ()
43 + if luasnip.get_active_snip() then
44 + luasnip.jump( 1 )
45 + elseif has_vim_snippet and snippet.active() then
46 + snippet.jump( 1 )
47 + else
48 + local cur = vim.api.nvim_win_get_cursor( 0 )
49 + pcall( vim.api.nvim_win_set_cursor, 0, { cur[1], cur[2] + 1, } )
50 + end
51 + end )
53 + -- Required to support nested placeholders
54 + -- From https://github.com/L3MON4D3/LuaSnip/wiki/Nice-Configs#imitate-vscodes-behaviour-for-nested-placeholders
55 + local util = require 'luasnip.util.util'
57 + luasnip.config.setup {
58 + store_selection_keys = '<Tab>',
59 + updateevents = 'TextChanged,TextChangedI',
60 + parser_nested_assembler = function ( _, snippet )
61 + local select = function ( snip, no_move )
62 + snip.parent:enter_node( snip.indx )
63 + -- upon deletion, extmarks of inner nodes should shift to end of
64 + -- placeholder-text.
65 + for _, node in ipairs( snip.nodes ) do
66 + node:set_mark_rgrav( true, true )
67 + end
69 + -- SELECT all text inside the snippet.
70 + if not no_move then
71 + vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( '<Esc>', true, false, true ), 'n', true )
72 + local pos_begin, pos_end = snip.mark:pos_begin_end()
73 + util.normal_move_on( pos_begin )
74 + vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( 'v', true, false, true ), 'n', true )
75 + util.normal_move_before( pos_end )
76 + vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( 'o<C-G>', true, false, true ), 'n', true )
77 + end
78 + end
79 + function snippet:jump_into( dir, no_move )
80 + if self.active then
81 + -- inside snippet, but not selected.
82 + if dir == 1 then
83 + self:input_leave()
84 + return self.next:jump_into( dir, no_move )
85 + else
86 + select( self, no_move )
87 + return self
88 + end
89 + else
90 + -- jumping in from outside snippet.
91 + self:input_enter()
92 + if dir == 1 then
93 + select( self, no_move )
94 + return self
95 + else
96 + return self.inner_last:jump_into( dir, no_move )
97 + end
98 + end
99 + end
101 + -- this is called only if the snippet is currently selected.
102 + function snippet:jump_from( dir, no_move )
103 + if dir == 1 then
104 + return self.inner_first:jump_into( dir, no_move )
105 + else
106 + self:input_leave()
107 + return self.prev:jump_into( dir, no_move )
108 + end
109 + end
111 + return snippet
112 + end,
114 + end,

neovim/lua/bugabinga/plugins/starter.lua

Deleted
deleted file mode 100644
1 -local auto = require 'std.auto'
2 -local icon = require 'std.icon'
4 -return {
5 - 'echasnovski/mini.starter',
6 - lazy = false,
7 - config = function ()
8 - local starter = require 'mini.starter'
9 - local is_home = vim.uv.cwd() == vim.uv.os_homedir()
11 - local custom_actions = {
12 - { name = 'Find files', action = 'Telescope find_files', section = 'Builtin actions', },
13 - { name = 'Explore files', action = 'Oil', section = 'Builtin actions', },
14 - }
16 - local sessions = function ( limit )
17 - limit = limit or 8
18 - local persistence = require 'persistence'
19 - local persistence_config = require 'persistence.config'
20 - local sessions = persistence.list()
21 - table.sort( sessions, function ( a, b )
22 - return vim.loop.fs_stat( a ).mtime.sec > vim.loop.fs_stat( b ).mtime.sec
23 - end )
24 - return vim.iter( sessions )
25 - :slice( 1, limit )
26 - :map( function ( session_path )
27 - -- session files encode their cwd as an escaped path in their file name
28 - -- t = tail of name
29 - -- r = remove extension
30 - -- gs = replace all % with /
31 - -- ~ = relative to home
32 - local name = vim.fn.fnamemodify( session_path, ':t:r:gs_%_/_:~' )
33 - local session_restore = 'silent! source ' .. vim.fn.fnameescape( session_path )
34 - local action = function ()
35 - vim.cmd( session_restore )
36 - vim.notify( 'Restored session: ' .. name )
37 - end
38 - local section = 'Sessions'
40 - return { name = name, action = action, section = section, }
41 - end )
42 - :totable()
43 - end
45 - starter.setup {
46 - footer = (function ()
47 - local startuptime
49 - auto 'display_startup_time' {
50 - description = 'Display startup time on starter screen',
51 - events = 'User',
52 - pattern = 'LazyVimStarted',
53 - once = true,
54 - command = vim.schedule_wrap( function ()
55 - if vim.bo.filetype == 'starter' then
56 - startuptime = require 'lazy'.stats().startuptime
57 - starter.refresh()
58 - end
59 - end ),
60 - }
62 - return function ()
63 - return icon.start .. ' ' .. (startuptime or ' ') .. 'ms'
64 - end
65 - end)(),
66 - header = [[
67 -███ ▄ ▄▀ ██ ███ ▄█ ▄ ▄▀ ██
68 -█ █ █ ▄▀ █ █ █ █ ██ █ ▄▀ █ █
69 -█ ▀ ▄ █ █ █ ▀▄ █▄▄█ █ ▀ ▄ ██ ██ █ █ ▀▄ █▄▄█
70 -█ ▄▀ █ █ █ █ █ █ █ ▄▀ ▐█ █ █ █ █ █ █ █
71 -███ █▄ ▄█ ███ █ ███ ▐ █ █ █ ███ █
72 - ▀▀▀ █ █ ██ █
73 - ▀ ▀]],
74 - items = {
75 - starter.sections.builtin_actions(),
76 - custom_actions,
77 - sessions,
78 - starter.sections.recent_files( is_home and 24 or 8, not is_home, is_home ),
79 - },
80 - content_hooks = {
81 - starter.gen_hook.adding_bullet(),
82 - starter.gen_hook.aligning( 'center', 'center' ),
83 - starter.gen_hook.indexing( 'all', { 'Recent files', 'Recent files (current directory)', 'Builtin actions', } ),
84 - },
85 - }
86 - end,
87 -}

neovim/lua/bugabinga/plugins/sudo.lua

Added
new file mode 100644
1 +return { 'lambdalisue/suda.vim', cmd = { 'SudaRead', 'SudaWrite', }, }

neovim/lua/bugabinga/plugins/symbols-outline.lua

Deleted
deleted file mode 100644
1 -local map = require 'std.map'
3 -map.normal {
4 - description = 'Open overview of symbols in current buffer',
5 - category = 'lsp',
6 - keys = '<leader>lo',
7 - command = function () require 'navbuddy'.open( 0 ) end,
8 -}
10 -return {
11 - 'SmiteshP/nvim-navbuddy',
12 - cmd = 'NavBuddy',
13 - dependencies = {
14 - 'SmiteshP/nvim-navic',
15 - 'MunifTanjim/nui.nvim',
16 - },
17 - opts = {
18 - window = {
19 - border = vim.g.border_style,
20 - },
21 - },
22 -}

neovim/lua/bugabinga/plugins/tasks.lua

Added
new file mode 100644
1 +--FIXME: own this and integrate
2 +return {
3 + {
4 + 'stevearc/resession.nvim',
5 + lazy = true,
6 + opts = {
7 + extensions = {
8 + overseer = {
9 + status = { 'RUNNING', },
10 + },
11 + },
12 + },
13 + },
14 + {
15 + 'stevearc/overseer.nvim',
16 + cmd = {
17 + 'Grep',
18 + 'Make',
19 + 'OverseerDebugParser',
20 + 'OverseerInfo',
21 + 'OverseerOpen',
22 + 'OverseerRun',
23 + 'OverseerRunCmd',
24 + 'OverseerToggle',
25 + },
26 + keys = {
27 + { '<leader>oo', '<cmd>OverseerToggle<CR>', mode = 'n', },
28 + { '<leader>or', '<cmd>OverseerRun<CR>', mode = 'n', },
29 + { '<leader>oc', '<cmd>OverseerRunCmd<CR>', mode = 'n', },
30 + { '<leader>ol', '<cmd>OverseerLoadBundle<CR>', mode = 'n', },
31 + { '<leader>ob', '<cmd>OverseerToggle! bottom<CR>', mode = 'n', },
32 + { '<leader>od', '<cmd>OverseerQuickAction<CR>', mode = 'n', },
33 + { '<leader>os', '<cmd>OverseerTaskAction<CR>', mode = 'n', },
34 + },
35 + opts = {
36 + templates = { builtin = true, },
37 + strategy = { 'jobstart', },
38 + dap = false,
39 + log = {
40 + {
41 + type = 'echo',
42 + level = vim.log.levels.WARN,
43 + },
44 + {
45 + type = 'file',
46 + filename = 'overseer.log',
47 + level = vim.log.levels.DEBUG,
48 + },
49 + },
50 + task_launcher = {
51 + bindings = {
52 + n = {
53 + ['<leader>c'] = 'Cancel',
54 + },
55 + },
56 + },
57 + component_aliases = {
58 + default = {
59 + {
60 + 'display_duration',
61 + detail_level = 2,
62 + },
63 + 'on_output_summarize',
64 + 'on_exit_set_status',
65 + { 'on_complete_notify', system = 'unfocused', },
66 + 'on_complete_dispose',
67 + },
68 + default_neotest = {
69 + 'unique',
70 + { 'on_complete_notify', system = 'unfocused', on_change = true, },
71 + 'default',
72 + },
73 + },
74 + post_setup = {},
75 + },
76 + config = function ( _, opts )
77 + opts.templates = vim.tbl_keys( opts.templates )
78 + local overseer = require 'overseer'
79 + overseer.setup( opts )
80 + for _, cb in pairs( opts.post_setup ) do
81 + cb()
82 + end
83 + vim.api.nvim_create_user_command( 'OverseerDebugParser', 'lua require("overseer").debug_parser()', {} )
84 + vim.api.nvim_create_user_command( 'Grep', function ( params )
85 + local args = vim.fn.expandcmd( params.args )
86 + -- Insert args at the '$*' in the grepprg
87 + local cmd, num_subs = vim.o.grepprg:gsub( '%$%*', args )
88 + if num_subs == 0 then
89 + cmd = cmd .. ' ' .. args
90 + end
91 + local cwd
92 + local has_oil, oil = pcall( require, 'oil' )
93 + if has_oil then
94 + cwd = oil.get_current_dir()
95 + end
96 + local task = overseer.new_task {
97 + cmd = cmd,
98 + cwd = cwd,
99 + name = 'grep ' .. args,
100 + components = {
102 + 'on_output_quickfix',
103 + errorformat = vim.o.grepformat,
104 + open = not params.bang,
105 + open_height = 8,
106 + items_only = true,
107 + },
108 + -- We don't care to keep this around as long as most tasks
109 + { 'on_complete_dispose', timeout = 30, },
110 + 'default',
111 + },
113 + task:start()
114 + end, { nargs = '*', bang = true, bar = true, complete = 'file', } )
116 + vim.api.nvim_create_user_command( 'Make', function ( params )
117 + -- Insert args at the '$*' in the makeprg
118 + local cmd, num_subs = vim.o.makeprg:gsub( '%$%*', params.args )
119 + if num_subs == 0 then
120 + cmd = cmd .. ' ' .. params.args
121 + end
122 + local task = require 'overseer'.new_task {
123 + cmd = vim.fn.expandcmd( cmd ),
124 + components = {
125 + { 'on_output_quickfix', open = not params.bang, open_height = 8, },
126 + 'unique',
127 + 'default',
128 + },
130 + task:start()
131 + end, {
132 + desc = 'Run your makeprg as an Overseer task',
133 + nargs = '*',
134 + bang = true,
135 + } )
136 + end,
137 + }, }

neovim/lua/bugabinga/plugins/telescope.lua

Modified
84 84 'nvim-lua/plenary.nvim',
85 85 'nvim-tree/nvim-web-devicons',
86 86 'nvim-telescope/telescope-symbols.nvim',
87 - 'nvim-telescope/telescope-ui-select.nvim',
88 87 'jvgrootveld/telescope-zoxide',
90 89 config = function ()
99 98 telescope.setup {
100 99 defaults = {
101 - path_display = { 'truncate', },
102 - sorting_strategy = 'ascending',
103 100 layout_config = {
104 101 horizontal = { prompt_position = 'bottom', preview_width = 0.69, },
105 102 vertical = { mirror = false, },
110 107 prompt_prefix = icon.telescope .. ' ',
111 108 selection_caret = icon.arrow_right .. ' ',
112 - border = vim.g.border_style,
113 109 file_ignore_patterns = {
114 110 '.git/',
115 111 '.svn/',
135 131 n = { q = actions.close, },
138 - pickers = {
139 - find_files = ivy,
140 - fd = ivy,
141 - keymaps = dropdown,
142 - diagnostics = dropdown,
143 - symbols = cursor,
144 - live_grep = ivy,
145 - current_buffer_fuzzy_find = cursor,
146 - buffers = cursor,
147 - help_tags = dropdown,
148 - },
134 + -- FIXME: some thems have an issue, where filtered results do not get selected and are thuis not in view
135 + -- pickers = {
136 + -- find_files = ivy,
137 + -- fd = ivy,
138 + -- keymaps = dropdown,
139 + -- diagnostics = dropdown,
140 + -- symbols = cursor,
141 + -- live_grep = ivy,
142 + -- current_buffer_fuzzy_find = cursor,
143 + -- buffers = cursor,
144 + -- help_tags = dropdown,
145 + -- },
149 146 extensions = {
150 - ['ui-select'] = { cursor, },
151 147 zoxide = { prompt_title = 'Navigate deez nuts!', },
155 - telescope.load_extension 'ui-select'
156 151 telescope.load_extension 'zoxide'

neovim/lua/bugabinga/plugins/tests.lua

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

neovim/lua/bugabinga/plugins/tint.lua

Added
new file mode 100644
1 +return { 'levouh/tint.nvim', opts = {}, }

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

Modified
2 2 return {
3 3 'folke/todo-comments.nvim',
4 4 version = '1.*',
5 5 dependencies = { 'nvim-lua/plenary.nvim', },
6 - event = 'BufReadPost',
6 + event = vim.g.FILE_LOADED_EVENTS,
7 7 opts = {},

neovim/lua/bugabinga/plugins/treesitter.lua

Modified
21 21 'nvim-treesitter/nvim-treesitter',
22 22 -- version = '0.*',
23 23 branch = 'master',
24 - event = { 'BufReadPre', 'BufNewFile', },
24 + -- restoring session throws errors, if this is lazy
25 + lazy = false,
25 26 build = function ()
26 27 require 'nvim-treesitter.install'.update { with_sync = true, }
39 40 install.prefer_git = false
40 41 install.compilers = { 'zig', 'clang', 'gcc', 'cl', 'cc', vim.fn.getenv 'CC', }
44 + local should_disable = function ( _, bufnr )
45 + local max_filesize = 5 * 1024 * 1024 --MiB
46 + local ok, stats = pcall( vim.loop.fs_stat, vim.api.nvim_buf_get_name( bufnr or 0 ) )
47 + if ok and stats and stats.size > max_filesize then
48 + return true
49 + end
50 + return false
51 + end
42 53 ---@diagnostic disable-next-line: missing-fields
43 54 configs.setup {
44 55 sync_install = false,
67 78 'zig',
70 - ignore_install = { 'oil', },
81 + ignore_install = { 'oil', disable = should_disable, },
72 83 auto_install = true,
74 - autotag = { enable = true, },
85 + autotag = { enable = true, disable = should_disable, },
76 87 highlight = {
77 88 enable = true,
78 - disable = function ( _, buf )
79 - local max_filesize = 1000 * 1024 -- 1000 KiB
80 - local ok, stats = pcall( vim.loop.fs_stat, vim.api.nvim_buf_get_name( buf ) )
81 - if ok and stats and stats.size > max_filesize then
82 - return true
83 - end
84 - end,
89 + disable = should_disable,
85 90 additional_vim_regex_highlighting = false,
88 93 incremental_selection = {
89 94 enable = true,
95 + disable = should_disable,
90 96 keymaps = {
91 97 init_selection = '<up>',
92 98 node_incremental = '<right>',
100 106 playground = {
101 107 enable = true,
108 + disable = should_disable,
102 109 disable = {},
103 110 updatetime = 25,
104 111 persist_queries = false,
119 126 textobjects = {
120 127 select = {
121 128 enable = true,
129 + disable = should_disable,
122 130 lookahead = true,
123 131 keymaps = {
124 132 ['af'] = { query = '@call.outer', desc = 'outer function call', },
163 171 swap = {
164 172 enable = true,
173 + disable = should_disable,
165 174 swap_next = {
166 - ['<leader>spn'] = { query = '@parameter.inner', desc = 'Swap parameter with next', },
175 + ['<leader>rwn'] = { query = '@parameter.inner', desc = 'Swap parameter with next', },
168 177 swap_previous = {
169 - ['<leader>spp'] = { query = '@parameter.inner', desc = 'Swap parameter with previous', },
178 + ['<leader>rwp'] = { query = '@parameter.inner', desc = 'Swap parameter with previous', },
173 182 lsp_interop = {
174 183 enable = true,
184 + disable = should_disable,
175 185 border = vim.g.border_style,
176 186 floating_preview_opts = {},
177 187 peek_definition_code = {
183 193 move = {
184 194 enable = true,
195 + disable = should_disable,
185 196 set_jumps = true,
186 197 goto_next = {
187 198 [']f'] = { query = '@call.outer', desc = 'Goto next function call', },
205 216 parsers.get_parser_configs().just = {
206 217 install_info = {
207 218 url = 'https://github.com/IndianBoy42/tree-sitter-just', -- local path or git repo
208 - files = { 'src/parser.c', 'src/scanner.cc', },
219 + files = { 'src/parser.c', 'src/scanner.c', },
209 220 branch = 'main',
211 222 maintainers = { '@IndianBoy42', },

neovim/lua/bugabinga/plugins/treesj.lua

Modified
1 -local map = require 'std.map'
1 +local map = require("std.map")
3 -map.normal {
4 - description = 'Toggle Tree Join/Split',
5 - category = 'editing',
3 +map.normal({
4 + description = "Toggle Tree Join/Split",
5 + category = "editing",
6 6 -- WARN: <C-j> produces the same keycode as <C-enter> on some terminals
7 - keys = '<C-j>',
8 - command = function () require 'treesj'.toggle() end,
9 -}
7 + keys = "<C-j>",
8 + command = function()
9 + require("treesj").toggle()
10 + end,
11 +})
11 13 return {
12 - 'Wansmer/treesj',
13 - keys = '<C-j>',
14 - dependencies = { 'nvim-treesitter/nvim-treesitter', },
15 - opts = {
16 - use_default_keymaps = false,
17 - },
14 + "Wansmer/treesj",
15 + dependencies = { "nvim-treesitter/nvim-treesitter" },
16 + opts = { use_default_keymaps = false },

neovim/lua/bugabinga/plugins/virt-column.lua

Modified
3 3 local ignored = require 'std.ignored'
5 5 return {
6 6 'lukas-reineke/virt-column.nvim',
7 7 version = '2.*',
8 - event = { 'BufReadPost', 'BufNew', },
8 + event = vim.g.FILE_LOADED_EVENTS,
9 9 opts = {
10 - -- FIXME: I have visual redrawing bugs right now.
11 - enabled = false,
12 - char = { '░', '▒', '▓', },
10 + char = { '┆', '╎', '│', },
13 11 exclude = {
14 12 filetypes = ignored.filetypes,
15 13 buftypes = ignored.buftypes,

neovim/lua/bugabinga/plugins/whichkey.lua

Modified
42 42 ['<leader>'] = {
43 43 m = { name = '|m|ark', _ = 'which_key_ignore', },
44 44 h = { name = '|h|unk', _ = 'which_key_ignore', },
45 - r = { name = '|r|efactor', _ = 'which_key_ignore', },
46 45 f = { name = '|f|iles', _ = 'which_key_ignore', },
47 46 g = { name = '|g|enerate', _ = 'which_key_ignore', },
48 47 v = { name = '|v|ersion control', _ = 'which_key_ignore', },
49 - l = { name = '|l|sp', _ = 'which_key_ignore',
50 - p = { name = '|p|eek', _ = 'which_key_ignore', },
51 - c = { name = '|c|alls', _ = 'which_key_ignore', },
52 - },
53 - s = { name = '|s|wap', _ = 'which_key_ignore',
48 + s = { name = '|s|essions', _ = 'which_key_ignore', },
49 + r = { name = '|r|efactor', _ = 'which_key_ignore', },
50 + w = { name = 's|w|ap', _ = 'which_key_ignore',
55 52 p = { name = '|p|arameter', _ = 'which_key_ignore', },
55 + l = { name = '|l|sp', _ = 'which_key_ignore',
56 + p = { name = '|p|eek', _ = 'which_key_ignore', },
57 + c = { name = '|c|alls', _ = 'which_key_ignore', },
58 + },
58 59 t = { name = '|t|oggle', _ = 'which_key_ignore',
60 61 o = { name = '|o|ptions', _ = 'which_key_ignore', },

neovim/lua/std/auto.lua

Modified
1 --- TODO: metatable for api like map.modes
2 --- Wrapper over `vim.api.nvim_create_autocmd` for automatic grouping and idempotency.
3 -return function(group_name)
4 - local group = vim.api.nvim_create_augroup(group_name, { clear = true })
5 - return function(list_of_autocommands)
1 +--- Wrapper over `vim.api.nvim_create_autocmd` for automatic grouping and idempotency.
2 +--- @param group_name string name of the group of autocommands to define
3 +--- @return function a function to add new autocommands to the defined group
4 +return function ( group_name )
5 + local group = vim.api.nvim_create_augroup( group_name, { clear = true, } )
6 + --- adds new autocommands to the outer group
7 + --- @param list_of_autocommands table a single autocommand definition, or a list of those.
8 + return function ( list_of_autocommands )
6 9 if list_of_autocommands.events then
7 - list_of_autocommands = { list_of_autocommands }
10 + list_of_autocommands = { list_of_autocommands, }
9 - for _, autocommand in pairs(list_of_autocommands) do
12 + for _, autocommand in pairs( list_of_autocommands ) do
10 13 -- command and callback are mutually exclusive.
11 14 -- one of them has to be nil
12 15 local command = nil
13 16 local callback = nil
14 - if type(autocommand.command) == 'function' then
17 + if type( autocommand.command ) == 'function' then
15 18 callback = autocommand.command
16 19 else
17 20 command = autocommand.command
19 - vim.api.nvim_create_autocmd(autocommand.events, {
22 + vim.api.nvim_create_autocmd( autocommand.events, {
20 23 desc = autocommand.description,
21 24 group = group,
22 25 buffer = autocommand.buffer,
24 27 once = autocommand.once,
25 28 command = command,
26 29 callback = callback,
27 - })
30 + } )

neovim/lua/std/localrc.lua

Added
new file mode 100644
1 +return function ( file_name )
2 + local filepath = vim.fn.fnamemodify( file_name, ':p' )
3 + local file = vim.secure.read( filepath )
4 + if not file then
5 + return {}
6 + end
7 + return loadstring( file )()
8 +end

neovim/lua/std/project.lua

Modified
50 50 -- Assuming you want to determine the root of your current buffer, that is part
51 51 -- of some project.
52 52 -- Buffer: `/home/user/workspace/some\_project/a/b/c/d/the\_buffer.c`
53 --- Project root: `/home/user/workspace/some\_project`
54 --- -> contains `.git`, `README` and `Makefile`
53 +-- Project root: `/home/user/workspace/some\_project` -> contains `.git`, `README` and `Makefile`
56 55 -- ```lua
57 56 -- local project = require'std.project'
58 57 -- local current_buffer = vim.api.nvim_buf_get_name(0)
59 58 -- local markers = {
60 --- { name = ".git", weight = MAYBE },
61 --- { name = "README", weight = LIKELY },
62 --- { naem = "Makefile", weight = DEFINITLY },
59 +-- { name = ".git", weight = MAYBE },
60 +-- { name = "README", weight = LIKELY },
61 +-- { naem = "Makefile", weight = DEFINITLY },
64 63 -- local root = project.find_root(current_buffer, markers, vim.uv.os_homedir())
65 64 -- print(root) -- /home/user/workspace/some_project
165 164 local function find_project_root( path, markers )
166 165 -- define some language-independent markers
167 166 local default_markers = {
167 + { name = '.project_model.lua', weight = DEFINITLY, },
168 + { name = '.lazy.specs.lua', weight = DEFINITLY, },
169 + { name = '.editorconfig', weight = LIKELY, },
168 170 { name = '.git', weight = LIKELY, },
169 171 { name = '.gitignore', weight = LIKELY, },
170 172 { name = '.svn', weight = LIKELY, },
171 173 { name = 'justfile', weight = LIKELY, },
174 + { name = 'Makefile', weight = LIKELY, },
172 175 { name = 'Jenkinsfile', weight = MAYBE, },
173 - { name = '.editorconfig', weight = MAYBE, },
174 176 { name = 'LICENSE', weight = MAYBE, },
175 177 { name = 'LICENSE.md', weight = MAYBE, },
176 178 { name = 'LICENSE.txt', weight = MAYBE, },
177 179 { name = 'COPYING', weight = MAYBE, },
178 180 { name = 'README', weight = MAYBE, },
179 181 { name = 'README.md', weight = MAYBE, },
180 - { name = 'Makefile', weight = LIKELY, },
181 182 { name = 'flake.nix', weight = MAYBE, },
182 183 { name = 'flake.nix', weight = MAYBE, },
183 - { name = '.project_model.lua', weight = DEFINITLY, },
186 186 markers = markers or {}

neovim/neovim.yml

Modified
23 23 - type: function
24 24 vim:
25 25 any: true
26 + bit:
27 + any: true

neovim/spell/de.utf-8.add

Modified
1 1 Enums
2 2 Skripte
3 +startuptime

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

Modified

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

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

neovim/spell/en.utf-8.add

Added
new file mode 100644

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

Modified

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

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

neovim/spell/nerd.utf-8.add

Modified
25 25 autopairs
26 26 cterm/!
27 +resession
28 +configs
29 +BufNewFile
30 +LuaLS

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.

neovim/spell/pl.utf-8.add

Added
new file mode 100644

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

Added
new file mode 100644

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