1 -#
bugabingas personal dotfiles, 33rd attempt 1 +#
bugabinga neovim config 3 -Shared configuration files between some Linux and some Windows hosts.
3 +neovim configuration is scripting.
4 +scripting with lua + neovim api is programming.
5 -##
bootstrapping a new host 9 -1. `git clone git@github.com:bugabinga/dotfiles`
11 -1. `java bootstripper.java`
12 +: standard lib. can only depend on itself and neovim apis.
15 +: config modules. in aggregation, defines all of the config. can depend on itself, std and plugins.
17 +lua/bugabinga/plugins
18 +: third party plugins and their config glue integrating it into the config.
24 +: file type specific config
13 -> Pay attention to already existing symlinks!
17 -Initial setup on windows is a little more sophisticated, because I am used to a developers environment.
30 +I am the bone of my code, bugs are my body and exceptions are my blood.
31 +I have created over a thousand bugs, unknown to testers, nor known to debuggers.
32 +Have withstood pain to create many programs, yet those hands will never hold a working program.
33 +So as I pray, Unlimited Bug Works.
19 -1. Enable Developer Mode, so that it is allowed to make symlinks without admin permissions.
20 -1. Install Build Tools with C++ Option (for Rust and cargo tools)
21 -1. Install Git without internal SSH
22 -1. Start ssh-agent service
23 -1. Enable `UTF-8` in regional settings
27 -- minimal amount of dependencies
28 - This helps in setting up new host.
29 - But it is really hard to achieve when hosts are allowed to be Windows and Linux AND [OpenBSD] ...
30 - The current state is a compromise reached after some experimentation.
31 -- editing and applying configs is "natural"
32 - Natural in this context is to mean: as if there was no dotfiles repository used for sharing.
33 - This is achieved by sym-linking the files from the dotfiles repository into their normal locations.
34 - So when it comes time to edit a config file, you can stay blissfully unaware of the dotfiles repository.
36 -##
handling per host differences 38 -There are two classes of differences in configurations between platforms (specifically Linux and Windows in my case).
40 -###
differing locations of config files 42 -For example, [NeoVim] stores its configuration at `~/.config/nvim` in Linux and at `~/AppData/Roaming/nvim` in Windows.
43 -In order to handle theses differences each host gets its own symlink file with the naming pattern `(hostname).symlinks`.
44 -The format of this file is:
47 -path to configuration file/directory relative to dotfiles root
48 -absolute path of symlink on host
51 -Each symlink path pair is to be delimited by a newline.
59 -~/.config/foobar.conf
62 -This file will be parsed by [bootstripper] in order to create those symlinks.
64 -###
differing values in configuration files 66 -Most often, these come down to different paths of stuff, that get referred to in config files.
67 -For example, [topgrade], an abstraction over a bunch of package managers and updaters, might want to know the location of your git repositories, so it can pull them for you.
68 -Some programs, e.g. [NeoVim], have rich configuration languages that are powerful enough for you to resolve those differences with conditionals.
69 -However some programs, e.g. [topgrade], offer only declarative configuration languages, which make it impossible to resolve this problem in the config.
70 -I tried solving this problem with some kind of a templating engine.
71 -But I quickly gave up on that, because it was too annoying to manage.
72 -Specifically, editing configuration stopped being "natural", meaning you cannot simply open and edit the file at the location you expect the config to be anymore.
73 -This natural flow is the reason symlinks are used.
74 -With templating in the mix, an intermediary step is necessary, between editing and applying config.
76 -Instead, I use the `(hostname).symlink` files to resolve such cases.
77 -That means, that config files are completely independent per host, and as such some duplication of configuration occurs.
78 -A tradeoff well worth it in my opinion.
82 -Secrets are encrypted and saved as file into the `tresor` folder.
83 -The name of these file is a random UUID, which I map to their original purpose somewhere else.
84 -Those secret files are decrypted either by [bootstripper] or on demand in my scripts.
86 -##
the trouble with bootstrapping dotfiles 88 -Most of my previous attempts at managing my configuration files failed because it is tricky to share them between Windows and Unix systems.
89 -If all my hosts were Unix(y), I would write a POSIX shell script and be done with it.
90 -But that does not work for Windows.
92 -Since I find it important to be able to setup my configuration files on any fresh new host, it is important to have as few dependencies as possible.
93 -However, with Windows in the mix, this is pretty hard, so I settled on a compromise: JDK.
95 -Things I tried in the past to solve this problem:
97 -- dotfiles managers (e.g. [chezmoi])
99 -- writing a bootstrap/installer with [cosmopolitan]
100 - > extremely cool tech. unfortunately I am not a C programmer so I struggled a lot.
101 - > also, the resulting binary rewrites itself on first run. How do I keep a file version controlled that is allowed to change on first use, but should not result in a new modification...?
102 - > furthermore, managing the [cosmopolitan] toolchain for windows made extra work.
103 -- use POSIX shell for Unix, use PowerShell for Windows
104 - > too much work. maintaining the same program in 2 different languages ... depressing not because you have to write twice, but because you have to test twice.
105 -- Pretend Windows is Unix by only interfacing with it through [WSL].
106 - > Windows is not Unix. [WSL] is cute, even useful for cross-compilation and testing. But when I am on Windows I want to use Windows, when I am on Linux I want to use Linux. Fighting the platform constantly is too tiring.
108 -Things I have not tried (yet?):
110 -- Use a language with a pleasant cross-compile story ([golang], [Rust], [ziglang]) and version control a binary for those platforms I care about.
111 -- Use [PowerShell Core] and maybe a script per platform to install it. This could be nice if [PowerShell Core] would replace [PowerShell Windows] and it was my main shell.
113 -[
NeoVim]: https://neovim.io/
114 -[
topgrade]: https://github.com/r-darwish/topgrade
115 -[
bootstripper]: https://github.com/bugabinga/dotfiles/blob/trunk/bootstripper.java
116 -[
chezmoi]: https://github.com/twpayne/chezmoi
117 -[
golang]: https://golang.org/
118 -[
Rust]: https://www.rust-lang.org/
119 -[
ziglang]: https://ziglang.org/
120 -[
WSL]: https://docs.microsoft.com/en-us/windows/wsl/about
121 -[
PowerShell Core]: https://github.com/PowerShell/PowerShell
122 -[
PowerShell Windows]: https://de.wikipedia.org/wiki/PowerShell
123 -[
OpenBSD]: https://www.openbsd.org/
124 -[
cosmopolitan]: https://github.com/jart/cosmopolitan
42 +* write plugin to parse lsp settings locally and apply them
43 +* is there a use case for a plugin that parses local plugin configuration overrides?
44 +* kill custom lsp stuff in favor of lspconfig and try neoconf + nvim-java
45 +* does status bar fail to display if lsp fails to load?
46 +* pandoc with lua filters for diagrams for generating documents and previewing --> https://github.com/tex/vimpreviewpandoc
47 +* use gen.ai to generate docs
48 +* learn marks and refactor mark.lua
49 +* use ltex-ls for markdown, code comments and commit messages
50 +* create a floating window that shows plugins, that have commands, as reminder
52 +* add nu-check to nvim-lint
53 +* create facade over vim.api.nvim_create_user_command
54 +* create skeleton-plugin for default file content based on file type
55 +* add support for Java multi line string in autopairs
56 +* nvim spell for camel case words