repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: enables project local overrides for lsp settings, some neovim opitons, save actions.

5ba4c370b533a104d8b893760f91368ed48b390d

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (33)

neovim/.editorconfig

Modified
1 -# see https://github.com/CppCXY/EmmyLuaCodeStyle
2 -[*.lua]
1 +root = true
3 +[*]
4 +spell = true
6 +[*.lua]
7 +diagnostic = true
9 +# see https://github.com/CppCXY/EmmyLuaCodeStyle
4 10 # optional space/tab
5 11 indent_style = space
6 12 # if indent_style is space, this is valid

neovim/.lazy.specs.lua

Modified
1 1 return {
3 - 'WhoIsSethDaniel/mason-tool-installer.nvim',
3 + "WhoIsSethDaniel/mason-tool-installer.nvim",
4 4 opts = {
5 5 ensure_installed = {
6 - 'gitleaks',
7 - 'mdslw',
6 + "gitleaks",
7 + "mdslw",
8 + "vint",

neovim/.lsp.settings.lua

Added
new file mode 100644

No text changes.

neovim/.save.actions.lua

Added
new file mode 100644
1 +return { 'Format', }

neovim/README.md

Modified
35 35 ~ Shirou Emiya
37 -.
39 37 # todo
41 39 * 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...
40 +* integrate language tool?
41 +* ]s [s to jump to spelling mistakes
45 42 * 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 43 * make lsp config extensible, so that plugin configs can hook into it (e.g. on_attach)
48 -* scavenge stevearc dotfiles for nvim goodies
49 44 * write plugin to parse lsp settings locally and apply them
50 45 * pandoc with lua filters for diagrams for generating documents and previewing --> https://github.com/tex/vimpreviewpandoc
51 -* learn marks and refactor mark.lua
46 +* once a terminal was open, i cannot quit with :wqa anymore...
52 47 * create facade over vim.api.nvim_create_user_command
53 48 * use ltex-ls for markdown, code comments and commit messages
49 +* learn from <https://github.com/stevearc/dotfiles/blob/master/.config/nvim/plugin/exrc.lua> and maybe adapt `std.localrc`
54 50 * setup DAP
55 51 * nvim spell for camel case words
52 +* learn marks and refactor mark.lua
56 53 * add nu-check to nvim-lint
57 54 * create skeleton-plugin for default file content based on file type (BufNewFile?)
58 55 * add support for Java multi line string in autopairs

neovim/init.lua

Modified
18 18 -- set general neovim editor settings
19 19 ok, loaded = pcall( require, 'bugabinga.options' )
20 -if not ok then vim.print( 'error while loading options', loaded ) end
20 +if not ok then
21 + vim.print( 'error while loading options', loaded )
22 +end
24 +-- extends default editorconfig options
25 +ok, loaded = pcall( require, 'bugabinga.editorconfig' )
26 +if not ok then
27 + vim.print( 'error while loading editorconfg extensions', loaded )
28 +end
22 30 -- install plugin manager and declare plugins to use
23 31 ok, loaded = pcall( require, 'bugabinga.lazy' )
24 -if not ok then vim.print( 'error while loading lazy', loaded ) end
32 +if not ok then
33 + vim.print( 'error while loading lazy', loaded )
34 +end
26 36 -- configures the vim diagnostic subsystem
27 37 ok, loaded = pcall( require, 'bugabinga.diagnostic' )
28 -if not ok then vim.print( 'error while loading diagnostic', loaded ) end
38 +if not ok then
39 + vim.print( 'error while loading diagnostic', loaded )
40 +end
30 --- Defines `TrimTrailingWhitespace` command
31 -ok, loaded = pcall( require, 'bugabinga.trim' )
32 -if not ok then vim.print( 'error while loading trim', loaded ) end
42 +-- project local save actions
43 +ok, loaded = pcall( require, 'bugabinga.save_actions' )
44 +if not ok then
45 + vim.print( 'error while loading save_actions', loaded )
46 +end
34 48 -- visualize marks in signcolumn
35 49 ok, loaded = pcall( require, 'bugabinga.mark' )
36 -if not ok then vim.print( 'error while loading mark', loaded ) end
50 +if not ok then
51 + vim.print( 'error while loading mark', loaded )
52 +end
38 54 -- setup lsp clients
39 55 ok, loaded = pcall( require, 'bugabinga.lsp' )
40 -if not ok then vim.print( 'error while loading lsp', loaded ) end
56 +if not ok then
57 + vim.print( 'error while loading lsp', loaded )
58 +end

neovim/lazy-lock.json

Modified
3 3 "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
4 4 "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" },
5 5 "actions-preview.nvim": { "branch": "master", "commit": "5072b1b1065a6b22bdd46b5c21780a91d6a08071" },
6 - "aerial.nvim": { "branch": "master", "commit": "993142d49274092c64a2d475aa726df3c323949d" },
6 + "aerial.nvim": { "branch": "master", "commit": "51a07949abf169b4cad30e14c165ac1ec0ce4e6f" },
7 7 "auto-dark-mode.nvim": { "branch": "master", "commit": "e328dc463d238cb7d690fb4daf068eba732a5a14" },
8 8 "better-escape.nvim": { "branch": "master", "commit": "7e86edafb8c7e73699e0320f225464a298b96d12" },
9 9 "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
16 16 "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
17 17 "fidget.nvim": { "branch": "main", "commit": "4e854f3299e21d1c18279add340428a97520fc44" },
18 18 "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
19 - "gitsigns.nvim": { "branch": "main", "commit": "078041e9d060a386b0c9d3a8c7a7b019a35d3fb0" },
19 + "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
20 20 "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
21 21 "heirline.nvim": { "branch": "master", "commit": "03cff30d7e7d3ba6fdc00925f015822f79cef908" },
22 22 "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
23 - "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" },
23 + "lazy.nvim": { "branch": "main", "commit": "08954f723bf2d442ea020551e3acc956f4dc6dc7" },
24 24 "lsp_signature.nvim": { "branch": "master", "commit": "c6aeb2f1d2538bbdfdaab1664d9d4c3c75aa9db8" },
25 25 "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
26 26 "mason-tool-installer.nvim": { "branch": "main", "commit": "1212fb6082b7177dde17ea65e429e027835aeb40" },
27 27 "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
28 28 "mini.bracketed": { "branch": "main", "commit": "65c7dfb51e832de9e279e5d5b0741e7af6755ab5" },
29 29 "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
30 - "neogen": { "branch": "main", "commit": "b95347a588401a755eadd17482edc1662876bd58" },
31 - "neorg": { "branch": "main", "commit": "086891d396ac9fccd91faf1520f563b6eb9eb942" },
30 + "neogen": { "branch": "main", "commit": "0daffcec249bf42275e322361fe55b89a05ff278" },
31 + "neorg": { "branch": "main", "commit": "df755b5f5cf837743b78392fa90fd8d993263ca1" },
32 32 "neotest": { "branch": "master", "commit": "e07fe8241112274aae9947b98d255763738a1d52" },
33 33 "neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" },
34 34 "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" },
35 35 "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
36 36 "nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" },
37 - "nvim-cmp": { "branch": "main", "commit": "43b460a2bd02fd898e67f5f1f65dfd1cce26203a" },
37 + "nvim-cmp": { "branch": "main", "commit": "97dc716fc914c46577a4f254035ebef1aa72558a" },
38 38 "nvim-dap": { "branch": "master", "commit": "c1695e500c7d552a0a19953a9aefcc89178fb1af" },
39 39 "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
40 40 "nvim-dap-virtual-text": { "branch": "master", "commit": "baa5b0dc6663284cce32e0d00ac1f2511b13496f" },
44 44 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
45 45 "nvim-lint": { "branch": "master", "commit": "2669aabb8362fdc36aced5ba864b7135636ea863" },
46 46 "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" },
47 - "nvim-navbuddy": { "branch": "master", "commit": "f137a3466a6cd1965cdcc5398daff54e66eebbe5" },
47 + "nvim-navbuddy": { "branch": "master", "commit": "f34237e8a41ebc6e2716af2ebf49854d8c5289c8" },
48 48 "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
49 49 "nvim-neoclip.lua": { "branch": "main", "commit": "798cd0592a81c185465db3a091a0ff8a21af60fd" },
50 - "nvim-nio": { "branch": "master", "commit": "7054695117581bdb0183b8d27d8d82b4a2ac8958" },
51 - "nvim-spectre": { "branch": "master", "commit": "1d23be1165c373a6026e42f3b3a5100126eaf81d" },
50 + "nvim-nio": { "branch": "master", "commit": "33c62b3eadd8154169e42144de16ba4db6784bec" },
51 + "nvim-spectre": { "branch": "master", "commit": "31f62d7fc30257b2a5c5327ff7b47719da37a1b4" },
52 52 "nvim-surround": { "branch": "main", "commit": "84a26afce16cffa7e3322cfa80a42cddf60616eb" },
53 - "nvim-tree.lua": { "branch": "master", "commit": "707b24af91a1d05823099ed8c5450796290466ba" },
54 - "nvim-treesitter": { "branch": "master", "commit": "722617e6726c1508adadf83d531f54987c703be0" },
53 + "nvim-tree.lua": { "branch": "master", "commit": "85c502e9076d9c82e2f04addabb3614846ae7558" },
54 + "nvim-treesitter": { "branch": "master", "commit": "33c9db832b6f25446f7bd2dd3353f7737a3476c4" },
55 55 "nvim-treesitter-textobjects": { "branch": "master", "commit": "d2a4ffc22d9d38d44edb73da007b3cf43451e9b4" },
56 56 "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
57 57 "nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
58 - "nvim-web-devicons": { "branch": "master", "commit": "cb0c967c9723a76ccb1be0cc3a9a10e577d2f6ec" },
58 + "nvim-web-devicons": { "branch": "master", "commit": "6662f059bf78e6092ba90cd1929599625f448f55" },
59 59 "nvim-window": { "branch": "main", "commit": "e7f5d60eeec8ff37af7be4c9a99f65edf67fc574" },
60 60 "oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
61 - "overseer.nvim": { "branch": "master", "commit": "b72f6d23ce47ccd427be2341f389c63448278f17" },
61 + "overseer.nvim": { "branch": "master", "commit": "b04b0b105c07b4f02b3073ea3a98d6eca90bf152" },
62 62 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
63 63 "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
64 64 "qf_helper.nvim": { "branch": "master", "commit": "91dad029c11d1c39b0d1276eda52616f651072be" },
65 65 "resession.nvim": { "branch": "master", "commit": "dc8825439c619030925543a444c4186a2487c200" },
66 - "schemastore.nvim": { "branch": "main", "commit": "9ad2209d3fe54f99e3df2c26fadd6f4a3ecae44c" },
66 + "schemastore.nvim": { "branch": "main", "commit": "290e692d568e55be475f6af4579fea434e20ba0c" },
67 67 "specs.nvim": { "branch": "main", "commit": "e929006d3f6bb8e43f03e13ac364c67236eb5299" },
68 68 "speedtyper.nvim": { "branch": "main", "commit": "2d158eed4c753995b0501a3a7a72464fbb213e3d" },
69 69 "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },

neovim/lua/bugabinga/const.lua

Added
new file mode 100644
1 +--- constant 'global' values
2 +return {
3 + win32 = vim.loop.os_uname().sysname:match 'Win',
4 + wsl2 = vim.loop.os_uname().release:match 'WSL2',
5 +}

neovim/lua/bugabinga/editorconfig.lua

Added
new file mode 100644
1 +local editorconfig = require 'editorconfig'
3 +-- extends the parsing of '.editorconfig' files, if present, with some neovim options, that i care about.
4 +-- theoretically, this could also be achieved by enabling the 'exrc' feature in neovim or by using my 'localrc' module.
5 +-- however, i prefer editorconfig in this case, because:
6 +-- 1. it is its intended use case
7 +-- 2. it does not require a manual step (`vim.secure.read`)
8 +-- 3. there is no chance of random code execution by third parties
9 +-- 4. there is a miniscule chance to share those options with others in the future
10 +--
11 +-- NOTE: editorconfig options are not re-evaluated, when loading a session
13 +local tobool = function ( str )
14 + -- intentionally strict
15 + return str == 'true'
16 +end
18 +local expose_option = function ( option_name, parser )
19 + editorconfig.properties[option_name] = function ( _, value )
20 + vim.opt_local[option_name] = parser( value )
21 + end
22 +end
24 +-- even those options are the same as my togglers, the code is not shared for the
25 +-- small off chance, that this ever gets shared as a neovim plugin
26 +expose_option( 'spell', tobool )
27 +expose_option( 'number', tobool )
28 +expose_option( 'cursorline', tobool )
29 +expose_option( 'virtualedit', tostring )
31 +editorconfig.properties.diagnostic = function ( bufnr, value )
32 + local option = tobool( value )
33 + if option then
34 + vim.diagnostic.enable( bufnr )
35 + else
36 + vim.diagnostic.disable( bufnr )
37 + end
38 +end

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 -local overrides = require 'std.localrc' '.lazy.specs.lua'
23 ---- a couple of vim events, that collectivly represent "a file has been opened".
22 +local overrides = require 'std.localrc' ( '.lazy.specs.lua', 'table' )
23 +--- a couple of vim events, that collectively represent "a file has been opened".
24 24 --- this is useful for plugins that want to be lazy loaded, when some file is shown in a buffer/window
25 25 vim.g.FILE_LOADED_EVENTS = { 'BufRead', 'BufNew', 'SessionLoadPost', }
27 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 - },
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 - },
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 + },
105 105 local map = require 'std.map'
107 107 local lazy_cmds = vim.iter {
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, },
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, },
120 120 local base_key = '<leader>z'
122 122 lazy_cmds:each( function ( cmd )
123 - map.normal {
124 - description = cmd[1],
125 - category = 'plugins',
126 - keys = base_key .. cmd[2],
127 - command = cmd[3],
128 - }
123 + map.normal {
124 + description = cmd[1],
125 + category = 'plugins',
126 + keys = base_key .. cmd[2],
127 + command = cmd[3],
131 131 local auto = require 'std.auto'
133 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 ),
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/clients/bash.lua

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

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

Modified
3 3 return {
4 4 require 'bugabinga.lsp.clients.java',
5 5 require 'bugabinga.lsp.clients.lua',
6 6 require 'bugabinga.lsp.clients.json',
7 7 require 'bugabinga.lsp.clients.asm',
8 - require 'bugabinga.lsp.clients.bash',
9 8 require 'bugabinga.lsp.clients.c',
10 9 require 'bugabinga.lsp.clients.graphviz',
11 10 require 'bugabinga.lsp.clients.markdown',

neovim/lua/bugabinga/lsp/init.lua

Modified
1 -require 'bugabinga.lsp.lightbulb'
3 1 local debug = require 'std.debug'
4 2 local defer = require 'std.defer'
5 3 local map = require 'std.map'
9 7 local ignored = require 'std.ignored'
10 8 local user_command = vim.api.nvim_create_user_command
11 9 local lsp_client_configs = require 'bugabinga.lsp.clients'
10 +local localrc = require 'std.localrc'
12 12 local _ = {}
14 -local token_update = function ( lsp_client )
14 +require 'bugabinga.lsp.lightbulb'
16 +local token_update = function ( lsp_client )
15 17 local token = lsp_client.data.token
16 18 local buffer = lsp_client.buffer
17 19 local client_id = lsp_client.data.client_id
27 29 --* closures that capture something
30 -local expand_path = function ( path )
32 +local expand_path = function ( path )
31 33 if vim.fn.executable( path ) == 1 then
32 34 return vim.fn.exepath( path )
38 -local expand_command = function ( command )
40 +local expand_command = function ( command )
39 41 vim.validate { command = { command, { 'string', 'table', }, }, }
41 43 if type( command ) == 'table' then
46 48 return expand_path( command )
49 -local lsp_start = function ( file_type_event )
51 +local lsp_start = function ( file_type_event )
50 52 debug.print 'trying to start lsp'
51 53 local match = file_type_event.match
115 117 -- TODO: LspStart
116 118 -- TODO: LspStop
117 - -- TODO: stop lsp on vim idle/ficus lost?
118 - -- FIXME: lsp detach errors
120 + local project_local_lsp_settings = localrc( '.lsp.settings.lua', 'table' ) or {}
120 122 for _, config in ipairs( potential_client_configs ) do
121 123 local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
192 194 local old_omnifunc
193 195 local old_tagfunc
195 -local keybinds = {}
196 -local add = function ( client_id, keybind_remover )
197 +local keybinds = {}
198 +local add = function ( client_id, keybind_remover )
197 199 vim.validate {
198 200 client_id = { client_id, 'number', },
199 201 keybind_remover = { keybind_remover, 'function', },
204 206 table.insert( keybinds[client_id], keybind_remover )
207 -local lsp_attach = function ( args )
209 +local lsp_attach = function ( args )
208 210 local bufnr = args.buf
209 211 local client_id = args.data.client_id
210 212 local client = vim.lsp.get_client_by_id( client_id )
364 -local lsp_detach = function ( args )
366 +local lsp_detach = function ( args )
365 367 debug.print( 'DETACH LSP', args )
367 369 local bufnr = args.buf

neovim/lua/bugabinga/options/behaviour.lua

Modified
34 34 -- try to guess indentation based on context
35 35 vim.opt.smartindent = true
36 --- Keep indentation of new lines in line with previuos lines
36 +-- Keep indentation of new lines in line with previous lines
37 37 vim.opt.autoindent = true
38 38 vim.opt.copyindent = true
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 project = project.find_root_by_filetype( file, filetype )
104 - if not project then return end
105 - local root = vim.fs.normalize(project)
103 + local project_root = project.find_root_by_filetype( file, filetype )
104 + if not project_root then return end
105 + local root = vim.fs.normalize( project_root )
106 106 local cwd = vim.fs.normalize( vim.uv.cwd() )
107 107 if root and cwd ~= root then
108 108 vim.uv.chdir( root )

neovim/lua/bugabinga/options/keymaps.lua

Modified
1 1 local map = require 'std.map'
2 +local const = require 'bugabinga.const'
2 3 local togglers = require 'bugabinga.options.togglers'
4 5 -- set <SPACE> as leader key
18 19 local current_buffer = 0
19 20 local current_line = vim.api.nvim_win_get_cursor( current_buffer )[1]
20 21 local strict_indexing = false
21 - local newline = { '' }
22 + local newline = { '', }
22 23 vim.api.nvim_buf_set_lines( current_buffer, current_line, current_line, strict_indexing, newline )
31 32 local current_buffer = 0
32 33 local current_line = vim.api.nvim_win_get_cursor( current_buffer )[1] - 1
33 34 local strict_indexing = false
34 - local newline = { '' }
35 + local newline = { '', }
36 37 vim.api.nvim_buf_set_lines( current_buffer, current_line, current_line, strict_indexing, newline )
79 80 command = '<nop>',
82 --- system clipboard copy and paste
83 -map.normal.visual {
84 - description = 'system clipboard motion',
85 - category = 'editing',
86 - keys = '<c-s-v>',
87 - command = '"+',
90 -map.insert {
91 - description = 'Cycle through autocomplete popup',
92 - category = 'editing',
93 - keys = '<tab>',
94 - options = { expr = true },
95 - command = function () return vim.fn.pumvisible() == 1 and '<C-n>' or '<tab>' end,
98 ---TODO make global
99 -local win32 = vim.loop.os_uname().sysname:match 'Win'
100 -local wsl2 = vim.loop.os_uname().release:match 'WSL2'
102 83 local function open_link_under_cursor()
103 84 ---@diagnostic disable-next-line: missing-parameter
104 85 local file_under_cursor = vim.fn.expand '<cfile>'
107 88 if file_under_cursor and file_under_cursor:match '%a+://.+' then
108 89 vim.system(
109 90 ---@diagnostic disable-next-line: assign-type-mismatch
110 - (win32 or wsl2) and { 'cmd.exe', '/C', 'start', 'msedge', file_under_cursor }
111 - or { 'firefox', file_under_cursor },
112 - { text = true },
91 + (const.win32 or const.wsl2) and { 'cmd.exe', '/C', 'start', 'msedge', file_under_cursor, }
92 + or { 'firefox', file_under_cursor, },
93 + { text = true, },
113 94 function ( completed )
114 95 if completed.code == 0 then
115 - vim.schedule( function () vim.notify( 'Opened ' .. file_under_cursor ) end )
96 + vim.schedule( function ()
97 + vim.notify( 'Opened ' .. file_under_cursor )
98 + end )
117 100 error( 'Failed to open ' .. file_under_cursor .. ' because: ' .. completed.stderr )
130 113 command = open_link_under_cursor,
133 -map.normal {
134 - description = 'Grep search for word under cursor',
135 - category = 'search',
136 - keys = 'gw',
137 - command = '<cmd>grep <cword> . <cr>',
140 116 map.normal {
141 117 description = 'Dismiss current search highlight',
142 118 category = 'search',
143 119 keys = '<esc><esc>',
144 - command = function () vim.cmd [[ nohlsearch ]] end,
120 + command = function ()
121 + vim.cmd [[ nohlsearch ]]
122 + end,
147 125 map.normal {
149 127 category = 'ui',
150 128 keys = '<leader>tt',
151 129 command = function ()
130 + ---@diagnostic disable-next-line: undefined-field
152 131 if vim.opt.background:get() == 'dark' then
153 132 vim.opt.background = 'light'
155 134 vim.opt.background = 'dark'
136 +---@diagnostic disable-next-line: undefined-field
157 137 vim.notify( 'Toggled background to ' .. vim.opt.background:get() .. '.' )
179 159 command = vim.cmd.redo,
182 -map.normal {
183 - description = 'Run save actions',
184 - category = 'edit',
185 - keys = '<c-s>',
186 - command = function ()
187 - -- trim
188 - vim.cmd 'TrimTrailingWhitespace'
190 - -- format
191 - vim.lsp.buf.format { async = false }
193 - -- TODO: run makeprg
194 - -- vim.cmd [[silent make]]
196 - -- save
197 - vim.cmd [[wa]]
199 - -- workaround for neovim bug:https://github.com/neovim/neovim/issues/25370
200 - vim.api.nvim_feedkeys( 'zz', 'n', true )
201 - end,
204 162 for _, toggler in ipairs( togglers ) do
205 163 local option_name = toggler.options[1].name
206 164 local first_char = string.sub( option_name, 1, 1 )
209 167 description = 'Toggle ' .. option_name .. ' option',
210 168 category = 'options',
211 169 keys = '<leader>to' .. first_char,
212 - command = function () toggler:toggle() end,
170 + command = function ()
171 + toggler:toggle()
172 + end,

neovim/lua/bugabinga/options/ui.lua

Modified
3 3 local icon = require 'std.icon'
4 4 local auto = require 'std.auto'
5 5 local ignored = require 'std.ignored'
7 7 auto 'highlight_yanked_text' {
8 - description = 'briefly highlight yanked text',
9 - events = 'TextYankPost',
10 - pattern = '*',
11 - command = function () vim.highlight.on_yank() end,
8 + description = 'briefly highlight yanked text',
9 + events = 'TextYankPost',
10 + pattern = '*',
11 + command = function () vim.highlight.on_yank() end,
14 14 auto 'disable_columns_in_special_buffers' {
15 - description = 'Hide columns in buffers, that do not show source code.',
16 - events = { 'FileType', },
17 - pattern = ignored.filetypes,
18 - command = function ()
19 - vim.opt_local.colorcolumn = {}
20 - vim.opt_local.signcolumn = 'no'
21 - vim.opt_local.foldcolumn = '0'
22 - vim.opt_local.number = false
23 - end,
15 + description = 'Hide columns in buffers, that do not show source code.',
16 + events = { 'FileType', },
17 + pattern = ignored.filetypes,
18 + command = function ()
19 + vim.opt_local.colorcolumn = {}
20 + vim.opt_local.signcolumn = 'no'
21 + vim.opt_local.foldcolumn = '0'
22 + vim.opt_local.number = false
23 + end,
26 26 -- show trailing whitespace
27 27 vim.opt.list = true
28 28 vim.opt.listchars = {
29 - -- space = icon.space,
30 - -- eol = icon.eol,
31 - -- tab = icon.tab .. ' ',
32 - trail = icon.trail,
33 - extends = icon.extends,
34 - precedes = icon.precedes,
35 - nbsp = icon.nbsp,
29 + -- space = icon.space,
30 + -- eol = icon.eol,
31 + tab = icon.tab .. icon.middle_ellipsis,
32 + trail = icon.trail,
33 + extends = icon.extends,
34 + precedes = icon.precedes,
35 + nbsp = icon.nbsp,
38 38 -- force english messages
54 54 -- hide weird symbol at end of buffer
55 55 vim.opt.fillchars = {
56 - eob = ' ',
57 - lastline = ' ',
58 - diff = '╱',
59 - wbr = ' ',
56 + eob = ' ',
57 + lastline = ' ',
58 + diff = '╱',
59 + wbr = ' ',
61 - horiz = '─',
62 - horizup = '┴',
63 - horizdown = '┬',
64 - vert = '│',
65 - vertleft = '┤',
66 - vertright = '├',
67 - verthoriz = '┼',
61 + horiz = '─',
62 + horizup = '┴',
63 + horizdown = '┬',
64 + vert = '│',
65 + vertleft = '┤',
66 + vertright = '├',
67 + verthoriz = '┼',
70 70 -- better have no syntax highlighting than regex based, treesitter will take over later
110 110 local is_tty = os.getenv 'XDG_SESSION_TYPE' == 'tty' and os.getenv 'SSH_TTY' == ''
111 111 if is_tty then
112 - vim.opt.termguicolors = false
113 - vim.g.nerdfont = false
114 - vim.opt.lazyredraw = true
112 + vim.opt.termguicolors = false
113 + vim.g.nerdfont = false
114 + vim.opt.lazyredraw = true
116 - vim.opt.termguicolors = true
117 - vim.g.nerdfont = true
118 - vim.opt.lazyredraw = false
116 + vim.opt.termguicolors = true
117 + vim.g.nerdfont = true
118 + vim.opt.lazyredraw = false
121 121 -- scroll by screen lines if buffer is wrapped
133 133 -- neovide only options
134 134 if vim.g.neovide then
135 - -- vim.g.neovide_floating_blur_amount_x = 12.0
136 - -- vim.g.neovide_floating_blur_amount_y = 12.0
137 - -- vim.g.neovide_scroll_animation_length = 0.69
138 - -- vim.g.neovide_fullscreen = true
139 - vim.g.neovide_remember_window_size = true
140 - vim.g.neovide_profiler = false
141 - -- vim.g.neovide_cursor_animation_length = 0.42
142 - -- vim.g.neovide_cursor_trail_length = 0.42
143 - vim.g.neovide_cursor_vfx_mode = 'railgun'
144 - -- vim.g.neovide_cursor_unfocused_outline_width = 0.125
145 - vim.g.neovide_cursor_antialiasing = true
146 - vim.g.neovide_padding_top = 0
147 - vim.g.neovide_padding_bottom = 0
148 - vim.g.neovide_padding_right = 0
149 - vim.g.neovide_padding_left = 0
150 - vim.g.neovide_hide_mouse_when_typing = true
151 - vim.g.neovide_theme = 'auto'
152 - vim.g.neovide_refresh_rate = vim.uv.os_gethostname() == 'pop-os' and 144 or 60
153 - vim.g.neovide_refresh_rate_idle = 5
135 + -- vim.g.neovide_floating_blur_amount_x = 12.0
136 + -- vim.g.neovide_floating_blur_amount_y = 12.0
137 + -- vim.g.neovide_scroll_animation_length = 0.69
138 + -- vim.g.neovide_fullscreen = true
139 + vim.g.neovide_remember_window_size = true
140 + vim.g.neovide_profiler = false
141 + -- vim.g.neovide_cursor_animation_length = 0.42
142 + -- vim.g.neovide_cursor_trail_length = 0.42
143 + vim.g.neovide_cursor_vfx_mode = 'railgun'
144 + -- vim.g.neovide_cursor_unfocused_outline_width = 0.125
145 + vim.g.neovide_cursor_antialiasing = true
146 + vim.g.neovide_padding_top = 0
147 + vim.g.neovide_padding_bottom = 0
148 + vim.g.neovide_padding_right = 0
149 + vim.g.neovide_padding_left = 0
150 + vim.g.neovide_hide_mouse_when_typing = true
151 + vim.g.neovide_theme = 'auto'
152 + vim.g.neovide_refresh_rate = vim.uv.os_gethostname() == 'pop-os' and 144 or 60
153 + vim.g.neovide_refresh_rate_idle = 5

neovim/lua/bugabinga/plugins/aerial.lua

Modified
54 54 manage_folds = {
55 55 ['_'] = true,
57 - -- nerd_font = vim.g.nerd_font,
57 + nerd_font = vim.g.nerdfont,
59 59 -- backends = { "treesitter", "markdown" },
60 60 -- backends = { "lsp", "treesitter" },

neovim/lua/bugabinga/plugins/format.lua

Modified
1 ---FIXME: own this
1 +local debug = require 'std.debug'
2 +local map = require 'std.map'
4 +local format = function ()
5 + require 'conform'.format( { async = false, lsp_fallback = true, }, function ( err )
6 + if err and debug.get() then
7 + vim.print( 'Format failed', err )
8 + end
9 + end )
10 +end
12 +map.N {
13 + description = 'Format buffer',
14 + category = 'format',
15 + keys = '=',
16 + command = format,
19 +--TODO: make user command Format
20 +vim.api.nvim_create_user_command( 'Format', format, {} )
2 22 return {
3 23 'stevearc/conform.nvim',
4 - event = { 'BufWritePre', },
5 24 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 25 opts = {
23 26 formatters_by_ft = {
24 - markdown = { 'injected', },
25 - norg = { 'injected', },
26 - lua = { 'stylua', },
27 - go = { 'goimports', 'gofmt', },
27 + -- https://github.com/razziel89/mdslw/issues/14
28 + -- markdown = { 'mdslw', },
29 + -- lua = { "stylua" },
30 + toml = { 'taplo', },
28 31 sh = { 'shfmt', },
32 + just = { 'just', },
29 33 zig = { 'zigfmt', },
34 + -- Use the "*" filetype to run formatters on all filetypes.
35 + ['*'] = { 'injected', 'typos', },
36 + -- Use the "_" filetype to run formatters on filetypes that don't
37 + -- have other formatters configured.
30 38 ['_'] = { 'trim_whitespace', 'trim_newlines', },
32 40 formatters = {
33 - injected = {
34 - options = {
35 - lang_to_formatters = {
36 - html = {},
37 - },
38 - },
39 - },
40 - shfmt = {
41 - prepend_args = { '-i', '2', },
41 + mdslw = {
42 + -- remove `:` from the default set of end markers
43 + prepend_args = { '--end-markers', '?!.', },
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,
46 + log_level = debug.get() and vim.log.levels.TRACE or vim.log.levels.INFO,
52 - init = function () vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" end,
48 + init = function ()
49 + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
50 + end,

neovim/lua/bugabinga/plugins/mason.lua

Modified
1 1 return {
2 - 'williamboman/mason.nvim',
3 - version = '1.*',
2 + "williamboman/mason.nvim",
3 + version = "1.*",
4 4 lazy = false,
5 5 opts = {
6 6 ui = {
12 12 dependencies = {
14 - 'WhoIsSethDaniel/mason-tool-installer.nvim',
14 + "WhoIsSethDaniel/mason-tool-installer.nvim",
15 15 lazy = false,
16 16 opts = {
17 17 ensure_installed = {
18 - 'lua-language-server',
19 - 'shellcheck',
20 - 'editorconfig-checker',
21 - 'shfmt',
22 - 'jdtls',
23 - 'java-test',
24 - 'java-debug-adapter',
25 - 'lemminx',
26 - 'marksman',
18 + "lua-language-server",
19 + "shellcheck",
20 + "editorconfig-checker",
21 + "shfmt",
22 + "jdtls",
23 + "java-test",
24 + "java-debug-adapter",
25 + "lemminx",
26 + "marksman",
27 + "typos",

neovim/lua/bugabinga/plugins/quickfix.lua

Modified
1 ---FIXME: use map
1 +local map = require 'std.map'
3 +map.normal {
4 + description = 'Grep search for word under cursor',
5 + category = 'search',
6 + keys = 'gw',
7 + command = '<cmd>cclose <bar> Grep <cword><cr>',
8 +}
10 +map.normal {
11 + description = 'Goto next quickfix item',
12 + category = 'navigation',
13 + keys = ']q',
14 + command = '<cmd>QNext<cr>',
17 +map.normal {
18 + description = 'Goto previous quickfix item',
19 + category = 'navigation',
20 + keys = '[q',
21 + command = '<cmd>QPrev<cr>',
24 +map.normal {
25 + description = 'Toggle open quickfix window',
26 + category = 'navigation',
27 + keys = '<leader>Q',
28 + command = '<cmd>QFToggle!<CR>',
31 +map.normal {
32 + description = 'Toggle open loclist window',
33 + category = 'navigation',
34 + keys = '<leader>L',
35 + command = '<cmd>LLToggle!<CR>',
2 38 return {
3 39 'stevearc/qf_helper.nvim',
4 40 ft = 'qf',
5 41 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', },
42 + opts = {
43 + prefer_loclist = false,
12 - config = function ()
13 - require 'qf_helper'.setup {
14 - prefer_loclist = false,
15 - }
16 - end,

neovim/lua/bugabinga/plugins/telescope.lua

Modified
11 11 local map = require 'std.map'
12 12 local icon = require 'std.icon'
13 -local table = require 'std.table'
15 14 map.normal {
16 15 description = 'Switch to recently used folders',
134 133 -- 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 - -- },
134 + pickers = {
135 + find_files = ivy,
136 + fd = ivy,
137 + keymaps = dropdown,
138 + diagnostics = dropdown,
139 + -- symbols = cursor,
140 + live_grep = ivy,
141 + current_buffer_fuzzy_find = cursor,
142 + buffers = cursor,
143 + -- help_tags = dropdown,
144 + },
146 145 extensions = {
147 146 zoxide = { prompt_title = 'Navigate deez nuts!', },

neovim/lua/bugabinga/plugins/tint.lua

Modified
1 -return { 'levouh/tint.nvim', opts = {}, }
1 +return {
2 + 'levouh/tint.nvim',
3 + event = { 'WinNew', 'SessionLoadPost', },
4 + opts = {},
5 +}

neovim/lua/bugabinga/plugins/toggleterm.lua

Modified
30 30 toggleterm.setup( opts )
32 32 local set_terminal_keymaps = function ()
33 - local local_to_buffer = { buffer = 0, }
34 33 map.terminal {
35 34 description = 'Quit insert mode',
36 35 category = 'terminal',
37 36 keys = '<esc>',
38 - options = local_to_buffer,
37 + buffer = true,
39 38 command = [[ <C-\><C-n> ]],
41 + vim.opt_local.spell = false
43 44 auto 'normalize_terminal_windows' {

neovim/lua/bugabinga/save_actions.lua

Added
new file mode 100644
1 +local map = require 'std.map'
2 +local localrc = require 'std.localrc'
4 +local global_actions = vim.g.save_actions or {}
5 +local project_local_actions = localrc( '.save.actions.lua', 'table' ) or {}
6 +local all_actions = vim.tbl_deep_extend( 'force', global_actions, project_local_actions )
8 +local apply_save_actions = function ( options )
9 + options = options or {}
11 + vim.iter( all_actions ):each(
12 + function ( action )
13 + vim.validate {
14 + action = { action, 'string', },
15 + }
16 + local user_command = vim.api.nvim_parse_cmd( action, {} )
17 + vim.api.nvim_cmd( user_command, { output = not options.bang, } )
18 + end
19 + )
21 + --save all
22 + vim.cmd [[wa]]
23 +end
25 +--TODO: use facade
26 +vim.api.nvim_create_user_command( 'SaveActions', apply_save_actions, { bang = true, } )
28 +map.normal.visual {
29 + description = 'Save all buffers and apply save actions',
30 + category = 'actions',
31 + keys = '<c-s>',
32 + command = '<cmd>SaveActions<cr>',

neovim/lua/bugabinga/trim.lua

Deleted
deleted file mode 100644
1 --- If invoked as a preview callback, performs 'inccommand' preview by
2 --- highlighting trailing whitespace in the current buffer.
3 -local function trim_space_preview(opts, preview_ns, preview_buf)
4 - vim.cmd('hi clear Whitespace')
5 - local line1 = opts.line1
6 - local line2 = opts.line2
7 - local buf = vim.api.nvim_get_current_buf()
8 - local lines = vim.api.nvim_buf_get_lines(buf, line1 - 1, line2, false)
9 - local preview_buf_line = 0
10 - for i, line in ipairs(lines) do
11 - local start_idx, end_idx = string.find(line, '%s+$')
12 - if start_idx then
13 - -- Highlight the match
14 - vim.api.nvim_buf_add_highlight(
15 - buf,
16 - preview_ns,
17 - 'Substitute',
18 - line1 + i - 2,
19 - start_idx - 1,
20 - end_idx
21 - )
22 - -- Add lines and set highlights in the preview buffer
23 - -- if inccommand=split
24 - if preview_buf then
25 - local prefix = string.format('|%d| ', line1 + i - 1)
26 - vim.api.nvim_buf_set_lines(
27 - preview_buf,
28 - preview_buf_line,
29 - preview_buf_line,
30 - false,
31 - { prefix .. line }
32 - )
33 - vim.api.nvim_buf_add_highlight(
34 - preview_buf,
35 - preview_ns,
36 - 'Substitute',
37 - preview_buf_line,
38 - #prefix + start_idx - 1,
39 - #prefix + end_idx
40 - )
41 - preview_buf_line = preview_buf_line + 1
42 - end
43 - end
44 - end
45 - -- Return the value of the preview type
46 - return 2
47 -end
48 --- Trims all trailing whitespace in the current buffer.
49 -local function trim_space(opts)
50 - local line1 = opts.line1
51 - local line2 = opts.line2
52 - local buf = vim.api.nvim_get_current_buf()
53 - local lines = vim.api.nvim_buf_get_lines(buf, line1 - 1, line2, false)
54 - local new_lines = {}
55 - for i, line in ipairs(lines) do
56 - new_lines[i] = string.gsub(line, '%s+$', '')
57 - end
58 - vim.api.nvim_buf_set_lines(buf, line1 - 1, line2, false, new_lines)
59 -end
60 --- Create the user command
61 -vim.api.nvim_create_user_command(
62 - 'TrimTrailingWhitespace',
63 - trim_space,
64 - { nargs = '?', range = '%', addr = 'lines', preview = trim_space_preview }
65 -)

neovim/lua/std/debug.lua

Modified
18 18 vim.notify( 'Toggled debug mode to ' .. tostring( is_debug_mode() ) )
21 +--TODO: use facade
21 22 vim.api.nvim_create_user_command( 'Debug', toggle_debug_mode, {} )
23 24 return {

neovim/lua/std/icon.lua

Modified
49 49 spelling = '󰓆',
50 50 subversion = '󰳗',
51 51 tab = '󰌒',
52 + middle_ellipsis = '⋯',
52 53 terminal = '',
53 54 thread = '󱇫',
54 55 toggle_off = '',

neovim/lua/std/localrc.lua

Modified
1 -return function ( file_name )
1 +local debug = require 'std.debug'
3 +--- loads given lua file path in current working directory into the current neovim lua runtime.
4 +--- @param file_name string path to lua file, that should be loaded
5 +--- @param validator function|string|table a validation function, that checks, if the loaded value fulfills your requirements.
6 +--- If `validator` is a string or table, then it should contain the allowed types of the value.
7 +--- @return any returns the evaluated value of the loaded lua file or `nil`, if it does not exists or did not pass
8 +--- validation.
9 +return function ( file_name, validator )
2 10 local filepath = vim.fn.fnamemodify( file_name, ':p' )
3 11 local file = vim.secure.read( filepath )
4 12 if not file then
5 - return {}
13 + return nil
7 - return loadstring( file )()
15 + local value, err = loadstring( file )()
16 + if err then
17 + debug.print( 'unable to load ' .. file_name .. '. ' .. err )
18 + end
19 + local validator_type = type( validator )
20 + if validator_type == 'string' or validator_type == table then
21 + local expected_types = validator_type == table and validator or { validator, }
22 + local value_type = type( value )
23 + local is_valid = vim.iter( expected_types ):any( function ( t ) return t == value_type end )
24 + return is_valid and value or nil
25 + end
26 + return validator( value ) and value or nil

neovim/lua/std/map.lua

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

neovim/lua/std/project.lua

Modified
33 33 --- number of max loop iterations when searching for markers
34 34 local MAX_TRAVERSAL_COUNT = 100
36 ---- the weight of a project marker, when the likelyhood is low
36 +--- the weight of a project marker, when the likelihood is low
37 37 local MAYBE = 1
38 ---- the weight of a project marker, when the likelyhood is high
38 +--- the weight of a project marker, when the likelihood is high
39 39 local LIKELY = 3
40 ---- the weight of a project marker, when the likelyhood is 100%
41 -local DEFINITLY = 7
40 +--- the weight of a project marker, when the likelihood is 100%
41 +local DEFINITELY = 7
43 43 --- Determines the path to a root directory, starting from the given path.
44 44 -- Markers have a name and weight.
53 53 -- Project root: `/home/user/workspace/some\_project` -> contains `.git`, `README` and `Makefile`
55 55 -- ```lua
56 --- local project = require'std.project'
56 +-- local project = require 'std.project'
57 57 -- local current_buffer = vim.api.nvim_buf_get_name(0)
58 58 -- local markers = {
59 59 -- { name = ".git", weight = MAYBE },
60 60 -- { name = "README", weight = LIKELY },
61 --- { naem = "Makefile", weight = DEFINITLY },
61 +-- { name = "Makefile", weight = DEFINITELY },
63 63 -- local root = project.find_root(current_buffer, markers, vim.uv.os_homedir())
64 64 -- print(root) -- /home/user/workspace/some_project
164 164 local function find_project_root( path, markers )
165 165 -- define some language-independent markers
166 166 local default_markers = {
167 - { name = '.project_model.lua', weight = DEFINITLY, },
168 - { name = '.lazy.specs.lua', weight = DEFINITLY, },
169 - { name = '.editorconfig', weight = LIKELY, },
170 - { name = '.git', weight = LIKELY, },
171 - { name = '.gitignore', weight = LIKELY, },
172 - { name = '.svn', weight = LIKELY, },
173 - { name = 'justfile', weight = LIKELY, },
174 - { name = 'Makefile', weight = LIKELY, },
175 - { name = 'Jenkinsfile', weight = MAYBE, },
176 - { name = 'LICENSE', weight = MAYBE, },
177 - { name = 'LICENSE.md', weight = MAYBE, },
178 - { name = 'LICENSE.txt', weight = MAYBE, },
179 - { name = 'COPYING', weight = MAYBE, },
180 - { name = 'README', weight = MAYBE, },
181 - { name = 'README.md', weight = MAYBE, },
182 - { name = 'flake.nix', weight = MAYBE, },
183 - { name = 'flake.nix', weight = MAYBE, },
167 + { name = '.save.actions.lua', weight = DEFINITELY, },
168 + { name = '.lsp.settings.lua', weight = DEFINITELY, },
169 + { name = '.lazy.specs.lua', weight = DEFINITELY, },
170 + { name = '.editorconfig', weight = LIKELY, },
171 + { name = '.git', weight = LIKELY, },
172 + { name = '.gitignore', weight = LIKELY, },
173 + { name = '.svn', weight = LIKELY, },
174 + { name = 'justfile', weight = LIKELY, },
175 + { name = 'Makefile', weight = LIKELY, },
176 + { name = 'Jenkinsfile', weight = MAYBE, },
177 + { name = 'LICENSE', weight = MAYBE, },
178 + { name = 'LICENSE.md', weight = MAYBE, },
179 + { name = 'LICENSE.txt', weight = MAYBE, },
180 + { name = 'COPYING', weight = MAYBE, },
181 + { name = 'README', weight = MAYBE, },
182 + { name = 'README.md', weight = MAYBE, },
183 + { name = 'flake.nix', weight = MAYBE, },
184 + { name = 'flake.nix', weight = MAYBE, },
186 187 markers = markers or {}
199 200 { name = '.project', weight = LIKELY, },
200 201 { name = 'target', weight = LIKELY, },
201 202 { name = 'pom.xml', weight = LIKELY, },
202 - { name = 'mvnw', weight = DEFINITLY, },
203 - { name = '.mvn', weight = DEFINITLY, },
204 - { name = 'mvnw.cmd', weight = DEFINITLY, },
205 - { name = 'build.gradle', weight = DEFINITLY, },
206 - { name = 'gradle.properties', weight = DEFINITLY, },
207 - { name = 'settings.gradle', weight = DEFINITLY, },
208 - { name = 'gradlew', weight = DEFINITLY, },
209 - { name = 'gradlew.bat', weight = DEFINITLY, },
203 + { name = 'mvnw', weight = DEFINITELY, },
204 + { name = '.mvn', weight = DEFINITELY, },
205 + { name = 'mvnw.cmd', weight = DEFINITELY, },
206 + { name = 'build.gradle', weight = DEFINITELY, },
207 + { name = 'gradle.properties', weight = DEFINITELY, },
208 + { name = 'settings.gradle', weight = DEFINITELY, },
209 + { name = 'gradlew', weight = DEFINITELY, },
210 + { name = 'gradlew.bat', weight = DEFINITELY, },
211 212 return find_project_root( path, java_markers )
230 231 local find_zig_project_root = function ( path )
231 232 local zig_markers = {
232 - { name = 'build.zig', weight = DEFINITLY, },
233 - { name = 'zls.build.json', weight = DEFINITLY, },
233 + { name = 'build.zig', weight = DEFINITELY, },
234 + { name = 'zls.build.json', weight = DEFINITELY, },
234 235 { name = 'zig-cache', weight = MAYBE, },
235 236 { name = 'zig-out', weight = MAYBE, },
242 243 local find_rust_project_root = function ( path )
243 244 local markers = {
244 - { name = 'Cargo.toml', weight = DEFINITLY, },
245 + { name = 'Cargo.toml', weight = DEFINITELY, },
246 247 local cargo_crate_dir = find_project_root( path, markers )
247 248 if cargo_crate_dir == nil then return nil end

neovim/neovim/lua/bugabinga/plugins/lush.lua

Deleted
deleted file mode 100644
1 -return {
2 - {
3 - 'rktjmp/lush.nvim',
4 - -- tag = 'v2.0.1',
5 - -- we rely on injects.sym for better treesitter support
6 - branch = 'main',
7 - -- lazy = false,
8 - -- priority = 1000,
9 - config = function ()
10 - -- disabled to find theming issues with heirline
11 - -- vim.cmd.colorscheme 'nugu'
12 - end,
13 - },
14 -}

neovim/spell/nerd.utf-8.add

Modified
28 28 configs
29 29 BufNewFile
30 30 LuaLS
31 +editorconfig
32 +exrc
33 +localrc
34 +signcolumn
35 +togglers
36 +ripgrep

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.