repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix: resolve symlink target relative to root dir

241c33f29029fbf9a49762ac984554b44d6557c1

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

unsigned

Browse filesCompare with HEAD

Changed files (8)

TODO.md

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

bootstripper.java

Modified
11 11 var dorkfiles_root = Path.of(arguments[0]).toRealPath();
12 12 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"));
14 14 var hostname = hostname();
15 15 System.out.printf("Hostname: %s%n", emphasize_global(hostname));
16 16 var symlinks_file = hostname + ".symlinks";
17 - create_symlinks(dorkfiles_root.resolve(symlinks_file));
17 + create_symlinks(dorkfiles_root, dorkfiles_root.resolve(symlinks_file));
19 19 static void decrypt_secrets(Path secrets_root) throws Exception {
20 20 System.out.printf("%s:Decrypting files in %s folder.%n", emphasize_global("TODO"), emphasize_local(secrets_root.getFileName().toString()));
22 - static void create_symlinks(Path symlinks_file) throws Exception {
22 + static void create_symlinks(Path root, Path symlinks_file) throws Exception {
23 23 System.out.printf("Creating symlinks as defined in %s file.%n", emphasize_local(symlinks_file.getFileName().toString()));
24 24 var lines = Files.readAllLines(symlinks_file);
25 25 String source = null;
29 29 if (source == null) source = line;
30 30 else if (target == null) target = line;
31 31 if(source != null && target != null){
32 - link(source, target);
32 + link(root, source, target);
33 33 source = null;
34 34 target = null;
38 - static void link(String source, String target) throws Exception {
38 + static void link(Path root, String source, String target) throws Exception {
39 39 var home = System.getProperty("user.home");
40 - var source_path = Path.of(source.replace("~", home)).toAbsolutePath();
40 + var source_path = root.resolve(source).toAbsolutePath();
41 41 var target_path = Path.of(target.replace("~", home)).toAbsolutePath();
42 42 var is_directory = Files.isDirectory(source_path);
43 43 if(Files.exists(target_path, LinkOption.NOFOLLOW_LINKS)){

neovim/lua/plugins.lua

Modified
15 15 local packer_installation_path = data_path .. "/site/pack/" .. plugin_package .. "/opt/packer.nvim"
16 16 if vim.fn.empty(vim.fn.glob(packer_installation_path)) == 1 then
17 17 vim.cmd('!git clone https://github.com/wbthomason/packer.nvim "' .. packer_installation_path .. '"')
18 - vim.cmd('packadd packer')
18 + vim.cmd("packadd packer")
20 20 local packer = nil
21 21 local init = function()
95 - -- TODO learn to configure minimal status line and tabline
97 95 -- NVIM API for defining color schemes
98 96 -- TODO: when profiling, this plugins loading times are high
99 97 -- maybe the cause is that it loads a bunch of files
108 106 -- Advanced parsers for better syntax highlighting
110 108 "nvim-treesitter/nvim-treesitter",
109 + requires = { "nvim-treesitter/nvim-treesitter-refactor" },
111 110 config = function()
112 111 require("nvim-treesitter.install").compilers = { "clang" }
113 112 require("nvim-treesitter.configs").setup({
114 - ensure_installed = { "zig", "java", "rust", "lua", "toml", "yaml", "json", "c" },
113 + ensure_installed = {
114 + "zig",
115 + "java",
116 + "rust",
117 + "lua",
118 + "toml",
119 + "yaml",
120 + "json",
121 + "jsonc",
122 + "c",
123 + "comment",
124 + "html",
125 + "css",
126 + "javascript",
127 + "query",
128 + "vim",
129 + },
115 130 highlight = { enable = true },
116 131 incremental_selection = {
117 132 enable = true,
125 140 indent = { enable = true },
126 141 query_linter = { enable = true, use_virtual_text = true, lint_events = { "BufWrite" } },
142 + refactor = {
143 + highlight_definitions = { enable = true },
144 + smart_rename = { enable = true, keymaps = { smart_rename = "<LEADER>r" } },
145 + navigation = { enable = true, keymaps = { goto_next_usage = "<a-.>", goto_previous_usage = "<a-,>" } },
146 + },

neovim/lua/statusline.lua

Modified
1 1 local branch_icon = ""
2 2 local vcs_branch_name = ""
3 +local code_actions_count = 0
3 4 local special_windows = {
4 5 intro = { "CheatSheet", "" },
5 6 NvimTree = { "Files", "" },
6 7 packer = { "Plugins", "" },
7 8 help = { "Help", "龎" },
8 - [""] = { "no name", "" },
9 + [""] = { "unknown file type", "" },
10 11 local lsp_symbols = { Error = "", Information = "", Warning = "", Hint = "" }
23 24 return {
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,
24 37 -- refresh the statuslines of all windows.
25 38 -- the current window gets special treatment. it is "active".
26 39 update_statuslines = function()
84 97 local modifiable = vim.bo.modifiable and " " or ""
85 98 local diagnostics = get_lsp_diagnostics_count()
87 - local vcs_info = vcs_branch_name and ("%#LineNr#%=" .. branch_icon .. " " .. vcs_branch_name) or nil
100 + local vcs_info = vcs_branch_name and ("%#LineNr#%=" .. branch_icon .. " " .. vcs_branch_name) or nil
89 102 local statusline = "%#Statusline"
90 103 .. (active and "" or "NC")
95 108 .. " "
96 109 .. "%F" -- full file path
97 110 .. (active and (diagnostics ~= "" and "  " .. diagnostics .. "  " or " ") or " ")
111 + .. (code_actions_count ~= 0 and ("%#Title#" .. " " .. code_actions_count .. " ﯦ") or "")
98 112 .. (active and vcs_info or "")
100 114 return statusline
102 116 -- setup a custom statusline
103 117 setup = function(autocommand)
104 118 autocommand({
105 - update_statuslines = "BufEnter,WinEnter,BufWinEnter,BufReadPost * lua require'statusline'.update_statuslines()",
106 119 -- TODO: is there a more clever way to synchronize getting the branch name and updating the statusline?
107 120 update_vcs_branch_name = "BufEnter,WinEnter,BufWinEnter,BufReadPost * lua require'statusline'.update_vcs_branch_name()",
121 + update_code_actions_count = "CursorHold,CursorHoldI * lua require'statusline'.update_code_actions_count()",
122 + update_statuslines = "CursorHold,CursorHoldI,BufEnter,WinEnter,BufWinEnter,BufReadPost * lua require'statusline'.update_statuslines()",

pop-os.symlinks

Modified
28 28 stackoverflow/so
29 29 ~/.config/so
31 -starship/starship.toml
31 +starship/starship.toml.pop-os
32 32 ~/.config/starship.toml
34 34 topgrade/topgrade.linux.toml

starship/starship.toml.EJ-PC-00363

Modified
9 9 truncation_symbol = '⋯ /'
10 10 home_symbol = '∽'
11 11 truncation_length = 5
12 +read_only = " "
13 14 [java]
14 -style = 'yellow dimmed'
15 +style = 'dimmed yellow'
16 +symbol = " "
16 18 [git_status]
17 19 # too slow
18 20 disabled = true
22 +[git_branch]
23 +symbol = " "
20 25 [package]
21 26 style = "dimmed cyan"
23 28 [rust]
29 +symbol = " "
24 30 style = "dimmed cyan"
26 32 [zig]
27 33 style = "dimmed yellow"
35 +[lua]
36 +style = "dimmed blue"
37 +symbol = " "
29 39 [memory_usage]
30 40 disabled = false
31 41 format = "$symbol $ram_pct ($style)"

starship/starship.toml.pop-os

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

starship/starship.toml.x230

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