From a8db391070998990e5017a3fa5f0caa6c41a27df Mon Sep 17 00:00:00 2001 From: Hans Goor Date: Wed, 27 Mar 2024 19:16:28 +0100 Subject: [PATCH] Clean up structure of dotfiles --- .gitmodules | 4 +-- bash/{.bashrc => dot-bashrc} | 0 git/{.gitconfig => dot-gitconfig} | 0 install.sh | 31 +++++++++++++++++++ ssh/{.ssh => }/config | 0 tmux/.tmux/.gitignore | 1 - tmux/{.tmux.conf => dot-tmux.conf} | 0 tmux/dot-tmux/.gitignore | 2 ++ tmux/{.tmux => dot-tmux}/bindings.conf | 0 tmux/{.tmux => dot-tmux}/gitmux.conf | 0 tmux/{.tmux => dot-tmux}/globals.conf | 0 tmux/{.tmux => dot-tmux}/nvim.conf | 0 .../plugin-configs/rose-pine.conf | 0 tmux/{.tmux => dot-tmux}/plugins/tpm | 0 zsh/{.zshrc => dot-zshrc} | 7 ++--- 15 files changed, 37 insertions(+), 8 deletions(-) rename bash/{.bashrc => dot-bashrc} (100%) rename git/{.gitconfig => dot-gitconfig} (100%) create mode 100755 install.sh rename ssh/{.ssh => }/config (100%) delete mode 100644 tmux/.tmux/.gitignore rename tmux/{.tmux.conf => dot-tmux.conf} (100%) create mode 100644 tmux/dot-tmux/.gitignore rename tmux/{.tmux => dot-tmux}/bindings.conf (100%) rename tmux/{.tmux => dot-tmux}/gitmux.conf (100%) rename tmux/{.tmux => dot-tmux}/globals.conf (100%) rename tmux/{.tmux => dot-tmux}/nvim.conf (100%) rename tmux/{.tmux => dot-tmux}/plugin-configs/rose-pine.conf (100%) rename tmux/{.tmux => dot-tmux}/plugins/tpm (100%) rename zsh/{.zshrc => dot-zshrc} (95%) diff --git a/.gitmodules b/.gitmodules index f7a1de1..f6b10e5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "tmux/.tmux/plugins/tpm"] - path = tmux/.tmux/plugins/tpm +[submodule "tmux/dot-tmux/plugins/tpm"] + path = tmux/dot-tmux/plugins/tpm url = https://github.com/tmux-plugins/tpm diff --git a/bash/.bashrc b/bash/dot-bashrc similarity index 100% rename from bash/.bashrc rename to bash/dot-bashrc diff --git a/git/.gitconfig b/git/dot-gitconfig similarity index 100% rename from git/.gitconfig rename to git/dot-gitconfig diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..9e92bc9 --- /dev/null +++ b/install.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +function do_stow() { + local package="$1" + local opts=( "--dotfiles" "--dir" "${DOTFILES_DIR}" ) + + if [[ "$#" -ge 2 ]]; then + opts+=( "--target" "$2" ) + fi + + stow "${opts[@]}" "$package" +} + +set -eo pipefail + +DOTFILES_DIR="$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")" +TARGET_DIR="$HOME" + +if ! command -v stow &> /dev/null; then + echo "[!] Stow is not installed!" + exit 1 +fi + +# Install SSH separately, as it requres a different target. +do_stow ssh "${TARGET_DIR}/.ssh" +do_stow tmux +do_stow git +do_stow zsh +do_stow nvim "${TARGET_DIR}/.config" + +echo "[+] Installed!" diff --git a/ssh/.ssh/config b/ssh/config similarity index 100% rename from ssh/.ssh/config rename to ssh/config diff --git a/tmux/.tmux/.gitignore b/tmux/.tmux/.gitignore deleted file mode 100644 index 16873f6..0000000 --- a/tmux/.tmux/.gitignore +++ /dev/null @@ -1 +0,0 @@ -plugins/ diff --git a/tmux/.tmux.conf b/tmux/dot-tmux.conf similarity index 100% rename from tmux/.tmux.conf rename to tmux/dot-tmux.conf diff --git a/tmux/dot-tmux/.gitignore b/tmux/dot-tmux/.gitignore new file mode 100644 index 0000000..9761a4b --- /dev/null +++ b/tmux/dot-tmux/.gitignore @@ -0,0 +1,2 @@ +plugins/* +!plugins/tpm diff --git a/tmux/.tmux/bindings.conf b/tmux/dot-tmux/bindings.conf similarity index 100% rename from tmux/.tmux/bindings.conf rename to tmux/dot-tmux/bindings.conf diff --git a/tmux/.tmux/gitmux.conf b/tmux/dot-tmux/gitmux.conf similarity index 100% rename from tmux/.tmux/gitmux.conf rename to tmux/dot-tmux/gitmux.conf diff --git a/tmux/.tmux/globals.conf b/tmux/dot-tmux/globals.conf similarity index 100% rename from tmux/.tmux/globals.conf rename to tmux/dot-tmux/globals.conf diff --git a/tmux/.tmux/nvim.conf b/tmux/dot-tmux/nvim.conf similarity index 100% rename from tmux/.tmux/nvim.conf rename to tmux/dot-tmux/nvim.conf diff --git a/tmux/.tmux/plugin-configs/rose-pine.conf b/tmux/dot-tmux/plugin-configs/rose-pine.conf similarity index 100% rename from tmux/.tmux/plugin-configs/rose-pine.conf rename to tmux/dot-tmux/plugin-configs/rose-pine.conf diff --git a/tmux/.tmux/plugins/tpm b/tmux/dot-tmux/plugins/tpm similarity index 100% rename from tmux/.tmux/plugins/tpm rename to tmux/dot-tmux/plugins/tpm diff --git a/zsh/.zshrc b/zsh/dot-zshrc similarity index 95% rename from zsh/.zshrc rename to zsh/dot-zshrc index 3eb12e7..2e67f33 100644 --- a/zsh/.zshrc +++ b/zsh/dot-zshrc @@ -70,7 +70,7 @@ zstyle ':omz:update' mode auto # update automatically without asking # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git) +plugins=() source $ZSH/oh-my-zsh.sh @@ -105,7 +105,4 @@ zstyle ':completion:*:manuals' separate-sections true zstyle ':completion:*:manuals.*' insert-sections true zstyle ':completion:*:man:*' menu yes select -# Auto start tmux -if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ] && [ -z "$SSH_CONNECTION" ]; then - exec tmux -fi +alias vim="nvim"