feat(zsh): idiomatically organise .zprofile .zshenv and .zshrc
This commit is contained in:
@@ -1 +1,5 @@
|
||||
|
||||
path=(
|
||||
"$HOME/.local/bin"
|
||||
"$GOPATH/bin"
|
||||
$path
|
||||
)
|
||||
|
||||
@@ -4,8 +4,8 @@ export XDG_CACHE_HOME="$HOME/.cache"
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
export XDG_STATE_HOME="$HOME/.local/state"
|
||||
|
||||
# ~/.local/bin
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
# deduplicate path
|
||||
typeset -U path
|
||||
|
||||
# editor
|
||||
export EDITOR=nvim
|
||||
@@ -13,14 +13,12 @@ export EDITOR=nvim
|
||||
# go
|
||||
export GOPATH="$XDG_DATA_HOME/go"
|
||||
export GOMODCACHE="$XDG_CACHE_HOME/go/mod"
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
|
||||
# ggman
|
||||
export GGROOT="$HOME/git"
|
||||
|
||||
|
||||
# name
|
||||
export NAME="Matej Janežič"
|
||||
|
||||
# starship nest config into a folder, default is ~/.config/startship.toml
|
||||
# starship nest config into a folder, default is ~/.config/starship.toml
|
||||
export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml"
|
||||
|
||||
24
zsh/.zshrc
24
zsh/.zshrc
@@ -1,15 +1,17 @@
|
||||
# zsh history file
|
||||
export HISTFILE="$XDG_STATE_HOME/zsh/history"
|
||||
export HISTSIZE=100
|
||||
# zsh history file
|
||||
HISTFILE="$XDG_STATE_HOME/zsh/history"
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
|
||||
# gnupg
|
||||
export GPG_TTY=$(tty)
|
||||
|
||||
## pre plugin load
|
||||
# nvm
|
||||
export NVM_COMPLETION=true
|
||||
# zsh autosugestions
|
||||
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline"
|
||||
# zsh autosuggestions
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline"
|
||||
|
||||
# source antidote
|
||||
source $ZDOTDIR/.antidote/antidote.zsh
|
||||
source "$ZDOTDIR/.antidote/antidote.zsh"
|
||||
antidote load
|
||||
|
||||
unsetopt autocd
|
||||
@@ -22,10 +24,10 @@ source "$ZDOTDIR/aliases.zsh"
|
||||
source "$ZDOTDIR/scripts.zsh"
|
||||
|
||||
# completion
|
||||
fpath=($ZDOTDIR/completions $fpath)
|
||||
fpath=("$ZDOTDIR/completions" $fpath)
|
||||
autoload -Uz compinit
|
||||
compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION
|
||||
zstyle ':completion:*' cache-path $XDG_CACHE_HOME/zsh/zcompcache
|
||||
compinit -d "$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION"
|
||||
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache"
|
||||
|
||||
eval "$(starship init zsh)"
|
||||
eval "$(direnv hook zsh)"
|
||||
|
||||
@@ -10,11 +10,11 @@ alias dp="docker ps --format 'table {{.Names}}\t{{.Ports}}'"
|
||||
alias dcp="docker compose ps --format 'table {{.Name}}\t{{.Ports}}'"
|
||||
|
||||
# navigation
|
||||
alias cdgit="cd $GGROOT"
|
||||
alias cdgit='cd $GGROOT'
|
||||
|
||||
# git
|
||||
alias gpo="git push origin"
|
||||
alias gros="git reset origin/$(git_current_branch) --soft"
|
||||
gros() { git reset "origin/$(git_current_branch)" --soft }
|
||||
alias gcan="git commit -v --amend --no-edit"
|
||||
alias glogaa="git log --oneline --graph --all --pretty=format:\"%C(auto)%h %C(blue)(%aL/%cL)%C(auto)%(decorate) %s%Creset\""
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
function tmux_attach {
|
||||
local tmux_running
|
||||
tmux_running=$(pgrep tmux)
|
||||
|
||||
if ! [[ -z ${TMUX} ]]; then
|
||||
if [[ -n ${TMUX} ]]; then
|
||||
echo "already attached; refreshing env"
|
||||
source <(tmux show-environment | sed -n 's/^\(.*\)=\(.*\)$/export \1="\2"/p')
|
||||
return 1
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ -z $tmux_running ]]; then
|
||||
|
||||
Reference in New Issue
Block a user