mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 11:14:08 +00:00
chore(shell): touching the paths again, no regrats
This commit is contained in:
@@ -18,11 +18,7 @@ export XDG_RUNTIME_DIR="$HOME/.local/run"
|
||||
# Paths
|
||||
export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$HOME/.local/go/bin:$XDG_DATA_HOME/cargo/bin:$PATH"
|
||||
|
||||
# shellcheck source=scripts/shared.sh
|
||||
# source "$DOTFILES/scripts/shared.sh"
|
||||
|
||||
source "$DOTFILES/config/exports"
|
||||
source "$DOTFILES/config/alias"
|
||||
x-load-configs
|
||||
|
||||
# shellcheck source=../config/fzf/fzf.bash
|
||||
[ -f "${DOTFILES}/config/fzf/fzf.bash" ] &&
|
||||
|
||||
15
base/zshrc
15
base/zshrc
@@ -14,28 +14,17 @@ export XDG_BIN_HOME="$HOME/.local/bin"
|
||||
export XDG_CACHE_HOME="$HOME/.cache"
|
||||
export XDG_RUNTIME_DIR="$HOME/.local/run"
|
||||
|
||||
export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$HOME/.local/go/bin:$XDG_DATA_HOME/cargo/bin:$PATH"
|
||||
export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$HOME/.local/go/bin:$XDG_DATA_HOME/bob/nvim-bin:$XDG_DATA_HOME/cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||
|
||||
source "$DOTFILES/config/exports"
|
||||
source "$DOTFILES/config/alias"
|
||||
source "$DOTFILES/config/functions"
|
||||
|
||||
source "$DOTFILES/scripts/shared.sh"
|
||||
x-load-configs
|
||||
|
||||
export COMPLETION_WAITING_DOTS=true
|
||||
|
||||
path_append "/opt/homebrew/bin"
|
||||
if type brew &> /dev/null; then
|
||||
eval "$(brew shellenv)"
|
||||
FPATH="$HOMEBREW_PREFIX/share/zsh/site-functions:${FPATH}"
|
||||
fi
|
||||
|
||||
path_append "/usr/local/bin"
|
||||
path_prepend "$XDG_DATA_HOME/cargo/bin"
|
||||
path_prepend "$XDG_BIN_HOME"
|
||||
path_prepend "$HOME/.local/go/bin"
|
||||
path_prepend "$XDG_DATA_HOME/bob/nvim-bin"
|
||||
|
||||
export ZSH_CUSTOM_COMPLETION_PATH="$XDG_CONFIG_HOME/zsh/completion"
|
||||
x-dc "$ZSH_CUSTOM_COMPLETION_PATH"
|
||||
|
||||
|
||||
17
config/alias
17
config/alias
@@ -61,7 +61,6 @@ alias please="sudo "
|
||||
# Color the grep output
|
||||
alias grep='grep --color'
|
||||
|
||||
! x-have eza && alias ls='ls --color=auto'
|
||||
x-have eza && {
|
||||
alias ls='eza -h -s=type --git --icons --group-directories-first'
|
||||
}
|
||||
@@ -148,13 +147,13 @@ alias wget="wget --hsts-file=$XDG_DATA_HOME/wget-hsts"
|
||||
alias svn="svn --config-dir $XDG_CONFIG_HOME/subversion"
|
||||
|
||||
# Alacritty preexec hook to update dynamic title
|
||||
preexec()
|
||||
function preexec()
|
||||
{
|
||||
print -Pn "\e]0;$1%~\a"
|
||||
}
|
||||
|
||||
# Update dotfiles
|
||||
dfu()
|
||||
function dfu()
|
||||
{
|
||||
(
|
||||
cd "$DOTFILES" && git pull --ff-only && ./install -q
|
||||
@@ -162,7 +161,7 @@ dfu()
|
||||
}
|
||||
|
||||
# Weather in Tampere, or other city
|
||||
weather()
|
||||
function weather()
|
||||
{
|
||||
# https://github.com/chubin/wttr.in#usage
|
||||
local city="${1:-Tampere}"
|
||||
@@ -170,19 +169,19 @@ weather()
|
||||
}
|
||||
|
||||
# Docker
|
||||
ssh-docker()
|
||||
function ssh-docker()
|
||||
{
|
||||
docker exec -it "$@" bash
|
||||
}
|
||||
|
||||
# All the dig info
|
||||
digga()
|
||||
function digga()
|
||||
{
|
||||
dig +nocmd "$1" any +multiline +noall +answer
|
||||
}
|
||||
|
||||
# Rector project to php version 8.2 by default.
|
||||
rector()
|
||||
function rector()
|
||||
{
|
||||
local php="${1:-82}"
|
||||
docker run -v "$(pwd)":/project rector/rector:latest process \
|
||||
@@ -192,7 +191,7 @@ rector()
|
||||
}
|
||||
|
||||
# Commit everything
|
||||
commit()
|
||||
function commit()
|
||||
{
|
||||
commitMessage="$*"
|
||||
|
||||
@@ -204,7 +203,7 @@ commit()
|
||||
eval "git commit -a -m '${commitMessage}'"
|
||||
}
|
||||
|
||||
scheduler()
|
||||
function scheduler()
|
||||
{
|
||||
while :; do
|
||||
php artisan schedule:run
|
||||
|
||||
@@ -21,15 +21,14 @@ x-dc "$ANSIBLE_GALAXY_CACHE_DIR"
|
||||
export ANDROID_HOME="$XDG_DATA_HOME/android"
|
||||
|
||||
# bob manages nvim versions
|
||||
x-path-prepend "$XDG_DATA_HOME/bob/nvim-bin"
|
||||
x-have nvim && export EDITOR="nvim"
|
||||
export PATH="$XDG_DATA_HOME/bob/nvim-bin:$PATH"
|
||||
|
||||
export HOMEBREW_NO_ENV_HINTS=true
|
||||
|
||||
# composer, https://getcomposer.org/
|
||||
export COMPOSER_HOME="$XDG_STATE_HOME/composer"
|
||||
export COMPOSER_BIN="$COMPOSER_HOME/vendor/bin"
|
||||
x-path-append "$COMPOSER_BIN"
|
||||
export PATH="$COMPOSER_BIN:$PATH"
|
||||
|
||||
# docker, https://docs.docker.com/engine/reference/commandline/cli/
|
||||
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
|
||||
@@ -55,7 +54,7 @@ export NB_DIR="$XDG_STATE_HOME/nb"
|
||||
# NPM: Add npm packages to path
|
||||
x-have node && {
|
||||
NVM_NODE_BIN_DIR="$(dirname "$(which node)")"
|
||||
x-path-append "$NVM_NODE_BIN_DIR"
|
||||
export PATH="$NVM_NODE_BIN_DIR:$PATH"
|
||||
}
|
||||
|
||||
# op (1Password cli) is present
|
||||
@@ -73,7 +72,7 @@ x-have op && {
|
||||
export WORKON_HOME="$XDG_DATA_HOME/virtualenvs"
|
||||
export PYENV_ROOT="$XDG_STATE_HOME/pyenv"
|
||||
x-have pyenv && {
|
||||
x-path-append "$PYENV_ROOT/shims"
|
||||
export PATH="$PYENV_ROOT/shims:$PATH"
|
||||
eval "$(pyenv init -)"
|
||||
}
|
||||
|
||||
@@ -87,7 +86,7 @@ export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle
|
||||
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle
|
||||
export RBENV_ROOT="$XDG_STATE_HOME/rbenv"
|
||||
x-dc "$RBENV_ROOT"
|
||||
x-have gem && x-path-append "${GEM_HOME}/bin"
|
||||
x-have gem && export PATH="${GEM_HOME}/bin:$PATH"
|
||||
x-have rbenv && {
|
||||
[ "$DOTFILES_CURRENT_SHELL" = "zsh" ] && eval "$(rbenv init - zsh)"
|
||||
[ "$DOTFILES_CURRENT_SHELL" = "bash" ] && eval "$(rbenv init - bash)"
|
||||
@@ -96,7 +95,7 @@ x-have rbenv && {
|
||||
# Rust / cargo
|
||||
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
|
||||
export CARGO_HOME="$XDG_DATA_HOME/cargo"
|
||||
x-path-append "$CARGO_HOME/bin"
|
||||
export PATH="$CARGO_HOME/bin:$PATH"
|
||||
|
||||
# screen
|
||||
export SCREENRC="$XDG_CONFIG_HOME/misc/screenrc"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## LUA
|
||||
have luarocks && $(luarocks path --bin)
|
||||
|
||||
path_prepend "$HOME/.local/go/bin"
|
||||
export PATH="$HOME/.local/go/bin:$PATH"
|
||||
|
||||
alias logrotate='/usr/sbin/logrotate -s $HOME/logs/state'
|
||||
alias nano='nano -wS -$'
|
||||
|
||||
@@ -2,30 +2,35 @@
|
||||
# Load our configuration files
|
||||
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
|
||||
|
||||
# Set verbosity with VERBOSE=1 x-load-configs
|
||||
: "${VERBOSE:0}"
|
||||
|
||||
DOTFILES="$HOME/.dotfiles"
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
CONFIG_PATH="$DOTFILES/config"
|
||||
|
||||
# Load the shell dotfiles, and then some:
|
||||
function x-load-config-fn()
|
||||
{
|
||||
for FILE in $CONFIG_PATH/{exports,alias,functions}; do
|
||||
FILENAME="$FILE"
|
||||
HOST="$(hostname -s)"
|
||||
# global (exports|alias|functions) FILENAME for all hosts
|
||||
# shellcheck source=../config/exports
|
||||
[ -r "$FILENAME" ] && source "$FILENAME"
|
||||
# global secret FILENAME, git ignored
|
||||
# shellcheck source=../config/exports-secret
|
||||
[ -r "$FILENAME-secret" ] && source "$FILENAME-secret"
|
||||
# host specific (exports|alias|functions) FILENAME
|
||||
# shellcheck source=../config/exports
|
||||
[ -r "$FILENAME-$HOST" ] && source "$FILENAME-$HOST"
|
||||
# host specific (exports|alias|functions) FILENAME, git ignored
|
||||
# shellcheck source=../config/exports
|
||||
[ -r "$FILENAME-$HOST-secret" ] && source "$FILENAME-$HOST-secret"
|
||||
done
|
||||
HOST="$(hostname -s)"
|
||||
[ "$VERBOSE" = "1" ] && {
|
||||
echo "x-load-config-fn: VERBOSE=1"
|
||||
echo "x-load-config-fn: HOST: $HOST"
|
||||
}
|
||||
|
||||
x-load-config-fn
|
||||
for FILE in $CONFIG_PATH/{exports,alias,functions}; do
|
||||
FILENAME="$FILE"
|
||||
# global (exports|alias|functions) FILENAME for all hosts
|
||||
# shellcheck source=../config/exports
|
||||
[ -r "$FILENAME" ] && source "$FILENAME" \
|
||||
&& [ "$VERBOSE" = "1" ] && echo "x-load-config-fn: $FILENAME"
|
||||
# global secret FILENAME, git ignored
|
||||
# shellcheck source=../config/exports-secret
|
||||
[ -r "$FILENAME-secret" ] && source "$FILENAME-secret" \
|
||||
&& [ "$VERBOSE" = "1" ] && echo "x-load-config-fn: $FILENAME-secret"
|
||||
# host specific (exports|alias|functions) FILENAME
|
||||
# shellcheck source=../config/exports
|
||||
[ -r "$FILENAME-$HOST" ] && source "$FILENAME-$HOST" \
|
||||
&& [ "$VERBOSE" = "1" ] && echo "x-load-config-fn: $FILENAME-$HOST"
|
||||
# host specific (exports|alias|functions) FILENAME, git ignored
|
||||
# shellcheck source=../config/exports
|
||||
[ -r "$FILENAME-$HOST-secret" ] && source "$FILENAME-$HOST-secret" \
|
||||
&& [ "$VERBOSE" = "1" ] && echo "x-load-config-fn: $FILENAME-$HOST-secret"
|
||||
done
|
||||
|
||||
@@ -6,7 +6,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
msg "Starting to install rust/cargo packages"
|
||||
|
||||
[[ $(x-have "cargo") == "1" ]] && {
|
||||
! x-have cargo && {
|
||||
msg "cargo could not be found. installing cargo with rustup.rs"
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path
|
||||
}
|
||||
@@ -53,8 +53,8 @@ msg_done "Installed cargo packages!"
|
||||
msg_run "Now doing the next steps for cargo packages"
|
||||
|
||||
# use bob to install nvim
|
||||
have bob && {
|
||||
bob use stable && path_append "$XDG_DATA_HOME/bob/nvim-bin"
|
||||
x-have bob && {
|
||||
bob use stable && x-path-append "$XDG_DATA_HOME/bob/nvim-bin"
|
||||
}
|
||||
|
||||
msg_done "All next steps done!"
|
||||
|
||||
@@ -5,7 +5,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
PBB_REQUIRED_TOOLS=(git cheat)
|
||||
for t in ${PBB_REQUIRED_TOOLS[@]}; do
|
||||
[[ $(x-have "$t") == "1" ]] && echo "(!) $t is missing, can't continue..." && exit 1
|
||||
! x-have "$t" && echo "(!) $t is missing, can't continue..." && exit 1
|
||||
done
|
||||
|
||||
PBB_GIT="https://github.com/dylanaraps/pure-bash-bible.git"
|
||||
|
||||
@@ -5,7 +5,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
TLDR_REQUIRED_TOOLS=(git cheat)
|
||||
for t in ${TLDR_REQUIRED_TOOLS[@]}; do
|
||||
[[ $(x-have "$t") == "1" ]] && echo "(!) $t is missing, can't continue..." && exit 1
|
||||
! x-have "$t" && echo "(!) $t is missing, can't continue..." && exit 1
|
||||
done
|
||||
|
||||
TLDR_GIT="https://github.com/tldr-pages/tldr.git"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# shellcheck source="shared.sh"
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
[[ $(x-have "php") == "1" ]] && msg_err "PHP Not Available, cannot install composer" && exit 0
|
||||
! x-have "php" && msg_err "PHP Not Available, cannot install composer" && exit 0
|
||||
|
||||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
|
||||
@@ -6,7 +6,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
msg_run "Installing gh (GitHub Client) extensions"
|
||||
|
||||
[[ $(x-have "gh") == "1" ]] \
|
||||
! x-have "gh" \
|
||||
&& msg_err "gh (GitHub Client) could not be found, please install it first" \
|
||||
&& exit 0
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
msg_run "Installing git-crypt"
|
||||
|
||||
[[ $(x-have "git-crypt") == "1" ]] && {
|
||||
x-have "git-crypt" || {
|
||||
|
||||
REPO_URL="https://github.com/AGWA/git-crypt.git"
|
||||
CHECK_PATH="${XDG_BIN_HOME}/git-crypt"
|
||||
|
||||
@@ -6,7 +6,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
msg_run "Installing go packages"
|
||||
|
||||
[[ $(x-have "go") == "1" ]] && msg "go hasn't been installed yet." && exit 0
|
||||
! x-have "go" && msg "go hasn't been installed yet." && exit 0
|
||||
|
||||
packages=(
|
||||
# A shell parser, formatter, and interpreter with bash support; includes shfmt
|
||||
@@ -44,7 +44,7 @@ done
|
||||
|
||||
msg_run "Installing completions for selected packages"
|
||||
|
||||
have git-profile && {
|
||||
x-have git-profile && {
|
||||
git-profile completion zsh > "$ZSH_CUSTOM_COMPLETION_PATH/_git-profile" \
|
||||
&& msg_ok "Installed completions for git-profile"
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ NEOFETCH_URL="${NEOFETCH_REPO}/archive/refs/tags/${NEOFETCH_VERSION}.tar.gz"
|
||||
NEOFETCH_TEMP="/tmp/neofetch"
|
||||
NEOFETCH_INSTALL_PREFIX="$HOME/.local"
|
||||
|
||||
[[ $(x-have "neofetch") == "1" ]] && {
|
||||
x-have "neofetch" || {
|
||||
LC_ALL=C
|
||||
|
||||
mkdir -p "$NEOFETCH_TEMP" "$NEOFETCH_INSTALL_PREFIX"
|
||||
|
||||
@@ -6,7 +6,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
msg "Starting to install npm packages"
|
||||
|
||||
[[ $(x-have "npm") == "1" ]] && msg_err "npm could not be found." && exit 0
|
||||
! x-have "npm" && msg_err "npm could not be found." && exit 0
|
||||
|
||||
packages=(
|
||||
# This is a tool to check if your files consider your .editorconfig rules.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
set -e
|
||||
|
||||
[[ $(x-have "ntfy") == "0" ]] && msg "ntfy already installed" && exit 0
|
||||
x-have "ntfy" && msg "ntfy already installed" && exit 0
|
||||
|
||||
case $(dfm check arch) in
|
||||
Linux)
|
||||
|
||||
@@ -6,7 +6,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
msg "Starting to install pip packages"
|
||||
|
||||
[[ $(x-have "python3") == "1" ]] && {
|
||||
x-have "python3" || {
|
||||
msg_err "Could not find python3, something really weird is going on." && exit 1
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
[ "$(uname)" != "Darwin" ] && echo "Not a macOS system" && exit 0
|
||||
|
||||
! have xcode-select \
|
||||
! x-have xcode-select \
|
||||
&& msg_err "xcode-select could not be found, skipping" \
|
||||
&& exit 0
|
||||
|
||||
|
||||
@@ -50,21 +50,6 @@ function path_prepend
|
||||
x-path-prepend "$1"
|
||||
}
|
||||
|
||||
# Create directory if it doesn't exist already
|
||||
x-dc()
|
||||
{
|
||||
dir="$1"
|
||||
|
||||
[ $# -eq 0 ] && {
|
||||
echo "Usage: $0 full/path/to/dir/to/create"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
mkdir -p "$dir" && exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Create a new directory and enter it
|
||||
mkd()
|
||||
{
|
||||
@@ -84,31 +69,6 @@ nonascii()
|
||||
LC_ALL=C grep -n '[^[:print:][:space:]]' "${@}"
|
||||
}
|
||||
|
||||
CONFIG_PATH="$DOTFILES/config"
|
||||
|
||||
# Load the shell dotfiles, and then some:
|
||||
function x-load-config-fn()
|
||||
{
|
||||
for FILE in $CONFIG_PATH/{exports,alias,functions}; do
|
||||
FILENAME="$FILE"
|
||||
HOST="$(hostname -s)"
|
||||
# global (exports|alias|functions) FILENAME for all hosts
|
||||
# shellcheck source=../config/exports
|
||||
[ -r "$FILENAME" ] && source "$FILENAME"
|
||||
# global secret FILENAME, git ignored
|
||||
# shellcheck source=../config/exports-secret
|
||||
[ -r "$FILENAME-secret" ] && source "$FILENAME-secret"
|
||||
# host specific (exports|alias|functions) FILENAME
|
||||
# shellcheck source=../config/exports
|
||||
[ -r "$FILENAME-$HOST" ] && source "$FILENAME-$HOST"
|
||||
# host specific (exports|alias|functions) FILENAME, git ignored
|
||||
# shellcheck source=../config/exports
|
||||
[ -r "$FILENAME-$HOST-secret" ] && source "$FILENAME-$HOST-secret"
|
||||
done
|
||||
}
|
||||
|
||||
x-load-config-fn
|
||||
|
||||
source "$DOTFILES/local/bin/msgr"
|
||||
|
||||
# -- Menu builder -- #
|
||||
|
||||
Reference in New Issue
Block a user