Refactor: Replace users with home
This commit is contained in:
parent
36a22dc58a
commit
aaaf4808f3
65 changed files with 17 additions and 25 deletions
12
dotfiles/zsh/.zshrc
Executable file
12
dotfiles/zsh/.zshrc
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Prefetch paths
|
||||
source "$ZDOTDIR/conf.d/path.zsh"
|
||||
|
||||
for file in $ZDOTDIR/conf.d/*; do
|
||||
if [[ "$file" == *"path.zsh" ]]; then
|
||||
continue
|
||||
fi
|
||||
source "$file"
|
||||
done
|
||||
|
8
dotfiles/zsh/conf.d/alias.zsh
Normal file
8
dotfiles/zsh/conf.d/alias.zsh
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
alias reload="exec zsh"
|
||||
|
||||
if [ -x "$(command -v nix)" ]; then
|
||||
alias nix-develop="nix develop -c $SHELL"
|
||||
fi
|
||||
|
11
dotfiles/zsh/conf.d/color.zsh
Executable file
11
dotfiles/zsh/conf.d/color.zsh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
alias ls='ls --color=auto'
|
||||
alias ll='ls -lah --color=auto'
|
||||
alias grep='grep --color=auto'
|
||||
|
||||
term_name=$(ps -o comm= "$PPID")
|
||||
if [ "$term_name" = "xterm" ] && [ -n "$(command -v "transset")" ]; then
|
||||
transset -a 0.95 > /dev/null
|
||||
fi
|
||||
|
20
dotfiles/zsh/conf.d/completions.zsh
Executable file
20
dotfiles/zsh/conf.d/completions.zsh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
if [ -z "$FZF_TAB_PLUGIN" ]; then
|
||||
if [ ! -d "$HOME/.cache/fzf-tab" ]; then
|
||||
echo "Installing fzf-tab"
|
||||
git clone "https://github.com/Aloxaf/fzf-tab" "$HOME/.cache/fzf-tab"
|
||||
fi
|
||||
FZF_TAB_PLUGIN="$HOME/.cache/fzf-tab/fzf-tab.plugin.zsh"
|
||||
fi
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
|
||||
source "$FZF_TAB_PLUGIN"
|
||||
zstyle ':completion:*:git-checkout:*' sort false
|
||||
|
||||
if [ -n "$TMUX" ]; then
|
||||
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
|
||||
fi
|
||||
|
6
dotfiles/zsh/conf.d/env.zsh
Executable file
6
dotfiles/zsh/conf.d/env.zsh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
if [ -n "$(command -v qt5ct)" ] && [ -z "$DESKTOP_SESSION" ]; then
|
||||
export QT_QPA_PLATFORMTHEME=qt5ct
|
||||
fi
|
||||
|
9
dotfiles/zsh/conf.d/fuck.zsh
Executable file
9
dotfiles/zsh/conf.d/fuck.zsh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
if [ -n "$(command -v thefuck)" ]; then
|
||||
fuck() {
|
||||
eval $(thefuck --alias)
|
||||
fuck
|
||||
}
|
||||
fi
|
||||
|
5
dotfiles/zsh/conf.d/gpg.zsh
Executable file
5
dotfiles/zsh/conf.d/gpg.zsh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
GPG_TTY=$(tty)
|
||||
export GPG_TTY
|
||||
|
6
dotfiles/zsh/conf.d/manpager.zsh
Executable file
6
dotfiles/zsh/conf.d/manpager.zsh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
if [ -n "$(command -v "nvim")" ]; then
|
||||
export MANPAGER='nvim +Man!'
|
||||
fi
|
||||
|
7
dotfiles/zsh/conf.d/nix.zsh
Normal file
7
dotfiles/zsh/conf.d/nix.zsh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Nix specific zsh configuration
|
||||
if [ -x "$(command -v nix)" ]; then
|
||||
source "$NIX_SHELL_PLUGIN"
|
||||
fi
|
||||
|
50
dotfiles/zsh/conf.d/path.zsh
Executable file
50
dotfiles/zsh/conf.d/path.zsh
Executable file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
add_to_path() {
|
||||
if [ -d "$1" ] && [[ "$PATH" != *"$1"* ]]; then
|
||||
PATH="$PATH:$1"
|
||||
fi
|
||||
}
|
||||
|
||||
add_to_path "$HOME/.local/bin"
|
||||
|
||||
if [ -f "/etc/profile.d/nix.sh" ]; then
|
||||
source /etc/profile.d/nix.sh
|
||||
fi
|
||||
|
||||
# Language package mangers
|
||||
if [ -n "$(command -v go)" ]; then
|
||||
export GOPATH="$HOME/.local/share/go"
|
||||
add_to_path "$HOME/.local/share/go/bin"
|
||||
fi
|
||||
|
||||
if [ -n "$(command -v npm)" ]; then
|
||||
if [ -f "$HOME/.npmrc" ]; then
|
||||
if [ -z "$(grep prefix "$HOME/.npmrc")" ]; then
|
||||
npm config set prefix "$HOME/.local/share/npm"
|
||||
fi
|
||||
else
|
||||
npm config set prefix "$HOME/.local/share/npm"
|
||||
fi
|
||||
add_to_path "$HOME/.local/share/npm/bin"
|
||||
fi
|
||||
|
||||
if [ -n "$(command -v cargo)" ]; then
|
||||
export CARGO_HOME="$HOME/.local/share/cargo"
|
||||
add_to_path "$HOME/.local/share/cargo/bin"
|
||||
fi
|
||||
|
||||
if [ -n "$(command -v pip3)" ] && [ -n "$(command -v virtualenv)" ]; then
|
||||
if [ ! -d "$HOME/.local/share/python3-venv" ]; then
|
||||
python3 -m venv "$HOME/.local/share/python3-venv"
|
||||
fi
|
||||
|
||||
if [ "$(grep "executable" "$HOME/.local/share/python3-venv/pyvenv.cfg" | awk '{print $3}')" \
|
||||
!= "$(realpath $(command -v python3))" ]; then
|
||||
python3 -m venv --upgrade "$HOME/.local/share/python3-venv"
|
||||
fi
|
||||
|
||||
export VIRTUAL_ENV_DISABLE_PROMPT=true
|
||||
source "$HOME/.local/share/python3-venv/bin/activate"
|
||||
fi
|
||||
|
29
dotfiles/zsh/conf.d/ps1.zsh
Executable file
29
dotfiles/zsh/conf.d/ps1.zsh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
distro=$(cat /etc/os-release | grep -w 'ID=.*' | sed -e 's/ID=//g' | awk '{print $1}')
|
||||
case "$distro" in
|
||||
"debian") dicon="%F{red}%f" ;;
|
||||
"gentoo") dicon="%F{magenta}%f" ;;
|
||||
"\"opensuse-tumbleweed\"") dicon="%F{green} %f" ;;
|
||||
"nixos") dicon="%F{cyan}%f" ;;
|
||||
*) dicon="%F{yellow}[]%f" ;;
|
||||
esac
|
||||
|
||||
if [ -n "$IN_NIX_SHELL" ]; then
|
||||
if [ -z "$NIX_SHELL_PACKAGES" ]; then
|
||||
nix_shell_ps1=" %F{red}nix-shell%f"
|
||||
else
|
||||
nix_shell_ps1=" %F{red}{ $NIX_SHELL_PACKAGES }%f"
|
||||
fi
|
||||
else
|
||||
nix_shell_ps1=""
|
||||
fi
|
||||
|
||||
setopt prompt_subst
|
||||
autoload -Uz vcs_info
|
||||
precmd () { vcs_info }
|
||||
zstyle ':vcs_info:*' formats ' %F{yellow}(%b)%f'
|
||||
|
||||
NL=$'\n'
|
||||
export PS1='%F{green}%~%f$vcs_info_msg_0_$nix_shell_ps1$NL$dicon > '
|
||||
|
11
dotfiles/zsh/conf.d/ssh.zsh
Executable file
11
dotfiles/zsh/conf.d/ssh.zsh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
if [ -z "$DESKTOP_SESSION" ]; then
|
||||
if [ -z "$(pidof gnome-keyring-daemon)" ] && [ -n "$(command -v gnome-keyring-daemon)" ]; then
|
||||
{ eval $(gnome-keyring-daemon --start); } > /dev/null 2>&1
|
||||
export SSH_AUTH_SOCK
|
||||
else
|
||||
{ eval $(ssh-agent -s); } > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
29
dotfiles/zsh/conf.d/suggestions.zsh
Executable file
29
dotfiles/zsh/conf.d/suggestions.zsh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
export HISTFILE=~/.cache/zsh_history
|
||||
export HISTSIZE=10000
|
||||
export SAVEHIST=$HISTSIZE
|
||||
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt SHARE_HISTORY
|
||||
setopt HIST_IGNORE_SPACE
|
||||
setopt HIST_SAVE_NO_DUPS
|
||||
|
||||
if [ -z "$AUTOSUGGEST_PLUGIN" ]; then
|
||||
import_file="/usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||
else
|
||||
import_file="$AUTOSUGGEST_PLUGIN"
|
||||
fi
|
||||
|
||||
if [ ! -f "$import_file" ]; then
|
||||
if [ ! -d "$HOME/.cache/zsh-autosuggestions" ]; then
|
||||
echo "Installing zsh-autosuggestions..."
|
||||
git clone "https://github.com/zsh-users/zsh-autosuggestions.git" "$HOME/.cache/zsh-autosuggestions"
|
||||
fi
|
||||
import_file="$HOME/.cache/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||
fi
|
||||
|
||||
source "$import_file"
|
||||
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
|
18
dotfiles/zsh/conf.d/syntax.zsh
Executable file
18
dotfiles/zsh/conf.d/syntax.zsh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
if [ -z "$SYNTAX_PLUGIN" ]; then
|
||||
import_file="/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||
else
|
||||
import_file="$SYNTAX_PLUGIN"
|
||||
fi
|
||||
|
||||
if [ ! -f "$import_file" ]; then
|
||||
if [ ! -d "$HOME/.cache/zsh-syntax-highlighting" ]; then
|
||||
echo "Installing zsh-syntax-highlighting..."
|
||||
git clone "https://github.com/zsh-users/zsh-syntax-highlighting.git" "$HOME/.cache/zsh-syntax-highlighting"
|
||||
fi
|
||||
import_file="$HOME/.cache/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||
fi
|
||||
|
||||
source "$import_file"
|
||||
|
9
dotfiles/zsh/conf.d/tmux.zsh
Executable file
9
dotfiles/zsh/conf.d/tmux.zsh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Disabled until I fix my tmux config
|
||||
return
|
||||
|
||||
if [ "$TERM" = "xterm-256color" ] && [ -x "$(command -v tmux)" ]; then
|
||||
tmux new-session
|
||||
fi
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue