1
0
Fork 0
nixos-config/home-manager/roles/zsh/zshrc
2020-10-14 00:46:51 +02:00

40 lines
1.2 KiB
Bash

if [[ -n "$SSH_CONNECTION" && -z "$TMUX" ]] {
exec mytmux
}
mkdir -p /var/run/user/$UID/tmp/downloads
setopt prompt_subst
autoload -U colors && colors # Enable colors in prompt
alias nix-build-remote="nix-build --builders '@/etc/nix/machines' --max-jobs 0"
alias nixpkgs-review-pr-remote='nixpkgs-review pr --build-args "--builders @/etc/nix/machines --max-jobs 0"'
alias cat=bat
alias accounting='hledger -f ~/git/buchhaltung/buchhaltung.ledger ui -- --watch --theme=terminal -T -E'
alias o=xdg-open
alias sudo='sudo -A'
alias s='sudo -A systemctl'
alias u='systemctl --user'
alias m=man
alias ls='exa -lh --git'
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
zstyle ':chpwd:*' recent-dirs-max 100
if [[ $PWD == "$HOME" ]] {
cd "$(head -n1 ~/.chpwd-recent-dirs | sed s/\\$// | sed s/\'//g)"
}
fzf-history-search() {
LBUFFER=$( history | sed -E 's/ *[0-9]*\*? *//' | fzf +s --tac | sed -E 's/\\/\\\\/g')
zle redisplay
}
zle -N fzf-history-search
bindkey '^R' fzf-history-search
fzf-directory-history-search() {
LBUFFER=$( sed "s/\\$//;s/'//g" ~/.chpwd-recent-dirs | fzf +s | sed -E 's/\\/\\\\/g;s/^/cd /')
zle redisplay
}
zle -N fzf-directory-history-search
bindkey '^T' fzf-directory-history-search