repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: faster startup on win32

694ad9772316a3bada33f33420cf9c32c1a42106

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

unsigned

Browse filesCompare with HEAD

Changed files (20)

+21 / −427 text lines

Diff layout

NB-00718.symlinks

Modified

+3 / −0 text lines

4343neovide
4444~/AppData/Roaming/neovide
46zed
47~/AppData/Roaming/zed
48
4649ssh/config
4750~/.ssh/config

neovim/.refactor/rule-tests/.gitkeep

Deleted
deleted file mode 100644

No text changes.

neovim/.refactor/rule-tests/vim.validate.deprecation-test.yml

Deleted
deleted file mode 100644

+0 / −5 text lines

1id: test
2valid:
3- "valid code"
4invalid:
5- "invalid code"

neovim/.refactor/rules/.gitkeep

Deleted
deleted file mode 100644

No text changes.

neovim/.refactor/rules/vim.validate.deprecation.yml

Deleted
deleted file mode 100644

+0 / −10 text lines

1# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json
2
3id: vim.validation.deprecation
4language: Lua
5severity: error
6message: Add your rule message here....
7rule:
8 pattern: vim.validate { $VALUE = { $VALUE, $TYPE } }
9fix: vim.validate('$VALUE', $VALUE, $TYPE)
10note: vim.validate API in neovim 0.11 got deprecated in favor of new signature

neovim/.refactor/utils/.gitkeep

Deleted
deleted file mode 100644

No text changes.

neovim/init.lua

Modified

+0 / −1 text lines

5252require 'bugabinga.bigfile'
5353require 'bugabinga.diagnostic'
5454require 'bugabinga.editorconfig'
55require 'bugabinga.java'
5655require 'bugabinga.lsp'
5756require 'bugabinga.statusline'.setup()
5857require 'bugabinga.mkdir'

neovim/lua/bugabinga/editorconfig.lua

Modified

+0 / −2 text lines

2121 end
2222end
24-- even those options are the same as my togglers, the code is not shared for the
25-- small off chance, that this ever gets shared as a neovim plugin
2624expose_option( 'spell', tobool )
2725expose_option( 'number', tobool )
2826expose_option( 'relativenumber', tobool )

neovim/lua/bugabinga/java.lua

Deleted
deleted file mode 100644

+0 / −263 text lines

1local puk = require 'std.puk'
2local project = require 'std.project'
3local auto = require 'std.auto'
4local map = require 'std.map'
5local dbg = require 'std.dbg'
6local localrc = require 'std.localrc'
7local table = require 'std.table'
8
9local jdtls_ss_id = nil
11local create_config = function(syntax_server_mode, path)
12 local data_path = vim.fn.stdpath 'data'
13 if type(data_path) == 'table' then
14 data_path = data_path[1]
15 end
16 local home = vim.fs.abspath '~'
17 local tools_path = vim.fs.joinpath(home, 'Tools')
18 local jdtls_jre_path = vim.fs.find(function(name) return name:match 'graalvm%-community%-openjdk%-25.*' end,
19 { path = tools_path, type = 'directory' })[1]
20 local jdtls_install_path = vim.fs.find(function(name) return name:match 'jdt%-language%-server%-1%.49.*' end,
21 { path = tools_path, type = 'directory' })[1]
22 local plugins_path = vim.fs.joinpath(jdtls_install_path, 'plugins')
23 local launcher_path = vim.fs.find(function(name) return name:match 'org%.eclipse%.equinox%.launcher_.*' end,
24 { path = plugins_path, type = 'file' })[1]
26 local project_local_settings = localrc('.jdtls.lua', 'table') or {}
27 project_local_settings.jdtls = project_local_settings.jdtls or {}
29 local find_runtimes = function()
30 local runtimes = {}
32 table.insert(runtimes, {
33 name = 'JavaSE-25',
34 path = jdtls_jre_path,
35 sources = vim.fs.joinpath(jdtls_jre_path, 'lib', 'src.zip'),
36 default = true,
37 })
39 if (project_local_settings.jdtls.runtimes) then
40 return table.deep_extend('force', runtimes, project_local_settings.jdlts.runtimes)
41 else
42 return runtimes
43 end
44 end
45 local root_dir = project.find_java_project_root(path)
46 local jdlts_config_dir
47 if syntax_server_mode then
48 jdlts_config_dir = vim.fn.has 'win32' and 'config_ss_win' or 'config_ss_linux'
49 else
50 jdlts_config_dir = vim.fn.has 'win32' and 'config_win' or 'config_linux'
51 end
52 local config_dir = vim.fs.joinpath(jdtls_install_path, jdlts_config_dir)
53 local workspace_dir = vim.fs.joinpath(data_path, 'jdtls-workspace', vim.fs.basename(root_dir))
54 local compiler_options_path = vim.fs.joinpath(home, '.config', 'jdlts', 'compiler_options.properties')
56 local cmd = {
57 vim.fs.joinpath(jdtls_jre_path, 'bin', 'java'),
58 '-Declipse.application=org.eclipse.jdt.ls.core.id1',
59 '-Dosgi.bundles.defaultStartLevel=4',
60 '-Declipse.product=org.eclipse.jdt.ls.core.product',
61 '-Dlog.level=ERROR',
62 '-Xmx8G',
63 '--add-modules=ALL-SYSTEM',
64 '--add-opens', 'java.base/java.util=ALL-UNNAMED',
65 '--add-opens', 'java.base/java.lang=ALL-UNNAMED',
66 '--add-modules', 'jdk.incubator.vector',
67 '--enable-native-access=ALL-UNNAMED',
68 '-jar', launcher_path,
69 '-configuration', config_dir,
70 '-data', workspace_dir,
71 }
73 if syntax_server_mode then
74 table.insert(cmd, 2, '-Dsyntaxserver=true')
75 end
77 local runtimes = find_runtimes()
78 local config = {
79 name = syntax_server_mode and 'jdtls_ss' or 'jdtls',
80 cmd = cmd,
81 root_dir = root_dir,
82 settings = {
83 java = {
84 autobuild = { enabled = true },
85 cleanup = {
86 actionsOnSave = {
87 'qualifyMembers',
88 'qualifyStaticMembers',
89 'addOverride',
90 'addDeprecated',
91 'stringConcatToTextBlock',
92 'invertEquals',
93 'addFinalModifier',
94 'instanceofPatternMatch',
95 'switchExpression',
96 },
97 },
98 codeGeneration = {
99 generateComments = false,
100 hashCodeEquals = { useJava7Objects = true },
101 toString = {
102 template = '${object.className}{${member.name()}=${member.value()}, ${otherMembers}}',
103 },
104 useBlocks = true,
105 },
106 codeAction = { sortMembers = { avoidVolatileChanges = true } },
107 completion = {
108 enabled = true,
109 favortiteStaticMembers = {
110 'org.junit.Assert.*',
111 'org.junit.Assume.*',
112 'org.junit.jupiter.api.Assertions.*',
113 'org.junit.jupiter.api.Assumptions.*',
114 'org.junit.jupiter.api.DynamicContainer.*',
115 'org.junit.jupiter.api.DynamicTest.*',
116 'org.assertj.core.api.Assertions.*',
117 'org.assertj.core.api.Assumptions.*',
118 'java.util.Objects.requireNonNull',
119 'java.util.Objects.requireNonNullElse',
120 'java.time.temporal.ChronoUnit.*',
121 'java.lang.System.Logger',
122 'java.lang.System.Logger.Level.*',
123 },
124 filteredTypes = {
125 -- Swing and AWT
126 'javax.swing.*',
127 'java.awt.*',
128 -- CORBA
129 'org.omg.*',
130 -- Applet
131 'java.applet.*',
132 -- Legacy JAF
133 'javax.activation.*',
134 -- Legacy Security
135 'java.security.acl.*',
136 'javax.security.auth.callback.*',
137 -- Legacy XML/SOAP
138 'javax.xml.soap.*',
139 'javax.xml.rpc.*',
140 -- RMI
141 'java.rmi.*',
142 -- Legacy Collections
143 'java.util.Vector',
144 'java.util.Hashtable',
145 'java.util.Stack',
146 'java.util.Dictionary',
147 -- Deprecated Classes
148 'java.util.Date',
149 'java.util.Calendar',
150 'java.util.Observable',
151 'java.util.Observer',
152 -- Niche Packages
153 'javax.annotation.*',
154 'javax.jws.*',
155 'java.beans.*',
156 'javax.management.*',
157 },
158 guessMethodArguments = false,
159 importOrder = {
160 'net',
161 'de',
162 'org',
163 'com',
164 'javax',
165 'java',
166 },
167 matchCase = 'FIRSTLETTER',
168 maxResults = 5,
169 overwrite = true,
170 postfix = { enabled = true },
171 },
172 configuration = {
173 runtimes = runtimes,
174 updateBuildConfiguration = 'interactive',
175 },
176 contentProvider = { preferred = nil },
177 eclipse = { downloadSources = true },
178 errors = { incompleteClassPath = { severity = 'error' } },
179 executeCommand = { enabled = true },
180 foldingRange = { enabled = false },
181 format = { enabled = true },
182 home = jdtls_jre_path,
183 implementationsCodeLens = { enabled = true },
184 import = {
185 maven = { enabled = true },
186 gradle = {
187 enabled = true,
188 annotationProcessing = true,
189 wrapper = { enabled = true },
190 },
191 exclusions = {
192 '**/output/**',
193 '**/target/**',
194 '**/node_modules/**',
195 '**/.metadata/**',
196 '**/archetype-resources/**',
197 '**/META-INF/maven/**',
198 },
199 },
200 inlayHints = { parameterNames = { enabled = 'all' } },
201 jdt = {
202 ls = {
203 androidSupport = false,
204 lombokSupport = false,
205 protofBufSupport = true,
206 },
207 },
208 maven = { notCoveredPluginExecutionSeverity = 'error' },
209 maxConcurrentBuilds = 16,
210 project = {
211 encoding = 'SETDEFAULT',
212 outputPath = project_local_settings.jdtls.outputPath,
213 referencedLibraries = project_local_settings.jdtls.referencedLibraries,
214 resourceFilters = project_local_settings.jdtls.resourceFilters,
215 sourcePaths = project_local_settings.jdtls.sourcePaths,
216 },
217 referencesCodeLens = { enabled = true },
218 references = {
219 includeAccessors = true,
220 includeDecompiledSources = true,
221 },
222 rename = { enabled = true },
223 saveActions = { origanizeImports = true },
224 selectionRange = { enabled = true },
225 settings = {
226 url = compiler_options_path,
227 },
228 signatureHelp = { enabled = true },
229 sources = {
230 organizeImports = {
231 starThreshold = 9999,
232 staticStarThreshold = 9999,
233 },
234 },
235 symbols = { includeSourceMethodDeclarations = true },
236 trace = { server = dbg.get() and 'verbose' or 'off' },
237 edit = { validateAllOpenBuffersOnChanges = false },
238 },
239 },
240 handlers = {
241 ['language/status'] = function(_, status)
242 if status.message == 'ServiceReady' and jdtls_ss_id ~= nil then
243 vim.notify('Stopping jdtls_ss: ' .. jdtls_ss_id)
244 vim.lsp.stop_client(jdtls_ss_id, false)
245 end
246 end,
247 },
248 }
249 return config
250end
252auto 'start_jdtls' {
253 pattern = 'java',
254 events = 'FileType',
255 description = 'Starts jdlts (with syntax mode initially)',
256 command = function()
257 local path = vim.api.nvim_buf_get_name(0)
258 jdtls_ss_id = vim.lsp.start(create_config(true, path))
259 --TODO: figure out a way to choose between ss and full mode on demand.
260 -- using the full server in script files is annoying
261 puk 'jdtls'.start_or_attach(create_config(false, path))
262 end,
263}

neovim/lua/bugabinga/lsp.lua

Modified

+0 / −3 text lines

2727 table.insert( servers, server_name )
2828end
30vim.print( servers )
31vim.lsp.enable( servers )
3330user_command.LspRestart 'Restarts LSP servers for current filetype or specified server' (
3431 function ( opts )
3532 local server = opts.args

neovim/lua/bugabinga/options/keymaps.lua

Modified

+0 / −15 text lines

11local map = require 'std.map'
2local togglers = require 'bugabinga.options.togglers'
43-- set <SPACE> as leader key
54map {
8281 command = vim.cmd.redo,
85for _, toggler in ipairs(togglers) do
86 local option_name = toggler.options[1].name
87 local first_char = string.sub(option_name, 1, 1)
89 map.normal {
90 description = 'Toggle ' .. option_name .. ' option',
91 category = 'options',
92 keys = '<leader>t' .. first_char,
93 command = function()
94 toggler:toggle()
95 end,
96 }
97end
9984map.normal {
10085 description = 'Run command and pipe output into temp buffer',
10186 category = 'external',

neovim/lua/bugabinga/options/togglers.lua

Deleted
deleted file mode 100644

+0 / −71 text lines

1local icon = require 'std.icon'
2
3local togglers = {}
4
5local toggle_on_icon = icon.toggle_on
6local toggle_off_icon = icon.toggle_off
7
8local get_option = function(name) return vim.api.nvim_get_option_value(name, {}) end
9local set_option = function(name, value) vim.api.nvim_set_option_value(name, value, {}) end
11local toggle = function(self)
12 vim.iter(self.options)
13 :each(function(option)
14 local current_value = get_option(option.name)
15 if current_value == option.default then
16 set_option(option.name, option.alternative)
17 vim.notify(self.display_name .. ' ' .. toggle_on_icon)
18 else
19 set_option(option.name, option.default)
20 vim.notify(self.display_name .. ' ' .. toggle_off_icon)
21 end
22 end)
23end
25local toggler_tostring = function(self)
26 local all_default = vim.iter(self.options)
27 :all(function(option) return get_option(option.name) == option.default end)
28 return self.display_name .. ' ' .. (all_default and toggle_off_icon or toggle_on_icon)
29end
31local make_toggler = function(display_name, options)
32 return {
33 display_name = display_name,
34 options = options,
35 toggle = toggle,
36 tostring = toggler_tostring
37 }
38end
40local make_option = function(name, alternative)
41 local option_value = get_option(name)
42 alternative = alternative or not option_value
43 return {
44 name = name,
45 default = option_value,
46 alternative = alternative
47 }
48end
50local add_toggler = function(display_name, options)
51 table.insert(togglers, make_toggler(display_name, options))
52end
54add_toggler(icon.spelling, { make_option 'spell' })
55add_toggler(icon.linenumber, { make_option 'number', make_option 'relativenumber' })
56add_toggler(icon.linehighlight, { make_option 'cursorline' })
57add_toggler(icon.wrap, { make_option 'wrap' })
58add_toggler(icon.list, { make_option 'list' })
59add_toggler(icon.virtual, { make_option('virtualedit', 'all') })
61local tostring = function(self)
62 return vim.iter(self)
63 :map(toggler_tostring)
64 :fold('', function(buffer, text)
65 return buffer .. (buffer == '' and '' or ' ') .. text
66 end)
67end
69return setmetatable(togglers, {
70 __tostring = tostring
71})

neovim/lua/bugabinga/statusline.lua

Modified

+1 / −1 text lines

8585 -- Remove empty components and join with separators
8686 local filtered = vim.tbl_filter(function(c) return c ~= '' end, components)
87 return table.concat(filtered, ' | ')
87 return table.concat(filtered, ' ')
8888end
9090-- Click handler for LSP component

neovim/lua/std/const.lua

Modified

+16 / −13 text lines

77 local background = 'dark'
99 -- Check for environment override first
10 local override = os.getenv("NVIM_BACKGROUND")
10 local override = os.getenv 'NVIM_BACKGROUND'
1111 if override then
1212 return override
1313 end
1515 -- First check whether we are on WSL or Windows
1616 if win32 or wsl then
17 -- Check if 'reg.exe' is executable
18 if vim.fn.executable 'reg.exe' ~= 0 then
19 -- Execute command to check if the win32 appearance is set to Dark
20 local appsUseLightTheme = vim.fn.system { 'reg.exe', 'Query',
21 'HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize', '/v', 'AppsUseLightTheme' }
22 if appsUseLightTheme:find '0x1' then
23 background = 'light'
24 end
25 end
17 return 'light'
18 -- This takes around 100ms, too long for code in my startup path
19 -- -- Check if 'reg.exe' is executable
20 -- if vim.fn.executable 'reg.exe' ~= 0 then
21 -- -- Execute command to check if the win32 appearance is set to Dark
22 -- local result = vim.system(
23 -- { 'reg.exe', 'Query', 'HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize', '/v',
24 -- 'AppsUseLightTheme' }, { text = true, timeout = 2000 } ):wait()
25 -- if result.code == 0 and result.stdout and result.stdout:find '0x1' then
26 -- background = 'light'
27 -- end
28 -- end
2629 -- Check if 'busctl' is executable (part of systemd)
2730 elseif vim.fn.executable 'busctl' ~= 0 then
2831 -- Abfrage des standardisierten XDG Color-Schemes
3538 'org.freedesktop.appearance', 'color-scheme',
3639 }
38 local obj = vim.system(cmd, { text = true, timeout = 2000 })
41 local obj = vim.system( cmd, { text = true, timeout = 2000 } )
3942 local result = obj:wait()
4144 if result.code ~= 0 then
4245 background = 'dark'
4346 else
44 local output = result.stdout or ""
47 local output = result.stdout or ''
4548 -- COSMIC/GNOME liefern meist 'v u 1' für Dark, 'v u 2' für Light (oder 0 für Default)
4649 -- Wir suchen nach der Zahl am Ende des Outputs
47 local color_scheme = output:match 'u%s+(%d+)'
50 local color_scheme = output:match 'u%s+(%d+)'
4952 -- 1 = prefer-dark, 2 = prefer-light, 0 = no-preference
5053 if color_scheme == '2' or color_scheme == '0' then

neovim/puk.plugins.nuon

Modified

+0 / −8 text lines

208208 "48f9afb684de1c191af7bed96bc1db85ba33f6a4",
209209 null
210210 ],
211 [
212 jdtls,
213 github,
214 mfussenegger/nvim-jdtls,
215 master,
216 "b69924ca90014fef485ee153571bdcbc1ece8c2e",
217 null
218 ],
219211 [
220212 nvim-autopairs,
221213 github,

neovim/sgconfig.yml

Deleted
deleted file mode 100644

+0 / −6 text lines

1ruleDirs:
2- /home/oli/Workspace/dotfiles/neovim/.refactor/rules
3testConfigs:
4- testDir: /home/oli/Workspace/dotfiles/neovim/.refactor/rule-tests
5utilDirs:
6- /home/oli/Workspace/dotfiles/neovim/.refactor/utils

neovim/todo.txt

Deleted
deleted file mode 100644

+0 / −8 text lines

1UX Improvements
2- Status line: You're using laststatus = 3 (global status) but no custom statusline - consider integrating with incline.nvim or winbar
3- Tabline: With showtabline = 2, consider a custom tabline showing LSP diagnostics or git status
4- Keymap consistency: Your LSP mappings use gr prefix well - consider extending to other areas (debugging, git)
5Code Organization
6- Error handling: Add more robust error handling in LSP attaches and plugin loads
7
8- finish cheatsheet (DONE - improved to dynamically collect keymaps from buffer)

wezterm/bugabinga/hosts/fedora.lua

Modified

+1 / −0 text lines

11return function ( cfg )
22 cfg.enable_wayland = true
3 cfg.max_fps = 144
34 cfg.font_size = 16
45end

wezterm/bugabinga/options.lua

Modified

+0 / −2 text lines

1414 fade_out_duration_ms = 69,
1515 target = 'CursorColor',
1616 }
17 cfg.front_end = 'WebGpu'
18 cfg.max_fps = 144
1917 cfg.unzoom_on_switch_pane = true
2018 cfg.scrollback_lines = 16777216
2119end

zed/settings.json

Modified

+0 / −19 text lines

11{
2 "agent": {
3 "default_model": {
4 "provider": "copilot_chat",
5 "model": "grok-code-fast-1",
6 },
7 "favorite_models": [],
8 "model_parameters": [],
9 },
102 "vim_mode": true,
11 "theme": {
12 "mode": "system",
13 "light": "Alabaster",
14 "dark": "Alabaster Dark",
15 },
16 "buffer_font_family": "Monaspace Neon Var",
173 "buffer_font_size": 18,
184 "buffer_font_features": {
195 "calt": true,
217 },
228 "cursor_blink": false,
239 "hide_mouse": "on_typing_and_movement",
24 "ui_font_size": 16,
25 "ui_font_family": "Intel One Mono",
2610 "relative_line_numbers": "enabled",
2711 "scroll_beyond_last_line": "off",
2812 "vertical_scroll_margin": 0,
4125 },
4226 "format_on_save": "on",
4327 "formatter": "language_server",
44 "project_panel": {
45 "dock": "left",
46 },