repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: new plugins for start screen, symbols outline and AI

f7c54cc77df707b4bb774551ffe4ae315ff63c3c

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (40)

neovim/.luarc.jsonc

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

neovim/init.lua

Modified
18 18 require 'bugabinga.lsp'
20 20 -- TODO:
21 --- [] learn marks and refac mark.lua
21 +-- [ ] check out gen.nvim
22 +-- [ ] check out mini.*
23 +-- colors
24 +-- hipatterns
25 +-- sessions
26 +-- completion
27 +-- bufremove
28 +-- bracketed
29 +-- align
30 +-- [ ] learn marks and refac mark.lua
22 31 -- [ ] use ltex-ls for markdown, code comments and commit messages
23 32 -- [ ] DAP
24 33 -- [ ] add nu-check to nvim-lint

neovim/lazy-lock.json

Modified
8 8 "cmp-omni": { "branch": "main", "commit": "4ef610bbd85a5ee4e97e09450c0daecbdc60de86" },
9 9 "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
10 10 "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
11 - "diffview.nvim": { "branch": "main", "commit": "a111d19ccceac6530448d329c63f998f77b5626e" },
11 + "diffview.nvim": { "branch": "main", "commit": "0437ef8bfdd67156d87140d692840a3c2824fa20" },
12 12 "dressing.nvim": { "branch": "master", "commit": "59fe7ef1aeeed499b983614fcfff89206bf0d5ce" },
13 - "flash.nvim": { "branch": "main", "commit": "e5a7bd96d0bb7e0806bfc18adea5ab148165bd62" },
14 - "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
13 + "flash.nvim": { "branch": "main", "commit": "f219066f1976c781780e2c317d52d515bc0e588b" },
14 + "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
15 + "gen.nvim": { "branch": "main", "commit": "fb44b33fd036ecbd2b5c0d9a63921337c9cb8992" },
15 16 "gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
16 17 "glow.nvim": { "branch": "main", "commit": "cf2177a514859fa3c55837b46de91d93b24cf488" },
17 18 "heirline.nvim": { "branch": "master", "commit": "7f1e805dfc001d5dbb7d894105063f463f6c7dcc" },
18 19 "hlargs.nvim": { "branch": "main", "commit": "6218a401824c5733ac50b264991b62d064e85ab2" },
19 - "hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" },
20 - "inc-rename.nvim": { "branch": "main", "commit": "ed0f6f2b917cac4eb3259f907da0a481b27a3b7e" },
21 - "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
22 - "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
20 + "indent-blankline.nvim": { "branch": "master", "commit": "877c1db2bf957300097dd5348a665666a4d900cb" },
21 + "lazy.nvim": { "branch": "main", "commit": "62745a7320f48a00ac4f7b0591352608cbc6bcea" },
23 22 "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
24 23 "lush.nvim": { "branch": "main", "commit": "966aad1accd47fa11fbe2539234f81f678fef2de" },
25 24 "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
26 - "multicursors.nvim": { "branch": "main", "commit": "b7a837496da6f5b39b610a7cbd6c3f7d05526d6e" },
25 + "mini.nvim": { "branch": "main", "commit": "707dca4f4152c2d9c9b4c5e02635f78dfd33db50" },
27 26 "neodev.nvim": { "branch": "main", "commit": "da1562e1e3df0e994ddc52cb4ba22376a5d7f2fc" },
28 27 "neogen": { "branch": "main", "commit": "cb1f384df804c1bf729332c4f728253fe17962d4" },
29 - "noice.nvim": { "branch": "main", "commit": "396f9146529130904e07c45e90ecdbfa607534f3" },
28 + "noice.nvim": { "branch": "main", "commit": "fcd01710ff6918d4d3ef90c8e36f3addacba13bf" },
30 29 "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" },
31 30 "nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" },
32 - "nvim-autopairs": { "branch": "master", "commit": "de4f7138a68d5d5063170f2182fd27faf06b0b54" },
31 + "nvim-autopairs": { "branch": "master", "commit": "748e72c05495a3d30e88a6ef04b21697019a9aa9" },
33 32 "nvim-cmp": { "branch": "main", "commit": "983453e32cb35533a119725883c04436d16c0120" },
34 33 "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
35 - "nvim-genghis": { "branch": "main", "commit": "b15d7d0c37f7739a5723f20dfae9e501b9952b08" },
36 34 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
37 35 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
36 + "nvim-lsp-file-operations": { "branch": "master", "commit": "0ae13ac58136c6175638b6e1ba04cb487dd22272" },
38 37 "nvim-neoclip.lua": { "branch": "main", "commit": "4e406ae0f759262518731538f2585abb9d269bac" },
39 38 "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
40 39 "nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" },
41 - "nvim-treesitter": { "branch": "master", "commit": "b5873bacb4ce44e0aac313abb28bb72e67fc9a53" },
42 - "nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" },
40 + "nvim-treesitter": { "branch": "master", "commit": "957f3f8c15a88ef0f0c77ecd13edf2e2578f176e" },
41 + "nvim-treesitter-textobjects": { "branch": "master", "commit": "76c7a89b41de77a4f83fb77fa072c5ad7605fe3b" },
43 42 "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
44 - "nvim-ts-context-commentstring": { "branch": "main", "commit": "95e9ba9de4289d221666b66fd930d157c7ca08c6" },
43 + "nvim-ts-context-commentstring": { "branch": "main", "commit": "7241635869b7a8115893ffa67bab3907756caf4f" },
45 44 "nvim-web-devicons": { "branch": "master", "commit": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82" },
46 - "oil.nvim": { "branch": "master", "commit": "fdb50dc5c57524c4b0b05b593abff4d4f7a099f6" },
45 + "oil.nvim": { "branch": "stevearc-trash", "commit": "b62f680059fffcf7ff89fd88126fbca12418df20" },
47 46 "persistence.nvim": { "branch": "main", "commit": "adcf6913693a0434665d162ee45a186230496f8a" },
48 47 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
49 48 "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
50 49 "schemastore.nvim": { "branch": "main", "commit": "ce624332e6ba5a9a0c8f311a114ac179c5e72f62" },
51 50 "specs.nvim": { "branch": "main", "commit": "2743e412bbe21c9d73954c403d01e8de7377890d" },
52 - "substitute.nvim": { "branch": "main", "commit": "42d09f1e6324d98aa2e5b765b64528e0aefe72b0" },
51 + "substitute.nvim": { "branch": "main", "commit": "89dbe55cccee36bcb5e2be8c2d92ff8716601734" },
52 + "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
53 53 "telescope-symbols.nvim": { "branch": "master", "commit": "f2060117d965df4a626f068a4ebbd8ee051aa076" },
54 54 "telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
55 55 "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" },
56 56 "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" },
57 57 "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" },
58 58 "toggleterm.nvim": { "branch": "main", "commit": "faee9d60428afc7857e0927fdc18daa6c409fa64" },
59 - "treesj": { "branch": "main", "commit": "bff8c32b826e188fa558e94c7c93ac17a8ef0365" },
59 + "treesj": { "branch": "main", "commit": "81d0ae51b84143e228d27b6cf79d09012d2021cb" },
60 60 "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
61 - "virt-column.nvim": { "branch": "master", "commit": "5fc72873dc3175eddbdbbedea8071919c99ad755" },
61 + "virt-column.nvim": { "branch": "master", "commit": "9c82009c53e5f9d43b6c0f5e8cb69c53663b786a" },
62 62 "which-key.nvim": { "branch": "main", "commit": "bf09a25bdc9a83bcc69d2cf078e680368676513b" },
63 - "zen-mode.nvim": { "branch": "main", "commit": "6e6c963d70a8e47854fa656987666bfb863f9c4e" }
64 -}
63 + "zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" }

neovim/lua/bugabinga/lazy.lua

Modified
41 41 ft = icon.file,
44 - custom_keys = false,
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 + },
45 56 change_detection = { notify = false },
46 57 performance = {
47 58 rtp = {
80 91 local map = require 'std.map'
82 93 local lazy_cmds = vim.iter {
83 - { 'Show', '' , lazy.show } ,
84 - { 'Install', 'i', lazy.install },
85 - { 'Update', 'u', lazy.update },
86 - { 'Sync', 's', lazy.sync },
87 - { 'Clean', 'x', lazy.clean },
88 - { 'Check', 'c', lazy.check },
89 - { 'Log', 'l', lazy.log },
90 - { 'Restore', 'r', lazy.restore },
91 - { 'Profile', 'p', lazy.profile },
92 - { 'Debug', 'd', lazy.debug },
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 },
95 106 local base_key = '<leader>z'
97 108 lazy_cmds:each(function(cmd)
98 - map.normal {
99 - name = cmd[1] .. ' plugins via Lazy.nvim',
100 - category = 'plugins',
101 - keys = base_key .. cmd[2],
102 - command = cmd[3],
103 - }
104 -end)
109 + map.normal {
110 + name = cmd[1] .. ' plugins',
111 + category = 'plugins',
112 + keys = base_key .. cmd[2],
113 + command = cmd[3],
115 +end)

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

Modified
1 1 local table = require 'std.table'
2 2 local project = require 'std.project'
3 +local want = require 'std.want'
4 +local auto = require 'std.auto'
5 +local map = require'std.map'
4 -local create_shared_config_path = function(base_path, syntax_server)
7 +local create_shared_config_path = function ( base_path, syntax_server )
5 8 local os_config
6 - if vim.fn.has('linux') == 1 then
7 - os_config = syntax_server and 'config_linux' or 'config_ss_linux'
8 - elseif vim.fn.has('mac') == 1 then
9 - os_config = syntax_server and 'config_mac' or 'config_ss_mac'
9 + if vim.fn.has 'linux' == 1 then
10 + os_config = syntax_server and 'config_ss_linux' or 'config_linux'
11 + elseif vim.fn.has 'mac' == 1 then
12 + os_config = syntax_server and 'config_ss_mac' or 'config_mac'
11 - os_config = syntax_server and 'config_win' or 'config_ss_win'
14 + os_config = syntax_server and 'config_ss_win' or 'config_win'
13 - return vim.fs.joinpath(base_path, os_config)
16 + return vim.fs.joinpath( base_path, os_config )
16 -local find_launcher_jar = function(base_path)
17 - local plugins_dir = vim.fs.joinpath(base_path, 'plugins')
18 - local launchers = vim.fn.globpath(plugins_dir, 'org.eclipse.equinox.launcher_*.jar', false, true)
19 +local find_launcher_jar = function ( base_path )
20 + local plugins_dir = vim.fs.joinpath( base_path, 'plugins' )
21 + local launchers = vim.fn.globpath( plugins_dir, 'org.eclipse.equinox.launcher_*.jar', false, true )
20 - if table.is_empty(launchers) then
21 - vim.error('Could not find jdtls launcher jar in ' .. plugins_dir)
23 + if table.is_empty( launchers ) then
24 + error( 'Could not find jdtls launcher jar in ' .. plugins_dir )
24 27 -- vim.print('found launcher jars', launchers)
25 28 return launchers[1]
28 -local create_data_dir = function()
31 +local create_data_dir = function ()
29 32 local cwd = vim.uv.cwd() or ''
30 - local data_name = vim.fn.sha256(cwd)
33 + local data_name = vim.fn.sha256( cwd )
31 34 local cache = vim.fn.stdpath 'cache'
32 - cache = type(cache) == 'table' and cache[1] or cache
35 + cache = type( cache ) == 'table' and cache[1] or cache
34 - return vim.fs.joinpath(cache, 'jdtls_data', data_name)
37 + return vim.fs.joinpath( cache, 'jdtls_data', data_name )
37 -local create_jdtls_command = function(syntax_server)
38 - local mason_packages_base_path = require 'mason-core.package':get_install_path()
39 - local jdtls_package_path = vim.fs.joinpath(mason_packages_base_path, 'jdtls')
40 - local shared_config_path = create_shared_config_path(jdtls_package_path, syntax_server)
41 - local launcher_jar = find_launcher_jar(jdtls_package_path)
40 +local function get_bundles()
41 + local mason_registry = require 'mason-registry'
42 + local java_debug = mason_registry.get_package 'java-debug-adapter'
43 + local java_test = mason_registry.get_package 'java-test'
44 + local java_debug_path = java_debug:get_install_path()
45 + local java_test_path = java_test:get_install_path()
46 + local bundles = {}
47 + --FIXME: refactor this!
48 + vim.list_extend( bundles,
49 + vim.split(
50 + vim.fn.glob( java_debug_path .. '/extension/server/com.microsoft.java.debug.plugin-*.jar' ), '\n' ) )
51 + vim.list_extend( bundles, vim.split( vim.fn.glob( java_test_path .. '/extension/server/*.jar' ), '\n' ) )
52 + return bundles
53 +end
55 +local create_jdtls_command = function ( syntax_server )
56 + local mason_packages_base_path = want 'mason-core.package' (
57 + function ( mason ) return mason:get_install_path() end,
58 + function () return '/home/oli/Programs' end
59 + )
61 + local jdtls_package_path = vim.fs.joinpath( mason_packages_base_path, 'jdtls' )
62 + local shared_config_path = create_shared_config_path( jdtls_package_path, syntax_server )
63 + local launcher_jar = find_launcher_jar( jdtls_package_path )
42 64 local data_dir = create_data_dir()
44 - local ss_option = syntax_server and '-Dsyntaxserver=true' or ''
66 + local ss_option = syntax_server and '-Dsyntaxserver=true' or nil
46 - return {
68 + local command = {
47 69 'java',
48 70 '-Declipse.application=org.eclipse.jdt.ls.core.id1',
49 71 '-Dosgi.bundles.defaultStartLevel=4',
50 72 '-Declipse.product=org.eclipse.jdt.ls.core.product',
51 73 '-Dlog.protocol=true',
52 74 '-Dlog.level=ALL',
53 - "-Dosgi.checkConfiguration=true",
54 - "-Dosgi.sharedConfiguration.area=" .. shared_config_path,
55 - "-Dosgi.sharedConfiguration.area.readOnly=true",
56 - "-Dosgi.configuration.cascaded=true",
57 - ss_option,
75 + '-Dosgi.checkConfiguration=true',
76 + '-Dosgi.sharedConfiguration.area=' .. shared_config_path,
77 + '-Dosgi.sharedConfiguration.area.readOnly=true',
78 + '-Dosgi.configuration.cascaded=true',
58 79 '--add-modules=ALL-SYSTEM',
59 80 '--add-opens', 'java.base/java.util=ALL-UNNAMED',
60 81 '--add-opens', 'java.base/java.lang=ALL-UNNAMED',
61 82 '-jar', launcher_jar,
62 83 '-data', data_dir,
86 + if ss_option then
87 + -- insert option after 'java'
88 + table.insert( command, 2, ss_option )
89 + end
91 + return command
66 -local find_jdks = function()
94 +local find_jdks = function ()
67 95 local host = vim.uv.os_gethostname()
68 96 local jdk11 = {
69 - name = "JavaSE-11",
97 + name = 'JavaSE-11',
71 99 local jdk17 = {
72 - name = "JavaSE-17",
100 + name = 'JavaSE-17',
74 102 local jdk19 = {
75 - name = "JavaSE-19",
103 + name = 'JavaSE-19',
105 + local jdk21 = {
106 + name = 'JavaSE-21',
78 109 if host == 'pop-os' then
79 - jdk11.path = '/usr/lib/jvm/openjdk-11'
80 - jdk17.path = '/usr/lib/jvm/openjdk-17'
81 - jdk19.path = '/usr/lib/jvm/openjdk-19'
110 + jdk11.path = '/usr/lib/jvm/java-11-openjdk-amd64'
111 + jdk17.path = '/usr/lib/jvm/java-17-openjdk-amd64'
112 + jdk19.path = '/usr/lib/jvm/java-19-openjdk-amd64'
113 + jdk21.path = '/home/oli/.jdks/openjdk-21'
83 115 vim.notify 'missing jdk paths in java settings for lsp'
86 - return { jdk11, jdk17, jdk19 }
118 + return { jdk11, jdk17, jdk19, jdk21 }
89 121 local java_settings = {
90 122 signatureHelp = { enabled = true },
91 123 sources = {
124 + autobuild = { enabeld = true },
125 + signatureHelp = { enabled = true },
126 + saveActions = { origanizeImports = true },
92 127 organizeImports = {
93 128 starThreshold = 9999,
94 129 staticStarThreshold = 9999,
131 + codeGeneration = {
132 + toString = {
133 + template = '${object.className}{${member.name()}=${member.value()}, ${otherMembers}}',
134 + },
135 + hashCodeEquals = { useJava7Objects = true },
136 + useBlocks = true,
137 + },
138 + eclipse = { downloadSources = true },
139 + },
140 + configuration = {
141 + updateBuildConfiguration = 'interactive',
142 + runtimes = find_jdks(),
143 + },
144 + maven = { downloadSources = true },
145 + implementationsCodeLens = { enabled = true },
146 + referencesCodeLens = { enabled = true },
147 + references = { includeDecompiledSources = true },
148 + inlayHints = { parameterNames = { enabled = 'all' } },
149 + format = {
150 + enabled = true,
151 + -- TODO: set these here with my preferred settings
152 + -- set these on a project level -> read intellij /eclipse settings?
153 + -- settings = {
154 + -- url = 'TODO',
155 + -- profile = 'TODO',
156 + -- },
97 - configuration = { runtimes = find_jdks(), },
100 -local jdtls_lsp_start = function(config, opts)
160 +local jdtls_lsp_start = function ( config, opts )
101 161 -- vim.print('jdtls lsp start', config, opts)
102 - require 'jdtls'.start_or_attach(config, opts)
162 + require 'jdtls'.start_or_attach( config, opts )
163 +end
165 +local get_extended_capabilites = function ()
166 + local ext = require 'jdtls'.extendedClientCapabilities
167 + ext.resolveAdditionalTextEditsSupport = true
168 + return ext
169 +end
171 +-- TODO:
172 +local on_attach = function ()
173 + local jdtls = require 'jdtls'
174 + vim.lsp.codelens.refresh()
175 + jdtls.setup_dap { hotcodereplace = 'auto' }
176 + require 'jdtls.dap'.setup_dap_main_class_configs()
177 + require 'jdtls.setup'.add_commands()
179 + map.normal {
180 + description = 'Organize Imports',
181 + category = 'jdlts',
182 + keys = '<leader>ljo',
183 + command = jdtls.organize_imports,
186 + map.normal {
187 + description = 'Extract Variable',
188 + category = 'jdlts',
189 + keys = '<leader>ljv',
190 + command = jdtls.extract_variable,
193 + map.normal {
194 + description = 'Extract Constant',
195 + category = 'jdlts',
196 + keys = '<leader>ljc',
197 + command = jdtls.extract_constant,
200 + map.normal {
201 + description = 'Test Nearest Method',
202 + category = 'jdlts',
203 + keys = '<leader>ljt',
204 + command = jdtls.test_nearest_method,
207 + map.normal {
208 + description = 'Test Class',
209 + category = 'jdlts',
210 + keys = '<leader>ljT',
211 + command = jdtls.test_class,
214 + map.normal {
215 + description = 'Update Config',
216 + category = 'jdlts',
217 + keys = '<leader>lju',
218 + command = '<cmd>JdtUpdateConfig<cr>',
221 + map.visual {
222 + description = 'Extract Variable',
223 + category = 'jdlts',
224 + keys = '<leader>ljv',
225 + command = function() jdtls.extract_variable(true) end,
228 + map.visual {
229 + description = 'Extract Constant',
230 + category = 'jdlts',
231 + keys = '<leader>ljc',
232 + command = function() jdtls.extract_constant(true) end,
235 + map.visual {
236 + description = 'Extract Method',
237 + category = 'jdlts',
238 + keys = '<leader>ljm',
239 + command = function() jdtls.extract_method(true) end,
242 + auto 'refresh_codelens' {
243 + events = 'BufWritePost',
244 + description = 'Refreshes LSP CodeLens after java file is written.',
245 + pattern = '*.java',
246 + command = function () pcall( vim.lsp.codelens.refresh ) end,
105 250 return {
106 - name = 'jdtls',
251 + name = 'jdtls',
107 252 custom_start = jdtls_lsp_start,
108 253 filetypes = 'java',
109 - command = create_jdtls_command(true),
254 + command = create_jdtls_command( false ),
110 255 root_dir = project.find_java_project_root,
111 256 single_file_support = true,
112 - workspaces = false,
257 + workspaces = true,
113 258 settings = { java = java_settings },
259 + on_attach = on_attach,
260 + init_options = {
261 + bundles = get_bundles(),
262 + extendedClientCapabilities = get_extended_capabilites(),

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

Modified
1 1 local project = require'std.project'
2 +local want = require'std.want'
3 4 return {
4 5 name = 'jsonls',
13 14 settings = {
14 15 json = {
15 - schemas = require'schemastore'.json.schemas{
16 + schemas = want'schemastore'(function(schemastore) return schemastore.json.schemas {
16 17 extra = {
17 18 description = 'Settings for lua-language-server',
18 19 name = "LuaLS Settings",
19 20 url = "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
20 21 fileMatch = { ".luarc.json", ".luarc.jsonc" },
22 - },
23 + } end, {}),
23 24 validate = { enable = true },

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

Modified
1 1 local project = require 'std.project'
2 +local want = require'std.want'
3 4 return {
4 5 name = 'LuaLS',

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

Modified
1 1 local project = require'std.project'
3 3 local function is_library(path)
4 - local cargo_home = os.getenv 'CARGO_HOME' or util.path.join(vim.env.HOME, '.cargo')
4 + local cargo_home = os.getenv 'CARGO_HOME' or vim.fs.joinpath(vim.env.HOME, '.cargo')
5 5 local registry = vim.fs.joinpath(cargo_home, 'registry', 'src')
7 - local rustup_home = os.getenv 'RUSTUP_HOME' or util.path.join(vim.env.HOME, '.rustup')
7 + local rustup_home = os.getenv 'RUSTUP_HOME' or vim.fs.joinpath(vim.env.HOME, '.rustup')
8 8 for _, item in ipairs { toolchains, registry } do
9 9 if path:sub(1, #item) == item then
10 10 local clients = vim.lsp.get_active_clients { name = 'rust_analyzer' }

neovim/lua/bugabinga/lsp/init.lua

Modified
56 56 if vim.iter( matches_to_ignore ):find( match ) then return end
58 58 local bufnr = file_type_event.buf
59 + local buftype = vim.api.nvim_get_option_value('buftype', { buf = bufnr })
60 + if buftype ~= '' then return end
59 62 local buffer_path = vim.api.nvim_buf_get_name( bufnr )
61 64 vim.print( 'searching lsp client for:', match, bufnr, buffer_path )
109 112 capabilities = table.extend( 'force', capabilities, cmp_capabilities, config.capabilities )
110 113 -- vim.print( 'lsp capabilities', capabilities, config.capabilities, cmp_capabilities )
115 + -- vim.print('starting command:', config.command)
112 117 local start_config = {
113 118 cmd = config.command,
114 119 cmd_cwd = root_dir,
153 158 --TODO lsps with single file or worksopaces support do not need smame root dir. instead add_workspace_folder
154 159 local same_name = existing_client.name == new_config.name
156 - local new_root = vim.fs.normalize( new_config.root_dir )
157 - local existing_root = vim.fs.normalize( existing_client.workspace_folders[1].name )
161 + local new_root_raw = new_config.root_dir or nil
162 + local existing_root_raw = existing_client.workspace_folders and #existing_client.workspace_folders >= 1 and
163 + existing_client.workspace_folders[1].name or nil
165 + if not (new_root_raw and existing_root_raw) then return false end
167 + local new_root = vim.fs.normalize( new_root_raw )
168 + local existing_root = vim.fs.normalize( existing_root_raw )
158 169 local same_root = new_root == existing_root
160 171 local reuse = same_name and same_root
172 183 local old_tagfunc
174 185 local keybinds = {}
175 -local add = function ( keybind )
176 - table.insert( keybinds, keybind )
186 +local add = function ( client_id, keybind )
187 + if not table.contains( keybinds, client_id ) then
188 + keybinds[client_id] = {}
189 + end
190 + table.insert( keybinds[client_id], keybind )
179 193 local lsp_attach = function ( args )
317 331 -- vim.print("DETACH LSP", ...)
319 333 local bufnr = args.buf
320 - local client = vim.lsp.get_client_by_id( args.data.client_id )
334 + local client_id = args.data.client_id
335 + local client = vim.lsp.get_client_by_id( client_id )
321 336 if not client then return end
323 338 if client.server_capabilities.definitionProvider then
332 347 vim.bo[bufnr].omnifunc = old_omnifunc
335 - for _, keybind_delete in ipairs( keybinds ) do
336 - keybind_delete()
350 + if table.contains( keybinds, client_id ) then
351 + for _, keybind_delete in ipairs( keybinds[client_id] ) do
352 + keybind_delete()
353 + end

neovim/lua/bugabinga/nugu/init.lua

Modified
3 3 ---@diagnostic disable: undefined-global
4 4 local palette = require 'bugabinga.nugu.palette'
5 5 local lush = require 'lush'
6 6 local hsl = lush.hsluv
8 +vim.g.terminal_color_0 = palette.ui_backdrop -- black
9 +vim.g.terminal_color_1 = palette.content_accent -- maroon
10 +vim.g.terminal_color_2 = palette.info -- green
11 +vim.g.terminal_color_3 = palette.ui_focus -- olive
12 +vim.g.terminal_color_4 = palette.content_important_local -- navy
13 +vim.g.terminal_color_5 = palette.content_important_global -- purple
14 +vim.g.terminal_color_6 = palette.ui_focus -- teal
15 +vim.g.terminal_color_7 = palette.content_normal -- silver
17 +vim.g.terminal_color_8 = palette.ui_minor -- grey
18 +vim.g.terminal_color_9 = palette.error -- red
19 +vim.g.terminal_color_10 = palette.info -- lime
20 +vim.g.terminal_color_11 = palette.content_focus -- yellow
21 +vim.g.terminal_color_12 = palette.ui_important_local -- blue
22 +vim.g.terminal_color_13 = palette.ui_accent -- fuchsia
23 +vim.g.terminal_color_14 = palette.ui_important_global -- aqua
24 +vim.g.terminal_color_15 = palette.ui_normal -- white
8 26 local flux = function ( color, number )
9 27 if vim.opt.background:get() == 'dark' then
10 28 return color.li( -number )
37 55 local nugu = lush( function ( injects )
38 56 local sym = injects.sym
39 57 return {
40 - Debug { fg = debug.readable(), bg = debug, gui = 'bold' }, -- debugging statements
58 + Debug { fg = debug.readable(), bg = debug, gui = 'bold' },
42 60 Normal { fg = content_normal, bg = content_backdrop },
43 61 NotifyBackground { bg = ui_backdrop },
46 64 CursorLineNr { fg = ui_focus, bg = ui_backdrop },
47 65 Search { fg = content_important_global.readable(), bg = content_important_global },
48 66 IncSearch { fg = content_important_local.readable(), bg = content_important_local },
49 - NormalFloat { fg = ui_normal, bg = ui_backdrop }, -- Normal text in floating windows.
67 + NormalFloat { fg = ui_normal, bg = ui_backdrop },
50 68 FloatBorder { fg = ui_accent, bg = NormalFloat.bg },
51 - ColorColumn { fg = ui_important_global, bg = content_backdrop }, -- used for the columns set with 'colorcolumn'
52 - Conceal { fg = content_normal, bg = ui_unfocus, gui = 'italic' }, -- placeholder characters substituted for concealed text (see 'conceallevel')
53 - Cursor { bg = ui_accent }, -- character under the cursor
54 - lCursor { bg = ui_accent }, -- the character under the cursor when |language-mapping| is used (see 'guicursor')
55 - CursorIM { bg = ui_accent }, -- like Cursor, but used when in IME mode |CursorIM|
56 - Directory { fg = Normal.fg }, -- directory names (and other special names in listings)
57 - DiffAdd { fg = content_focus }, -- diff mode: Added line |diff.txt|
58 - DiffDelete { fg = content_focus, gui = 'strikethrough' }, -- diff mode: Deleted line |diff.txt|
59 - DiffChange { fg = content_important_global }, -- diff mode: Changed line |diff.txt|
60 - DiffText { fg = content_important_local.readable(), bg = content_important_local }, -- diff mode: Changed text within a changed line |diff.txt|
61 - EndOfBuffer { Normal }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|.
62 - TermCursor { lCursor }, -- cursor in a focused terminal
63 - TermCursorNC { Cursor }, -- cursor in an unfocused terminal
64 - ErrorMsg { fg = error.readable(), bg = error }, -- error messages on the command line
65 - VertSplit { fg = ui_important_global, bg = content_backdrop }, -- the column separating vertically split windows
66 - Folded { Conceal }, -- line used for closed folds
67 - FoldColumn { Conceal }, -- 'foldcolumn'
68 - SignColumn { bg = ui_backdrop }, -- column where |signs| are displayed
69 - ModeMsg { gui = 'bold' }, -- 'showmode' message (e.g., "-- INSERT -- ")
70 - MsgArea { Normal }, -- Area for messages and cmdline
71 - MsgSeparator { fg = ui_accent }, -- Separator for scrolled messages, `msgsep` flag of 'display'
72 - MoreMsg { Normal }, -- |more-prompt|
73 - NonText { fg = ui_unfocus }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|.
74 - NormalNC {}, -- normal text in non-current windows
75 - Pmenu { NormalFloat }, -- Popup menu: normal item.
76 - PmenuSel { fg = ui_focus, sp = ui_focus.readable(), bg = ui_unfocus, gui = 'underline' }, -- Popup menu: selected item.
77 - PmenuSbar { bg = ui_unfocus }, -- Popup menu: scrollbar.
78 - PmenuThumb { bg = ui_minor }, -- Popup menu: Thumb of the scrollbar.
79 - Question { fg = ui_important_global, gui = 'bold' }, -- |hit-enter| prompt and yes/no questions
80 - QuickFixLine { PmenuSel }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there.
81 - SpecialKey { fg = error, bg = content_unfocus, gui = 'bold' }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace|
82 - SpellBad { fg = error, gui = 'undercurl' }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise.
83 - SpellCap { SpellBad }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise.
84 - SpellLocal { SpellBad }, -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise.
85 - SpellRare { SpellBad }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise.
86 - StatusLine { fg = ui_normal, bg = ui_backdrop }, -- status line of current window
87 - StatusLineNC { fg = ui_normal, bg = ui_unfocus }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window.
69 + ColorColumn { fg = ui_important_global, bg = content_backdrop },
70 + Conceal { fg = content_normal, bg = ui_unfocus, gui = 'italic' },
71 + Cursor { bg = ui_accent },
72 + lCursor { bg = ui_accent },
73 + CursorIM { bg = ui_accent },
74 + Directory { fg = Normal.fg },
75 + DiffAdd { fg = content_focus },
76 + DiffDelete { fg = content_focus, gui = 'strikethrough' },
77 + DiffChange { fg = content_important_global },
78 + DiffText { fg = content_important_local.readable(), bg = content_important_local },
79 + EndOfBuffer { NormalFloat },
80 + TermCursor { lCursor },
81 + TermCursorNC { Cursor },
82 + ErrorMsg { fg = error.readable(), bg = error },
83 + VertSplit { fg = ui_important_global, bg = ui_backdrop },
84 + Folded { Conceal },
85 + FoldColumn { LineNr },
86 + SignColumn { LineNr },
87 + ModeMsg { gui = 'bold' },
88 + MsgArea { Normal },
89 + MsgSeparator { fg = ui_accent },
90 + MoreMsg { Normal },
91 + NonText { fg = content_unfocus },
92 + Whitespace { NonText },
93 + NormalNC {},
94 + Pmenu { NormalFloat },
95 + PmenuSel { fg = ui_focus, sp = ui_focus.readable(), bg = ui_unfocus, gui = 'underline' },
96 + PmenuSbar { bg = ui_unfocus },
97 + PmenuThumb { bg = ui_minor },
98 + Question { fg = ui_important_global, gui = 'bold' },
99 + QuickFixLine { PmenuSel },
100 + SpecialKey { fg = error, bg = content_unfocus, gui = 'bold' },
101 + SpellBad { fg = error, gui = 'undercurl' },
102 + SpellCap { SpellBad },
103 + SpellLocal { SpellBad },
104 + SpellRare { SpellBad },
105 + StatusLine { fg = ui_normal, bg = ui_backdrop },
106 + StatusLineNC { fg = ui_minor, bg = ui_backdrop },
88 107 Winbar { StatusLine },
89 108 WinbarNC { StatusLineNC },
90 - IndentBlanklineContextChar { fg = content_accent, gui = 'nocombine' },
91 - IndentBlanklineContextStart { sp = IndentBlanklineContextChar.fg, gui = 'underline' },
92 - Title { fg = content_important_global, sp = content_important_global, gui = 'bold underline' }, -- titles for output from ":set all", ":autocmd" etc.
93 - TabLine { StatusLine }, -- tab pages line, not active tab page label
94 - TabLineFill { bg = TabLine.bg }, -- tab pages line, where there are no labels
95 - TabLineSel { fg = ui_accent.readable(), bg = ui_accent, gui = 'underline bold' }, -- tab pages line, active tab page label
96 - Visual { fg = content_focus.readable(), bg = content_focus }, -- Visual mode selection
97 - VisualNOS { fg = Visual.fg, bg = flux( Visual.bg, -42 ) }, -- Visual mode selection when vim is "Not Owning the Selection".
98 - WarningMsg { fg = warning, gui = 'bold' }, -- warning messages
99 - WhiteSpace { fg = ui_unfocus }, -- "nbsp", "space", "tab" and "trail" in 'listchars'
100 - WildMenu { fg = ui_accent, gui = 'bold' }, -- current match in 'wildmenu' completion
109 + Title { fg = content_important_global, sp = content_important_global, gui = 'bold underline' },
110 + TabLine { StatusLine },
111 + TabLineFill { bg = TabLine.bg },
112 + TabLineSel { fg = ui_accent.readable(), bg = ui_accent, gui = 'underline bold' },
113 + Visual { fg = content_focus.readable(), bg = content_focus },
114 + VisualNOS { fg = Visual.fg, bg = flux( Visual.bg, -42 ) },
115 + WarningMsg { fg = warning, gui = 'bold' },
116 + WhiteSpace { fg = ui_unfocus },
117 + WildMenu { fg = ui_accent, gui = 'bold' },
102 119 String { fg = content_important_local, gui = 'italic' },
103 - Constant { String }, -- (preferred) any constant
104 - Character { String }, -- a character constant: 'c', '\n'
105 - Number { String }, -- a number constant: 234, 0xff
106 - Boolean { String }, -- a boolean constant: TRUE, false
107 - Float { String }, -- a floating point constant: 2.3e10
120 + Constant { String },
121 + Character { String },
122 + Number { String },
123 + Boolean { String },
124 + Float { String },
109 - Identifier { Normal }, -- (preferred) any variable name
126 + Identifier { Normal },
110 127 MutableVariable { Debug },
111 - Function { Normal }, -- function name (also: methods for classes)
128 + Function { Normal },
113 - Statement { fg = content_minor }, -- (preferred) any statement
114 - Conditional { Statement }, -- if, then, else, endif, switch, etc.
115 - Repeat { Statement }, -- for, do, while, etc.
116 - Label { Statement }, -- case, default, etc.
117 - Operator { Statement }, -- "sizeof", "+", "*", etc.
118 - Keyword { Statement }, -- any other keyword
119 - Exception { Statement }, -- try, catch, throw
130 + Statement { fg = content_minor },
131 + Conditional { Statement },
132 + Repeat { Statement },
133 + Label { Statement },
134 + Operator { Statement },
135 + Keyword { Statement },
136 + Exception { Statement },
121 - PreProc { fg = content_important_global, bg = content_unfocus, gui = 'bold' }, -- (preferred) generic Preprocessor
122 - Include { PreProc }, -- preprocessor #include
123 - Define { PreProc }, -- preprocessor #define
124 - Macro { PreProc }, -- same as Define
125 - PreCondit { PreProc }, -- preprocessor #if, #else, #endif, etc.
138 + PreProc { fg = content_important_global, bg = content_unfocus, gui = 'bold' },
139 + Include { PreProc },
140 + Define { PreProc },
141 + Macro { PreProc },
142 + PreCondit { PreProc },
127 - Type { Statement }, -- (preferred) int, long, char, etc.
128 - StorageClass { Statement }, -- static, register, volatile, etc.
129 - Structure { Statement }, -- struct, union, enum, etc.
130 - Typedef { Statement }, -- A typedef
144 + Type { Statement },
145 + StorageClass { Statement },
146 + Structure { Statement },
147 + Typedef { Statement },
132 - Special { fg = content_normal, gui = 'italic bold' }, -- (preferred) any special symbol
133 - SpecialChar { Special }, -- special character in a constant
134 - Tag { Special }, -- you can use CTRL-] on this
135 - Delimiter { fg = content_minor }, -- character that needs attention
136 - SpecialComment { Special }, -- special things inside a comment
149 + Special { fg = content_normal, gui = 'italic bold' },
150 + SpecialChar { Special },
151 + Tag { Special },
152 + Delimiter { fg = content_minor },
153 + SpecialComment { Special },
138 - Underlined { sp = content_normal, gui = 'underline' }, -- (preferred) text that stands out, HTML links
155 + Underlined { sp = content_normal, gui = 'underline' },
139 156 Bold { gui = 'bold' },
140 157 Italic { gui = 'italic' },
142 - -- ("Ignore", below, may be invisible...)
143 - Ignore { fg = Normal.bg, bg = Normal.bg }, -- (preferred) left blank, hidden |hl-Ignore|
145 - Error { fg = error }, -- (preferred) any erroneous construct
159 + Ignore { fg = Normal.bg, bg = Normal.bg },
161 + Error { fg = error },
147 162 Todo { fg = content_important_global, sp = content_important_global, gui = 'bold underdouble' },
148 163 DiagnosticUnnecessary { fg = ui_focus },
149 164 DiagnosticDeprecated { fg = ui_important_global, sp = ui_important_global, gui = 'strikethrough' },
170 185 DiagnosticSignHint { DiagnosticHint },
171 186 DiagnosticSignOk { DiagnosticOk },
173 - LspReferenceText { fg = content_focus, bg = content_unfocus },
188 + LspReferenceText { sp = content_unfocus, gui = 'underline' },
174 189 LspReferenceRead { LspReferenceText },
175 190 LspReferenceWrite { LspReferenceText },
176 - LspInlayHint { fg = content_minor, bg = ui_unfocus },
178 - -- hlargs.nvim
179 - Hlargs { fg = ui_important_local },
191 + LspInlayHint { fg = ui_minor, bg = ui_unfocus },
181 193 -- Tree-Sitter syntax groups.
256 268 sym '@lsp.type.macro' { sym '@macro' },
257 269 sym '@lsp.type.decorator' { sym '@function' },
259 - -- lazy.nvim
260 271 LazyButton { NormalFloat, sp = NormalFloat.fg, gui = 'bold' },
261 272 LazyButtonActive { fg = ui_important_local.readable(), sp = NormalFloat.fg, bg = ui_important_local, gui = LazyButton
262 273 .gui },
290 301 LazyUrl { sp = NormalFloat.fg, gui = 'italic underline' },
291 302 LazyValue { gui = 'italic' },
293 - -- Noice
294 304 NoiceCmdline { fg = ui_focus, bg = ui_backdrop },
295 305 NoiceCmdlineIcon { fg = ui_accent, bg = NoiceCmdline.bg, gui = 'bold' },
296 306 NoiceCmdlineIconCalculator { NoiceCmdlineIcon },
379 389 NoiceSplit { NormalFloat },
380 390 NoiceSplitBorder { NoiceConfirmBorder, bg = NormalFloat.bg },
381 391 NoiceVirtualText { fg = ui_important_local, bg = ui_backdrop, gui = 'bold' },
383 - -- Notify
384 392 NotifyERRORBorder { DiagnosticError, bg = NormalFloat.bg },
385 393 NotifyWARNBorder { DiagnosticWarn, bg = NormalFloat.bg },
386 394 NotifyINFOBorder { DiagnosticInfo, bg = NormalFloat.bg },
452 460 GitSignsDeleteVirtLnInLine { DiffText },
453 461 GitSignsVirtLnum { fg = LineNr.fg },
455 - WhichKey { fg = ui_important_global }, -- the key
456 - WhichKeyGroup { fg = ui_important_local }, -- a group
457 - WhichKeySeparator { fg = ui_minor }, -- the separator between the key and its label
458 - WhichKeyDesc { fg = ui_normal }, -- the label of the key
459 - WhichKeyFloat { NormalFloat }, -- Normal in the popup window
460 - WhichKeyBorder { FloatBorder }, -- Normal in the popup window
461 - WhichKeyValue { Comment }, -- used by plugins that provide values
463 + WhichKey { fg = ui_important_global },
464 + WhichKeyGroup { fg = ui_important_local },
465 + WhichKeySeparator { fg = ui_minor },
466 + WhichKeyDesc { fg = ui_normal },
467 + WhichKeyFloat { NormalFloat },
468 + WhichKeyBorder { FloatBorder },
469 + WhichKeyValue { Comment },
471 + IblIndent { Whitespace },
472 + IblWhitespace { Whitespace },
473 + IblScope { fg = ui_focus, bg = content_backdrop },
475 + Hlargs { fg = ui_important_local },
477 + MiniStarterCurrent { bg = content_accent }, -- current item.
478 + MiniStarterFooter { Keyword }, -- footer units.
479 + MiniStarterHeader { Comment }, -- header units.
480 + MiniStarterInactive { fg = content_unfocus }, -- inactive item.
481 + MiniStarterItem { Normal }, -- item name.
482 + MiniStarterItemBullet { Whitespace }, -- units from |MiniStarter.gen_hook.adding_bullet|.
483 + MiniStarterItemPrefix { fg = content_focus, gui = '' }, -- unique query for item.
484 + MiniStarterSection { fg = content_important_global, gui = 'underline' }, -- section units.
485 + MiniStarterQuery { bg = content_accent }, -- current query in active items.

neovim/lua/bugabinga/options/autocommands.lua

Deleted
deleted file mode 100644
1 -local auto = require 'std.auto'
3 -auto 'highlight_yanked_text' {
4 - description = 'briefly highlight yanked text',
5 - events = 'TextYankPost',
6 - pattern = '*',
7 - command = function()
8 - vim.highlight.on_yank { timeout = 500 }
9 - end,
10 -}
12 -auto 'disable_colorcolumn_in_special_buffers' {
13 - description = 'Hide colorcolumn in buffers, that do not show source code.',
14 - events = { 'FileType' },
15 - pattern = 'lazy,noice,Trouble,qf,help,toggleterm',
16 - command = function()
17 - vim.opt_local.colorcolumn = {}
18 - end,
19 -}

neovim/lua/bugabinga/options/behaviour.lua

Modified
1 +local auto = require 'std.auto'
1 3 -- How many milliseconds must pass before neovim decides I was "idle"
2 4 vim.opt.updatetime = 50
3 5 -- How long to wait between key sequences in order to chain them. e.g. <LEADER>b
22 24 -- insert whitespace type based on whitespace on previous line
23 25 vim.opt.smarttab = true
27 +vim.opt.wrap = false
25 29 -- keep distance to borders while scrolling
26 -vim.opt.scrolloff = 0
30 +vim.opt.scrolloff = 10
27 31 vim.opt.sidescrolloff = 0
29 33 -- try to guess indentation based on context
50 54 vim.opt.shellquote = ''
51 55 vim.opt.shellxquote = ''
53 -require'bugabinga.health'.add_dependency
57 +require 'bugabinga.health'.add_dependency
55 - name = 'Nushell',
56 - name_of_executable = 'nu'
59 + name = 'Nushell',
60 + name_of_executable = 'nu'
59 63 -- highlight all search matches
72 76 vim.opt.grepprg = 'rg --hidden --vimgrep --no-heading --smart-case --'
73 77 vim.opt.grepformat = '%f:%l:%c:%m'
79 +require 'bugabinga.health'.add_dependency
81 + name = 'Ripgrep',
82 + name_of_executable = 'rg'
75 85 -- ask me to force failed commands
76 86 vim.opt.confirm = true
88 +auto 'load_project_if_available' {
89 + description = 'Loads the project root dir as cwd, if it can be determined from a file path.',
90 + events = { 'FileType' },
91 + pattern = '*',
92 + command = function ( event )
93 + local project = require 'std.project'
94 + local ignored = require 'std.ignored'
95 + local table = require 'std.table'
96 + local buffer = event.buf
97 + local file = event.file
98 + local filetype = vim.api.nvim_buf_get_option( buffer, 'filetype' )
99 + if table.contains( ignored.filetypes, filetype ) then return end
100 + local buftype = vim.api.nvim_buf_get_option( buffer, 'buftype' )
101 + if table.contains( ignored.buftypes, buftype ) then return end
102 + local root = project.find_root_by_filetype( file, filetype )
103 + local cwd = vim.uv.cwd()
104 + if root and cwd ~= root then
105 + vim.uv.chdir( root )
106 + vim.notify( 'Changed root directory to ' .. root )
107 + -- vim.print( buffer, file, vim.inspect( filetype ), vim.inspect( buftype ) )
108 + end
109 + end,

neovim/lua/bugabinga/options/init.lua

Modified
4 4 -- NEOVIM EDITOR OPTIONS
6 6 require 'bugabinga.options.behaviour'
7 7 require 'bugabinga.options.ui'
8 8 require 'bugabinga.options.file'
9 9 require 'bugabinga.options.keymaps'
10 -require 'bugabinga.options.autocommands'
12 11 -- disable some runtime providers that i will not use.
13 12 -- keeps checkhealth clean

neovim/lua/bugabinga/options/keymaps.lua

Modified
132 132 command = 'firefox',
133 133 args = { file_under_cursor },
134 134 on_exit = function()
135 - vim.notify('Openend ' .. file_under_cursor)
135 + vim.schedule(function() vim.notify('Openend ' .. file_under_cursor) end)
138 138 job:start()
226 226 category = 'config',
227 227 keys = '<cr><cr>',
228 228 command = '<cmd>lua <c-r><c-l><cr>'

neovim/lua/bugabinga/options/togglers.lua

Modified
55 55 add_toggler(icon.spelling, { make_option'spell' } )
56 56 add_toggler(icon.linenumber, { make_option'number', make_option'relativenumber'})
57 -add_toggler(icon.linehighlight, { make_option'cursorline'} )
57 +add_toggler(icon.linehighlight, { make_option'cursorline'} )
58 +add_toggler(icon.virtual, { make_option'virtualedit'} )
59 60 local tostring = function(self)
60 61 return vim.iter(self)
61 62 :map(toggler_tostring)
62 63 :fold('', function(buffer, text)
63 - return buffer .. (buffer == '' and '' or ' ' ) .. text
64 + return buffer .. (buffer == '' and '' or ' ' ) .. text
64 65 end)

neovim/lua/bugabinga/options/ui.lua

Modified
1 1 local icon = require'std.icon'
2 +local auto = require 'std.auto'
3 +local ignored = require 'std.ignored'
5 +auto 'highlight_yanked_text' {
6 + description = 'briefly highlight yanked text',
7 + events = 'TextYankPost',
8 + pattern = '*',
9 + command = function() vim.highlight.on_yank() end,
12 +auto 'disable_columns_in_special_buffers' {
13 + description = 'Hide columns in buffers, that do not show source code.',
14 + events = { 'FileType' },
15 + pattern = ignored.filetypes,
16 + command = function ()
17 + vim.opt_local.colorcolumn = {}
18 + vim.opt_local.signcolumn = 'no'
19 + vim.opt_local.foldcolumn = '0'
20 + vim.opt_local.number = false
21 + end,
3 24 -- show trailing whitespace
4 25 vim.opt.list = true
31 52 -- hide weird symbol at end of buffer
32 53 vim.opt.fillchars = {
33 54 eob = ' ',
34 - fold = ' ',
55 + lastline = ' ',
35 56 diff = '╱',
57 + wbr = ' ',
59 + horiz = '─',
60 + horizup = '┴',
61 + horizdown = '┬',
62 + vert = '│',
63 + vertleft = '┤',
64 + vertright = '├',
65 + verthoriz = '┼',
38 68 -- better have no syntax highlighting than regex based, treesitter will take over later
41 71 -- hide output of insert completion popup in status
42 72 vim.opt.shortmess:append 'c'
73 +-- hide vim intro screen
74 +vim.opt.shortmess:append 'I'
44 76 -- show cmd window to prevent jitter ui
45 77 vim.opt.cmdheight = 1
69 101 vim.opt.showmode = false
71 103 -- always show tabs, to avoid jitter ui
72 -vim.opt.showtabline = 1
104 +vim.opt.showtabline = 2
74 106 -- Use true colors
75 107 vim.opt.termguicolors = true
79 111 vim.opt.guicursor = 'n-v-c-sm:block-Cursor,i-ci-ve:ver25-blinkon250,r-cr:hor20,o:hor50'
81 113 -- font
82 -vim.opt.guifont = 'BlexMono_Nerd_Font:h14:#e-subpixelantialias:#h-none'
114 +vim.opt.guifont = 'BlexMono_Nerd_Font:h13:#e-subpixelantialias:#h-full'
115 +-- TODO: neovide font config is not as powerful as wezterm right now
116 +-- characters for box drawing do not seem to line up. try different font for now?
84 118 -- neovide only options
85 119 if vim.g.neovide then
86 - vim.g.neovide_floating_blur_amount_x = 8.0
87 - vim.g.neovide_floating_blur_amount_y = 4.0
88 - vim.g.neovide_scroll_animation_length = 0.42
120 + -- vim.g.neovide_floating_blur_amount_x = 12.0
121 + -- vim.g.neovide_floating_blur_amount_y = 12.0
122 + -- vim.g.neovide_scroll_animation_length = 0.69
89 123 -- vim.g.neovide_fullscreen = true
90 124 vim.g.neovide_remember_window_size = true
91 125 vim.g.neovide_profiler = false
92 - vim.g.neovide_cursor_animation_length = 0.11
93 - vim.g.neovide_cursor_trail_length = 1.69
94 - vim.g.neovide_cursor_vfx_mode = 'pixiedust'
95 - vim.g.neovide_cursor_unfocused_outline_width = 0.125
126 + -- vim.g.neovide_cursor_animation_length = 0.42
127 + -- vim.g.neovide_cursor_trail_length = 0.42
128 + vim.g.neovide_cursor_vfx_mode = 'railgun'
129 + -- vim.g.neovide_cursor_unfocused_outline_width = 0.125
96 130 vim.g.neovide_cursor_antialiasing = true
97 131 vim.g.neovide_padding_top = 0
98 132 vim.g.neovide_padding_bottom = 0
99 - vim.g.neovide_padding_right = 1
100 - vim.g.neovide_padding_left = 1
133 + vim.g.neovide_padding_right = 0
134 + vim.g.neovide_padding_left = 0
101 135 vim.g.neovide_hide_mouse_when_typing = true
102 136 vim.g.neovide_theme = 'auto'
103 137 vim.g.neovide_refresh_rate = vim.uv.os_gethostname() == 'pop-os' and 144 or 60

neovim/lua/bugabinga/plugins/cmp.lua

Modified
21 21 require 'luasnip.loaders.from_vscode'.lazy_load()
23 23 cmp.setup {
24 + performance = {
25 + debounce = 250,
26 + throttle = 400,
27 + fetching_timeout = 1000,
28 + },
24 29 completion = {
25 30 autocomplete = false,
26 - completeopt = 'menu,menuone,preview,noselect',
31 + -- completeopt = 'menu,menuone,preview,noselect',
28 33 formatting = {
29 34 format = lspkind.cmp_format {
32 37 ellipsis_char = '…',
40 + experimental = { ghost_text = true, },
41 + preselect = cmp.PreselectMode.None,
35 42 snippet = { expand = function ( args ) luasnip.lsp_expand( args.body ) end },
36 43 mapping = {
37 44 ['<c-p>'] = cmp.mapping.select_prev_item(),
38 45 ['<c-n>'] = cmp.mapping.select_next_item(),
39 46 ['<c-k>'] = cmp.mapping.select_prev_item(),
40 47 ['<c-j>'] = cmp.mapping.select_next_item(),
41 - ['<s-tab>'] = cmp.mapping.select_prev_item(),
42 - ['<tab>'] = cmp.mapping.select_next_item(),
48 + -- ['<s-tab>'] = cmp.mapping.select_prev_item(),
49 + -- ['<tab>'] = cmp.mapping.select_next_item(),
43 50 ['<c-b>'] = cmp.mapping.scroll_docs( -2 ),
44 51 ['<c-f>'] = cmp.mapping.scroll_docs( 2 ),
45 52 ['<c-u>'] = cmp.mapping.scroll_docs( -4 ),

neovim/lua/bugabinga/plugins/gen.lua

Added
new file mode 100644
1 +return {
2 + 'David-Kunz/gen.nvim',
3 + cmd = 'Gen',
4 + keys = { { 'n', 'v' }, '<leader>g', '<cmd>Gen<cr>' },
5 + config = function ()
6 + local gen = require 'gen'
7 + gen.model = 'kathy'
8 + end
9 +}

neovim/lua/bugabinga/plugins/genghis.lua

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

neovim/lua/bugabinga/plugins/gitsigns.lua

Modified
1 1 return {
2 - 'lewis6991/gitsigns.nvim',
3 - -- branch='main',
4 - event = 'VeryLazy',
5 - opts = {},
2 + 'lewis6991/gitsigns.nvim',
3 + -- branch='main',
4 + event = 'VeryLazy',
5 + opts = {
6 + signs = {
7 + add = { text = '│' },
8 + change = { text = '│' },
9 + delete = { text = '_' },
10 + topdelete = { text = '‾' },
11 + changedelete = { text = '~' },
12 + untracked = { text = '┆' },
13 + },
14 + },
15 + preview_config = {
16 + border = vim.g.border_style,
17 + },
18 + current_line_blame = true,
19 + current_line_blame_opts = {
20 + ignore_whitespace = true,
21 + },
22 + current_line_blame_formatter = '<author>(<author_time:%d.%m.%Y>): <summary>',
23 + --FIXME: refactor the suggested config code
24 + on_attach = function ( bufnr )
25 + local gs = package.loaded.gitsigns
27 + local function map( mode, l, r, opts )
28 + opts = opts or {}
29 + opts.buffer = bufnr
30 + vim.keymap.set( mode, l, r, opts )
31 + end
33 + -- Navigation
34 + map( 'n', ']c', function ()
35 + if vim.wo.diff then return ']c' end
36 + vim.schedule( function () gs.next_hunk() end )
37 + return '<Ignore>'
38 + end, { expr = true } )
40 + map( 'n', '[c', function ()
41 + if vim.wo.diff then return '[c' end
42 + vim.schedule( function () gs.prev_hunk() end )
43 + return '<Ignore>'
44 + end, { expr = true } )
46 + -- Actions
47 + map( 'n', '<leader>hs', gs.stage_hunk )
48 + map( 'n', '<leader>hr', gs.reset_hunk )
49 + map( 'v', '<leader>hs', function () gs.stage_hunk { vim.fn.line '.' , vim.fn.line 'v' } end )
50 + map( 'v', '<leader>hr', function () gs.reset_hunk { vim.fn.line '.' , vim.fn.line 'v' } end )
51 + map( 'n', '<leader>hS', gs.stage_buffer )
52 + map( 'n', '<leader>hu', gs.undo_stage_hunk )
53 + map( 'n', '<leader>hR', gs.reset_buffer )
54 + map( 'n', '<leader>hp', gs.preview_hunk )
55 + map( 'n', '<leader>hb', function () gs.blame_line { full = true } end )
56 + map( 'n', '<leader>hd', gs.diffthis )
57 + map( 'n', '<leader>hD', function () gs.diffthis '~' end )
59 + map( 'n', '<leader>tb', gs.toggle_current_line_blame )
60 + map( 'n', '<leader>td', gs.toggle_deleted )
62 + -- Text object
63 + map( { 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>' )
64 + end

neovim/lua/bugabinga/plugins/heirline.lua

Modified
1 -local icon = require'std.icon'
2 -local auto = require'std.auto'
1 +local icon = require 'std.icon'
2 +local auto = require 'std.auto'
3 +local ignored = require 'std.ignored'
5 +local NEW_FILE = '~new~'
4 7 return {
5 - {
6 - 'rebelot/heirline.nvim',
7 - event = 'BufEnter',
8 - dependencies = {
9 - 'nvim-tree/nvim-web-devicons',
10 - -- 'lewis6991/gitsigns.nvim',
11 - },
12 - config = function()
13 - local heirline = require'heirline'
14 - local conditions = require("heirline.conditions")
15 - local utils = require("heirline.utils")
17 - local nugu = require'bugabinga.nugu.palette'
18 - heirline.load_colors(nugu)
20 - auto 'ReloadHeirlineColors' {
21 - description = 'Reload dark/light nugu colors for Heirline',
22 - events = 'ColorScheme',
23 - command = function() utils.on_colorscheme(nugu) end,
24 - }
26 - local vi_mode = {
27 - init = function(self)
28 - self.mode = vim.fn.mode(1) -- :h mode()
29 - end,
31 - static = {
32 - mode_names = {
33 - n = icon.normal,
34 - no = icon.normal .. "?",
35 - nov = icon.normal .. "?",
36 - noV = icon.normal .. "?",
37 - ["no\22"] = icon.normal .. "?",
38 - niI = icon.normal .. "i",
39 - niR = icon.normal .. "r",
40 - niV = icon.normal .. "v",
41 - nt = icon.normal .. "t",
42 - v = icon.visual,
43 - vs = icon.visual .. "s",
44 - V = icon.visual .. "_",
45 - Vs = icon.visual .. "s",
46 - ["\22"] = "^" .. icon.visual,
47 - ["\22s"] = "^" .. icon.visual,
48 - s = icon.select,
49 - S = icon.select .. "_",
50 - ["\19"] = "^" .. icon.select,
51 - i = icon.insert,
52 - ic = icon.insert .. "c",
53 - ix = icon.insert .. "x",
54 - R = icon.replace,
55 - Rc = icon.replace .. "c",
56 - Rx = icon.replace .. "x",
57 - Rv = icon.replace .. "v",
58 - Rvc = icon.replace .. "v",
59 - Rvx = icon.replace .. "v",
60 - c = icon.command,
61 - cv = icon.command .. "x",
62 - r = icon.pending,
63 - rm = icon.pending .. "m",
64 - ["r?"] = icon.pending .. "?",
65 - ["!"] = icon.exclaim,
66 - t = icon.terminal,
67 - },
68 - mode_colors = {
69 - n = "ui_normal" ,
70 - i = "ui_accent",
71 - v = "ui_important_global",
72 - V = "ui_important_global",
73 - ["\22"] = "ui_important_global",
74 - c = "ui_important_global",
75 - s = "ui_important_global",
76 - S = "ui_important_global",
77 - ["\19"] = "ui_important_global",
78 - R = "ui_important_global",
79 - r = "ui_important_global",
80 - ["!"] = "ui_important_global",
81 - t = "ui_important_global",
82 - }
83 - },
85 - provider = function(self)
86 - local mode_name = self.mode_names[self.mode]
87 - return " ".. icon.vim .." %3(" .. mode_name .. "%) "
88 - end,
90 - hl = function(self)
91 - local mode = self.mode:sub(1, 1) -- get only the first mode character
92 - return { fg = self.mode_colors[mode], bold = true }
93 - end,
95 - update = {
96 - "ModeChanged",
97 - pattern = "*:*",
98 - callback = vim.schedule_wrap( function() vim.cmd.redrawstatus() end),
99 - },
100 - }
102 - local file_icon = {
103 - init = function(self)
104 - local filename = self.filename
105 - local extension = vim.fn.fnamemodify(filename, ":e")
106 - self.icon = require("nvim-web-devicons").get_icon_color(filename, extension, { default = true })
107 - end,
108 - provider = function(self)
109 - return self.icon and (self.icon .. " ")
110 - end,
111 - hl = 'DefaultIcon',
112 - }
114 - local file_name = {
115 - init = function(self)
116 - self.lfilename = vim.fs.normalize(vim.fn.fnamemodify(self.filename, ":."))
117 - if self.lfilename == "" then self.lfilename = "~new~" end
118 - end,
120 - flexible = 2,
122 - {
123 - provider = function(self)
124 - return self.lfilename
125 - end,
126 - },
127 - {
128 - provider = function(self)
129 - return vim.fs.normalize(vim.fn.pathshorten(self.lfilename))
130 - end,
131 - },
132 - }
134 - local file_flags = {
135 - {
136 - condition = function()
137 - return vim.bo.modified
138 - end,
139 - provider = string.format(" %s ", icon.modified),
140 - hl = 'Comment',
141 - },
142 - {
143 - condition = function()
144 - return not vim.bo.modifiable or vim.bo.readonly
145 - end,
146 - provider = string.format(" %s ", icon.lock),
147 - hl = 'ErrorMsg',
148 - },
149 - }
151 - local file_name_block = {
152 - init = function(self)
153 - self.filename = vim.fs.normalize(vim.api.nvim_buf_get_name(0))
154 - end,
156 - file_name,
157 - file_flags,
158 - { provider = ' ' },
159 - file_icon,
160 - { provider = '%<'} -- this means that the statusline is cut here when there's not enough space
161 - }
163 - local file_type = {
164 - provider = function()
165 - return icon.file .. ' ' .. string.upper(vim.bo.filetype)
166 - end,
167 - }
169 - local file_encoding = {
170 - provider = function()
171 - local enc = (vim.bo.fenc ~= '' and vim.bo.fenc) or vim.o.enc -- :h 'enc'
172 - return enc ~= 'utf-8' and enc:upper()
173 - end,
174 - }
176 - local file_format = {
177 - static = {
178 - dos = icon.newline .. icon.carriage_return,
179 - unix = icon.newline,
180 - mac = icon.carriage_return,
181 - },
182 - provider = function(self)
183 - local fileformat = vim.bo.fileformat
184 - return self[fileformat]
185 - end
186 - }
188 - local file_size = {
189 - provider = function()
190 - -- stackoverflow, compute human readable file size
191 - -- i want to see vim opening a 1EiB file 󰱯
192 - local suffix = { 'b', 'k', 'M', 'G', 'T', 'P', 'E' }
193 - local fsize = vim.fn.getfsize(vim.api.nvim_buf_get_name(0))
194 - fsize = (fsize < 0 and 0) or fsize
195 - if fsize < 1024 then
196 - return fsize..suffix[1]
197 - end
198 - local i = math.floor((math.log(fsize) / math.log(1024)))
199 - return string.format("%.2g%s", fsize / math.pow(1024, i), suffix[i + 1])
200 - end,
201 - }
203 - local file_last_modified = {
204 - provider = function()
205 - local ftime = vim.fn.getftime(vim.api.nvim_buf_get_name(0))
206 - if ftime > 0 then
207 - local timeago = require'std.timeago'
208 - return timeago.format(ftime)
209 - end
210 - end,
211 - }
213 - local lsp_active = {
214 - condition = conditions.lsp_attached,
215 - update = {'LspAttach', 'LspDetach', 'BufEnter'},
217 - provider = function()
218 - local names = {}
219 - for _, client in pairs(vim.lsp.get_active_clients{ bufnr = 0 }) do
220 - table.insert(names, client.name)
221 - end
222 - return icon.lsp .. " " .. table.concat(names, " ")
223 - end,
224 - }
226 - local diagnostic_enabled = {
227 - init = function(self)
228 - self.icon = vim.diagnostic.is_disabled() and icon.toggle_off or icon.toggle_on
229 - end,
230 - provider = function(self)
231 - return icon.diagnostic .. ' ' .. self.icon
232 - end,
233 - }
235 - local diagnostic = {
236 - condition = conditions.has_diagnostics,
238 - static = {
239 - error_icon = icon.error,
240 - warn_icon = icon.warn,
241 - info_icon = icon.info,
242 - hint_icon = icon.hint,
243 - },
245 - init = function(self)
246 - self.errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
247 - self.warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
248 - self.hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
249 - self.info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
250 - end,
252 - update = { "DiagnosticChanged", "BufEnter" },
254 - {
255 - provider = function(self)
256 - -- 0 is just another output, we can decide to print it or not!
257 - return self.errors > 0 and (self.error_icon .. ' ' .. self.errors .. " ")
258 - end,
259 - hl = 'DiagnosticError',
260 - },
261 - {
262 - provider = function(self)
263 - return self.warnings > 0 and (self.warn_icon .. ' ' .. self.warnings .. " ")
264 - end,
265 - hl = 'DiagnosticWarn',
266 - },
267 - {
268 - provider = function(self)
269 - return self.info > 0 and (self.info_icon .. ' ' .. self.info .. " ")
270 - end,
271 - hl = 'DiagnosticInfo',
272 - },
273 - {
274 - provider = function(self)
275 - return self.hints > 0 and (self.hint_icon .. ' ' .. self.hints)
276 - end,
277 - hl = 'DiagnosticHint',
278 - },
279 - }
281 - local is_svn_repo = function()
282 - local svn_dir = vim.fs.find('.svn', {
283 - upward = true,
284 - stop = vim.uv.os_homedir(),
285 - path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
286 - type = 'directory',
287 - })
289 - return not vim.tbl_isempty(svn_dir)
290 - end
292 - local svn_get_relative_url = function()
293 - local job = require'plenary.job'
294 - local relative_url = '[ERR]'
296 - job:new{
297 - command = 'svn',
298 - args = { 'info', '--show-item', 'relative-url', '--no-newline' },
299 - on_exit = function(current_job, exit_code)
300 - if exit_code == 0 then relative_url = current_job:result() end
301 - end,
302 - }:sync()
304 - return relative_url[1]
305 - end
307 - local svn = {
308 - condition = is_svn_repo,
310 - update = 'BufEnter',
312 - init = function(self)
313 - self.relative_url = svn_get_relative_url()
314 - end,
316 - {
317 - provider = function(self)
318 - return icon.subversion .. ' ' .. icon.branch.. ' ' .. self.relative_url
319 - end,
320 - },
322 - }
324 - local git = {
325 - condition = conditions.is_git_repo,
327 - init = function(self)
328 - self.status_dict = vim.b.gitsigns_status_dict
329 - end,
331 - {
332 - provider = function(self)
333 - return icon.git .. " " .. icon.branch .. " " .. self.status_dict.head .. ' '
334 - end,
335 - },
336 - {
337 - provider = function(self)
338 - local count = self.status_dict.added or 0
339 - return count > 0 and (icon.diff_add .. " " .. count .. ' ')
340 - end,
341 - hl = 'DiffAdd',
342 - },
343 - {
344 - provider = function(self)
345 - local count = self.status_dict.removed or 0
346 - return count > 0 and (icon.diff_remove .. " " .. count .. ' ')
347 - end,
348 - hl = 'DiffDelete',
349 - },
350 - {
351 - provider = function(self)
352 - local count = self.status_dict.changed or 0
353 - return count > 0 and (icon.diff_change .. " " .. count .. ' ')
354 - end,
355 - hl = 'DiffChange',
356 - },
357 - }
359 - local work_dir = {
360 - init = function(self)
361 - self.icon = (vim.fn.haslocaldir(0) == 1 and icon['local'] or "") .. " " .. icon.global .. " "
362 - self.cwd = vim.fs.normalize(vim.uv.cwd()):gsub(vim.fs.normalize(vim.uv.os_homedir()),"~")
363 - end,
365 - flexible = 1,
367 - {
368 - -- evaluates to the full-length path
369 - provider = function(self)
370 - return self.icon .. self.cwd
371 - end,
372 - },
373 - {
374 - -- evaluates to the shortened path
375 - provider = function(self)
376 - local cwd = vim.fn.pathshorten(self.cwd)
377 - return self.icon .. cwd
378 - end,
379 - },
380 - {
381 - -- evaluates to "", hiding the component
382 - provider = "",
383 - }
384 - }
386 - local help_file_name = {
387 - condition = function()
388 - return vim.bo.filetype == "help"
389 - end,
390 - provider = function()
391 - local filename = vim.api.nvim_buf_get_name(0)
392 - return vim.fn.fnamemodify(filename, ":t")
393 - end,
394 - hl = 'Question',
395 - }
397 - local terminal_name = {
398 - -- we could add a condition to check that buftype == 'terminal'
399 - -- or we could do that later (see #conditional-statuslines below)
400 - provider = function()
401 - local tname, _ = vim.api.nvim_buf_get_name(0):gsub(".*:", "")
402 - tname = vim.fs.basename(tname)
403 - return icon.terminal .. " " .. tname
404 - end,
405 - hl = 'Bold',
406 - }
408 - local togglers = {
409 - provider = function()
410 - local togglers = require'bugabinga.options.togglers'
411 - return tostring(togglers)
412 - end,
413 - }
415 - local macro_recording = {
416 - condition = function()
417 - return vim.fn.reg_recording() ~= "" and vim.o.cmdheight == 0
418 - end,
419 - provider = icon.macro .. " ",
420 - hl = 'PreProc',
421 - utils.surround({ "░▒▓ ", " ▓▒░" }, nil, {
422 - provider = function()
423 - return vim.fn.reg_recording()
424 - end,
425 - hl = 'Bold',
426 - }),
427 - update = {
428 - "RecordingEnter",
429 - "RecordingLeave",
430 - }
431 - }
433 - local lazy = {
434 - condition = function()
435 - local ok, lazy_status = pcall(require, "lazy.status")
436 - return ok and lazy_status.has_updates()
437 - end,
438 - update = { "User", pattern = "LazyUpdate" },
439 - provider = function() return ' ' .. icon.lazy .. ' ' .. require'lazy.status'.updates() .. ' ' end,
440 - on_click = {
441 - callback = function() require'lazy'.update() end,
442 - name = "update_plugins",
443 - },
444 - hl = 'LazyProgressTodo',
445 - }
447 - local align = { provider = "%=" }
448 - local space = { provider = " " }
450 - local default_statusline = {
451 - vi_mode, macro_recording, align,
452 - work_dir, space, git, svn, align,
453 - diagnostic_enabled, space, diagnostic, space, lsp_active, align,
454 - togglers, align,
455 - lazy, space, file_encoding, space, file_format, space ,file_type, space, file_size, space, file_last_modified,
456 - }
458 - local special_statusline = {
459 - condition = function()
460 - return conditions.buffer_matches({
461 - buftype = { "nofile", "prompt", "help", "quickfix", "noice", "Trouble" },
462 - filetype = { "^git.*", "fugitive" },
463 - })
464 - end,
466 - file_type, space, help_file_name, align
467 - }
469 - local terminal_statusline = {
471 - condition = function()
472 - return conditions.buffer_matches({ buftype = { "terminal" } })
473 - end,
475 - { condition = conditions.is_active, vi_mode, space }, file_type, space, terminal_name, align,
476 - }
478 - local inactive_statusline = {
479 - condition = conditions.is_not_active,
480 - file_type, space, file_name, align,
481 - }
483 - local statuslines = {
484 - hl = function()
485 - if conditions.is_active() then
486 - return "StatusLine"
487 - else
488 - return "StatusLineNC"
489 - end
490 - end,
492 - fallthrough = false,
494 - special_statusline, terminal_statusline, inactive_statusline, default_statusline,
495 - }
497 - local winbars = {
498 - hl = function()
499 - if conditions.is_active() then
500 - return "Winbar"
501 - else
502 - return "WinbarNC"
503 - end
504 - end,
506 - fallthrough = false,
508 - {
509 - condition = function()
510 - return conditions.buffer_matches({ buftype = { "terminal" } })
511 - end,
513 - file_type, space, terminal_name,
514 - },
516 - file_name_block,
517 - }
519 - local tabpage = {
520 - provider = function(self)
521 - return "%" .. self.tabnr .. "T " .. self.tabpage .. " %T"
522 - end,
523 - hl = function(self)
524 - if not self.is_active then
525 - return "TabLine"
526 - else
527 - return "TabLineSel"
528 - end
529 - end,
530 - }
532 - local tab_pages = {
533 - -- only show this component if there's 2 or more tabpages
534 - condition = function()
535 - return #vim.api.nvim_list_tabpages() >= 2
536 - end,
537 - { provider = "%=" },
538 - utils.make_tablist(tabpage),
539 - }
541 - local tabline = { tab_pages }
543 - -- local statuscolumn = {}
545 - heirline.setup {
546 - statusline = statuslines,
547 - winbar = winbars,
548 - tabline = tabline,
549 - -- statuscolumn = statuscolumn,
551 - opts = {
552 - colors = nugu,
553 - disable_winbar_cb = function(args)
554 - return conditions.buffer_matches({
555 - buftype = { "nofile", "prompt", "help", "quickfix" },
556 - filetype = { "^git.*", "noice", "Trouble" },
557 - }, args.buf)
558 - end,
559 - },
560 - }
561 - end,
562 - },
8 + {
9 + 'rebelot/heirline.nvim',
10 + event = 'BufEnter',
11 + dependencies = {
12 + 'nvim-tree/nvim-web-devicons',
13 + 'lewis6991/gitsigns.nvim',
14 + },
15 + config = function ()
16 + local heirline = require 'heirline'
17 + local conditions = require 'heirline.conditions'
18 + local utils = require 'heirline.utils'
20 + local nugu = require 'bugabinga.nugu.palette'
21 + heirline.load_colors( nugu )
23 + auto 'ReloadHeirlineColors' {
24 + description = 'Reload dark/light nugu colors for Heirline',
25 + events = 'ColorScheme',
26 + command = function () utils.on_colorscheme( nugu ) end,
27 + }
29 + local vi_mode = {
30 + init = function ( self )
31 + self.mode = vim.fn.mode( 1 ) -- :h mode()
32 + end,
34 + static = {
35 + mode_names = {
36 + n = icon.normal,
37 + no = icon.normal .. '?',
38 + nov = icon.normal .. '?',
39 + noV = icon.normal .. '?',
40 + ['no\22'] = icon.normal .. '?',
41 + niI = icon.normal .. 'i',
42 + niR = icon.normal .. 'r',
43 + niV = icon.normal .. 'v',
44 + nt = icon.normal .. 't',
45 + v = icon.visual,
46 + vs = icon.visual .. 's',
47 + V = icon.visual .. '_',
48 + Vs = icon.visual .. 's',
49 + ['\22'] = '^' .. icon.visual,
50 + ['\22s'] = '^' .. icon.visual,
51 + s = icon.select,
52 + S = icon.select .. '_',
53 + ['\19'] = '^' .. icon.select,
54 + i = icon.insert,
55 + ic = icon.insert .. 'c',
56 + ix = icon.insert .. 'x',
57 + R = icon.replace,
58 + Rc = icon.replace .. 'c',
59 + Rx = icon.replace .. 'x',
60 + Rv = icon.replace .. 'v',
61 + Rvc = icon.replace .. 'v',
62 + Rvx = icon.replace .. 'v',
63 + c = icon.command,
64 + cv = icon.command .. 'x',
65 + r = icon.pending,
66 + rm = icon.pending .. 'm',
67 + ['r?'] = icon.pending .. '?',
68 + ['!'] = icon.exclaim,
69 + t = icon.terminal,
70 + },
71 + mode_colors = {
72 + n = 'ui_normal',
73 + i = 'ui_accent',
74 + v = 'ui_important_global',
75 + V = 'ui_important_global',
76 + ['\22'] = 'ui_important_global',
77 + c = 'ui_important_global',
78 + s = 'ui_important_global',
79 + S = 'ui_important_global',
80 + ['\19'] = 'ui_important_global',
81 + R = 'ui_important_global',
82 + r = 'ui_important_global',
83 + ['!'] = 'ui_important_global',
84 + t = 'ui_important_global',
85 + }
86 + },
88 + provider = function ( self )
89 + local mode_name = self.mode_names[self.mode]
90 + return ' ' .. icon.vim .. ' %3(' .. mode_name .. '%) '
91 + end,
93 + hl = function ( self )
94 + local mode = self.mode:sub( 1, 1 ) -- get only the first mode character
95 + return { fg = self.mode_colors[mode], bold = true }
96 + end,
98 + update = {
99 + 'ModeChanged',
100 + pattern = '*:*',
101 + callback = vim.schedule_wrap( function () vim.cmd.redrawstatus() end ),
102 + },
105 + local file_icon = {
106 + init = function ( self )
107 + local filename = self.filename
108 + local extension = vim.fn.fnamemodify( filename, ':e' )
109 + self.icon = require 'nvim-web-devicons'.get_icon_color( filename, extension, { default = true } )
110 + end,
111 + provider = function ( self )
112 + return self.icon and (self.icon .. ' ')
113 + end,
114 + hl = 'DefaultIcon',
117 + local file_name = {
118 + init = function ( self )
119 + self.lfilename = vim.fs.normalize( vim.fn.fnamemodify( self.filename, ':.' ) )
120 + if self.lfilename == '' then self.lfilename = NEW_FILE end
121 + end,
123 + flexible = 2,
126 + provider = function ( self )
127 + return self.lfilename
128 + end,
129 + },
131 + provider = function ( self )
132 + return vim.fs.normalize( vim.fn.pathshorten( self.lfilename ) )
133 + end,
134 + },
137 + local file_flags = {
139 + condition = function ()
140 + return vim.bo.modified
141 + end,
142 + provider = string.format( ' %s ', icon.modified ),
143 + hl = 'Comment',
144 + },
146 + condition = function ()
147 + return not vim.bo.modifiable or vim.bo.readonly
148 + end,
149 + provider = string.format( ' %s ', icon.lock ),
150 + hl = 'ErrorMsg',
151 + },
154 + local file_name_block = {
155 + init = function ( self )
156 + self.filename = vim.fs.normalize( vim.api.nvim_buf_get_name( 0 ) )
157 + end,
159 + file_icon,
160 + { provider = ' ' },
161 + file_name,
162 + file_flags,
163 + { provider = '%<' } -- this means that the statusline is cut here when there's not enough space
166 + local file_type = {
167 + provider = function ()
168 + return icon.file .. ' ' .. string.upper( vim.bo.filetype )
169 + end,
172 + local file_encoding = {
173 + provider = function ()
174 + local enc = (vim.bo.fenc ~= '' and vim.bo.fenc) or vim.o.enc -- :h 'enc'
175 + return enc ~= 'utf-8' and enc:upper()
176 + end,
179 + local file_format = {
180 + static = {
181 + dos = icon.newline .. icon.carriage_return,
182 + unix = icon.newline,
183 + mac = icon.carriage_return,
184 + },
185 + provider = function ( self )
186 + local fileformat = vim.bo.fileformat
187 + return self[fileformat]
188 + end
191 + local file_size = {
192 + provider = function ()
193 + -- stackoverflow, compute human readable file size
194 + -- i want to see vim opening a 1EiB file 󰱯
195 + local suffix = { 'b', 'k', 'M', 'G', 'T', 'P', 'E' }
196 + local fsize = vim.fn.getfsize( vim.api.nvim_buf_get_name( 0 ) )
197 + fsize = (fsize < 0 and 0) or fsize
198 + if fsize < 1024 then
199 + return fsize .. suffix[1]
200 + end
201 + local i = math.floor( (math.log( fsize ) / math.log( 1024 )) )
202 + return string.format( '%.2g%s', fsize / math.pow( 1024, i ), suffix[i + 1] )
203 + end,
206 + local file_last_modified = {
207 + provider = function ()
208 + local ftime = vim.fn.getftime( vim.api.nvim_buf_get_name( 0 ) )
209 + if ftime > 0 then
210 + local timeago = require 'std.timeago'
211 + return timeago.format( ftime )
212 + end
213 + end,
216 + local lsp_active = {
217 + condition = conditions.lsp_attached,
218 + update = { 'LspAttach', 'LspDetach', 'BufEnter' },
220 + provider = function ()
221 + local names = {}
222 + for _, client in pairs( vim.lsp.get_active_clients { bufnr = 0 } ) do
223 + table.insert( names, client.name )
224 + end
225 + return icon.lsp .. ' ' .. table.concat( names, ' ' )
226 + end,
229 + local diagnostic_enabled = {
230 + init = function ( self )
231 + self.icon = vim.diagnostic.is_disabled() and icon.toggle_off or icon.toggle_on
232 + end,
233 + provider = function ( self )
234 + return icon.diagnostic .. ' ' .. self.icon
235 + end,
238 + local diagnostic = {
239 + condition = conditions.has_diagnostics,
241 + static = {
242 + error_icon = icon.error,
243 + warn_icon = icon.warn,
244 + info_icon = icon.info,
245 + hint_icon = icon.hint,
246 + },
248 + init = function ( self )
249 + self.errors = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.ERROR } )
250 + self.warnings = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.WARN } )
251 + self.hints = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.HINT } )
252 + self.info = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.INFO } )
253 + end,
255 + update = { 'DiagnosticChanged', 'BufEnter' },
258 + provider = function ( self )
259 + -- 0 is just another output, we can decide to print it or not!
260 + return self.errors > 0 and (self.error_icon .. ' ' .. self.errors .. ' ')
261 + end,
262 + hl = 'DiagnosticError',
263 + },
265 + provider = function ( self )
266 + return self.warnings > 0 and (self.warn_icon .. ' ' .. self.warnings .. ' ')
267 + end,
268 + hl = 'DiagnosticWarn',
269 + },
271 + provider = function ( self )
272 + return self.info > 0 and (self.info_icon .. ' ' .. self.info .. ' ')
273 + end,
274 + hl = 'DiagnosticInfo',
275 + },
277 + provider = function ( self )
278 + return self.hints > 0 and (self.hint_icon .. ' ' .. self.hints)
279 + end,
280 + hl = 'DiagnosticHint',
281 + },
284 + local is_svn_repo = function ()
285 + local svn_dir = vim.fs.find( '.svn', {
286 + upward = true,
287 + stop = vim.uv.os_homedir(),
288 + path = vim.fs.dirname( vim.api.nvim_buf_get_name( 0 ) ),
289 + type = 'directory',
290 + } )
292 + return not vim.tbl_isempty( svn_dir )
293 + end
295 + local svn_get_relative_url = function ()
296 + local job = require 'plenary.job'
297 + local relative_url = '[ERR]'
299 + job:new {
300 + command = 'svn',
301 + args = { 'info', '--show-item', 'relative-url', '--no-newline' },
302 + on_exit = function ( current_job, exit_code )
303 + if exit_code == 0 then relative_url = current_job:result() end
304 + end,
305 + }:sync()
307 + return relative_url[1]
308 + end
310 + local svn = {
311 + condition = is_svn_repo,
313 + update = 'BufEnter',
315 + init = function ( self )
316 + self.relative_url = svn_get_relative_url()
317 + end,
320 + provider = function ( self )
321 + return icon.subversion .. ' ' .. icon.branch .. ' ' .. self.relative_url
322 + end,
323 + },
327 + local git = {
328 + condition = conditions.is_git_repo,
330 + init = function ( self )
331 + self.status_dict = vim.b.gitsigns_status_dict
332 + end,
335 + provider = function ( self )
336 + return icon.git .. ' ' .. icon.branch .. ' ' .. self.status_dict.head .. ' '
337 + end,
338 + },
340 + provider = function ( self )
341 + local count = self.status_dict.added or 0
342 + return count > 0 and (icon.diff_add .. ' ' .. count .. ' ')
343 + end,
344 + hl = 'DiffAdd',
345 + },
347 + provider = function ( self )
348 + local count = self.status_dict.removed or 0
349 + return count > 0 and (icon.diff_remove .. ' ' .. count .. ' ')
350 + end,
351 + hl = 'DiffDelete',
352 + },
354 + provider = function ( self )
355 + local count = self.status_dict.changed or 0
356 + return count > 0 and (icon.diff_change .. ' ' .. count .. ' ')
357 + end,
358 + hl = 'DiffChange',
359 + },
362 + local work_dir = {
363 + init = function ( self )
364 + self.icon = (vim.fn.haslocaldir( 0 ) == 1 and icon['local'] or '') .. ' ' .. icon.global .. ' '
365 + self.cwd = vim.fs.normalize( vim.uv.cwd() ):gsub( vim.fs.normalize( vim.uv.os_homedir() ), '~' )
366 + end,
368 + flexible = 1,
371 + provider = function ( self )
372 + return self.icon .. self.cwd
373 + end,
374 + },
376 + provider = function ( self )
377 + local cwd = vim.fn.pathshorten( self.cwd )
378 + return self.icon .. cwd
379 + end,
380 + },
382 + provider = '',
386 + local help_file_name = {
387 + condition = function ()
388 + return vim.bo.filetype == 'help'
389 + end,
390 + provider = function ()
391 + local filename = vim.api.nvim_buf_get_name( 0 )
392 + return vim.fn.fnamemodify( filename, ':t' )
393 + end,
394 + hl = 'Question',
397 + local terminal_name = {
398 + provider = function ()
399 + local tname, _ = vim.api.nvim_buf_get_name( 0 ):gsub( '.*:', '' )
400 + tname = vim.fs.basename( tname )
401 + return icon.terminal .. ' ' .. tname
402 + end,
403 + hl = 'Bold',
406 + local togglers = {
407 + provider = function ()
408 + local togglers = require 'bugabinga.options.togglers'
409 + return tostring( togglers )
410 + end,
413 + local macro_recording = {
414 + condition = function ()
415 + return vim.fn.reg_recording() ~= '' and vim.o.cmdheight == 0
416 + end,
417 + provider = icon.macro .. ' ',
418 + hl = 'PreProc',
419 + utils.surround( { '░▒▓ ', ' ▓▒░' }, nil, {
420 + provider = function ()
421 + return vim.fn.reg_recording()
422 + end,
423 + hl = 'Bold',
424 + } ),
425 + update = {
426 + 'RecordingEnter',
427 + 'RecordingLeave',
431 + local lazy = {
432 + condition = function ()
433 + local ok, lazy_status = pcall( require, 'lazy.status' )
434 + return ok and lazy_status.has_updates()
435 + end,
436 + update = { 'User', pattern = 'LazyUpdate' },
437 + provider = function () return ' ' .. icon.lazy .. ' ' .. require 'lazy.status'.updates() .. ' ' end,
438 + on_click = {
439 + callback = function () require 'lazy'.update() end,
440 + name = 'update_plugins',
441 + },
442 + hl = 'LazyProgressTodo',
445 + local align = { provider = '%=' }
446 + local space = { provider = ' ' }
448 + local default_statusline = {
449 + vi_mode, macro_recording, align,
450 + work_dir, space, git, svn, align,
451 + diagnostic_enabled, space, diagnostic, space, lsp_active, align,
452 + togglers, align,
453 + lazy, space, file_encoding, space, file_format, space, file_type, space, file_size, space, file_last_modified,
456 + local special_statusline = {
457 + condition = function ()
458 + return conditions.buffer_matches {
459 + buftype = ignored.buftypes,
460 + filetype = ignored.filetypes,
462 + end,
464 + file_type,
465 + space,
466 + help_file_name,
467 + align
470 + local terminal_statusline = {
472 + condition = function ()
473 + return conditions.buffer_matches { buftype = { 'terminal' } }
474 + end,
476 + { condition = conditions.is_active, vi_mode, space },
477 + file_type,
478 + space,
479 + terminal_name,
480 + align,
483 + local inactive_statusline = {
484 + condition = conditions.is_not_active,
485 + file_type,
486 + space,
487 + file_name,
488 + align,
491 + local statuslines = {
492 + hl = function ()
493 + if conditions.is_active() then
494 + return 'StatusLine'
495 + else
496 + return 'StatusLineNC'
497 + end
498 + end,
500 + fallthrough = false,
502 + special_statusline,
503 + terminal_statusline,
504 + inactive_statusline,
505 + default_statusline,
508 + local winbars = {
509 + hl = function ()
510 + if conditions.is_active() then
511 + return 'Winbar'
512 + else
513 + return 'WinbarNC'
514 + end
515 + end,
517 + fallthrough = false,
520 + condition = function ()
521 + return conditions.buffer_matches { buftype = { 'terminal' } }
522 + end,
524 + file_type,
525 + space,
526 + terminal_name,
527 + },
529 + file_name_block,
532 + local tabline_buffer_number = {
533 + provider = function ( self )
534 + return '(' .. tostring( self.bufnr ) .. ')'
535 + end,
536 + hl = function ( self )
537 + if self.is_active then
538 + return { fg = 'content_accent' }
539 + else
540 + return { fg = 'ui_minor' }
541 + end
542 + end,
545 + local tabline_file_name = {
546 + provider = function ( self )
547 + local file_name = self.file_name
548 + file_name = file_name == '' and NEW_FILE or vim.fs.normalize( vim.fn.fnamemodify( file_name, ':t' ) )
549 + return file_name
550 + end,
551 + hl = function ( self ) return { bold = self.is_active or self.is_visible, italic = true } end,
554 + local tabline_file_flags = {
556 + condition = function ( self ) return vim.api.nvim_buf_get_option( self.bufnr, 'modified' ) end,
557 + provider = icon.modified,
558 + },
560 + condition = function ( self )
561 + return not vim.api.nvim_buf_get_option( self.bufnr, 'modifiable' ) or
562 + vim.api.nvim_buf_get_option( self.bufnr, 'readonly' )
563 + end,
564 + provider = function ( self )
565 + if vim.api.nvim_buf_get_option( self.bufnr, 'buftype' ) == 'terminal' then
566 + return icon.terminal
567 + else
568 + return icon.lock
569 + end
570 + end,
571 + },
572 + hl = 'Bold',
575 + local tabline_file_name_block = {
576 + init = function ( self )
577 + self.file_name = vim.api.nvim_buf_get_name( self.bufnr )
578 + end,
580 + hl = function ( self )
581 + if self.is_active then
582 + return 'TabLineSel'
583 + elseif not vim.api.nvim_buf_is_loaded( self.bufnr ) then
584 + return { fg = 'ui_unfocus' }
585 + else
586 + return 'TabLine'
587 + end
588 + end,
590 + on_click = {
591 + callback = function ( _, minwid, _, button )
592 + if button == 'm' then --m = middle click
593 + vim.schedule( function ()
594 + vim.api.nvim_buf_delete( minwid, { force = false } )
595 + vim.cmd.redrawtabline()
596 + end )
597 + else
598 + vim.api.nvim_win_set_buf( 0, minwid )
599 + end
600 + end,
601 + minwid = function ( self ) return self.bufnr end,
602 + name = 'heirline_tabline_buffer_callback',
603 + },
605 + file_icon,
606 + { provider = ' ' },
607 + tabline_file_name,
608 + tabline_buffer_number,
609 + tabline_file_flags,
612 + local tabline_close_button = {
613 + condition = function ( self )
614 + return not vim.api.nvim_buf_get_option( self.bufnr, 'modified' )
615 + end,
616 + { provider = ' ' },
618 + provider = icon.close,
619 + hl = { fg = 'gray' },
620 + on_click = {
621 + callback = function ( _, minwid )
622 + vim.schedule( function ()
623 + vim.api.nvim_buf_delete( minwid, { force = false } )
624 + vim.cmd.redrawtabline()
625 + end )
626 + end,
627 + minwid = function ( self )
628 + return self.bufnr
629 + end,
630 + name = 'heirline_tabline_close_buffer_callback',
631 + },
632 + },
635 + local tabline_buffer_block = utils.surround(
636 + { icon.block_open, icon.block_close },
637 + function ( self )
638 + if self.is_active then
639 + return utils.get_highlight 'TabLineSel'.bg
640 + else
641 + return utils.get_highlight 'TabLine'.bg
642 + end
643 + end,
644 + { tabline_file_name_block, tabline_close_button }
647 + local buffer_line = utils.make_buflist(
648 + tabline_buffer_block,
649 + { provider = icon.arrow_left, hl = { fg = 'ui_minor' } },
650 + { provider = icon.arrow_right, hl = { fg = 'ui_minor' } }
653 + local tabpage = {
654 + provider = function ( self )
655 + return '%' .. self.tabnr .. 'T ' .. self.tabpage .. ' %T'
656 + end,
657 + hl = function ( self )
658 + if not self.is_active then
659 + return 'TabLine'
660 + else
661 + return 'TabLineSel'
662 + end
663 + end,
666 + local tab_pages = {
667 + { provider = '%=' },
668 + utils.make_tablist( tabpage ),
671 + local tabline = { buffer_line, tab_pages }
673 + -- local statuscolumn = {}
675 + heirline.setup {
676 + statusline = statuslines,
677 + winbar = winbars,
678 + tabline = tabline,
679 + -- statuscolumn = statuscolumn,
681 + opts = {
682 + colors = nugu,
683 + disable_winbar_cb = function ( args )
684 + return conditions.buffer_matches(
686 + buftype = ignored.buftypes,
687 + filetype = ignored.filetypes,
688 + },
689 + args.buf )
690 + end,
691 + },
693 + end,
694 + },

neovim/lua/bugabinga/plugins/inc-rename.lua

Deleted
deleted file mode 100644
1 -return {
2 - 'smjonas/inc-rename.nvim',
3 - cmd = 'IncRename',
4 - keys = { {
5 - '<F2>',
6 - function()
7 - return ':IncRename ' .. vim.fn.expand('<cword>')
8 - end,
9 - desc = 'lsp: Rename symbol under cursor with live preview',
10 - expr = true,
11 - } },
12 - opts = {},
13 -}

neovim/lua/bugabinga/plugins/indent_blankline.lua

Modified
1 -return {
2 - "lukas-reineke/indent-blankline.nvim" ,
3 - event = { 'BufReadPost', 'BufNew' },
4 - config = function()
5 - local indent_blankline = require'indent_blankline'
1 +local icon = require'std.icon'
7 - indent_blankline.setup {
8 - space_char_blankline = " ",
9 - show_current_context = true,
10 - show_current_context_start = true,
11 - show_trailing_blankline_indent = false,
12 - }
13 - end,
3 +return {
4 + 'lukas-reineke/indent-blankline.nvim',
5 + main = 'ibl',
6 + event = { 'BufReadPost', 'BufNew' },
7 + config = function ()
8 + local ibl = require 'ibl'
10 + ibl.setup {
11 + debounce = 250,
12 + indent = {
13 + char = icon.vertical_bar,
14 + tab_char = icon.vertical_bar,
15 + },
16 + }
17 + end,

neovim/lua/bugabinga/plugins/mason.lua

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

neovim/lua/bugabinga/plugins/multicursors.lua

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

neovim/lua/bugabinga/plugins/noice.lua

Modified
1 1 local map = require'std.map'
2 +local ignored = require'std.ignored'
3 4 return {
20 21 ['cmp.entry.get_documentation'] = true,
24 + smart_move = { excluded_filetypes = ignored.filetypes },
23 25 presets = {
24 26 inc_rename = true, -- enables an input dialog for inc-rename.nvim

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

Modified
1 1 return {
2 2 'bugabinga/nvim-jdtls',
3 - ft = { 'java' },

neovim/lua/bugabinga/plugins/oil.lua

Modified
1 -local map = require'std.map'
1 +local map = require 'std.map'
3 3 return {
4 - 'stevearc/oil.nvim',
5 - lazy = false,
6 - -- event = 'VeryLazy',
7 - dependencies = { "nvim-tree/nvim-web-devicons" },
8 - config = function()
9 - local oil = require'oil'
10 - oil.setup{
11 - skip_confirm_for_simple_edits = true,
12 - -- delete_to_trash = true,
13 - -- trash_command = 'rm', --nu command
4 + 'stevearc/oil.nvim',
5 + branch = 'stevearc-trash',
6 + keys = '-',
7 + cmd = { 'Oil' },
8 + dependencies = { 'nvim-tree/nvim-web-devicons' },
9 + config = function ()
10 + local oil = require 'oil'
11 + oil.setup {
12 + skip_confirm_for_simple_edits = true,
13 + delete_to_trash = true,
14 + -- trash_command = 'rm --trash', --nu command
15 - colums = {
16 - "icon",
17 - "permissions",
18 - "size",
19 - "mtime",
20 - },
21 - keymaps = {
22 - ["q"] = "actions.close",
23 - ["<esc>"] = "actions.close",
24 - ["<C-/>"] = "actions.show_help",
25 - ["<C-_>"] = "actions.show_help",
26 - ["<C-?>"] = "actions.show_help",
27 - ["<C-v>"] = "actions.select_vsplit",
28 - ["<C-x>"] = "actions.select_split",
29 - ["<C-h>"] = "actions.toggle_hidden",
30 - },
31 - float = {
32 - border = vim.g.border_style,
33 - padding = 2,
34 - win_options = { winblend = vim.o.winblend },
35 - },
36 - }
16 + colums = {
17 + 'icon',
18 + 'permissions',
19 + 'size',
20 + 'mtime',
21 + },
22 + keymaps = {
23 + ['q'] = 'actions.close',
24 + ['<esc>'] = 'actions.close',
25 + ['<C-/>'] = 'actions.show_help',
26 + ['<C-v>'] = 'actions.select_vsplit',
27 + ['<C-s>'] = 'actions.select_split',
28 + ['<C-h>'] = 'actions.toggle_hidden',
29 + },
30 + float = {
31 + max_width = 69,
32 + min_width = 42,
33 + border = vim.g.border_style,
34 + padding = 2,
35 + win_options = { winblend = vim.o.winblend },
36 + },
37 + }
38 - map.normal {
39 - description = 'Open parent directory in buffer.',
40 - category = 'files',
41 - keys = '-',
42 - -- command = oil.open,
43 - command = oil.open_float,
44 - }
45 - end,
39 + map.normal {
40 + description = 'Open parent directory in buffer.',
41 + category = 'files',
42 + keys = '-',
43 + -- command = oil.open,
44 + command = oil.open_float,
45 + }
46 + end,

neovim/lua/bugabinga/plugins/persistence.lua

Modified
2 2 local map = require'std.map'
4 4 return {
5 5 'folke/persistence.nvim',
6 - lazy = false,
6 + event = "BufReadPre",
7 7 opts = { },
8 8 config = function(_, opts)
9 9 local persistence = require'persistence'
25 25 end,
26 -}

neovim/lua/bugabinga/plugins/starter.lua

Added
new file mode 100644
1 +return {
2 + 'echasnovski/mini.nvim',
3 + main = 'mini.starter',
4 + lazy = false,
5 + config = function ()
6 + local starter = require 'mini.starter'
7 + local is_home = vim.uv.cwd() == vim.uv.os_homedir()
9 + local custom_actions = {
10 + { name = 'Find files', action = 'Telescope find_files', section = 'Builtin actions' },
11 + { name = 'Oil', action = 'Oil', section = 'Builtin actions' },
12 + }
14 + local sessions = function ( limit )
15 + limit = limit or 8
16 + local persistence = require 'persistence'
17 + local persistence_config = require 'persistence.config'
18 + local sessions = persistence.list()
19 + table.sort( sessions, function ( a, b )
20 + return vim.loop.fs_stat( a ).mtime.sec > vim.loop.fs_stat( b ).mtime.sec
21 + end )
22 + return vim.iter( sessions )
23 + :slice( 1, limit )
24 + :map( function ( session_path )
25 + -- session files encode their cwd as an escaped path in their file name
26 + -- t = tail of name
27 + -- r = remove extension
28 + -- gs = replace all % with /
29 + -- ~ = relative to home
30 + local name = vim.fn.fnamemodify( session_path, ':t:r:gs_%_/_:~' )
31 + local action = 'silent! source ' .. vim.fn.fnameescape( session_path )
32 + local section = 'Sessions'
34 + return { name = name, action = action, section = section }
35 + end )
36 + :totable()
37 + end
39 + starter.setup {
40 + header = [[
41 +███ ▄ ▄▀ ██ ███ ▄█ ▄ ▄▀ ██
42 +█ █ █ ▄▀ █ █ █ █ ██ █ ▄▀ █ █
43 +█ ▀ ▄ █ █ █ ▀▄ █▄▄█ █ ▀ ▄ ██ ██ █ █ ▀▄ █▄▄█
44 +█ ▄▀ █ █ █ █ █ █ █ ▄▀ ▐█ █ █ █ █ █ █ █
45 +███ █▄ ▄█ ███ █ ███ ▐ █ █ █ ███ █
46 + ▀▀▀ █ █ ██ █
47 + ▀ ▀]],
48 + items = {
49 + starter.sections.builtin_actions(),
50 + custom_actions,
51 + sessions,
52 + starter.sections.recent_files( is_home and 24 or 8, not is_home, is_home ),
53 + --TODO
54 + -- change cwd when selecting recent file
55 + },
56 + content_hooks = {
57 + starter.gen_hook.adding_bullet(),
58 + starter.gen_hook.aligning( 'center', 'center' ),
59 + starter.gen_hook.indexing( 'all', { 'Recent files', 'Builtin actions' } ),
60 + },
61 + }
62 + end,

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

Added
new file mode 100644
1 +return {
2 + 'simrat39/symbols-outline.nvim',
3 + cmd = 'SymbolsOutline',
4 + opts = {},
5 +}

neovim/lua/bugabinga/plugins/treesitter.lua

Modified
22 22 return {
23 23 'nvim-treesitter/nvim-treesitter',
24 24 branch = 'master',
25 - event = 'BufRead',
26 - cmd = {
27 - 'TSBufDisable',
28 - 'TSBufEnable',
29 - 'TSBufToggle',
30 - 'TSDisable',
31 - 'TSEnable',
32 - 'TSToggle',
33 - 'TSInstall',
34 - 'TSInstallInfo',
35 - 'TSInstallSync',
36 - 'TSModuleInfo',
37 - 'TSUninstall',
38 - 'TSUpdate',
39 - 'TSUpdateSync',
40 - 'TSPlaygroundToggle',
41 - 'TSHighlightCapturesUnderCursor',
42 - 'TSNodeUnderCursor',
43 - },
25 + event = { 'BufReadPre', 'BufNewFile'},
44 26 build = function ()
45 27 require 'nvim-treesitter.install'.update { with_sync = true }
67 49 'bash',
69 51 -- https://github.com/nvim-treesitter/nvim-treesitter/issues/5389
70 - -- 'comment',
52 + 'comment',
71 53 'diff',
72 54 'dot',
73 55 'git_config',
112 94 keymaps = {
113 95 init_selection = '<up>',
114 96 node_incremental = '<right>',
115 - node_decremental = '<left>',
116 - scope_incremental = false,
97 + node_decremental = '<down>',
98 + scope_incremental = '<up>',
143 125 enable = true,
144 126 lookahead = true,
145 127 keymaps = {
146 - ['af'] = { query = '@function.outer', desc = 'Select outer function' },
147 - ['if'] = { query = '@function.inner', desc = 'Select inner function' },
128 + ['af'] = { query = '@call.outer', desc = 'outer function call' },
129 + ['if'] = { query = '@call.inner', desc = 'inner function call' },
149 - ['ac'] = { query = '@class.outer', desc = 'Select outer class' },
150 - ['ic'] = { query = '@class.inner' , desc = 'Select inner class' },
131 + ['am'] = { query = '@function.outer', desc = 'outer function definition' },
132 + ['im'] = { query = '@function.inner', desc = 'inner function definition' },
152 - ['at'] = { query = '@comment.outer' , desc = 'Select outer comment' },
134 + ['aa'] = { query = '@assignment.outer', desc = 'outer assignment' },
135 + ['ia'] = { query = '@assignment.inner', desc = 'inner assignment' },
154 - ['as'] = { query = '@scope', query_group = 'locals', desc = 'Select language scope' },
137 + ['la'] = { query = '@assignment.lhs', desc = 'left hand side of assignment'},
138 + ['ra'] = { query = '@assignment.rhs', desc = 'right hand side of assignment'},
140 + ['ac'] = { query = '@class.outer', desc = 'outer class' },
141 + ['ic'] = { query = '@class.inner' , desc = 'inner class' },
143 + ['ao'] = { query = '@conditional.outer', desc = 'outer conditional' },
144 + ['io'] = { query = '@conditional.inner' , desc = 'inner conditional' },
146 + ['al'] = { query = '@loop.outer', desc = 'outer loop' },
147 + ['il'] = { query = '@loop.inner' , desc = 'inner loop' },
149 + -- this overwrites the built-in 'paragraph' object
150 + ['ap'] = { query = '@parameter.outer', desc = 'outer parameter' },
151 + ['ip'] = { query = '@parameter.inner' , desc = 'inner parameter' },
153 + ['at'] = { query = '@comment.outer' , desc = 'outer comment' },
155 + ['as'] = { query = '@scope', query_group = 'locals', desc = 'language scope' },
156 157 selection_modes = {
157 158 ['@parameter.outer'] = 'v',
165 166 swap = {
166 167 enable = true,
167 168 swap_next = {
168 - ['<leader>sn'] = { query = '@parameter.inner' , desc = 'Swap parameter with next' },
169 + ['<leader>spn'] = { query = '@parameter.inner' , desc = 'Swap parameter with next' },
170 171 swap_previous = {
171 - ['<leader>sp'] = { query = '@parameter.inner' , desc = 'Swap parameter with previous' },
172 + ['<leader>spp'] = { query = '@parameter.inner' , desc = 'Swap parameter with previous' },
186 187 enable = true,
187 188 set_jumps = true,
188 189 goto_next = {
189 - [']f'] = { query = '@function.outer' , desc = 'Goto next funtion' },
190 + [']f'] = { query = '@call.outer' , desc = 'Goto next function call' },
191 + [']m'] = { query = '@fucntion.outer' , desc = 'Goto next function definition' },
190 192 [']c'] = { query = '@class.outer', desc = 'Goto next class' },
193 + [']o'] = { query = '@conditional.outer' , desc = 'Goto next conditional' },
194 + [']p'] = { query = '@parameter.outer' , desc = 'Goto next parameter' },
191 195 [']s'] = { query = '@scope', query_group = 'locals', desc = 'Goto next scope' },
192 - [']i'] = { query = '@conditional.outer' , desc = 'Goto next conditional' },
193 - [']a'] = { query = '@parameter.outer' , desc = 'Goto next parameter' },
195 197 goto_previous = {
196 - ['[f'] = { query = '@function.outer' , desc = 'Goto previous function' },
198 + ['[f'] = { query = '@call.outer' , desc = 'Goto previous function call' },
199 + ['[m'] = { query = '@function.outer' , desc = 'Goto previous function definition' },
197 200 ['[c'] = { query = '@class.outer', desc = 'goto previous class' },
201 + ['[o'] = { query = '@conditional.outer' , desc = 'Goto previous conditional' },
202 + ['[p'] = { query = '@parameter.outer' , desc = 'Goto previous parameter' },
198 203 ['[s'] = { query = '@scope', query_group = 'locals', desc = 'Goto previous scope' },
199 - ['[i'] = { query = '@conditional.outer' , desc = 'Goto previous conditional' },
200 - ['[a'] = { query = '@parameter.outer' , desc = 'Goto previous parameter' },
206 209 local ts_repeat_move = require 'nvim-treesitter.textobjects.repeatable_move'
211 + -- FIXME: use ; and , to repeat movement, just like built-ins.
212 + -- needs to fix f, F and t, T
213 + -- does flash still work then?
208 214 map.normal.visual.operator_pending {
209 215 description = 'This repeats the last query with always previous direction and to the start of the range.',
210 216 keys = '<PageUp>',

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

Modified
1 +local ignored = require 'std.ignored'
1 3 return {
3 5 'lukas-reineke/virt-column.nvim',
4 6 event = { 'BufReadPost', 'BufNew' },
5 7 opts = {
6 - char = '│',
8 + char = { '░', '▒', '▓' },
9 + exclude = {
10 + filetypes = ignored.filetypes,
11 + buftypes = ignored.buftypes,
12 + }

neovim/lua/bugabinga/plugins/whichkey.lua

Modified
1 1 local ignored = require 'std.ignored'
3 ---TODO: add which-key highlights in nugu
4 3 return {
5 4 'folke/which-key.nvim',
6 5 event = 'VeryLazy',

neovim/lua/std/icon.lua

Modified
1 1 return {
2 - error = '󰇷',
3 - warn = '󰱯',
4 - info = '󰩖',
5 - hint = '󰊪',
6 - quot_left = '󰝗',
7 - quot_right = '󰉾',
8 - hash = '',
2 + ['function'] = '󰡱',
3 + ['local'] = '󱥕',
4 + ['table'] = '',
5 + arrow_left = '',
6 + arrow_right = '',
7 + branch = '',
8 + carriage_return = '␍',
9 9 checkbox_mark = '',
10 10 checkbox_unmark = '',
11 - user = ' ',
12 - data = '',
13 - thread = '󱇫',
14 - ['function'] = '󰡱',
15 - ['table'] = '',
16 - toggle_on = '',
17 - toggle_off = '',
18 - diagnostic = '⊙',
19 - spelling = '󰓆',
20 - linenumber = '󰉻',
21 - linehighlight = '󰘤',
22 - modified = '',
23 - lock = '',
24 - file = '',
25 - newline = '␤',
26 - carriage_return = '␍',
27 - lsp = '',
28 - subversion = '󰳗',
29 - vim = '',
30 - branch = '',
31 - git = '',
32 - diff_add = '',
33 - diff_remove = '',
34 - diff_change = '',
35 - folder = '',
36 - terminal = '',
37 - macro = '',
38 - lazy = '󰄻',
39 - global = '󱥔',
40 - ['local'] = '󱥕',
41 - space = '⋅',
42 - eol = '↴',
43 - tab = '󰌒',
44 - trail = '•',
45 - extends = '❯',
46 - precedes = '❮',
47 - nbsp = '␣',
48 - normal = 'Ν',
49 - visual = '󰒉',
50 - insert = '',
51 - select = '󰒉',
52 - replace = '',
53 11 command = '󰘳',
54 - pending = '',
12 + close = '',
13 + block_open = '▟',
14 + block_close = '▙',
15 + data = '',
16 + diagnostic = '⊙',
17 + diff_add = '',
18 + diff_change = '',
19 + diff_remove = '',
20 + eol = '↴',
21 + error = '󰇷',
55 22 exclaim = '',
23 + extends = '❯',
24 + file = '',
25 + folder = '',
26 + git = '',
27 + global = '󱥔',
28 + hash = '',
29 + hint = '󰊪',
30 + info = '󰩖',
31 + insert = '',
32 + lazy = '󰄻',
33 + linehighlight = '󰘤',
34 + linenumber = '󰉻',
35 + lock = '',
36 + lsp = '',
37 + macro = '',
38 + modified = '',
39 + nbsp = '␣',
40 + newline = '␤',
41 + normal = 'Ν',
42 + pending = '',
43 + precedes = '❮',
44 + quot_left = '󰝗',
45 + quot_right = '󰉾',
46 + replace = '',
47 + select = '󰒉',
48 + space = '⋅',
49 + spelling = '󰓆',
50 + subversion = '󰳗',
51 + tab = '󰌒',
52 + terminal = '',
53 + thread = '󱇫',
54 + toggle_off = '',
55 + toggle_on = '',
56 + trail = '•',
57 + user = ' ',
58 + vertical_bar = '│',
59 + vim = '',
60 + virtual = '󰢔',
61 + visual = '󰒉',
62 + warn = '󰱯',

neovim/lua/std/ignored.lua

Modified
1 1 local filetypes = {
2 - 'gitcommit',
3 - 'gitrebase',
4 - 'svn',
5 - 'hgcommit',
6 - 'help',
7 - 'noice',
8 - 'notify',
2 + 'Outline',
9 3 'TelescopePrompt',
10 4 'TelescopeResults',
11 - 'toggleterm',
5 + 'WhichKey',
6 + 'flash_prompt',
7 + '^git.*',
8 + 'help',
12 9 'lazy',
10 + 'noice',
11 + 'notify',
13 12 'oil',
14 13 'spectre_panel',
15 - 'WhichKey',
14 + 'starter',
15 + 'svn',
16 + 'toggleterm',
17 + 'Trouble',
18 20 local buftypes = {
19 - 'noice',
20 - 'neotree',
21 - 'quickfix',
22 - 'help',
23 - 'nofile',
24 21 'acwrite',
22 + 'help',
23 + 'neotree',
24 + 'nofile',
25 + 'noice',
26 + 'prompt',
27 + 'quickfix',
27 30 local as_kv = function(list)

neovim/lua/std/project.lua

Modified
1 -local ignored = require 'std.ignored'
2 1 local table = require 'std.table'
3 2 local join = table.join
4 3 local dirname = vim.fs.dirname
9 8 local cache = {}
10 9 local hasher = vim.fn.sha256
11 -local markers_to_string = function(markers)
12 - return table.deep_concat(markers, {
10 +local markers_to_string = function ( markers )
11 + return table.deep_concat( markers, {
13 12 prefix = '',
14 13 suffix = '',
15 14 row_delimiter = '',
16 15 key_value_delimiter = '',
17 16 fill = '',
18 17 newline = '',
19 - })
18 + } )
21 -local create_hash = function(path, markers)
22 - local path_hash = hasher(path)
23 - local markers_hash = hasher(markers_to_string(markers))
20 +local create_hash = function ( path, markers )
21 + local path_hash = hasher( path )
22 + local markers_hash = hasher( markers_to_string( markers ) )
24 23 local hash = path_hash .. '|' .. markers_hash
25 24 return hash
27 -local cache_get = function(path, markers)
28 - local hash = create_hash(path, markers)
26 +local cache_get = function ( path, markers )
27 + local hash = create_hash( path, markers )
29 28 local hit = cache[hash]
30 29 return hit
32 -local cache_set = function(project_root, path, markers)
33 - local hash = create_hash(path, markers)
31 +local cache_set = function ( project_root, path, markers )
32 + local hash = create_hash( path, markers )
34 33 cache[hash] = project_root
67 66 ---@param stop string? The last directory on the path to root, when to stop searching. if `nil`, the users home
68 67 ---directory is used.
69 68 ---@return string? # Directory, that contains the `markers` and lies on the path from `path` to `stop`.
70 -local function find_root(path, markers, stop)
69 +local function find_root( path, markers, stop )
71 70 validate {
72 71 path = { path, 'string', true },
73 72 markers = { markers, 'table' },
74 73 stop = { stop, 'string', true },
77 - path = path or dirname(vim.api.nvim_buf_get_name(0))
78 - path = normalize(path)
76 + path = path or dirname( vim.api.nvim_buf_get_name( 0 ) )
77 + path = normalize( path )
79 78 stop = stop or vim.uv.os_homedir()
80 - stop = normalize(stop)
79 + stop = normalize( stop )
82 - if not exists(stop) then error(('the stop directory %s does not exist!'):format(stop)) end
81 + if not exists( stop ) then error( ('the stop directory %s does not exist!'):format( stop ) ) end
84 - local cache_hit = cache_get(path, markers)
83 + if #path == 0 then return nil end
85 + local cache_hit = cache_get( path, markers )
85 86 if cache_hit then
86 87 -- vim.print("CACHE HIT", cache_hit)
87 88 return cache_hit
99 100 local current_path = path
100 101 while current_path ~= stop do
101 102 if loop_count > MAX_TRAVERSAL_COUNT then
102 - vim.notify(('searching for markers reached the max traversal count for path %s !'):format(path))
103 + vim.notify( ('searching for markers reached the max traversal count for path %s !'):format( path ) )
110 111 markers = {},
113 - for _, marker in ipairs(markers) do
114 + for _, marker in ipairs( markers ) do
114 115 local marker_path = current_path .. '/' .. marker.name
115 - if exists(marker_path) then
116 + if exists( marker_path ) then
116 117 score.marker_count = score.marker_count + marker.weight
117 - table.insert(score.markers, marker_path)
118 + table.insert( score.markers, marker_path )
121 122 if score.marker_count > 0 then
122 - table.insert(directory_scores, score)
123 + table.insert( directory_scores, score )
125 - current_path = dirname(current_path)
126 + current_path = dirname( current_path )
127 128 current_distance_to_buffer = current_distance_to_buffer + 1
128 129 loop_count = loop_count + 1
136 137 -- then it is most likely a nested project structure (multi-module).
137 138 -- in those cases we are looking for the root project folder, instead the nearest
138 139 -- child project root folder.
139 - for _, score in ipairs(directory_scores) do
140 - local likelihood = score.marker_count + 1/score.distance_to_buffer_file
140 + for _, score in ipairs( directory_scores ) do
141 + local likelihood = score.marker_count + 1 / score.distance_to_buffer_file
141 142 if likelihood > max_likelyhood then
142 143 max_likelyhood = likelihood
143 144 project_root = score.path
146 147 if project_root then
147 - cache_set(project_root, path, markers)
148 + cache_set( project_root, path, markers )
149 150 return project_root
156 157 ---@return string? # The project root of the current buffer, or `nil`, if none could be determined.
158 -local function find_project_root(path, markers)
159 +local function find_project_root( path, markers )
159 160 -- define some language-independent markers
160 161 local default_markers = {
161 162 { name = '.git', weight = 1 },
175 176 { name = 'flake.nix', weight = 1 },
178 - return find_root(path, join(default_markers, markers))
179 + return find_root( path, join( default_markers, markers ) )
181 -local function find_vcs_project_root(path)
182 - return find_project_root(path, {})
182 +local function find_vcs_project_root( path )
183 + return find_project_root( path, {} )
185 -local function find_java_project_root(path)
186 +local function find_java_project_root( path )
186 187 local java_markers = {
187 188 { name = '.idea', weight = 2 },
188 189 { name = '.classpath', weight = 2 },
199 200 { name = 'gradlew', weight = 3 },
200 201 { name = 'gradlew.bat', weight = 3 },
202 - return find_root(path, java_markers)
203 + return find_root( path, java_markers )
205 206 -- TODO: how to get a marker for luarocks stuff?
218 219 { name = 'lua', weight = 1 },
221 -local find_lua_project_root = function(path)
222 - return find_root(path, lua_markers)
222 +local find_lua_project_root = function ( path )
223 + return find_root( path, lua_markers )
225 -local find_lua_nvim_project_root = function(path)
226 - return find_root(path, nvim_lua_markers)
226 +local find_lua_nvim_project_root = function ( path )
227 + return find_root( path, nvim_lua_markers )
229 230 local zig_markers = {
233 234 { name = 'zig-out', weight = 1 },
236 -local find_zig_project_root = function(path)
237 - return find_root(path, zig_markers)
237 +local find_zig_project_root = function ( path )
238 + return find_root( path, zig_markers )
240 -local find_rust_project_root = function(path)
241 +local find_rust_project_root = function ( path )
241 242 local markers = {
242 243 { name = 'Cargo.toml', weight = 3 },
244 - local cargo_crate_dir = find_root(path, markers)
245 + local cargo_crate_dir = find_root( path, markers )
245 246 if cargo_crate_dir == nil then return nil end
247 248 local cmd = {
251 252 '--format-version',
253 254 '--manifest-path',
254 - vim.fs.joinpath(cargo_crate_dir, 'Cargo.toml'),
255 + vim.fs.joinpath( cargo_crate_dir, 'Cargo.toml' ),
257 - local result = vim.system(cmd, { text = true }):wait()
258 + local result = vim.system( cmd, { text = true } ):wait()
258 259 local cargo_workspace_root
260 261 if result.code == 0 then
261 - local json = vim.json.decode(result.stdout)
262 + local json = vim.json.decode( result.stdout )
262 263 if json['workspace_root'] then
263 - cargo_workspace_root = vim.fs.normalize(json['workspace_root'])
264 + cargo_workspace_root = vim.fs.normalize( json['workspace_root'] )
267 268 return cargo_workspace_root or cargo_crate_dir
271 +local fallback_rooter = function ( path )
272 + return find_vcs_project_root( path ) or find_project_root( path )
273 +end
274 +local rooters = {
275 + java = find_java_project_root,
276 + lua = function ( path ) return find_lua_nvim_project_root( path ) or find_lua_project_root( path ) end,
277 + rust = find_rust_project_root,
278 + zig = find_zig_project_root,
281 +local find_root_by_filetype = function ( path, filetype )
282 + local rooter = rooters[filetype]
283 + return rooter and rooter( path ) or fallback_rooter( path )
284 +end
270 286 return {
271 287 find_root = find_root,
288 + find_root_by_filetype = find_root_by_filetype,
272 289 find_project_root = find_project_root,
273 290 find_vcs_project_root = find_vcs_project_root,
274 291 find_java_project_root = find_java_project_root,

neovim/lua/std/want.lua

Modified
1 +-- FIXME: remove this, use pcall instead
1 3 --- attempts to import modules with the given names.
2 4 ---@param module_names string|table name or list of names, or a function that returns those
3 5 ---@return function function that takes a function that takes in the modules listed by `module_names`
6 +---@deprecated use pcall instead
4 7 return function ( module_names )
5 8 return function ( block, error_handler )
6 9 local loaded_modules = {}

neovim/popo.xml

Deleted
deleted file mode 100644

No text changes.

nushell/modules/aliases.nu

Modified
29 29 export alias nf = open-editor-with-file-search
31 +def fuzzy-kill [ query:string ] {
32 + let pid = (^ps -ef | sed 1d | fzf -m --query $query | awk '{print $2}')
33 + if not ($pid | is-empty) {
34 + kill ($pid | into int )
35 + }
37 +export alias fkill = fuzzy-kill
31 39 # TODO: HOST SPECIFIC ALIASES
32 40 # I do not see a way right now the have different aliases per host with nu.