repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk

a5c6b207790c66d740c67b6ef10d883be4238790

Oliver Jan Krylow <olver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (13)

+260 / −97 text lines · 1 metadata-only

Diff layout

TODO.md

Modified

+8 / −0 text lines

3636- [ ] rewrite bootstripper and java commmands with zig. how to run them? precompile? zig run?
3737- [ ] encrypt box key
38- [ ] get SIM card to work on x230
39- [ ] disable syntax highlighting (treesitter) for inactive buffers and dim color
40- [ ] port commands from vim-eunuch:
41 - [ ] Delete
42 - [ ] Move/Rename
43 - [ ] Sudo/Doas
44- [ ] LSP diagnostics only on BufWrite
45- [ ] easier too read colors for lsp hovers
3947## Done

alacritty/Alacritty.desktop

Mode changed
old mode 100644 new mode 100755

No text changes.

bootstripper.java

Modified

+14 / −15 text lines

1010 }
1111 var dorkfiles_root = Path.of(arguments[0]).toRealPath();
1212 System.out.printf("Assuming dorkfiles root repo in %s.%n", emphasize_local(dorkfiles_root.toString()));
13 decrypt_secrets(dorkfiles_root.resolve("secrets"));
13 decrypt_secrets(dorkfiles_root.resolve("tresor"));
1414 var hostname = hostname();
1515 System.out.printf("Hostname: %s%n", emphasize_global(hostname));
1616 var symlinks_file = hostname + ".symlinks";
17 create_symlinks(dorkfiles_root.resolve(symlinks_file));
17 create_symlinks(dorkfiles_root, dorkfiles_root.resolve(symlinks_file));
1818 }
1919 static void decrypt_secrets(Path secrets_root) throws Exception {
2020 System.out.printf("%s:Decrypting files in %s folder.%n", emphasize_global("TODO"), emphasize_local(secrets_root.getFileName().toString()));
2121 }
22 static void create_symlinks(Path symlinks_file) throws Exception {
22 static void create_symlinks(Path root, Path symlinks_file) throws Exception {
2323 System.out.printf("Creating symlinks as defined in %s file.%n", emphasize_local(symlinks_file.getFileName().toString()));
2424 var lines = Files.readAllLines(symlinks_file);
2525 String source = null;
2929 if (source == null) source = line;
3030 else if (target == null) target = line;
3131 if(source != null && target != null){
32 link(source, target);
32 link(root, source, target);
3333 source = null;
3434 target = null;
3535 }
3636 }
3737 }
38 static void link(String source, String target) throws Exception {
38 static void link(Path root, String source, String target) throws Exception {
3939 var home = System.getProperty("user.home");
40 var source_path = Path.of(source.replace("~", home)).toAbsolutePath();
40 var source_path = root.resolve(source).toAbsolutePath();
4141 var target_path = Path.of(target.replace("~", home)).toAbsolutePath();
4242 var is_directory = Files.isDirectory(source_path);
4343 if(Files.exists(target_path, LinkOption.NOFOLLOW_LINKS)){
8585 }
8686 }
8787 static String hostname() throws Exception {
88 var process_builder = new ProcessBuilder();
89 var operating_system = System.getProperty("os.name");
90 if(operating_system.toLowerCase().contains("linux")){
91 process_builder = process_builder.command("hostnamectl", "hostname");
92 }
93 else
94 {
95 process_builder = process_builder.command("hostname");
96 }
88 var process_builder = new ProcessBuilder().command("hostname");
9789 var process = process_builder
9890 .start()
9991 .onExit()
10092 .join();
93 if(process.exitValue() != 0) {
94 process = new ProcessBuilder()
95 .command("hostnamectl", "hostname")
96 .start()
97 .onExit()
98 .join();
99 }
101100 try(var reader = new InputStreamReader(process.getInputStream()))
102101 {
103102 int character = -1;

neovim/lua/autocommand.lua

Modified

+2 / −2 text lines

11-- This function creates a custom API over autocommands in nvim.
22-- Since an official API is not present yet, I simply stole one from norcalli.
33-- groups: a map of group name to list of vimscript commands (table of string), or a single vimscript command (string).
4return function(groups)
5 for name, commands in pairs(groups) do
4return function(autocmd_groups)
5 for name, commands in pairs(autocmd_groups) do
66 -- wrap autocommands in a group and..
77 vim.cmd('augroup ' .. name)
88 -- ... undefine the groups commands, so that they become idempotent.

neovim/lua/general_editor_settings.lua

Modified

+1 / −1 text lines

6666 vim.opt.showcmd = false
6767 vim.opt.wildmode = "list:longest"
6868 -- Set the current working directory to the parent of the active buffer
69 vim.opt.autochdir = false
69 vim.opt.autochdir = true
7070 -- Keep track of file changes outside of vim
7171 vim.opt.autoread = true
7272 -- Make backups of all touched files in a special directory

neovim/lua/lsp.lua

Modified

+9 / −19 text lines

44return function()
55 local integrate_into_neovim = function(client, buffer_number)
66 print("LSP " .. client.name .. " [" .. client.id .. "] " .. "started.")
7 local chain_complete_list = {
8 default = {
9 { complete_items = { "lsp", "snippet" } },
10 { complete_items = { "path" }, triggered_only = { "/" } },
11 { complete_items = { "buffers" } },
12 },
13 string = {
14 { complete_items = { "path" }, triggered_only = { "/" } },
15 },
16 comment = {},
17 }
19 require("completion").on_attach({
20 sorting = "length",
21 enable_auto_popup = false,
22 chain_complete_list = chain_complete_list,
23 })
8 -- enable lsp-powered auto-completion
9 -- FIXME: I cannot seem to configure this plugin to my liking.
10 require("completion").on_attach()
11 -- adds icons into the completion ui
12 require"lspkind".init()
2514 -- hook lsp into vim autocomplete in insert mode
2615 vim.api.nvim_buf_set_option(buffer_number, "omnifunc", "v:lua.vim.lsp.omnifunc")
3221 map("n", "<LEADER>gD", "<CMD>lua vim.lsp.buf.declaration()<CR>")
3322 map("n", "<LEADER>gd", "<CMD>lua vim.lsp.buf.definition()<CR>")
34 map("n", "<LEADER>K", "<CMD>lua vim.lsp.buf.hover()<CR>")
3523 map("n", "<LEADER>gr", "<CMD>lua vim.lsp.buf.references()<CR>")
36 map("n", "<LEADER>gs", "<CMD>lua vim.lsp.buf.signature_help()<CR>")
3724 map("n", "<LEADER>gi", "<CMD>lua vim.lsp.buf.implementation()<CR>")
3825 map("n", "<LEADER>gt", "<CMD>lua vim.lsp.buf.type_definition()<CR>")
3926 map("n", "<LEADER>gw", "<CMD>lua vim.lsp.buf.document_symbol()<CR>")
4027 map("n", "<LEADER>gW", "<CMD>lua vim.lsp.buf.workspace_symbol()<CR>")
4129 map("n", "<LEADER>ah", "<CMD>lua vim.lsp.buf.hover()<CR>")
30 map("n", "<LEADER>as", "<CMD>lua vim.lsp.buf.signature_help()<CR>")
4231 map("n", "<LEADER>af", "<CMD>lua vim.lsp.buf.code_action()<CR>")
4332 map("n", "<LEADER>ar", "<CMD>lua vim.lsp.buf.rename()<CR>")
44 map("n", "<LEADER>=", "<CMD>lua vim.lsp.buf.formatting()<CR>")
33 map("n", "<LEADER>a=", "<CMD>lua vim.lsp.buf.formatting()<CR>")
4534 map("n", "<LEADER>ai", "<CMD>lua vim.lsp.buf.incoming_calls()<CR>")
4635 map("n", "<LEADER>ao", "<CMD>lua vim.lsp.buf.outgoing_calls()<CR>")
117106 },
118107 },
119108 })
120110 -- Markdown Notes (Zettelkasten) LSP
121111 lsp.zeta_note.setup({
122112 on_attach = integrate_into_neovim,

neovim/lua/plugins.lua

Modified

+50 / −7 text lines

1515 local packer_installation_path = data_path .. "/site/pack/" .. plugin_package .. "/opt/packer.nvim"
1616 if vim.fn.empty(vim.fn.glob(packer_installation_path)) == 1 then
1717 vim.cmd('!git clone https://github.com/wbthomason/packer.nvim "' .. packer_installation_path .. '"')
18 vim.cmd('packadd packer')
18 vim.cmd("packadd packer")
1919 end
2020 local packer = nil
2121 local init = function()
9292 end,
9393 })
95 -- TODO learn to configure minimal status line and tabline
9795 -- NVIM API for defining color schemes
98 -- TODO: when profiling, this plugins loading times are high
99 -- maybe the cause is that it loads a bunch of files
100 -- should those be merged into one file?
10196 use({
10297 "tjdevries/colorbuddy.vim",
10398 config = function()
108103 -- Advanced parsers for better syntax highlighting
109104 use({
110105 "nvim-treesitter/nvim-treesitter",
106 requires = { "nvim-treesitter/nvim-treesitter-refactor" },
111107 config = function()
112108 require("nvim-treesitter.install").compilers = { "clang" }
113109 require("nvim-treesitter.configs").setup({
114 ensure_installed = { "zig", "java", "rust", "lua", "toml", "yaml", "json", "c" },
110 ensure_installed = {
111 "zig",
112 "java",
113 "rust",
114 "lua",
115 "toml",
116 "yaml",
117 "json",
118 "jsonc",
119 "c",
120 "comment",
121 "html",
122 "css",
123 "javascript",
124 "query",
125 "vim",
126 },
115127 highlight = { enable = true },
116128 incremental_selection = {
117129 enable = true,
124136 },
125137 indent = { enable = true },
126138 query_linter = { enable = true, use_virtual_text = true, lint_events = { "BufWrite" } },
139 refactor = {
140 highlight_definitions = { enable = true },
141 smart_rename = { enable = true, keymaps = { smart_rename = "<LEADER>r" } },
142 navigation = {
143 enable = true,
144 keymaps = { goto_next_usage = "<a-.>", goto_previous_usage = "<a-,>" },
145 },
146 },
127147 })
128148 end,
129149 })
185205 -- This will configure all LSPs not only Null-ls.
186206 -- But because Null-ls depends on lspconfig, we have to delay this
187207 require("lsp")()
208 -- overwrite default action handlers with cuter ones
209 vim.lsp.handlers["textDocument/codeAction"] = require("lsputil.codeAction").code_action_handler
210 vim.lsp.handlers["textDocument/references"] = require("lsputil.locations").references_handler
211 vim.lsp.handlers["textDocument/definition"] = require("lsputil.locations").definition_handler
212 vim.lsp.handlers["textDocument/declaration"] = require("lsputil.locations").declaration_handler
213 vim.lsp.handlers["textDocument/typeDefinition"] = require("lsputil.locations").typeDefinition_handler
214 vim.lsp.handlers["textDocument/implementation"] = require("lsputil.locations").implementation_handler
215 vim.lsp.handlers["textDocument/documentSymbol"] = require("lsputil.symbols").document_handler
216 vim.lsp.handlers["workspace/symbol"] = require("lsputil.symbols").workspace_handler
188217 end,
189218 requires = {
190219 -- extensions to the std lib
193222 "neovim/nvim-lspconfig",
194223 -- Completions support, that integrates advanced nvim features (LSP+treesitter)
195224 "nvim-lua/completion-nvim",
225 -- Icons for completion UI
226 "onsails/lspkind-nvim",
227 -- dependency of nvim-lsputils
228 "RishabhRD/popfix",
229 -- collection of better handlers for lsp actions.
230 -- e.g. puts selection of code actions into floating window
231 "RishabhRD/nvim-lsputils",
196232 },
197233 })
231267 opt = true,
232268 command = "VBox",
233269 })
271 -- convenient lua abstraction over the nvim keymap function
272 -- TODO: use it throughout the code
273 use("Iron-E/nvim-cartographer")
275 -- automatically size splits reasonably
276 use("beauwilliams/focus.nvim")
234277 end
236279 -- the plugin module always delegates to packer, ensuring that at all times init configures packer correctly

neovim/lua/statusline.lua

Modified

+70 / −27 text lines

11local branch_icon = ""
22local vcs_branch_name = ""
3local code_actions_count = 0
34local special_windows = {
45 intro = { "CheatSheet", "" },
56 NvimTree = { "Files", "" },
67 packer = { "Plugins", "" },
78 help = { "Help", "龎" },
9 [""] = { "unknown file type", "" },
810}
911local lsp_symbols = { Error = "", Information = "", Warning = "", Hint = "" }
2022end
2224return {
25 update_code_actions_count = function()
26 local diagnostics_line_context = { diagnostics = vim.lsp.diagnostic.get_line_diagnostics() }
27 local lsp_parameters = vim.lsp.util.make_range_params()
28 lsp_parameters.context = diagnostics_line_context
29 vim.lsp.buf_request(0, "textDocument/codeAction", lsp_parameters, function(error, _, result)
30 if not error and result then
31 code_actions_count = #result
32 else
33 code_actions_count = 0
34 end
35 end)
36 end,
2337 -- refresh the statuslines of all windows.
2438 -- the current window gets special treatment. it is "active".
2539 update_statuslines = function()
2640 for _, window_number in pairs(vim.api.nvim_list_wins()) do
2741 if vim.api.nvim_get_current_win() == window_number then
28 vim.opt.statusline = [[%!v:lua.require'statusline'.render("current")]]
29 elseif vim.api.nvim_buf_get_name(0) ~= "" then
30 vim.opt.statusline = [[%!v:lua.require'statusline'.render()]]
42 vim.wo[window_number].statusline = [[%!v:lua.require'statusline'.render("current")]]
43 else
44 vim.wo[window_number].statusline = [[%!v:lua.require'statusline'.render()]]
3145 end
3246 end
3347 end,
3448 -- update the vcs branch name, if vcs is available
3549 update_vcs_branch_name = function()
3650 if not pcall(require, "plenary") then
37 return ""
51 return
52 end
53 local Job = require("plenary.job")
54 local git = Job:new({
55 command = "git",
56 args = { "branch", "--show-current" },
57 cwd = vim.fn.expand("%:p:h"), -- parent directory of current buffer
58 maximum_results = 1,
59 skip_validation = true,
60 on_exit = function(output)
61 local result = output:result()[1]
62 if result then
63 vcs_branch_name = result
64 end
65 end,
66 })
67 local svn = Job:new({
68 command = "svn",
69 args = { "info" },
70 cwd = vim.fn.expand("%:p:h"), -- parent directory of current buffer
71 maximum_results = 4,
72 skip_validation = true,
73 on_exit = function(output)
74 local result = output:result()[4] -- Relative URL is on the 4th line
75 result = result and result:match("Relative URL:%s%^/([%w/]+).*") or nil
76 if result then
77 vcs_branch_name = result
78 end
79 end,
80 })
81 -- simply try all vcs tools at once, and trust that only one returns an answer successfully
82 local all = { git, svn }
83 for _, tool in pairs(all) do
84 pcall(tool.start, tool)
3885 end
39 require("plenary.job")
40 :new({
41 command = "git",
42 args = { "branch", "--show-current" },
43 cwd = vim.fn.expand("%:p:h"), -- parent directory of current buffer
44 on_exit = function(output)
45 local result = output:result()[1]
46 if result then
47 vcs_branch_name = "%#LineNr#%=" .. branch_icon .. " " .. result
48 else
49 vcs_branch_name = ""
50 end
51 end,
52 })
53 :start()
5486 end,
5587 -- generate the statusline string
5688 render = function(active)
5789 local filetype = vim.bo.filetype
5890 local special_window = special_windows[filetype]
59 if active and special_window then
60 return "%#LineNr#%=" .. special_window[2] .. " " .. special_window[1] .. "%="
91 if special_window then
92 return "%#Statusline"
93 .. (active and "" or "NC")
94 .. "#%="
95 .. special_window[2]
96 .. " "
97 .. special_window[1]
98 .. "%="
6199 end
62 local edited = vim.bo.mod and "" or ""
63 local modifiable = vim.bo.modifiable and "" or ""
100 local edited = vim.bo.mod and "" or " "
101 local modifiable = vim.bo.modifiable and " " or ""
64102 local diagnostics = get_lsp_diagnostics_count()
104 local vcs_info = vcs_branch_name and ("%#LineNr#%=" .. branch_icon .. " " .. vcs_branch_name) or nil
66106 local statusline = "%#Statusline"
67107 .. (active and "" or "NC")
68108 .. "#"
71111 .. modifiable
72112 .. " "
73113 .. "%F" -- full file path
74 .. (diagnostics ~= "" and "  " .. diagnostics .. "  " or " ")
75 .. (active and vcs_branch_name or "")
114 .. (active and (diagnostics ~= "" and "  " .. diagnostics .. "  " or " ") or " ")
115 .. (code_actions_count ~= 0 and ("%#Title#" .. " " .. code_actions_count .. " ﯦ") or "")
116 .. (active and vcs_info or "")
77118 return statusline
78119 end,
79120 -- setup a custom statusline
80121 setup = function(autocommand)
81122 autocommand({
82 update_statusline = "CursorHold,CursorHoldI * lua require'statusline'.update_statuslines()",
83 update_vcs_branch_name = "BufEnter,BufWinEnter,WinEnter,BufReadPost * lua require'statusline'.update_vcs_branch_name()",
123 -- TODO: is there a more clever way to synchronize getting the branch name and updating the statusline?
124 update_vcs_branch_name = "BufEnter,WinEnter,BufWinEnter,BufReadPost * lua require'statusline'.update_vcs_branch_name()",
125 update_code_actions_count = "CursorHold,CursorHoldI * lua require'statusline'.update_code_actions_count()",
126 update_statuslines = "CursorHold,CursorHoldI,BufEnter,WinEnter,BufWinEnter,BufReadPost * lua require'statusline'.update_statuslines()",
84127 })
85128 end,

neovim/lua/tabline.lua

Modified

+14 / −11 text lines

1717 render = function()
1818 local buffer_names_to_ignore = {'NvimTree'}
1919 local tabline = ""
20 -- FIXME change this to tabpage instead of buf
21 for _, buffer_number in pairs(vim.api.nvim_list_bufs()) do
22 if vim.api.nvim_buf_is_valid(buffer_number) and vim.api.nvim_buf_is_loaded(buffer_number) then
20 for _, current_tab in pairs(vim.api.nvim_list_tabpages()) do
21 if vim.api.nvim_tabpage_is_valid(current_tab) then
22 local current_window = vim.api.nvim_tabpage_get_win(current_tab)
23 if not vim.api.nvim_win_is_valid(current_window) then goto continue end
24 local current_buffer = vim.api.nvim_win_get_buf(current_window)
25 if not (vim.api.nvim_buf_is_valid(current_buffer) and vim.api.nvim_buf_is_loaded(current_buffer)) then goto continue end
2326 local modified = vim.bo.modified and "" or " "
2427 -- we only care about the last part of the path
25 local stylish_buffer_name = vim.api.nvim_buf_get_name(buffer_number):match(".-([^\\/]-)$") or ""
26 if vim.tbl_contains(buffer_names_to_ignore, stylish_buffer_name) or stylish_buffer_name == "" then goto continue end
28 local current_buffer_name = vim.api.nvim_buf_get_name(current_buffer)
29 local stylish_buffer_name = current_buffer_name:match(".-([^\\/]-)$") or ""
30 if vim.tbl_contains(buffer_names_to_ignore, stylish_buffer_name) then goto continue end
2731 local icon = ""
28--FIXME this is the wrong way to handle new empty buffers: how to do it whithout showing tabs for all kinds of auxillary buffers (checkhealt for example)
29--[[ if stylish_buffer_name == "" then
30stylish_buffer_name = "no name"
31 icon = "" ]]
32 if stylish_buffer_name == "cheatsheet" then
32 if stylish_buffer_name == "" then
33 stylish_buffer_name = "no name"
34 icon = ""
35 elseif stylish_buffer_name == "cheatsheet" then
3336 icon = ""
3437 else
3538 local extension = stylish_buffer_name:match("%w+%.(.+)")
3639 icon = get_icon(stylish_buffer_name, extension)
3740 end
3841 stylish_buffer_name = " " .. stylish_buffer_name .. " "
39 local is_current_buffer = vim.api.nvim_get_current_buf() == buffer_number
42 local is_current_buffer = vim.api.nvim_get_current_buf() == current_buffer
4043 tabline = tabline .. "%#TabLine" ..
4144 (is_current_buffer and "Sel" or "") .. "#" ..
4245 " " .. icon .. stylish_buffer_name .. (is_current_buffer and modified or " ")

pop-os.symlinks

Modified

+1 / −1 text lines

2828stackoverflow/so
2929~/.config/so
31starship/starship.toml
31starship/starship.toml.pop-os
3232~/.config/starship.toml
3434topgrade/topgrade.linux.toml

starship/starship.toml.EJ-PC-00363

Modified

+11 / −1 text lines

99truncation_symbol = '⋯ /'
1010home_symbol = '∽'
1111truncation_length = 5
12read_only = " "
1314[java]
14style = 'yellow dimmed'
15style = 'dimmed yellow'
16symbol = " "
1618[git_status]
1719# too slow
1820disabled = true
22[git_branch]
23symbol = " "
2025[package]
2126style = "dimmed cyan"
2328[rust]
29symbol = " "
2430style = "dimmed cyan"
2632[zig]
2733style = "dimmed yellow"
35[lua]
36style = "dimmed blue"
37symbol = " "
2939[memory_usage]
3040disabled = false
3141format = "$symbol $ram_pct ($style)"

starship/starship.toml.pop-os

Added
new file mode 100644

+44 / −0 text lines

1#vim: ft=toml
2[character]
3success_symbol = ' (dimmed green)'
4# does not work yet in nushell
5error_symbol = ' (dimmed red)'
6
7[directory]
8style = 'bold purple'
9truncation_symbol = '⋯ /'
10home_symbol = '∽'
11truncation_length = 5
12read_only = " "
14[java]
15style = 'dimmed yellow'
16symbol = " "
18[git_status]
19# too slow
20disabled = true
22[git_branch]
23symbol = " "
25[package]
26style = "dimmed cyan"
28[rust]
29symbol = " "
30style = "dimmed cyan"
32[zig]
33style = "dimmed yellow"
35[lua]
36style = "dimmed blue"
37symbol = " "
39[memory_usage]
40disabled = false
41format = "$symbol $ram_pct ($style)"
42threshold = 50
43symbol = ""
44style = "dimmed gray"

starship/starship.toml.x230

Modified

+36 / −13 text lines

11#vim: ft=toml
22[character]
3#symbol = "> "
4
5[battery]
6full_symbol = "= "
7discharging_symbol = "- "
8charging_symbol = "+ "
9
10[[battery.display]]
11threshold = 100
12style = "dim gray"
3success_symbol = ' (dimmed green)'
4# does not work yet in nushell
5error_symbol = ' (dimmed red)'
157[directory]
16truncation_length = 5
178style = 'bold purple'
9truncation_symbol = '⋯ /'
10home_symbol = '∽'
11truncation_length = 5
12read_only = " "
1914[java]
20style = 'yellow dimmed'
15style = 'dimmed yellow'
16symbol = " "
2218[git_status]
19# too slow
2320disabled = true
22[git_branch]
23symbol = " "
25[package]
26style = "dimmed cyan"
28[rust]
29symbol = " "
30style = "dimmed cyan"
32[zig]
33style = "dimmed yellow"
35[lua]
36style = "dimmed blue"
37symbol = " "
2539[memory_usage]
2640disabled = false
2741format = "$symbol $ram_pct ($style)"
2842threshold = 50
2943symbol = ""
3044style = "dimmed gray"
46[battery]
47full_symbol = "🔋 "
48charging_symbol = "⚡️ "
49discharging_symbol = "💀 "
51[[battery.display]]
52threshold = 100
53style = "dim gray"