repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: luaLS for neovim

63e71dffcba0381c0e40a53d78237ec6a5817cbf

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (30)

helix/config.toml

Modified
1 -theme = "nugu-light"
1 +theme = "nugu-dark"
3 3 [editor]
4 4 shell = ["nu", "--commands"]

neovim/ftplugin/java.lua.bak

Deleted
deleted file mode 100644
1 -local want = require 'std.want'
2 -want {
3 - 'jdtls',
4 - 'lsp-zero',
5 - 'nvim-lsp-installer',
6 -}(function(jdtls, zero, installer)
7 - local debug_log = true
8 - local syntax_server = false
9 - local project = require 'std.project'
10 - local home = os.getenv 'HOME'
12 - local jdtls_root_dir = project.determine_java_project_root '~'
13 - if jdtls_root_dir then
14 - vim.notify('eclipse.jdt.ls java project root is ' .. jdtls_root_dir)
15 - -- even when a project root as found, it does not necessarily mean it is a
16 - -- `classic` java project, in the sense that eclipse.jdt.ls thinks of a "project"
17 - if not project.is_java_project_root(jdtls_root_dir, home) then
18 - -- support for single file mode
19 - syntax_server = true
20 - end
21 - else
22 - vim.notify('no root directory for eclipse.jdt.ls could be found.', 'warning')
23 - -- support for single file mode
24 - syntax_server = true
25 - end
27 - if syntax_server then
28 - vim.notify 'starting eclipse.jdt.ls in syntaxserver mode'
29 - end
31 - local installed, jdtls_installer = installer.get_server 'jdtls'
32 - if not installed then
33 - vim.notify('jdtls is not installed!', error)
34 - return
35 - end
36 - local jdtls_install_dir = jdtls_installer.root_dir
37 - local jdtls_config_dir = nil
38 - local jdtls_syntax_server_config_dir = nil
39 - if vim.fn.has 'mac' == 1 then
40 - jdtls_config_dir = jdtls_install_dir .. '/config_mac'
41 - jdtls_syntax_server_config_dir = jdtls_install_dir .. '/config_ss_mac'
42 - elseif vim.fn.has 'unix' == 1 then
43 - jdtls_config_dir = jdtls_install_dir .. '/config_linux'
44 - jdtls_syntax_server_config_dir = jdtls_install_dir .. '/config_ss_linux'
45 - elseif vim.fn.has 'win32' == 1 then
46 - jdtls_config_dir = jdtls_install_dir .. '/config_win'
47 - jdtls_syntax_server_config_dir = jdtls_install_dir .. '/config_ss_win'
48 - else
49 - vim.notify('eclipse.jdt.ls cannot be configured for current system.', 'error')
50 - return
51 - end
53 - local project_directory
54 - if jdtls_root_dir ~= nil then
55 - project_directory = jdtls_root_dir
56 - else
57 - project_directory = vim.fn.getcwd()
58 - end
59 - local project_name = vim.fn.fnamemodify(project_directory, ':p:h:t')
60 - local nvim_data = vim.fn.stdpath 'data'
61 - local jdtls_workspace_dir = nvim_data .. '/eclipse.jdt.ls.workspace/' .. project_name
62 - vim.fn.mkdir(jdtls_workspace_dir, 'p')
64 - local shared_configuration
65 - if syntax_server then
66 - shared_configuration = jdtls_syntax_server_config_dir
67 - else
68 - shared_configuration = jdtls_config_dir
69 - end
70 - -- sometimes the jdtls cannot start (code 13).
71 - -- it seems to have to do with invalif configuration "config_linux" and/or "~/.config/jdtls"
72 - local jdtls_command = {
73 - 'java',
74 - '-Dsyntaxserver=' .. tostring(syntax_server),
75 - '-Declipse.application=org.eclipse.jdt.ls.core.id1',
76 - '-Dosgi.bundles.defaultStartLevel=4',
77 - '-Declipse.product=org.eclipse.jdt.ls.core.product',
78 - '-Dlog.protocol=' .. tostring(debug_log),
79 - '-Dlog.level=INFO',
80 - '-XX:+UnlockExperimentalVMOptions',
81 - '-XX:+UseZGC',
82 - -- '-XX:+UseParallelGC',
83 - -- '-XX:GCTimeRatio=4',
84 - -- '-XX:AdaptiveSizePolicyWeight=90',
85 - '-Dsun.zip.disableMemoryMapping=true',
86 - '-Djava.import.generatesMetadataFilesAtProjectRoot=false',
87 - '-Xmx4G',
88 - '-Xms100m',
89 - '--add-modules=ALL-SYSTEM',
90 - '--add-opens',
91 - 'java.base/java.util=ALL-UNNAMED',
92 - '--add-opens',
93 - 'java.base/java.lang=ALL-UNNAMED',
94 - '-jar',
95 - vim.fn.glob(jdtls_install_dir .. '/plugins/org.eclipse.equinox.launcher_*.jar', false, false),
96 - '-configuration',
97 - shared_configuration,
98 - '-data',
99 - jdtls_workspace_dir,
100 - }
102 - -- FIXME: what's this? necessary?
103 - local extendedClientCapabilities = jdtls.extendedClientCapabilities
104 - extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
106 - local server_trace = 'off'
107 - if debug_log then
108 - server_trace = 'verbose'
109 - end
111 - -- See `:help vim.lsp.start_client` for an overview of the supported `config` options.
112 - local config = {
113 - -- The command that starts the language server
114 - -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
115 - cmd = jdtls_command,
117 - -- This is the default if not provided, you can remove it. Or adjust as needed.
118 - -- One dedicated LSP server & client will be started per unique root_dir
119 - root_dir = jdtls_root_dir,
121 - -- Here you can configure eclipse.jdt.ls specific settings
122 - -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
123 - -- for a list of options
124 - settings = {
125 - java = {
126 - autobuild = true,
127 - sources = {
128 - organizeImports = {
129 - starThreshold = 9999,
130 - staticStarThreshold = 9999,
131 - },
132 - },
133 - codeGeneration = {
134 - generateComments = true,
135 - hashCodeEquals = { useJava7Objects = true, useInstanceOf = true },
136 - -- insertionLocation = '',
137 - toString = {
138 - listArrayContents = true,
139 - skipNullValues = false,
140 - },
141 - useBlocks = true,
142 - },
143 - completion = {
144 - enabled = true,
145 - favoriteStaticMembers = {
146 - 'org.hamcrest.MatcherAssert.assertThat',
147 - 'org.hamcrest.Matchers.*',
148 - 'org.hamcrest.CoreMatchers.*',
149 - 'org.junit.jupiter.api.Assertions.*',
150 - 'java.util.Objects.requireNonNull',
151 - 'java.util.Objects.requireNonNullElse',
152 - 'org.mockito.Mockito.*',
153 - },
154 - filteredTypes = {
155 - 'com.sun.*',
156 - 'java.awt.*',
157 - 'sun.*',
158 - },
159 - guessMethodArguments = false,
160 - importOrder = {
161 - 'java',
162 - 'javax',
163 - 'javafx',
164 - 'com',
165 - 'org',
166 - 'de',
167 - 'net',
168 - },
169 - overwrite = false,
170 - },
171 - configuration = {
173 - --FIXME: configure platforms per host
174 - runtimes = {
175 - {
176 - name = 'JavaSE-1.8',
177 - path = '/usr/lib/jvm/java-8-openjdk-amd64',
178 - },
179 - {
180 - name = 'JavaSE-11',
181 - path = '/usr/lib/jvm/java-11-openjdk-amd64',
182 - },
183 - {
184 - name = 'JavaSE-17',
185 - path = '/usr/lib/jvm/java-17-openjdk-amd64',
186 - default = true,
187 - },
188 - },
189 - updateBuildConfiguration = 'automatic',
190 - },
191 - eclipse = { downloadSources = true },
192 - errors = { incompleteClasspath = { severity = 'warning' } },
193 - foldingRange = false,
194 - format = {
195 - enabled = true,
196 - onType = false,
197 - },
198 - implementationsCodeLens = true,
199 - inlayhints = { parameterNames = true },
200 - maven = { downloadSources = true, updateSnapshots = false },
201 - maxConcurrentBuilds = 8,
202 - referenceCodeLens = true,
203 - rename = true,
204 - saveActions = { organizeImports = true },
205 - selectionRange = true,
206 - signatureHelp = true,
207 - trace = { server = server_trace },
208 - },
209 - },
211 - -- Language server `initializationOptions`
212 - -- You need to extend the `bundles` with paths to jar files
213 - -- if you want to use additional eclipse.jdt.ls plugins.
214 - --
215 - -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
216 - --
217 - -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this
218 - init_options = {
219 - -- TODO: integrate debug and test extensions. can those be installed via paq, even though they are not vim plugins?
220 - bundles = {},
221 - extendedClientCapabilities = extendedClientCapabilities,
222 - },
223 - flags = {
224 - debounce_text_changes = 80,
225 - allow_incremental_sync = true,
226 - },
227 - }
228 - -- This starts a new client & server,
229 - -- or attaches to an existing client & server depending on the `root_dir`.
230 - local merged_config = zero.build_options('jdtls', config)
231 - jdtls.start_or_attach(merged_config)
232 -end)

neovim/init.lua

Modified
13 13 require'bugabinga.lazy'
14 14 -- configures the vim diagnostic subsystem
15 15 require'bugabinga.diagnostic'
16 --- FIXME(buga): should this be moved somewhere else?
17 16 require'bugabinga.trim'
18 17 require 'bugabinga.lsp'
20 19 -- TODO:
21 --- [ ] add nu-check to null-ls
22 20 -- [ ] use neodev
23 --- [ ] is it possible to cache LSP init per project?
24 --- [ ] nugu theme
21 +-- [ ] add nu-check to nvim-lint
25 22 -- [ ] use ltex-ls for markdown, code comments and commit messages
23 +-- [ ] use nvimjdtls
26 24 -- [ ] DAP
25 +-- [ ] nugu theme
28 27 -- PLUGINS TO TRY
29 28 -- https://github.com/ThePrimeagen/refactoring.nvim

neovim/justfile

Modified
4 4 set shell := ['nu', '--commands']
6 6 # List available recipes.
7 7 default:
8 8 @just --list
10 -# Format lua and toml files.
11 -fmt:
12 - stylua --verify --num-threads 100 .
13 - taplo fmt
15 -# Lint lua and toml files.
16 -lint:
17 - selene --num-threads 100 .
18 - taplo lint
10 +# update nvim plugins
11 +update:
12 + nvim --headless "+Lazy! sync" +qa
20 14 # delete all current neovim state, cache and other ephemeral data.
21 15 # does NOT delete the configs

neovim/lazy-lock.json

Modified
7 7 "glow.nvim": { "branch": "main", "commit": "cf2177a514859fa3c55837b46de91d93b24cf488" },
8 8 "heirline.nvim": { "branch": "master", "commit": "76136ccd93ed608e8109762f032cf1118981ebbd" },
9 9 "hlargs.nvim": { "branch": "main", "commit": "cfc9beab4e176a13311efe03e38e6b6fed5df4f6" },
10 - "indent-blankline.nvim": { "branch": "master", "commit": "b7aa0aed55887edfaece23f7b46ab22232fc8741" },
11 - "lazy.nvim": { "branch": "main", "commit": "14d76aac4bd3ff07c1fca074c210f28f766a931e" },
10 + "indent-blankline.nvim": { "branch": "master", "commit": "73640233cca0da8e01aced8c1f9e63fd892128b7" },
11 + "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
12 12 "lush.nvim": { "branch": "main", "commit": "b10ef2bfff0647e701b691019ade3edd5e44eb50" },
13 13 "neodev.nvim": { "branch": "main", "commit": "da1562e1e3df0e994ddc52cb4ba22376a5d7f2fc" },
14 14 "neogen": { "branch": "main", "commit": "cb1f384df804c1bf729332c4f728253fe17962d4" },
15 - "noice.nvim": { "branch": "main", "commit": "40d670ef8935af3bf5df44ca27d83dcf1d75f0fd" },
15 + "noice.nvim": { "branch": "main", "commit": "bae49f5e0615cfffde271d4bec50376d770a15d3" },
16 16 "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" },
17 - "nui.nvim": { "branch": "main", "commit": "7a524120a7a70761b5a65b602fd235a65cb005aa" },
17 + "nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" },
18 18 "nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" },
19 19 "nvim-cmp": { "branch": "main", "commit": "983453e32cb35533a119725883c04436d16c0120" },
20 20 "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
24 24 "nvim-neoclip.lua": { "branch": "main", "commit": "4e406ae0f759262518731538f2585abb9d269bac" },
25 25 "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
26 26 "nvim-surround": { "branch": "main", "commit": "211eaad7c6d01ef4ac02cba9052b3082ec232101" },
27 - "nvim-treesitter": { "branch": "master", "commit": "9fa6806b88905d52b5ca36094909630919b432cc" },
27 + "nvim-treesitter": { "branch": "master", "commit": "7b04e8b67eec7d92daadf9f0717dd272ddfc81a3" },
28 28 "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
29 29 "nvim-ts-context-commentstring": { "branch": "main", "commit": "7f625207f225eea97ef7a6abe7611e556c396d2f" },
30 30 "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" },
31 31 "oil.nvim": { "branch": "master", "commit": "0138a2e0f9baacd98d5531ebb5078fafc5114fae" },
32 + "persistence.nvim": { "branch": "main", "commit": "adcf6913693a0434665d162ee45a186230496f8a" },
32 33 "playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" },
33 34 "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
34 - "refactoring.nvim": { "branch": "master", "commit": "7894b10078a1a70c9b26028f4373bf209968e9bc" },
35 + "refactoring.nvim": { "branch": "master", "commit": "7d57e01a9ae012c7aedd73f518d45608a772eb1f" },
35 36 "specs.nvim": { "branch": "main", "commit": "2743e412bbe21c9d73954c403d01e8de7377890d" },
36 37 "substitute.nvim": { "branch": "main", "commit": "42d09f1e6324d98aa2e5b765b64528e0aefe72b0" },
37 38 "telescope-symbols.nvim": { "branch": "master", "commit": "f2060117d965df4a626f068a4ebbd8ee051aa076" },
38 39 "telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
40 + "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" },
39 41 "toggleterm.nvim": { "branch": "main", "commit": "b90a1381e9b5b8596f49070ee86c71db267ac868" },
40 42 "treesj": { "branch": "main", "commit": "3203aa553217921fd4dcb79245f9df07278910b2" },
41 - "virt-column.nvim": { "branch": "master", "commit": "93b40ea038f676f5a72d7d1f2336fe7b051fc0ce" }
43 + "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
44 + "virt-column.nvim": { "branch": "master", "commit": "93b40ea038f676f5a72d7d1f2336fe7b051fc0ce" },
45 + "zen-mode.nvim": { "branch": "main", "commit": "6e6c963d70a8e47854fa656987666bfb863f9c4e" }

neovim/lua/bugabinga/diagnostic.lua

Modified
152 152 dia(vim.diagnostic.severity.HINT, 4)
155 -vim.g.send_dia = send_dia
155 +vim.g.send_dia = send_dia

neovim/lua/bugabinga/health.lua

Modified
3 3 -- use the neovim healthcheck module to integrate into :checkhealth.
4 4 -- check the system for dependencies, that:
5 5 -- * i like to use with neovim.
6 6 -- * plugins need.
8 -local check_parameter = require'std.check_parameter'
10 8 local _ = {}
12 10 local function program_installed(name_of_executable)
24 22 local programs_to_check = {}
26 24 _.add_dependency = function(program)
27 - check_parameter(program, 'add_program', 'program', 'table')
28 - check_parameter(program.name_of_executable, 'add_program', 'program.name_of_executable', 'string')
25 + vim.validate{
26 + program = { program, 'table' },
27 + name_of_executable = { program.name_of_executable, 'string' },
28 + }
30 30 programs_to_check[program.name_of_executable] = program

neovim/lua/bugabinga/lazy.lua

Modified
1 +local win32 = vim.loop.os_uname().sysname:match'Win'
1 2 local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
2 3 if not vim.loop.fs_stat(lazypath) then
3 4 vim.fn.system {
26 27 missing = true,
28 29 checker = {
29 - enabled = not vim.loop.os_uname().sysname:match'Win',
30 + enabled = not win32,
31 32 ui = {
32 33 size = { width = 0.69 , heigth = 0.69 },
63 + dev = {
64 + fallback = true,
65 + patterns = { 'bugabinga' },
66 + path = win32 and 'W:/' or '~/Workspace'
67 + },
64 70 local map = require 'std.keymap'

neovim/lua/bugabinga/lsp.old

Deleted
deleted file mode 100644
1 -local icon = require 'std.icon'
2 -local map = require 'std.keymap'
3 -local auto = require 'std.auto'
4 -local project = require 'std.project'
5 -local want = require 'std.want'
7 --- TODO: setup codelens -> use lsp-signature plugin?
8 --- TODO: setup custom cmp keybinds
9 -want {
10 - 'lsp-zero',
11 - 'null-ls',
12 - 'nvim-lsp-installer',
13 - 'neodev',
14 - 'rust-tools',
15 - 'nvim-navic',
16 - 'lsp-status',
17 -}(function(zero, null_ls, installer, neodev, rust, navic, lsp_status)
18 - installer.settings {
19 - ui = {
20 - --TODO: use some global float window settings
21 - border = 'rounded',
22 - },
23 - }
25 - zero.preset 'recommended'
26 - zero.set_preferences {
27 - configure_diagnostics = false,
28 - set_lsp_keymaps = false,
29 - sign_icons = {
30 - error = icon 'Error',
31 - warn = icon 'Warning',
32 - hint = icon 'Hint',
33 - info = icon 'Information',
34 - },
35 - }
37 - -- setup lsp for my neovim config
38 - zero.nvim_workspace {
39 - -- add paths of all plugins and neovim
40 - library = vim.api.nvim_get_runtime_file('', true),
41 - }
42 - -- Initialize rust_analyzer with rust-tools
43 - rust.setup {
44 - server = zero.build_options('rust_analyzer', {}),
45 - }
47 - -- this will prevent zero from loading this server.
48 - -- Java will be managed by nvim-jdtls, which wants to do things differently.
49 - -- see ftplugin/java.lua
50 - zero.build_options('jdtls', {})
52 - -- lua neovim lsp
53 - neodev.setup {
54 - lspconfig = zero.defaults.nvim_workspace(),
55 - }
57 - -- disable disco mode while typing
58 - zero.setup_nvim_cmp {
59 - completion = {
60 - autocomplete = false,
61 - },
62 - }
64 - local null_opts = zero.build_options 'null-ls'
66 - local formatting = null_ls.builtins.formatting
67 - local diagnostics = null_ls.builtins.diagnostics
68 - local code_actions = null_ls.builtins.code_actions
69 - local hover = null_ls.builtins.hover
70 - local completion = null_ls.builtins.completion
72 - -- run diagnostics on save
73 - local diagnostics_on_save = { method = null_ls.methods.DIAGNOSTICS_ON_SAVE }
74 - null_ls.setup {
75 - on_attach = null_opts.on_attach,
76 - sources = {
77 - formatting.stylua,
78 - formatting.clang_format,
79 - formatting.jq,
80 - formatting.protolint,
81 - formatting.shellharden,
82 - formatting.shfmt,
83 - formatting.taplo,
85 - hover.dictionary,
87 - diagnostics.actionlint.with(diagnostics_on_save),
88 - diagnostics.checkmake.with(diagnostics_on_save),
89 - diagnostics.gitlint.with(diagnostics_on_save),
90 - diagnostics.protoc_gen_lint.with(diagnostics_on_save),
91 - diagnostics.protolint.with(diagnostics_on_save),
92 - diagnostics.selene.with(diagnostics_on_save).with {
93 - -- null-ls determines the root in a too simplistic manner.
94 - -- since my neovim configuration live inside my dotfiles, the dotfiles root
95 - -- was taken. but i want the neovim config folder as root.
96 - cwd = function(parameters)
97 - local root = project.determine_project_root({ name = 'selene.toml', weight = 10 }, parameters.root)
98 - return root or parameters.root
99 - end,
100 - },
101 - diagnostics.shellcheck.with(diagnostics_on_save),
102 - diagnostics.tidy.with(diagnostics_on_save),
104 - code_actions.refactoring,
105 - code_actions.shellcheck,
107 - completion.luasnip,
108 - },
109 - }
111 - local function setup_keybinds_and_actions(client, buffer_number)
112 - -- TODO: use buffer number in keymaps
113 - -- TODO: make format changed lines command
114 - local capabilities = client.server_capabilities
115 - if capabilities.document_formatting then
116 - map.normal {
117 - name = 'Format buffer using LSP',
118 - category = "editing",
119 - keys = '<leader>' .. 'l' .. 'f',
120 - command = function()
121 - vim.lsp.buf.format { bufnr = buffer_number }
122 - vim.notify('Formatted ' .. vim.api.nvim_buf_get_name(buffer_number))
123 - end,
124 - }
125 - end
126 - if capabilities.document_range_formatting then
127 - map.visual {
128 - name = 'Format range using LSP',
129 - category = 'editing',
130 - keys = '<leader>' .. 'l' .. 'f',
131 - command = function()
132 - vim.lsp.buf.range_formatting { bufnr = buffer_number }
133 - vim.notify('Formatted range in ' .. vim.api.nvim_buf_get_name(buffer_number))
134 - end,
135 - }
136 - end
137 - --TODO: change some of these commands to telescoped versions
138 - if capabilities.hover then
139 - map.normal {
140 - name = 'Show Hover',
141 - category = 'view',
142 - keys = '<leader>' .. 'l' .. 'k',
143 - command = vim.lsp.buf.hover,
144 - }
145 - end
146 - if capabilities.goto_definition then
147 - map.normal {
148 - name = 'Go to Definition',
149 - category = 'navigation',
150 - keys = '<leader>' .. 'l' .. 'd',
151 - command = vim.lsp.buf.definition,
152 - }
153 - end
154 - if capabilities.declaration then
155 - map.normal {
156 - name = 'Go to Declaration',
157 - category = 'navigation',
158 - keys = '<leader>' .. 'l' .. 'd' .. 'd',
159 - command = vim.lsp.buf.declaration,
160 - }
161 - end
162 - if capabilities.implementation then
163 - map.normal {
164 - name = 'Go to Implementation',
165 - category = 'navigation',
166 - keys = '<leader>' .. 'l' .. 'i',
167 - command = vim.lsp.buf.implementation,
168 - }
169 - end
170 - if capabilities.type_definition then
171 - map.normal {
172 - name = 'Go to Type Definition',
173 - category = 'navigation',
174 - keys = '<leader>' .. 'l' .. 't',
175 - command = vim.lsp.buf.type_definition,
176 - }
177 - end
178 - if capabilities.find_references then
179 - map.normal {
180 - name = 'Go to References',
181 - category = 'navigation',
182 - keys = '<leader>' .. 'l' .. 'r',
183 - command = vim.lsp.buf.references
184 - }
185 - end
186 - if capabilities.call_hierarchy then
187 - map.normal {
188 - name = 'Go to Incoming Call',
189 - category = 'navigation',
190 - keys = '<leader>' .. 'l' .. 'c',
191 - command = vim.lsp.buf.incoming_calls,
192 - }
193 - map.normal {
194 - name = 'Go to Outgoing Call',
195 - category = 'navigation',
196 - keys = '<leader>' .. 'l' .. 'c' .. 'c',
197 - command = vim.lsp.buf.outgoing_calls,
198 - }
199 - end
200 - if capabilities.rename then
201 - map.normal {
202 - name = 'Rename symbol',
203 - category = 'editing',
204 - keys = 'f'2,
205 - command = vim.lsp.buf.rename,
206 - }
207 - end
208 - if capabilities.code_action then
209 - map.normal {
210 - name = 'Show code actions',
211 - category = 'view',
212 - keys = 'f'4,
213 - command = vim.lsp.buf.code_action,
214 - }
215 - map.visual {
216 - name = 'Show code actions in range',
217 - category = 'view',
218 - keys = 'f'4,
219 - command = vim.lsp.buf.range_code_action,
220 - }
221 - end
222 - if capabilities.document_highlight then
223 - -- this variable should technically be scoped to the current buffer.
224 - -- how to do that?
225 - local highlight_timer = nil
226 - auto 'highlight_reference_under_cursor' {
227 - {
228 - description = 'Automatically highlight a symbol under cursor',
229 - events = 'CursorHold',
230 - pattern = '<buffer>',
231 - command = function()
232 - if not highlight_timer then
233 - highlight_timer = vim.defer_fn(function()
234 - vim.lsp.buf.document_highlight()
235 - highlight_timer = nil
236 - end, 866)
237 - end
238 - end,
239 - },
240 - {
241 - description = 'Clear highlighted symbol under cursor',
242 - events = { 'CursorMoved', 'CursorMovedI', 'InsertEnter' },
243 - pattern = '<buffer>',
244 - command = function()
245 - if highlight_timer then
246 - highlight_timer:close()
247 - highlight_timer = nil
248 - end
249 - vim.lsp.buf.clear_references()
250 - end,
251 - },
252 - }
253 - end
254 - end
256 - zero.on_attach(function(client, buffer_number)
257 - if client.name ~= 'null-ls' and not vim.b.lsp_attached then
258 - navic.attach(client, buffer_number)
259 - lsp_status.on_attach(client, buffer_number)
260 - setup_keybinds_and_actions(client, buffer_number)
261 - end
262 - end)
264 - zero.setup()
265 -end)

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

Added
new file mode 100644
1 +local lua = require'bugabinga.lsp.clients.lua'
2 +-- NOTE: The order of clients is implicitly priorization.
3 +-- Put "more specific" clients first
4 +return {
5 + lua.nvim_lua_ls,
6 + lua.lua_ls,
7 +}

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

Added
new file mode 100644
1 +local project = require'std.project'
3 +-- TODO: share lua ls settings in shared table
4 +local lua_ls =
5 +{
6 + name = 'LuaLS',
7 + filetypes = 'lua',
8 + cmd = 'lua-language-server',
9 + root_dir = project.find_lua_project_root,
10 + single_file_support = true,
11 + workspaces = true,
12 + settings = {
13 + Lua = {
14 + addonManager = { enable = false },
15 + completion = { callSnippet = 'Both', postfix = '.' },
16 + diagnostics = { workspaceRate = 50 },
17 + hint = { enable = true, setType = true },
18 + runtime = {
19 + version = "Lua 5.4",
20 + pathStrict = true,
21 + },
22 + telemetry = { enable = true },
23 + window = { progressBar = false, statusBar = false },
24 + workspace = { checkThirdParty = false, }
25 + },
26 + }
29 +local nvim_lua_ls =
31 + name = 'LuaLS(nvim)',
32 + filetypes = 'lua',
33 + cmd = 'lua-language-server',
34 + root_dir = project.find_lua_nvim_project_root,
35 + single_file_support = false,
36 + workspaces = true,
37 + settings = {
38 + Lua = {
39 + addonManager = { enable = false },
40 + completion = { callSnippet = 'Both', postfix = '.' },
41 + diagnostics = { globals = { 'vim' }, workspaceRate = 50 },
42 + hint = { enable = true, setType = true },
43 + runtime = {
44 + version = 'LuaJIT',
45 + pathStrict = true,
46 + special = {
47 + want = 'require',
48 + },
49 + },
50 + telemetry = { enable = true },
51 + window = { progressBar = false, statusBar = false },
52 + workspace = { checkThirdParty = false, }
53 + },
54 + },
55 + before_init = function(...)
56 + local before_init_arguments = { ... }
57 + want'neodev'(function(neodev)
58 + return neodev.before_init(unpack(before_init_arguments))
59 + end, function()
60 + return nil
61 + end)
62 + end,
65 +return {
66 + lua_ls = lua_ls,
67 + nvim_lua_ls = nvim_lua_ls,

neovim/lua/bugabinga/lsp/init.lua

Modified
1 --- TODO setup neodev + jsonls for neovim plugins ans config
2 --- TODO setup lua_ls for generic lua stuff
3 --- TODO setup nvimjdtls + lemminx for java/maven
4 --- TODO setup marksman + ltex for markdown
5 --- TODO setup mason for "less important" lsps
1 +-- TODO: setup neodev + jsonls for neovim plugins ans config
2 +-- TODO: setup lua_ls for generic lua stuff
3 +-- TODO: setup nvimjdtls + lemminx for java/maven
4 +-- TODO: setup marksman + ltex for markdown
5 +-- TODO: setup mason for "less important" lsps
6 +-- TODO: LspInfo clone
7 8 local map = require'std.keymap'
8 9 local auto = require'std.auto'
14 15 local buffer = lsp_client.buffer
15 16 local client_id = lsp_client.data.client_id
16 17 local mutable_variable_highlight = 'MutableVariable'
17 - --TODO(buga): add this highlight to nugu
19 19 if token.type == 'variable' and not token.modifiers.readonly then
20 20 vim.lsp.semantic_tokens.highlight_token(token, buffer, client_id, mutable_variable_highlight)
23 - --TODO(buga): find more use cases for semantic tokens
23 + --TODO: find more use cases for semantic tokens
24 + --TODO: global variables
26 -local lua_config =
27 -{
28 - name = 'LuaLS',
29 - filetypes = 'lua',
30 - cmd = 'lua-language-server',
31 - root_dir = project.determine_lua_project_root,
32 - single_file = true,
33 - workspaces = true,
34 -}
36 -local lsp_start = function(...) vim.print("START LSP", ...) end
28 +local lsp_start = function(file_type_event)
30 + local match = file_type_event.match
32 + local matches_to_ignore = {'noice', 'notify', 'help', 'TelescopePrompt', 'TelescopeResults', 'toggleterm', 'lazy', 'oil'}
33 + if vim.iter(matches_to_ignore):find(match) then return end
35 + -- vim.print("LSP START", file_type_event)
37 + local buffer_path = vim.api.nvim_buf_get_name(file_type_event.buf)
39 + vim.print( "SEARCHING LSP CLIENT FOR:", match, buffer_path)
41 + local lsp_client_configs = require'bugabinga.lsp.clients'
43 + local potential_client_configs = vim.iter(vim.deepcopy(lsp_client_configs))
44 + :map(function(config)
45 + vim.validate{
46 + config = { config, 'table' },
47 + ['config.name'] = { config.name, 'string'},
48 + ['config.filetypes']= { config.filetypes, {'string', 'table'}},
49 + ['config.cmd'] = { config.cmd, { 'string', 'table'}},
50 + ['config.root_dir'] = { config.root_dir, 'function'},
51 + ['config.single_file_support'] = { config.single_file_support, 'boolean'},
52 + ['config.workspaces'] = { config.workspaces, 'boolean'},
53 + }
54 + config.cmd = type(config.cmd) == 'string' and { config.cmd } or config.cmd
55 + config.filetypes = type(config.filetypes) == 'string' and { config.filetypes } or config.filetypes
56 + config.root_dir = config.root_dir(buffer_path)
57 + return config
58 + end)
59 + :filter(function(config)
60 + return vim.iter(config.filetypes):find(match)
61 + end)
62 + :totable()
64 + vim.print("POTENTIAL CLIENTS", #potential_client_configs)
66 + -- find clients, that returns some root_dir for this buffer
67 + local config = vim.iter(potential_client_configs):find(
68 + function(_) return _.root_dir ~= nil end
69 + )
71 + -- if no client can open this buffer as part of a project (root_dir), then look
72 + -- for a client with single file support
73 + -- FIXME: root_dir needs to change if single file mode
74 + config = config or vim.iter(potential_client_configs):find(
75 + function(_) return _.single_file_support end
76 + )
78 + if config then vim.print('FOUND LSP CLIENT', config.name) end
80 + --TODO: augment other arguments from start_client
81 + local client_id = vim.lsp.start(config)
82 + vim.print("ATTACHING LSP CLIENT", client_id)
85 + --TODO: workspaces
86 + -- local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
88 +end
37 89 local lsp_attach = function(...) vim.print("ATTACH LSP", ...) end
38 90 local lsp_detach = function(...) vim.print("DETACH LSP", ...) end
64 -return setmetatable(_ ,{
66 -})
116 +return setmetatable(_ ,{ })

neovim/lua/bugabinga/options/keymaps.lua

Modified
146 146 command = open_link_under_cursor,
149 ---TODO move to noice config
150 -map.normal {
151 - name = 'Dismiss current notifications',
152 - category = 'notify',
153 - keys = '<esc>',
154 - command = function()
155 - want { 'noice' }(function(noice)
156 - noice.cmd 'dismiss'
157 - end)
158 - end,
161 149 map.normal {
162 150 name = 'Dismiss current search highlight',
163 151 category = 'search',
200 188 command = vim.cmd.redo,
191 +map {
192 + keys = '<bs>',
193 + command = '<nop>',
203 196 map.normal {
204 197 name = 'Move next in quickfix list',
205 198 category = 'navigation',
213 206 keys = '<bs>',
214 207 command = '<cmd>cprevious<cr>',
210 +map.normal {
211 + name = 'Open quickfix list',
212 + category = 'navigation',
213 + keys = '<bs><bs>',
214 + command = '<cmd>copen<cr>',
217 +map.normal {
218 + name = 'Open nvim configuration',
219 + category = 'config',
220 + keys = '<F2><F2>',
221 + command = '<cmd>tabedit ' .. vim.fn.stdpath'config' .. '<cr>',

neovim/lua/bugabinga/options/togglers.lua

Modified
26 26 local toggler_tostring = function(self)
27 27 local all_default = vim.iter(self.options)
28 28 :all(function(option) return get_option(option.name) == option.default end)
29 - return self.display_name .. ':' .. ( all_default and toggle_off_icon or toggle_on_icon )
29 + return self.display_name .. ' ' .. ( all_default and toggle_off_icon or toggle_on_icon )
32 32 local make_toggler = function( display_name, options)
60 60 return vim.iter(self)
61 61 :map(toggler_tostring)
62 62 :fold('', function(buffer, text)
63 - local delimiter = '|'
64 - return buffer .. (buffer == '' and delimiter or ' ') .. text
63 + return buffer .. (buffer == '' and '' or ' ' ) .. text
65 64 end)

neovim/lua/bugabinga/plugins/genghis.lua

Modified
15 15 config = function()
16 16 -- TODO: setup cmp integration
18 - -- TODO: setup keymaps
18 + -- TODO: setup keymaps with hydra
19 19 -- local keymap = vim.keymap.set
20 20 -- local genghis = require("genghis")
21 21 -- keymap("n", "<leader>yp", genghis.copyFilepath)

neovim/lua/bugabinga/plugins/heirline.lua

Modified
212 212 local lsp_active = {
213 213 condition = conditions.lsp_attached,
214 - update = {'LspAttach', 'LspDetach'},
214 + update = {'LspAttach', 'LspDetach', 'BufEnter'},
216 216 provider = function()
217 217 local names = {}

neovim/lua/bugabinga/plugins/noice.lua

Modified
36 36 -- does not seem to play well with other popups
37 37 -- cmdline = { relative = "cursor", position = { row = 0, col = 0 }, border = { style = "shadow" } },
39 + routes = {
40 + {
41 + view = 'split',
42 + filter = { event = 'msg_show', min_height=20 },
43 + },
44 + {
45 + filter = { event = 'msg_show', kind = ' search_count' },
46 + opts = { skip = true },
47 + }
48 + },
40 50 config = function(_, opts)
41 51 local noice = require'noice'
52 62 end,
55 - end,
56 - },
57 - {
58 - 'rcarriga/nvim-notify',
59 - config = function()
60 - local notify = require'notify'
61 - local fade = require'notify.stages.fade' 'bottom_up'
65 + map.command_line {
66 + name = 'Redirect Cmdline',
67 + category = 'ui',
68 + keys = '<S-cr>',
69 + command = function() noice.redirect(vim.fn.getcmdline()) end,
70 + }
63 - local shadow_fade = function(...)
64 - local opts = fade[1](...)
65 - if opts then
66 - opts.border = 'shadow'
67 - opts.row = opts.row - 1
68 - end
69 - return opts
70 - end
72 + map.normal {
73 + name = 'Dismiss current notifications',
74 + category = 'notify',
75 + keys = '<esc>',
76 + command = function() noice.cmd 'dismiss' end,
77 + }
72 - notify.setup {
73 - stages = { shadow_fade, unpack(fade, 2) },
74 - render = 'compact',
75 - timeout = 10000,
76 - fps = 140,
77 - top_down = false,
78 - }
79 - end,
80 - },
79 + end,
80 + },
81 + {
82 + 'rcarriga/nvim-notify',
83 + config = function()
84 + local notify = require'notify'
85 + local fade = require'notify.stages.fade' 'bottom_up'
87 + local shadow_fade = function(...)
88 + local opts = fade[1](...)
89 + if opts then
90 + opts.border = 'shadow'
91 + opts.row = opts.row - 1
92 + end
93 + return opts
94 + end
96 + notify.setup {
97 + stages = { shadow_fade, unpack(fade, 2) },
98 + render = 'compact',
99 + timeout = 10000,
100 + fps = 140,
101 + top_down = false,
103 + end,
104 + },

neovim/lua/bugabinga/plugins/persistence.lua

Added
new file mode 100644
1 +local map = require'std.keymap'
3 +return {
4 + 'folke/persistence.nvim',
5 + lazy = false,
6 + opts = { },
7 + config = function(_, opts)
8 + local persistence = require'persistence'
9 + persistence.setup(opts)
11 + map.normal {
12 + name = 'Restore session for current directory',
13 + category = 'history',
14 + keys = '<F4>',
15 + command = function() persistence.load() end,
16 + }
18 + map.normal {
19 + name = 'Restore last session',
20 + category = 'history',
21 + keys = '<F4><F4>',
22 + command = function() persistence.load{last= true} end,
23 + }
25 + end,

neovim/lua/bugabinga/plugins/spectre.lua

Added
new file mode 100644
1 +require'bugabinga.health'.add_dependency
2 +{
3 + name_of_executable = 'rg'
4 +}
6 +return {
7 + 'bugabinga/nvim-spectre',
8 + cmd = 'Spectre',
9 + dependencies = {
10 + 'nvim-lua/plenary.nvim',
11 + 'nvim-tree/nvim-web-devicons',
12 + },
13 + opts = {
14 + live_update = true,
15 + line_sep_start = '▛▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔',
16 + result_padding = '▎',
17 + line_sep = '▙▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁',
18 + default = { replace = { cmd = 'oxi' } }
19 + },

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

Added
new file mode 100644
1 +return {
2 + 'folke/todo-comments.nvim',
3 + event = 'BufReadPost',
4 + opts = {},
5 +}

neovim/lua/bugabinga/plugins/treesitter.lua

Modified
85 85 'zig',
88 + ignore_install = { 'oil' },
88 90 auto_install = true,
90 92 autotag = { enable = true },
92 - -- TODO configure this
94 + -- TODO(oli): configure this
93 95 refactor = 'all',
95 97 context_commentstring = { enable = true, enable_autocmd = false },

neovim/lua/bugabinga/plugins/zen.lua

Added
new file mode 100644
1 +return {
2 + "folke/zen-mode.nvim",
3 + cmd = 'ZenMode',
4 + dependencies = { { 'folke/twilight.nvim', opts = { dimming = { inactive = true } } } },
5 + opts = {
6 + plugins = { wezterm = { enabled = true, font = "+4" } },
7 + window = {
8 + width = 0.69,
9 + backdrop = 0.42,
10 + options = {
11 + signcolumn = "no",
12 + number = false,
13 + relativenumber = false,
14 + cursorline = false,
15 + cursorcolumn = false,
16 + foldcolumn = "0",
17 + list = false,
18 + },
19 + },
20 + },

neovim/lua/std/check_parameter.lua

Deleted
deleted file mode 100644
1 --- asserts if given value is of given types
2 -return function(value, function_name, parameter_name, ...)
3 - assert(
4 - type(function_name) == 'string',
5 - 'the parameter function_name to function check_parameter cannot be nil and must be string'
6 - )
7 - assert(
8 - type(parameter_name) == 'string',
9 - 'the parameter parameter_name to function check_parameter cannot be nil and must be string'
10 - )
12 - local prelude = 'the parameter ' .. parameter_name .. ' to function ' .. function_name
14 - assert(value, prelude .. ' cannot be nil!')
16 - local actual_type = type(value)
17 - local type_check = false
19 - local arg = { ... } -- we are still lua version 5.1 in here...
20 - -- if no types are given, we pass
21 - if vim.tbl_isempty(arg) then
22 - return value
23 - end
25 - for _, expected_type in ipairs(arg) do
26 - local same_type = actual_type == expected_type
27 - type_check = type_check or same_type
28 - end
30 - assert(type_check, prelude .. ' must be one of ' .. vim.inspect(arg) .. ', but is ' .. actual_type .. '.')
32 - return value
33 -end

neovim/lua/std/icon.lua

Modified
4 4 return {
5 5 toggle_on = '',
6 6 toggle_off = '',
7 7 diagnostic = '⊙',
8 8 spelling = '󰓆',
9 9 linenumber = '󰉻',
10 - linehighlight = '―',
10 + linehighlight = '󰘤',
11 11 modified = '',
12 12 lock = '',
13 13 file = '',

neovim/lua/std/keymap.lua

Modified
1 -local check_parameter = require 'std.check_parameter'
3 1 local available_modes = {
4 2 normal_visual_select_operator_pending = '',
34 32 local bind = function(self, map)
35 - local keys = check_parameter(map.keys, 'bind', 'map.keys', 'string')
36 - local command = check_parameter(map.command, 'bind', 'map.command', 'function', 'string')
33 + vim.validate{
34 + map = { map, 'table' },
35 + keys = { map.keys, 'string' },
36 + command = { map.command, { 'function', 'string' }},
37 + }
39 + local keys = map.keys
40 + local command = map.command
38 - map.visible = map.visible == nil or map.visible
39 42 map.options = map.options or {}
41 44 if map.category and map.description then

neovim/lua/std/project.lua

Modified
1 -local dirname = vim.fs.dirname
1 +local join = require'std.table'.join
2 +local dirname = vim.fs.dirname
2 3 local exists = vim.loop.fs_stat
4 ---- number of max loop iterations when searching for markers
5 +--- number of max loop iterations when searching for markers
5 6 local MAX_TRAVERSAL_COUNT = 100
7 8 --- Determines the path to a root directory, starting from the given path.
35 36 ---directory is used.
36 37 ---@return string? # Directory, that contains the `markers` and lies on the path from `path` to `stop`.
37 38 local function find_root(path, markers, stop)
38 - if not path then
39 - local buffer_name = vim.api.nvim_buf_get_name(0)
40 - local path = dirname(buffer_name)
41 - end
39 + path = path or dirname(vim.api.nvim_buf_get_name(0))
43 40 stop = stop or vim.uv.os_homedir()
45 - if not exists(stop) then error( 'the stop directory %s does not exist!':format(stop)) end
42 + --FIXME:: vim.validate
44 + if not exists(stop) then error( ( 'the stop directory %s does not exist!' ):format(stop) ) end
47 46 local directory_scores = {}
48 47 local current_distance_to_buffer = 0
102 101 --- Determines the project root directory of the current buffer file. A "project" is not clearly defined for all programming languages, so this function uses a heuristic approach.
103 102 ---@param markers table<string, number>? list of markers. a marker is a table with `name` and `weight` key. `name` can be a file or directory name, that indicates, that if a file/folder with that name exists in a directory, that directory is likely to be a project root. `weight` is a means to express confidence in that likelihood. Values should be between 1 and 3. Internally, there are some project-agnostic markers defined (e.g. README, LICENSE, .git, ...) that will be merged with `custom_markers`.
105 ----@param stop string? Given a custom `stop` the path traversal can be aborted before the filesystem root is reached. the stop directory itself does __not__ get searched for markers!
106 ----
107 104 ---@return string? # The project root of the current buffer, or `nil`, if none could be determined.
109 106 local function find_project_root(markers)
125 122 { name = 'flake.nix', weight = 1 },
126 123 { name = 'flake.nix', weight = 1 },
128 - markers = vim.tbl_deep_extend('force', default_markers, markers)
130 - return find_root(nil, markers)
126 + return find_root(nil, join(default_markers, markers))
133 129 local function find_java_project_root()
147 143 { name = 'gradlew', weight = 3 },
148 144 { name = 'gradlew.bat', weight = 3 },
151 146 return find_root(nil, java_markers)
149 +-- TODO: how to get a marker for luarocks stuff?
154 150 local lua_markers = {
155 - {name = '.luacheckrc', weight = 1},
156 - {name = '.stylua.toml', weight = 1},
157 - {name = 'selene.toml', weight = 1},
151 + { name = '.luarc.json', weight = 1 },
152 + { name = '.luarc.jsonc', weight = 1 },
153 + { name = '.luacheckrc', weight = 1 },
154 + { name = '.stylua.toml', weight = 1 },
155 + { name = 'stylua.toml', weight = 1 },
156 + { name = 'selene.toml', weight = 1 },
157 + { name = 'selene.yml', weight = 1 },
159 160 local nvim_lua_markers = {
160 161 {name = 'neovim.yml', weight = 1},
161 - {name = 'init.lua', weight = 1},
162 - {name = 'lua', weight = 2},
162 + {name = 'lua', weight = 1},
165 165 local find_lua_project_root = function()
166 166 return find_root(nil, lua_markers)
169 -local find_nvim_lua_project_root = function()
170 - local markers = vim.tbl_deep_extend('error', lua_markers, nvim_lua_markers)
171 - return find_root(nil, markers)
169 +local find_lua_nvim_project_root = function()
170 + return find_root(nil, join(lua_markers, nvim_lua_markers))
174 173 return {
176 175 find_project_root = find_project_root,
177 176 find_java_project_root = find_java_project_root,
178 177 find_lua_project_root = find_lua_project_root,
179 - find_nvim_lua_project_root = find_nvim_lua_project_root,
178 + find_lua_nvim_project_root = find_lua_nvim_project_root,

neovim/lua/std/table.lua

Added
new file mode 100644
1 +local count = vim.tbl_count
3 +local join = function( tableA, tableB )
4 + vim.validate{
5 + tableA = { tableA, 'table' },
6 + tableB = { tableB, 'table' },
7 + }
9 + local sizeA = #tableA
10 + local sizeB = #tableB
11 + local index = 1
12 + local newTable = {}
14 + while index <= sizeA or index <= sizeB do
15 + if index <= sizeA then newTable[index] = tableA[index] end
16 + if index <= sizeB then newTable[index + sizeA] = tableB[index] end
17 + index = index + 1
18 + end
20 + return newTable
21 +end
23 +--TODO: add methods from lua table and vim.tbl_*
24 +return {
25 + join = join,
26 + count = count,

tools/nerd-font.sh

Modified
1 1 #!/bin/bash
2 +set -eu fail
3 4 # rewrite this some time...
5 6 declare -a fonts=(
6 - 3270
7 - Agave
8 - AnonymousPro
9 - Arimo
10 - ArulentSansMono
11 - BigBlueTerminal
12 - BitstreamVeraSansMono
13 - CascadiaCode
14 - CodeNewRoman
15 - ComicShannsMono
16 - Cousine
17 - DaddyTimeMono
18 - DroidSansMono
19 - EnvyCodeR
20 - FantasqueSansMono
21 - FiraCode
22 - FiraMono
23 - Gohu
24 - Go-Mono
25 - Hack
26 - Hasklig
27 - Hermit
28 7 IBMPlexMono
29 - iA-Writer
30 - Iosevka
31 - JetBrainsMono
32 - Lekton
33 - Lilex
34 - Meslo
35 - Mononoki
36 - MPlus
37 - Overpass
38 - ProggyClean
39 - ProFont
40 - RobotoMono
41 - SourceCodePro
42 - ShareTechMono
43 - SpaceMono
44 - Ubuntu
45 - UbuntuMono
46 - Terminus
47 8 VictorMono
48 - NerdFontsSymbolsOnly
51 -version='2.1.0'
11 +version='3.0.2'
52 12 fonts_dir="${HOME}/.local/share/fonts"
54 14 if [[ ! -d "$fonts_dir" ]]; then
60 20 download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/${zip_file}"
61 21 echo "Downloading $download_url"
62 22 wget "$download_url"
63 - unzip -fuo "$zip_file" -d "$fonts_dir"
23 + ouch decompress --dir "$fonts_dir" --yes --quiet "$zip_file"
64 24 rm "$zip_file"
65 25 done

wezterm/bugabinga/neovim_zen_mode.lua

Added
new file mode 100644
1 +local wez = require'wezterm'
3 +wez.on('user-var-changed', function(window, pane, name, value)
4 + local overrides = window:get_config_overrides() or {}
5 + if name == "ZEN_MODE" then
6 + local incremental = value:find("+")
7 + local number_value = tonumber(value)
8 + if incremental ~= nil then
9 + while (number_value > 0) do
10 + window:perform_action(wez.action.IncreaseFontSize, pane)
11 + number_value = number_value - 1
12 + end
13 + overrides.enable_tab_bar = false
14 + elseif number_value < 0 then
15 + window:perform_action(wez.action.ResetFontSize, pane)
16 + overrides.font_size = nil
17 + overrides.enable_tab_bar = true
18 + else
19 + overrides.font_size = number_value
20 + overrides.enable_tab_bar = false
21 + end
22 + end
23 + window:set_config_overrides(overrides)
24 +end)

wezterm/wezterm.lua

Modified
3 3 local wez = require 'wezterm'
4 4 local nugu = require 'bugabinga.nugu'
6 6 local key_binds = require 'bugabinga.key_binds'
7 7 local dark_mode = require 'bugabinga.dark_mode'
8 --- TODO mux server seems slow.
9 8 -- local workspaces = require 'bugabinga.workspaces'
10 -local status = require 'bugabinga.status'
9 +require 'bugabinga.status'
10 +require 'bugabinga.neovim_zen_mode'
12 12 local hostname = wez.hostname()
13 13 local enable_wayland = false
14 14 local window_decorations = 'RESIZE'
15 15 local font_size = 11.0
16 -local font = wez.font'IBM Plex Mono'
16 +local font = wez.font'Blex Mono Nerd Font'
17 17 local font_rules = {
19 19 intensity = 'Bold',
20 20 italic = true,
21 21 font = wez.font {
22 - family = 'VictorMono',
22 + family = 'VictorMono Nerd Font',
23 23 weight = 'Bold',
24 24 style = 'Italic',
26 26 italic = true,
27 27 intensity = 'Half',
28 28 font = wez.font {
29 - family = 'VictorMono',
29 + family = 'VictorMono Nerd Font',
30 30 weight = 'DemiBold',
31 31 style = 'Italic',
35 35 italic = true,
36 36 intensity = 'Normal',
37 37 font = wez.font {
38 - family = 'VictorMono',
38 + family = 'VictorMono Nerd Font',
39 39 style = 'Italic',