Add some more options for zsh

This commit is contained in:
2021-04-16 00:06:15 +01:00
parent 17a908604f
commit 3e6f3a1b3e
2 changed files with 25 additions and 1 deletions

View File

@@ -46,6 +46,19 @@ alias \
enp="enpasscli -vault="$HOME/Documents/Enpass/Vaults/Primary" -sort show" \ enp="enpasscli -vault="$HOME/Documents/Enpass/Vaults/Primary" -sort show" \
dgit="git --git-dir ~/.config/dotfiles/.git --work-tree=$HOME" 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 # Git aliases
alias \ alias \
g="git" \ g="git" \

View File

@@ -10,7 +10,15 @@ setopt interactive_comments
# History in cache directory: # History in cache directory:
HISTSIZE=10000000 HISTSIZE=10000000
SAVEHIST=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. # Load aliases and shortcuts if existent.
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" [ -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 '^[[P' delete-char
bindkey '^[[A' history-search-backward
bindkey '^[[B' history-search-forward
setxkbmap gb setxkbmap gb
# Edit line in vim with ctrl-e: # Edit line in vim with ctrl-e: