summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-05-04 08:44:50 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-05-06 16:43:16 +0200
commit0bc002288b984d8ec8123c135456570c78a22da3 (patch)
tree020ed3f6a7f28a081687a3e46ea190e3aa724f7c /.local
downloaddotfiles-0bc002288b984d8ec8123c135456570c78a22da3.tar.gz
dotfiles-0bc002288b984d8ec8123c135456570c78a22da3.zip
feat: initial setup
- `dotfiles` (this project's CLI) - foot configuration - tmux configuration - bash configuration - nvim (as a git submodule) + configuration - ranger configuration - fzf configuration - KDE global shortcuts - Other miscellaneous dependencies
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/dotfiles104
-rw-r--r--.local/share/dotfiles/README.md41
m---------.local/share/dotfiles/deps/neovim0
-rw-r--r--.local/share/dotfiles/dotfiles_off.env1
-rw-r--r--.local/share/dotfiles/dotfiles_on.env6
5 files changed, 152 insertions, 0 deletions
diff --git a/.local/bin/dotfiles b/.local/bin/dotfiles
new file mode 100755
index 0000000..faf2c1f
--- /dev/null
+++ b/.local/bin/dotfiles
@@ -0,0 +1,104 @@
+#!/usr/bin/bash
+set -euo pipefail
+
+prompt_for_install() {
+ local label=${1:?label argument missing}
+ echo "$label"
+ read -rn 1 -p "Install? (y/n)" input
+ echo
+ if [[ $input == y ]]; then return 0; else return 1; fi
+}
+
+clipboard_hint() {
+ local cmd=${1:?cmd argument missing}
+ wl-copy "$cmd"
+ echo -e "Copied to clipboard:\n\n$cmd\n"
+}
+
+sync_deps() {
+ local missing_deps=()
+ for dep; do
+ if ! pacman --query "$dep" >/dev/null 2>&1; then missing_deps+=("$dep"); fi
+ done
+ if [[ ${#missing_deps[@]} -eq 0 ]]; then return; fi
+ if prompt_for_install "Missing dependencies: ${missing_deps[*]}"; then
+ sudo pacman --sync "${missing_deps[@]}"
+ fi
+}
+
+sync_mdformat() {
+ local pipx_json
+ pipx_json="$(pipx list --json)"
+ if ! jq --exit-status '.venvs | has("mdformat")' <<<"$pipx_json" >/dev/null 2>&1; then
+ if prompt_for_install "Missing mdformat"; then pipx install mdformat; else return; fi
+ fi
+ local missing_injected_packages=()
+ for pack in mdformat-gfm mdformat-frontmatter; do
+ if ! jq --exit-status ".venvs.mdformat.metadata.injected_packages | has(\"$pack\")" <<<"$pipx_json" >/dev/null 2>&1; then
+ missing_injected_packages+=("$pack")
+ fi
+ done
+ if [[ ${#missing_injected_packages[@]} -eq 0 ]]; then return; fi
+ if prompt_for_install "Missing mdformat extensions: ${missing_injected_packages[*]}"; then
+ pipx inject mdformat "${missing_injected_packages[@]}"
+ fi
+}
+
+build_and_install_nvim() {
+ local src_dir="$HOME/.local/share/dotfiles/deps/neovim"
+ local build_dir="$HOME/.local/share/nvim"
+ rm -rf "$build_dir/build/"
+ make \
+ --directory="$src_dir" \
+ CMAKE_BUILD_TYPE=RelWithDebInfo \
+ CMAKE_INSTALL_PREFIX="$build_dir"
+ make --directory="$src_dir" install
+ ln --symbolic --force "$build_dir/bin/nvim" "$HOME/.local/bin/nvim"
+}
+
+sync_nvim() {
+ local nvim_dir="$HOME/.local/share/dotfiles/deps/neovim"
+ local git_args=(--git-dir "$nvim_dir/.git" --work-tree "$nvim_dir")
+ git "${git_args[@]}" fetch --tags --force >/dev/null
+ local current_version latest_version
+ if ! command -v nvim >/dev/null; then
+ if prompt_for_install "Missing nvim"; then build_and_install_nvim; fi
+ return
+ fi
+ current_version="$(command nvim --version | head -1 | grep -E --only-matching "v[0-9]+\.[0-9]+\.[0-9]+")"
+ latest_version="$(git "${git_args[@]}" tag --list "v*" --sort=-version:refname | head -1)"
+ if [[ $current_version == "$latest_version" ]]; then return; fi
+ if prompt_for_install "New nvim version $current_version → $latest_version"; then
+ git "${git_args[@]}" checkout "$latest_version"
+ build_and_install_nvim
+ fi
+}
+
+case ${1:-} in
+sync)
+ declare deps=(
+ foot # terminal emulator
+ tmux # terminal multiplexer
+ bash # shell
+ bash-completion # collection of bash completions
+ fzf # fuzzy finder
+ ranger # file explorer
+ bat # syntax highlighter
+ python-pipx # Python apps environment
+ wl-clipboard # Wayland clipboard
+ jq # JSON processor
+ shfmt # shell program formatter
+ stylua # Lua formatter
+ base-devel cmake ninja git # nvim build dependencies
+ )
+ sync_deps "${deps[@]}"
+ sync_nvim
+ sync_mdformat
+ ;;
+on) clipboard_hint "source $HOME/.local/share/dotfiles/dotfiles_on.env" ;;
+off) clipboard_hint "source $HOME/.local/share/dotfiles/dotfiles_off.env" ;;
+*)
+ echo "What?"
+ exit 1
+ ;;
+esac
diff --git a/.local/share/dotfiles/README.md b/.local/share/dotfiles/README.md
new file mode 100644
index 0000000..8382007
--- /dev/null
+++ b/.local/share/dotfiles/README.md
@@ -0,0 +1,41 @@
+# dotfiles
+
+The repository for my configurations, my tools, my setup. Each branch is for a specific environment (OS, distribution,
+DE, whatever). It is inspired by [this][0].
+
+A dotfiles repository index can be anywhere, but the working tree must be at `HOME`. This is how to start from scratch:
+
+```bash
+git init --bare "$DOTFILES_DIR"
+export GIT_DIR="$DOTFILES_DIR" GIT_WORK_TREE="$HOME"
+git config --local status.showUntrackedFiles no
+```
+
+Add any file to the repository: `git add ~/.bashrc`.
+
+## Setup
+
+There is one thing to configure not included in the repo (because you can choose `DOTFILES_DIR`):
+
+```bash
+echo "DOTFILES_DIR=$DOTFILES_DIR" >>"$HOME/.config/environment.d/50-dotfiles.conf"
+```
+
+This variable must be available for other programs to function. See `man 5 environment.d`. Now reboot. That's it!
+
+## Overview
+
+- **Terminal emulator**: [foot][1]
+- **Terminal multiplexer**: [tmux][2]
+- **Shell**: [bash][3]
+- **File browser**: [ranger][4]
+- **Text editor**: [nvim][5]
+
+## Links
+
+[0]: https://www.atlassian.com/git/tutorials/dotfiles
+[1]: https://codeberg.org/dnkl/foot#index
+[2]: https://github.com/tmux/tmux/wiki
+[3]: https://www.gnu.org/software/bash/
+[4]: https://github.com/ranger/ranger
+[5]: https://neovim.io/
diff --git a/.local/share/dotfiles/deps/neovim b/.local/share/dotfiles/deps/neovim
new file mode 160000
+Subproject 4b35336f6f850ce68a230716401cdaa21bdb6a2
diff --git a/.local/share/dotfiles/dotfiles_off.env b/.local/share/dotfiles/dotfiles_off.env
new file mode 100644
index 0000000..949494d
--- /dev/null
+++ b/.local/share/dotfiles/dotfiles_off.env
@@ -0,0 +1 @@
+unset GIT_DIR GIT_WORK_TREE
diff --git a/.local/share/dotfiles/dotfiles_on.env b/.local/share/dotfiles/dotfiles_on.env
new file mode 100644
index 0000000..f02b9f4
--- /dev/null
+++ b/.local/share/dotfiles/dotfiles_on.env
@@ -0,0 +1,6 @@
+export GIT_DIR="$DOTFILES_DIR" GIT_WORK_TREE="$HOME"
+
+function _comp_dotfiles() {
+ COMPREPLY=(sync on off)
+}
+complete -F _comp_dotfiles dotfiles