Skip to content

Commit

Permalink
Update .zshrc
Browse files Browse the repository at this point in the history
Change attributes of .zsh/util/func.zsh
Change attributes of .zsh/util/fzf.zsh
  • Loading branch information
xvzc committed Jun 24, 2024
1 parent 7bf5eba commit 12bd8f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 34 deletions.
File renamed without changes.
32 changes: 0 additions & 32 deletions dot_zsh/fzf.zsh → dot_zsh/util/fzf.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,9 @@ export FZF_DEFAULT_OPTS="--layout=reverse \

export FZF_TMUX_OPTS='-p80%,60%'

# export FZF_CUSTOM_OPTS=( \
# --layout=reverse \
# --inline-info \
# --height 40% \
# --color 'fg:#bbccdd,fg+:#ddeeff,bg:#334455,preview-bg:#223344,border:#778899' \
# )

# Use ~~ as the trigger sequence instead of the default **
export FZF_COMPLETION_TRIGGER='**'

# Options to fzf command
# export ='--border --info=inline'
# export FZF_COMPLETION_OPTS="--layout=reverse \
# --inline-info \
# --height 40% \
# --preview 'bat --style=numbers --color=always --line-range :500 {}' \
# --color 'fg:#bbccdd,fg+:#ddeeff,bg:#334455,preview-bg:#223344,border:#778899' \
# "

# Use fd (https://github.com/sharkdp/fd) instead of the default find
# command for listing path candidates.
# - The first argument to the function ($1) is the base path to start traversal
# - See the source code (completion.{bash,zsh}) for the details.

_fzf_compgen_path() {
fd --hidden --follow --exclude ".git" . "$1"
}
Expand Down Expand Up @@ -104,14 +83,3 @@ function fif() {
--preview "bat --theme='OneHalfDark' --style=numbers --color=always {} | rg --colors 'match:bg:yellow' --ignore-case --pretty --context 10 '$1' || rg --ignore-case --pretty --context 10 '$1' {}"
}

git-commit-show () {
git log --graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" | \
fzf --ansi --no-sort --reverse --tiebreak=index --preview \
'f() { set -- $(echo -- "$@" | grep -o "[a-f0-9]\{7\}"); [ $# -eq 0 ] || git show --color=always $1 ; }; f {}' \
--bind "j:down,k:up,alt-j:preview-down,alt-k:preview-up,ctrl-f:preview-page-down,ctrl-b:preview-page-up,q:abort,ctrl-m:execute:
(grep -o '[a-f0-9]\{7\}' | head -1 |
xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
{}
FZF-EOF" --preview-window=right:60%
}

8 changes: 6 additions & 2 deletions dot_zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ source "$DOT_ZSH/style.zsh"
source "$DOT_ZSH/alias.zsh"
source "$DOT_ZSH/opt.zsh"
source "$DOT_ZSH/keymap.zsh"
source "$DOT_ZSH/func.zsh"
source "$DOT_ZSH/fzf.zsh"

for file in $HOME/.zsh/util/*
do
source "$file"
done

[ -f ~/.profile ] && zsh-defer source "$HOME/.profile"
[ -f ~/.secrets ] && zsh-defer source "$HOME/.secrets"

Expand Down

0 comments on commit 12bd8f4

Please sign in to comment.