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_DATA_HOME="$HOME/.local/share"
|
||||||
export XDG_STATE_HOME="$HOME/.local/state"
|
export XDG_STATE_HOME="$HOME/.local/state"
|
||||||
|
|
||||||
# ~/.local/bin
|
# deduplicate path
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
typeset -U path
|
||||||
|
|
||||||
# editor
|
# editor
|
||||||
export EDITOR=nvim
|
export EDITOR=nvim
|
||||||
@@ -13,14 +13,12 @@ export EDITOR=nvim
|
|||||||
# go
|
# go
|
||||||
export GOPATH="$XDG_DATA_HOME/go"
|
export GOPATH="$XDG_DATA_HOME/go"
|
||||||
export GOMODCACHE="$XDG_CACHE_HOME/go/mod"
|
export GOMODCACHE="$XDG_CACHE_HOME/go/mod"
|
||||||
export PATH="$GOPATH/bin:$PATH"
|
|
||||||
|
|
||||||
# ggman
|
# ggman
|
||||||
export GGROOT="$HOME/git"
|
export GGROOT="$HOME/git"
|
||||||
|
|
||||||
|
|
||||||
# name
|
# name
|
||||||
export NAME="Matej Janežič"
|
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"
|
export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml"
|
||||||
|
|||||||
22
zsh/.zshrc
22
zsh/.zshrc
@@ -1,15 +1,17 @@
|
|||||||
# zsh history file
|
# zsh history file
|
||||||
export HISTFILE="$XDG_STATE_HOME/zsh/history"
|
HISTFILE="$XDG_STATE_HOME/zsh/history"
|
||||||
export HISTSIZE=100
|
HISTSIZE=10000
|
||||||
|
SAVEHIST=10000
|
||||||
|
|
||||||
|
# gnupg
|
||||||
|
export GPG_TTY=$(tty)
|
||||||
|
|
||||||
## pre plugin load
|
## pre plugin load
|
||||||
# nvm
|
# zsh autosuggestions
|
||||||
export NVM_COMPLETION=true
|
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline"
|
||||||
# zsh autosugestions
|
|
||||||
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline"
|
|
||||||
|
|
||||||
# source antidote
|
# source antidote
|
||||||
source $ZDOTDIR/.antidote/antidote.zsh
|
source "$ZDOTDIR/.antidote/antidote.zsh"
|
||||||
antidote load
|
antidote load
|
||||||
|
|
||||||
unsetopt autocd
|
unsetopt autocd
|
||||||
@@ -22,10 +24,10 @@ source "$ZDOTDIR/aliases.zsh"
|
|||||||
source "$ZDOTDIR/scripts.zsh"
|
source "$ZDOTDIR/scripts.zsh"
|
||||||
|
|
||||||
# completion
|
# completion
|
||||||
fpath=($ZDOTDIR/completions $fpath)
|
fpath=("$ZDOTDIR/completions" $fpath)
|
||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION
|
compinit -d "$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION"
|
||||||
zstyle ':completion:*' cache-path $XDG_CACHE_HOME/zsh/zcompcache
|
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache"
|
||||||
|
|
||||||
eval "$(starship init zsh)"
|
eval "$(starship init zsh)"
|
||||||
eval "$(direnv hook 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}}'"
|
alias dcp="docker compose ps --format 'table {{.Name}}\t{{.Ports}}'"
|
||||||
|
|
||||||
# navigation
|
# navigation
|
||||||
alias cdgit="cd $GGROOT"
|
alias cdgit='cd $GGROOT'
|
||||||
|
|
||||||
# git
|
# git
|
||||||
alias gpo="git push origin"
|
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 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\""
|
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 {
|
function tmux_attach {
|
||||||
|
local tmux_running
|
||||||
tmux_running=$(pgrep tmux)
|
tmux_running=$(pgrep tmux)
|
||||||
|
|
||||||
if ! [[ -z ${TMUX} ]]; then
|
if [[ -n ${TMUX} ]]; then
|
||||||
echo "already attached; refreshing env"
|
echo "already attached; refreshing env"
|
||||||
source <(tmux show-environment | sed -n 's/^\(.*\)=\(.*\)$/export \1="\2"/p')
|
source <(tmux show-environment | sed -n 's/^\(.*\)=\(.*\)$/export \1="\2"/p')
|
||||||
return 1
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $tmux_running ]]; then
|
if [[ -z $tmux_running ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user