From 30b733851b17c2786a3340bff017c8ef0e057de7 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Tue, 19 May 2026 19:59:18 +0200 Subject: feat(dotfiles): add reinstall-nvim subcommand - New 'dotfiles reinstall-nvim': clean rebuild of nvim from the currently checked-out submodule tag (prompted), independent of sync's version check. - Fix build_and_install_nvim: rm targeted $build_dir/build (install prefix, nonexistent) instead of the real build tree; now clears $src_dir/{build,.deps} so rebuilds are from scratch. sync only worked before because a new tag changed sources. - Add reinstall-nvim to the _comp_dotfiles completion. --- .local/bin/dotfiles | 11 +++++++++-- .local/share/dotfiles/dotfiles_on.env | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.local/bin/dotfiles b/.local/bin/dotfiles index 40855f7..d29f4fe 100755 --- a/.local/bin/dotfiles +++ b/.local/bin/dotfiles @@ -47,7 +47,7 @@ sync_mdformat() { 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/" + rm -rf "$src_dir/build/" "$src_dir/.deps/" make \ --directory="$src_dir" \ CMAKE_BUILD_TYPE=RelWithDebInfo \ @@ -76,6 +76,12 @@ sync_nvim() { fi } +reinstall_nvim() { + if prompt_for_install "Rebuild nvim from source"; then + build_and_install_nvim + fi +} + case ${1:-} in sync) declare deps=( @@ -105,10 +111,11 @@ sync) sync_nvim sync_mdformat ;; +reinstall-nvim) reinstall_nvim ;; on) clipboard_hint "source $HOME/.local/share/dotfiles/dotfiles_on.env" ;; off) clipboard_hint "source $HOME/.local/share/dotfiles/dotfiles_off.env" ;; *) - echo "usage: dotfiles {sync|on|off}" + echo "usage: dotfiles {sync|reinstall-nvim|on|off}" exit 1 ;; esac diff --git a/.local/share/dotfiles/dotfiles_on.env b/.local/share/dotfiles/dotfiles_on.env index f02b9f4..99c6fdb 100644 --- a/.local/share/dotfiles/dotfiles_on.env +++ b/.local/share/dotfiles/dotfiles_on.env @@ -1,6 +1,6 @@ export GIT_DIR="$DOTFILES_DIR" GIT_WORK_TREE="$HOME" function _comp_dotfiles() { - COMPREPLY=(sync on off) + COMPREPLY=(sync reinstall-nvim on off) } complete -F _comp_dotfiles dotfiles -- cgit v1.3.1