From ac10aec58743647b8f237896621883e8ea9df29a Mon Sep 17 00:00:00 2001 From: Josh Patra <30350506+SoPat712@users.noreply.github.com> Date: Sun, 21 Apr 2024 17:50:08 -0400 Subject: [PATCH] git delta and fzf updates --- git/.gitconfig | 14 ++++++++++++++ zsh/.zshrc | 47 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/git/.gitconfig b/git/.gitconfig index 519ced6..3f9c453 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -6,7 +6,21 @@ tool = nvimdiff [core] editor = nvim + pager = delta [commit] gpgsign = true [tag] gpgSign = true +[interactive] + diffFilter = delta --color-only +[delta] + navigate = true # use n and N to move between diff sections + side-by-side = true + + # delta detects terminal colors automatically; set one of these to disable auto-detection + # dark = true + # light = true +[merge] + conflictstyle = diff3 +[diff] + colorMoved = default diff --git a/zsh/.zshrc b/zsh/.zshrc index 220d5b5..0b5403a 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -124,7 +124,7 @@ alias zshconfig="nvim ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" alias vim=nvim alias cd=z -alias ls=eza +alias ls="eza --color=always --git --no-filesize --icons=always --no-time --no-user --no-permissions" alias ll="eza -alh" alias tree="eza --tree" alias cat=bat @@ -137,13 +137,52 @@ eval "$(zoxide init zsh)" # zsh-autocomplete keybinds bindkey '\t' menu-select "$terminfo[kcbt]" menu-select bindkey -M menuselect '\t' menu-complete "$terminfo[kcbt]" reverse-menu-complete - +# Atuin eval "$(atuin init zsh)" eval "$(atuin init zsh)" +# Eternal Terminal export ET_NO_TELEMETRY=FALSE export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init -)" -eval "$(fzf --zsh)" eval "$(pyenv virtualenv-init -)" -export PATH=$PATH:/Users/joshp/.spicetify + if [[ "$OSTYPE" == "darwin"* ]]; then + export PATH=$PATH:/Users/joshp/.spicetify export DISPLAY=:0 +fi + +eval "$(fzf --zsh)" + +export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git" +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .git" + +_fzf_compgen_path() { + fd --hidden --exclude .git . "$1" +} + +# Use fd to generate the list for directory completion +_fzf_compgen_dir() { + fd --type=d --hidden --exclude .git . "$1" +} + +if [[ "$OSTYPE" == "darwin"* ]]; then + source ~/fzf-git.sh/fzf-git.sh +fi + +export FZF_CTRL_T_OPTS="--preview 'bat -n --color=always --line-range :500 {}'" +export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'" + +# Advanced customization of fzf options via _fzf_comprun function +# - The first argument to the function is the name of the command. +# - You should make sure to pass the rest of the arguments to fzf. +_fzf_comprun() { + local command=$1 + shift + + case "$command" in + cd) fzf --preview 'eza --tree --color=always {} | head -200' "$@" ;; + export|unset) fzf --preview "eval 'echo \$'{}" "$@" ;; + ssh) fzf --preview 'dig {}' "$@" ;; + *) fzf --preview "bat -n --color=always --line-range :500 {}" "$@" ;; + esac +}