From b01daaceaa5d5128517f2cdf821373fb58d5b56f Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Thu, 9 Feb 2023 16:26:31 +0000 Subject: [PATCH] Move zsh setup back into separate files for ohmyzsh custom --- home/zshrc | 29 +++++------------------------ ohmyzsh/aliases.zsh | 7 +++++-- ohmyzsh/completions.zsh | 6 ++++-- ohmyzsh/paths.zsh | 3 --- 4 files changed, 14 insertions(+), 31 deletions(-) diff --git a/home/zshrc b/home/zshrc index 99f1669e..6f99e708 100644 --- a/home/zshrc +++ b/home/zshrc @@ -1,3 +1,8 @@ +# Connect to TMUX if not login shell and not already connected +if [[ $- =~ i ]] && [[ -z "$TMUX" ]]; then + tmux new -A -s main +fi + # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this block; everything else may go below. @@ -83,29 +88,5 @@ source $ZSH/oh-my-zsh.sh export EDITOR="nvim" export VISUAL="nvim" -LOCAL_BIN="$HOME/.local/bin" -echo $PATH | grep -i "$LOCAL_BIN" - > /dev/null || export PATH=$PATH:$LOCAL_BIN - -vim () -{ - poetry env info > /dev/null 2>&1 && poetry run nvim $@ || nvim $@ -} - -alias nvimdiff="nvim -d" -alias lg="lazygit" -command -v yadm > /dev/null && { - alias yvi="yadm enter nvim" - alias ylg="yadm enter lazygit" - alias yss="yadm status" -} -[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh" - -autoload -U bashcompinit -bashcompinit -command -v pipx > /dev/null && { - command -v register-python-argcomplete3 > /dev/null && eval "$(register-python-argcomplete3 pipx)" - command -v register-python-argcomplete > /dev/null && eval "$(register-python-argcomplete pipx)" -} - # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh diff --git a/ohmyzsh/aliases.zsh b/ohmyzsh/aliases.zsh index cffdadc6..ae69c3c8 100644 --- a/ohmyzsh/aliases.zsh +++ b/ohmyzsh/aliases.zsh @@ -1,4 +1,7 @@ +vim () +{ + poetry env info > /dev/null 2>&1 && poetry run nvim $@ || nvim $@ +} + alias nvimdiff="nvim -d" -alias pvim="poetry run nvim" alias lg="lazygit" -[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh" diff --git a/ohmyzsh/completions.zsh b/ohmyzsh/completions.zsh index 90151294..21b14a4b 100644 --- a/ohmyzsh/completions.zsh +++ b/ohmyzsh/completions.zsh @@ -1,4 +1,6 @@ autoload -U bashcompinit bashcompinit -command -v register-python-argcomplete3 > /dev/null && eval "$(register-python-argcomplete3 pipx)" -command -v register-python-argcomplete > /dev/null && eval "$(register-python-argcomplete pipx)" +command -v pipx > /dev/null && { + command -v register-python-argcomplete3 > /dev/null && eval "$(register-python-argcomplete3 pipx)" + command -v register-python-argcomplete > /dev/null && eval "$(register-python-argcomplete pipx)" +} diff --git a/ohmyzsh/paths.zsh b/ohmyzsh/paths.zsh index 49ac52f0..1c939330 100644 --- a/ohmyzsh/paths.zsh +++ b/ohmyzsh/paths.zsh @@ -2,6 +2,3 @@ LOCAL_BIN="$HOME/.local/bin" echo $PATH | grep -i "$LOCAL_BIN" - > /dev/null || export PATH=$PATH:$LOCAL_BIN - -DOTFILES_BIN="$(dirname $(dirname $(readlink -f $0)))/bin" -echo $PATH | grep -i "$DOTFILES_BIN" - > /dev/null || export PATH=$PATH:$DOTFILES_BIN