Removed obsolete stow configurations. Migrate to Makefile instead of install.sh. Auto install tools.

This commit is contained in:
Hans Goor 2025-06-22 14:00:08 +01:00
parent 1584784949
commit ae6a871336
Signed by: eyedevelop
SSH key fingerprint: SHA256:Td89veptDEwCV8J3fjqnknNk7SbwzedYhauyC2nFBYg
39 changed files with 172 additions and 703 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build/

3
.gitmodules vendored
View file

@ -1,6 +1,3 @@
[submodule "tmux/dot-tmux/plugins/tpm"]
path = stowers/tmux/dot-tmux/plugins/tpm
url = https://github.com/tmux-plugins/tpm
[submodule "zsh/dot-oh-my-zsh"]
path = stowers/zsh/dot-oh-my-zsh
url = https://github.com/ohmyzsh/ohmyzsh

55
Makefile Normal file
View file

@ -0,0 +1,55 @@
.PHONY = clean install offline fonts/all fonts/download-all uninstall
default: install
LOCAL_CACHE ?= ./build/cache
LOCAL_TOOLS ?= ./build/tools
LOCAL_FONTS ?= $(HOME)/.local/share/fonts
FONTS_TO_INSTALL ?= FiraCode FiraMono Hack
LOCAL_TOOLS_BIN ?= $(HOME)/.local/bin
STOW_TARGET ?= $(HOME)
STOW := $(shell command -v stow 2>/dev/null)
# Compile stow if it doesn't exist
ifeq ($(STOW),)
STOW := $(LOCAL_TOOLS_BIN)/stow
BUILD_STOW := 1
PERL5LIB := $(LOCAL_TOOLS)/stow/lib
export PERL5LIB
endif
## Includes
include tools.mk
include stowers.mk
install: tools/all stowers/all fonts/all
offline: tools/download-all fonts/download-all
clean: tools/clean
rm -rf ./build
uninstall: stowers/uninstall/all clean
@echo Uninstalled!
$(LOCAL_CACHE) $(LOCAL_CACHE)/fonts $(LOCAL_TOOLS) $(LOCAL_TOOLS_BIN):
mkdir -p $@
$(LOCAL_CACHE)/fonts/%.tar.xz: $(LOCAL_CACHE)/fonts
@echo Downloading font $*
curl -o $@ -L https://github.com/ryanoasis/nerd-fonts/releases/latest/download/$*.tar.xz
fonts/download-all: $(foreach font,$(FONTS_TO_INSTALL),$(LOCAL_CACHE)/fonts/$(font).tar.xz)
@echo Downloaded all fonts
fonts/all: $(foreach font,$(FONTS_TO_INSTALL),fonts/$(font))
@echo Installed all fonts
fonts/%: $(LOCAL_CACHE)/fonts/%.tar.xz
@echo Installing font $*
mkdir -p $(LOCAL_FONTS)
mkdir -p $(LOCAL_CACHE)/fonts/$*
tar -C $(LOCAL_CACHE)/fonts/$* -xJf $<
find $(LOCAL_CACHE)/fonts/$* -type f \( -iname '*.otf' -o -iname '*.ttf' \) -exec mv {} $(LOCAL_FONTS)/ \;
fc-cache -f

View file

@ -1,98 +0,0 @@
#!/bin/bash
set -euo pipefail
DOTFILES_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
STOWERS_DIR="${DOTFILES_DIR}/stowers"
MODULES_DIR="${DOTFILES_DIR}/modules"
TARGET_DIR="${HOME}"
install_stower() {
if ! command -v stow &>/dev/null; then
echo "[!] GNU Stow is not installed!" >&2
return 1
fi
if [[ "$#" -lt 1 ]]; then
echo "[!] No stower given!" >&2
return 1
fi
local stower_name stower_dir
stower_name="$1"
stower_dir="${STOWERS_DIR}/${stower_name}"
if [[ ! -d "${stower_dir}" ]]; then
echo "[!] Stower (${stower_dir}) is not a directory!" >&2
return 1
fi
local COMMAND_DEPS
COMMAND_DEPS=()
if [[ -f "${stower_dir}"/config.sh ]]; then
source "${stower_dir}"/config.sh
fi
for required_cmd in "${COMMAND_DEPS[@]}"; do
if ! command -v "${required_cmd}" &>/dev/null; then
echo "[${stower_name}] Missing required command: ${required_cmd}" >&2
return 1
fi
done
stow --dotfiles \
--dir "${STOWERS_DIR}" \
--target "${TARGET_DIR}" \
--ignore "config.sh" "${stower_name}" || \
{ [[ "$(type -t fallback)" == "function" ]] && fallback "${stower_dir}" "${TARGET_DIR}"; } || \
{ echo "[!] [${stower_name}] Failed to install!" >&2; return 1; }
echo "[+] [${stower_name}] Installed!"
}
install_module() {
if [[ "$#" -lt 1 ]]; then
echo "[!] No module given!" >&2
return 1
fi
local module_dir
module_dir="${MODULES_DIR}/$1"
if [[ ! -d "${module_dir}" ]] || [[ ! -f "${module_dir}/install.sh" ]]; then
echo "[!] Module (${module_dir}) is not a module!" >&2
return 1
fi
/bin/bash "${module_dir}/install.sh"
}
STOWERS=()
MODULES=()
if [[ "$#" -gt 0 ]]; then
for stower_or_module in "$@"; do
if [[ -e "${STOWERS_DIR}/${stower_or_module}" ]]; then
STOWERS+=("${stower_or_module}")
elif [[ -e "${MODULES_DIR}/${stower_or_module}" ]]; then
MODULES+=("${stower_or_module}")
else
echo "[!] No such stower/module: ${stower_or_module}" >&2
return 1
fi
done
else
for stower in "${STOWERS_DIR}"/*/; do
stower_name="$(basename -- "${stower}")"
STOWERS+=("${stower_name}")
done
fi
for stower in "${STOWERS[@]}"; do
install_stower "${stower}" || true
done
for module in "${MODULES[@]}"; do
install_module "${module}" || true
done
echo "[+] Installed everything!"

View file

@ -1,37 +0,0 @@
#!/bin/bash
set -euo pipefail
get_latest_nerd_font_release() {
basename "$(curl -Ls -o /dev/null -w "%{url_effective}" https://github.com/ryanoasis/nerd-fonts/releases/latest)"
}
install_font() {
if [[ "$#" -lt 1 ]]; then
echo "[!] No font file given to download!" >&2
return 1
fi
local latest_release font_name
font_name="$1"
latest_release="$(get_latest_nerd_font_release)"
tmpdir="$(mktemp -d)"
curl -Lo "${tmpdir}/${font_name}" "https://github.com/ryanoasis/nerd-fonts/releases/download/${latest_release}/${font_name}"
mkdir "${tmpdir}/font_files"
tar -C "${tmpdir}/font_files" -xJf "${tmpdir}/${font_name}"
mkdir -p "${HOME}/.local/share/fonts"
find "${tmpdir}/font_files" -type f \( -iname '*.otf' -o -iname '*.ttf' \) -exec mv {} "${HOME}/.local/share/fonts/" \;
rm -rf "${tmpdir}"
}
for font in "FiraCode.tar.xz" "Hack.tar.xz" "FiraMono.tar.xz"; do
echo "[+] Installing ${font}..."
install_font "${font}"
done
echo "[+] Reloading font cache..."
fc-cache -f

18
stowers.mk Normal file
View file

@ -0,0 +1,18 @@
STOWERS := $(wildcard stowers/*)
STOW_TARGET ?= $(HOME)
.PHONY = stowers/all $(STOWERS)
stowers/all: $(STOWERS)
@echo Installed all
stowers/uninstall/all: $(foreach stower,$(STOWERS),$(patsubst stowers/%,stowers/uninstall/%,$(stower)))
@echo Uninstalled all
stowers/uninstall/%: $(STOW)
@echo Unstowing $*
$(STOW) --delete --dir stowers/ --target $(STOW_TARGET) --dotfiles $*
stowers/%: $(STOW)
@echo Stowing $*
test -d $@ && $(STOW) --stow --dir stowers/ --target $(STOW_TARGET) --dotfiles $*

View file

@ -1,3 +0,0 @@
#!/bin/bash
COMMAND_DEPS=("bash")

View file

@ -1,44 +0,0 @@
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
for rc in ~/.bashrc.d/*; do
if [ -f "$rc" ]; then
. "$rc"
fi
done
fi
unset rc
# Auto start tmux
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ] && [ -z "$SSH_CONNECTION" ]; then
exec tmux
fi
# Aliases
WORKSPACE_DIR="${HOME}/spaces/workspace"
export WORKSPACE_DIR
alias vi="nvim"
alias vim="nvim"
alias cdw="cd -- ${WORKSPACE_DIR}"
function cdp() {
cd -- "$(_cdp_path "$@")"
}

View file

@ -1,3 +0,0 @@
#!/bin/bash
COMMAND_DEPS=("fastfetch")

View file

@ -1,25 +0,0 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"source": "opensuse",
"type": "small"
},
"modules": [
"title",
"separator",
"host",
"uptime",
"shell",
"break",
"cpu",
"gpu",
"memory",
"disk",
"break",
"localip",
{
"type": "publicip",
"url": "http://ip.eyedevelop.org"
}
]
}

View file

@ -1,3 +0,0 @@
if status --is-interactive; and test -f /etc/os-release
fastfetch --logo (grep -Ee '^ID=' /etc/os-release | sed 's,ID="\(.*\)-.*",\1,g') -c ~/.config/fastfetch.json
end

View file

@ -1,5 +0,0 @@
#!/bin/bash
[[ -n "$PS1" ]] && [[ -f /etc/os-release ]] && \
fastfetch --logo "$(grep -Ee '^ID=' /etc/os-release | sed 's,ID="\(.*\)-.*",\1,g')" -c ~/.config/fastfetch.json

View file

@ -1,3 +0,0 @@
#!/bin/bash
COMMAND_DEPS=("fish")

View file

@ -1,16 +0,0 @@
#!/bin/bash
COMMAND_DEPS=("git")
fallback() {
local stower_dir target_dir
stower_dir="$1"
target_dir="$2"
git config --global user.name "Hans Goor"
git config --global user.email "me@eyedevelop.org"
git config --global commit.gpgSign true
git config --global push.autoSetupRemote true
git config --global init.defaultBranch main
git config --global pull.rebase true
}

View file

@ -1,3 +0,0 @@
#!/bin/bash
COMMAND_DEPS=("nvim")

View file

@ -1,3 +0,0 @@
#!/bin/bash
COMMAND_DEPS=("bash")

View file

@ -1,29 +0,0 @@
#!/bin/bash
function _get_projects() {
( cd -- "${WORKSPACE_DIR}" && find . -mindepth 3 -maxdepth 3 -type d | sed 's|^\./||' )
}
function _cdp() {
if command -v fzf &>/dev/null; then
echo "${WORKSPACE_DIR}/$(_get_projects | fzf --query "$*")"
return
fi
readarray -t projects <<< "$(_get_projects)"
local filtered_projects
filtered_projects=()
for project in "${projects[@]}"; do
if [[ "${project}" == "$1"* ]]; then
filtered_projects+=("${project}")
fi
done
select project in "${filtered_projects[@]}"; do
echo "${WORKSPACE_DIR}/${project}"
break
done
}
_cdp "$@"

View file

@ -8,15 +8,15 @@ function _clone() {
local url="$1"
local forge owner repo
if [[ "${url}" =~ ^ssh:\/\/[a-zA-Z0-9_\-]+@([a-zA-Z0-9_.\-]+):[0-9]+/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then
forge="${BASH_REMATCH[1],,}"
owner="${BASH_REMATCH[2],,}"
repo="${BASH_REMATCH[3],,}"
elif [[ "${url}" =~ ^[a-zA-Z0-9_\-]+@([a-zA-Z0-9_.\-]+):([a-zA-Z0-9_\-]+)\/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then
forge="${BASH_REMATCH[1],,}"
owner="${BASH_REMATCH[2],,}"
repo="${BASH_REMATCH[3],,}"
elif [[ "${url}" =~ ^https?:\/\/([a-zA-Z0-9_.\-]+)(:[0-9]+)?\/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then
if [[ "${url}" =~ ^ssh:\/\/([a-zA-Z0-9_\-]+@)?([a-zA-Z0-9_.\-]+)(:[0-9]+)?\/([a-zA-Z0-9_\-\/]+)\/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then
forge="${BASH_REMATCH[2],,}"
owner="${BASH_REMATCH[4],,}"
repo="${BASH_REMATCH[5],,}"
elif [[ "${url}" =~ ^([a-zA-Z0-9_\-]+@)?([a-zA-Z0-9_.\-]+):([a-zA-Z0-9_\-\/]+)\/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then
forge="${BASH_REMATCH[2],,}"
owner="${BASH_REMATCH[3],,}"
repo="${BASH_REMATCH[4],,}"
elif [[ "${url}" =~ ^https?:\/\/([a-zA-Z0-9_.\-]+)(:[0-9]+)?\/([a-zA-Z0-9_\-\/]+)/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then
forge="${BASH_REMATCH[1],,}"
owner="${BASH_REMATCH[3],,}"
repo="${BASH_REMATCH[4],,}"
@ -25,6 +25,7 @@ function _clone() {
return 1
fi
mkdir -p "${WORKSPACE_DIR}/${forge}/${owner}"
git clone "${url}" "${WORKSPACE_DIR}/${forge}/${owner}/${repo}"
}

View file

@ -1,43 +0,0 @@
#!/bin/bash
CONTAINER="docker"
if ! command -v docker &>/dev/null; then
CONTAINER="podman"
fi
if [[ "$#" -lt 1 ]]; then
echo "Usage: $0 <container id>" >&2
exit 1
fi
container_id="$1"; shift
# We expect a devcontainer to run an SSH server on 2222/tcp
# and to have this port exposed. We find the host binding
# to SSH to that container.
if ! ssh_port="$(${CONTAINER} inspect --format '{{ (index (index .NetworkSettings.Ports "2222/tcp") 0).HostPort }}' "${container_id}" 2>/dev/null)"; then
echo "[!] Could not get SSH host port for container '${container_id}'" >&2
exit 1
fi
ignore_hostkey=("-oUserKnownHostsFile=/dev/null" "-oStrictHostKeyChecking=false")
if ! ssh "${ignore_hostkey[@]}" -oPasswordAuthentication=no -p "${ssh_port}" -T dev@localhost 'exit'; then
docker exec -it "${container_id}" /bin/bash -c 'echo "dev:dev" | chpasswd'
echo "[+] Changed password of container user to 'dev'"
if command -v sshpass &>/dev/null; then
sshpass -p"dev" ssh-copy-id -p "${ssh_port}" dev@localhost
elif command -v expect &>/dev/null; then
expect -c "spawn $(which ssh-copy-id) -p ${ssh_port} dev@localhost; interact -o -nobuffer -re .*assword.* return; send \"dev\r\n\"; send -- \"\r\"; expect eof;"
else
echo "[?] Could not find application to automatically copy SSH key."
echo " Please enter the password 'dev' manually below."
ssh-copy-id -p "${ssh_port}" dev@localhost
fi
fi
ssh "${ignore_hostkey[@]}" \
-p "${ssh_port}" \
dev@localhost "$@"

View file

@ -0,0 +1,27 @@
#!/bin/bash
set -euo pipefail
function _get_projects() {
find "${WORKSPACE_DIR?}" -type d -iname ".git" | sed "s|${WORKSPACE_DIR?}/\(.*\)/.git|\1|g"
}
function _pp() {
if command -v fzf &>/dev/null; then
_get_projects | fzf --select-1 --query "$1"
return
fi
select project in $(_get_projects); do
echo "${project}"
done
}
function _pp_comp() {
_init_completion || return
local cur prev words cword
COMPREPLY=( compgen -W "$(_get_projects)" -- "${cur}" )
} && complete -F _pp_comp pp cdp
_pp "$*"

View file

@ -1,110 +0,0 @@
#!/bin/bash
set -euo pipefail
TOOLBX_NAME="toolbx"
LIB_HOME="${HOME}/.local/share/eyedevelop/shell-utils/toolbx"
delete_toolbox() {
podman rm -f "${TOOLBX_NAME}"
}
create_toolbox() {
local image podman_args
image="debian:bookworm"
podman_args=(
"--name=${TOOLBX_NAME}"
"--hostuser=${USER}"
"--env=_REAL_USER=${USER}"
"--userns=keep-id"
"--security-opt=label=disable"
"--network=host"
"--hostname=toolbox"
"--volume=${HOME}:/home/${USER}"
"--user=root"
"--entrypoint=/entrypoint.sh"
)
while [[ "$#" -ge 1 ]]; do
case "$1" in
-i|--image)
image="$2"
shift
shift
;;
-p|--privileged)
podman_args+=("--privileged")
shift
;;
esac
done
podman_args+=("$image")
if podman container exists toolbx; then
echo "[!] Toolbx container already exists. Want to replace?"
echo -n "(Y/n) > "
read -r opt
if [[ "${opt,,}" == "n" ]]; then
echo "[!] Aborting."
return 1
fi
delete_toolbox
fi
podman create "${podman_args[@]}" >/dev/null
podman cp "${LIB_HOME}/container_setup.sh" "${TOOLBX_NAME}":/entrypoint.sh >/dev/null
podman cp "${LIB_HOME}/container_autoshell.sh" "${TOOLBX_NAME}":/autoshell.sh &>/dev/null
podman start "${TOOLBX_NAME}" >/dev/null
echo "[+] Created!"
}
enter_toolbox() {
if ! podman container exists "${TOOLBX_NAME}"; then
create_toolbox
fi
podman exec -it --env=_REAL_USER="${USER}" "${TOOLBX_NAME}" "/autoshell.sh" "${SHELL}"
}
print_usage() {
echo "--- Primitive container-based toolbox utility ---"
echo "Usage: $0 <command> <args>"
echo "Commands:"
echo " enter -- Enter the toolbox."
echo " create [opts] [command...] -- Create a new toolbox."
echo " -i|--image -- The image to use to create the toolbox with."
echo " -p|--privileged -- Whether the toolbox is privileged or not."
echo " delete -- Delete the current toolbox."
}
if [[ "$#" -lt 1 ]]; then
print_usage
exit 1
fi
while [[ "$#" -ge 1 ]]; do
COMMAND="$1"; shift
case "${COMMAND}" in
enter)
enter_toolbox "$@"
;;
create)
create_toolbox "$@"
;;
delete)
delete_toolbox "$@"
;;
*)
enter_toolbox "$@"
;;
esac
done

View file

@ -1,33 +0,0 @@
#!/bin/bash
set -euo pipefail
REAL_SHELL="$1"
install_shell() {
source /etc/os-release
case "${ID}" in
debian)
apt-get -y update && apt-get -y install "$(apt-file update &>/dev/null && apt-file search -lF "${REAL_SHELL}" | head -n1 )"
;;
*)
echo "[!] Unsupported distro: ${NAME}" >&2
return 1
esac
}
start_shell() {
if command -v "${REAL_SHELL}" &>/dev/null; then
exec su -s "${REAL_SHELL}" - "${_REAL_USER}"
else
exec su -s "/bin/bash" - "${_REAL_USER}"
fi
}
if ! command -v "${REAL_SHELL}" &>/dev/null; then
install_shell >/dev/null || true
fi
start_shell "$@"

View file

@ -1,48 +0,0 @@
#!/bin/bash
set -euo pipefail
trap 'exit 0' SIGTERM SIGINT
if [[ "$#" -gt 1 ]] && [[ "$1" == /autoshell.sh ]]; then
exec /autoshell.sh "$@"
fi
install_deps() {
if [[ -f /.pkg-installed ]]; then
return 0
fi
if [[ ! -f /etc/os-release ]]; then
echo "[!] Unsupported container image!" >&2
return 1
fi
source /etc/os-release
case "${ID}" in
debian)
apt-get -y update && apt-get -y install \
sudo iproute2 man bash-completion net-tools git passwd util-linux apt-utils apt-file
;;
*)
echo "[!] Unsupported distro: ${NAME}" >&2
return 1
esac
touch /.pkg-installed
}
create_user() {
echo "${_REAL_USER} ALL=(root) NOPASSWD: ALL" > /etc/sudoers.d/toolbx
}
install_deps
create_user
echo "127.0.1.1 $(hostname -f) $(hostname)" >> /etc/hosts
echo "[!] Done with setup!"
while true; do
sleep 86400
done

View file

@ -1,3 +0,0 @@
#!/bin/bash
COMMAND_DEPS=("ssh")

View file

@ -1,3 +0,0 @@
#!/bin/bash
COMMAND_DEPS=("tmux")

View file

@ -1,21 +0,0 @@
set -g mouse on
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'rose-pine/tmux'
set -g @plugin 'ofirgall/tmux-window-name'
# Plugin config
source $HOME/.tmux/plugin-configs/rose-pine.conf
# General config
source $HOME/.tmux/globals.conf
# Nvim helper
source $HOME/.tmux/nvim.conf
# Keybindings
source $HOME/.tmux/bindings.conf
# Initialise tmux plugin manager.
run $HOME/.tmux/plugins/tpm/tpm

View file

@ -1,2 +0,0 @@
plugins/*
!plugins/tpm

View file

@ -1,17 +0,0 @@
set -g mouse on
# Open new windows with the same directory
unbind c
bind c new-window -c "#{pane_current_path}"
# Binds
unbind '"'
unbind %
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Alt-arrow switching
# bind -n M-Left select-pane -L
# bind -n M-Right select-pane -R
# bind -n M-Up select-pane -U
# bind -n M-Down select-pane -D

View file

@ -1,85 +0,0 @@
tmux:
# The symbols section defines the symbols printed before specific elements
# of Git status displayed in tmux status string.
symbols:
# current branch name.
branch: "⎇ "
# Git SHA1 hash (in 'detached' state).
hashprefix: ":"
# 'ahead count' when local and remote branch diverged.
ahead: ↑·
# 'behind count' when local and remote branch diverged.
behind: ↓·
# count of files in the staging area.
staged: "● "
# count of files in conflicts.
conflict: "✖ "
# count of modified files.
modified: "✚ "
# count of untracked files.
untracked: "… "
# count of stash entries.
stashed: "⚑ "
# count of inserted lines (stats section).
insertions: Σ
# count of deleted lines (stats section).
deletions: Δ
# Shown when the working tree is clean.
clean: ✔
# Styles are tmux format strings used to specify text colors and attributes
# of Git status elements. See the STYLES section of tmux man page.
# https://man7.org/linux/man-pages/man1/tmux.1.html#STYLES.
styles:
# Clear previous style.
clear: "#[none]"
# Special tree state strings such as [rebase], [merge], etc.
state: "#[fg=red,bold]"
# Local branch name
branch: "#[fg=white,bold]"
# Remote branch name
remote: "#[fg=cyan]"
# 'divergence' counts
divergence: "#[fg=yellow]"
# 'staged' count
staged: "#[fg=green,bold]"
# 'conflicts' count
conflict: "#[fg=red,bold]"
# 'modified' count
modified: "#[fg=red,bold]"
# 'untracked' count
untracked: "#[fg=magenta,bold]"
# 'stash' count
stashed: "#[fg=cyan,bold]"
# 'insertions' count
insertions: "#[fg=green]"
# 'deletions' count
deletions: "#[fg=red]"
# 'clean' symbol
clean: "#[fg=green,bold]"
# The layout section defines what components gitmux shows and the order in
# which they appear on tmux status bar.
#
# Allowed components:
# - branch: local branch name. Examples: `⎇ main`, `⎇ :345e7a0` or `[rebase]`
# - remote-branch: remote branch name, for example: `origin/main`.
# - divergence: divergence between local and remote branch, if any. Example: `↓·2↑·1`
# - remote: alias for `remote-branch` followed by `divergence`, for example: `origin/main ↓·2↑·1`
# - flags: symbols representing the working tree state, for example `✚ 1 ⚑ 1 … 2`
# - stats: insertions/deletions (lines), for example`Σ56 Δ21`
# - some string `foo`: any other character of string is directly shown, for example `foo` or `|`
layout: [branch, remote-branch, divergence, " - ", flags]
# Additional configuration options.
options:
# Maximum displayed length for local and remote branch names.
branch_max_len: 0
# Trim left or right end of the branch (`right` or `left`).
branch_trim: right
# Character indicating whether and where a branch was truncated.
ellipsis: …
# Hides the clean flag
hide_clean: false
# Swaps order of behind & ahead upstream counts - "↓·1↑·1" -> "↑·1↓·1"
swap_divergence: false

View file

@ -1,4 +0,0 @@
set -g status-interval 2
set -g default-command "${SHELL}"
set -g update-environment "PATH"
set -g history-limit 10000

View file

@ -1,29 +0,0 @@
# helper to decide whether we are inside (n)vim
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\$+\\/)?g?(view|n?vim?x?)(diff)?$'"
# Correct binding depending on version
if-shell -b '[[ "$(tmux -V)" == tmux\ 2.* ]]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[[ "$(tmux -V)" == tmux\ 3.* ]]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
# Bindings
bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+'
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
bind-key -n 'M-Left' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n 'M-Down' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n 'M-Up' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n 'M-Right' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
bind-key -T copy-mode-vi 'M-h' select-pane -L
bind-key -T copy-mode-vi 'M-j' select-pane -D
bind-key -T copy-mode-vi 'M-k' select-pane -U
bind-key -T copy-mode-vi 'M-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+

View file

@ -1,14 +0,0 @@
# Config for rose-pine theme
set -g @rose_pine_variant 'main'
set -g @rose_pine_host 'off'
set -g @rose_pine_date_time '%H:%M'
set -g @rose_pine_user 'on'
set -g @rose_pine_directory 'off'
set -g @rose_pine_bar_bg_disable 'on'
set -g @rose_pine_only_windows 'off'
set -g @rose_pine_disable_active_window_menu 'on'
set -g @rose_pine_show_current_program 'off'
set -g @rose_pine_show_pane_directory 'off'
set -g @rose_pine_status_left_prepend_section "#(gitmux -cfg ~/.tmux/gitmux.conf '#{pane_current_path}')"

@ -1 +0,0 @@
Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946

View file

@ -1,3 +0,0 @@
#!/bin/bash
COMMAND_DEPS=("bash")

View file

@ -1,3 +0,0 @@
#!/bin/bash
COMMAND_DEPS=("zsh" "starship")

12
tools.mk Normal file
View file

@ -0,0 +1,12 @@
include tools/stow.mk
include tools/nvim.mk
include tools/starship.mk
.PHONY = tools/all tools/download-all tools/clean
tools/clean:
rm -rf $(LOCAL_TOOLS_BIN)/stow $(LOCAL_TOOLS_BIN)/nvim $(LOCAL_TOOLS_BIN)/starship
tools/download-all: $(STOW_DOWNLOAD_LOCATION) $(NVIM_DOWNLOAD_LOCATION) $(STARSHIP_DOWNLOAD_LOCATION)
tools/all: $(LOCAL_TOOLS_BIN)/stow $(LOCAL_TOOLS_BIN)/nvim $(LOCAL_TOOLS_BIN)/starship

18
tools/nvim.mk Normal file
View file

@ -0,0 +1,18 @@
NVIM_DOWNLOAD_LOCATION ?= $(LOCAL_CACHE)/nvim-0.11.2.tar.gz
NVIM_COMPAT ?= 0
NVIM_DOWNLOAD_URL ?= https://github.com/neovim/neovim/releases/download/v0.11.2/nvim-linux-x86_64.tar.gz
ifeq ($(NVIM_COMPAT),1)
NVIM_DOWNLOAD_LOCATION := $(LOCAL_CACHE)/nvim-0.11.2-compat.tar.gz
NVIM_DOWNLOAD_URL := https://github.com/neovim/neovim-releases/releases/download/v0.11.2/nvim-linux-x86_64.tar.gz
endif
$(NVIM_DOWNLOAD_LOCATION): $(LOCAL_CACHE)
@echo Downloading neovim 0.11.2
curl -L -o $@ $(NVIM_DOWNLOAD_URL)
$(LOCAL_TOOLS_BIN)/nvim: $(NVIM_DOWNLOAD_LOCATION) $(LOCAL_TOOLS) $(LOCAL_TOOLS_BIN)
@echo Installing neovim 0.11.2
mkdir -p $(LOCAL_TOOLS)/nvim
tar -C $(LOCAL_TOOLS)/nvim --strip-components=1 -xzf $(NVIM_DOWNLOAD_LOCATION)
cp $(LOCAL_TOOLS)/nvim/bin/nvim $@

12
tools/starship.mk Normal file
View file

@ -0,0 +1,12 @@
STARSHIP_DOWNLOAD_LOCATION ?= $(LOCAL_CACHE)/starship-1.23.0.tar.gz
STARSHIP_DOWNLOAD_URL ?= https://github.com/starship/starship/releases/download/v1.23.0/starship-x86_64-unknown-linux-musl.tar.gz
$(STARSHIP_DOWNLOAD_LOCATION): $(LOCAL_CACHE)
@echo Downloading starship 1.23.0
curl -L -o $@ $(STARSHIP_DOWNLOAD_URL)
$(LOCAL_TOOLS_BIN)/starship: $(STARSHIP_DOWNLOAD_LOCATION) $(LOCAL_TOOLS) $(LOCAL_TOOLS_BIN)
@echo Installing starship 1.23.0
mkdir -p $(LOCAL_TOOLS)/starship
tar -C $(LOCAL_TOOLS)/starship -xzf $(STARSHIP_DOWNLOAD_LOCATION)
cp $(LOCAL_TOOLS)/starship/starship $@

19
tools/stow.mk Normal file
View file

@ -0,0 +1,19 @@
STOW_DOWNLOAD_LOCATION ?= $(LOCAL_CACHE)/stow-2.4.1.tar.gz
STOW_DOWNLOAD_URL ?= http://ftp.gnu.org/gnu/stow/stow-2.4.1.tar.gz
BUILD_STOW ?= 0
$(STOW_DOWNLOAD_LOCATION): $(LOCAL_CACHE)
@echo Downloading Stow 2.4.1
curl -L -o $@ $(STOW_DOWNLOAD_URL)
$(LOCAL_TOOLS_BIN)/stow: $(STOW_DOWNLOAD_LOCATION) $(LOCAL_TOOLS) $(LOCAL_TOOLS_BIN)
ifeq ($(BUILD_STOW),1)
@echo Building Stow 2.4.1 from source
mkdir -p $(LOCAL_TOOLS)/stow
tar -C $(LOCAL_TOOLS)/stow --strip-components=1 -xzf $(STOW_DOWNLOAD_LOCATION)
cd $(LOCAL_TOOLS)/stow && /bin/sh ./configure && make
cp $(LOCAL_TOOLS)/stow/bin/stow $@
else
@echo Using system-installed Stow
ln -s $(STOW) $(LOCAL_TOOLS_BIN)/stow
endif