diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 38d6d24..c834c66 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -46,6 +46,19 @@ alias \ enp="enpasscli -vault="$HOME/Documents/Enpass/Vaults/Primary" -sort show" \ dgit="git --git-dir ~/.config/dotfiles/.git --work-tree=$HOME" +# Check if main exists and use instead of master +function git_main_branch() { + command git rev-parse --git-dir &>/dev/null || return + local branch + for branch in main trunk; do + if command git show-ref -q --verify refs/heads/$branch; then + echo $branch + return + fi + done + echo master +} + # Git aliases alias \ g="git" \ diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 0abffb3..d29fda4 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -10,7 +10,15 @@ setopt interactive_comments # History in cache directory: HISTSIZE=10000000 SAVEHIST=10000000 -HISTFILE=~/.cache/zsh/history +HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history" +[ ! -f $HISTFILE ] && mkdir "${XDG_CACHE_HOME:-$HOME/.cache}/zsh"; touch "$HISTFILE" +setopt share_history # Share histories between open sessions +setopt append_history # Append to history file instead of overriding +setopt inc_append_history # Append to history file as you go +setopt hist_ignore_dups # Ignore duplicates directly after each other +setopt hist_find_no_dups # Ignore duplicates when navigating up through history +setopt hist_no_store # Don't store `history` command +setopt hist_ignore_space # Allow using a space to not add the line to the history # Load aliases and shortcuts if existent. [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" @@ -71,6 +79,9 @@ bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n' bindkey '^[[P' delete-char +bindkey '^[[A' history-search-backward +bindkey '^[[B' history-search-forward + setxkbmap gb # Edit line in vim with ctrl-e: