brew install fzf rg git-delta bat
Language diffs
[pager]
diff = delta
log = delta
reflog = delta
show = delta
[interactive]
diffFilter = delta --color-only --features=interactive
[delta]
features = side-by-side line-numbers decorations
syntax-theme = Dracula
plus-style = syntax "#003800"
minus-style = syntax "#3f0001"
[delta "decorations"]
commit-decoration-style = bold yellow box ul
file-style = bold yellow ul
file-decoration-style = none
hunk-header-decoration-style = cyan box ul
[delta "line-numbers"]
line-numbers-left-style = cyan
line-numbers-right-style = cyan
line-numbers-minus-style = 124
line-numbers-plus-style = 28
You need to enable ESC+ in iterm for these to work well.
cd **
kill **
<CTLR-R>
This script will use riggrep along with fzf to unleash awesome filesystem search capabilities. It will open the file in intellij.
ADDR=(${@//--/ })
RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case ${ADDR[1]}"
INITIAL_QUERY="${ADDR[0]:-}"
IFS=: read -ra selected < <(
FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \
fzf --ansi \
--color "hl:-1:underline,hl+:-1:underline:reverse" \
--disabled --query "$INITIAL_QUERY" \
--bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \
--bind "alt-enter:unbind(change,alt-enter)+change-prompt(2. fzf> )+enable-search+clear-query" \
--prompt '1. ripgrep> ' \
--delimiter : \
--preview 'bat --color=always {1} --highlight-line {2}' \
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3'
)
[ -n "${selected[0]}" ] && idea --line "${selected[1]}" "${selected[0]}"
Emacs variant, you can use vim as well.
ADDR=(${@//--/ })
RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case ${ADDR[1]}"
INITIAL_QUERY="${ADDR[0]:-}"
IFS=: read -ra selected < <(
FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \
fzf --ansi \
--color "hl:-1:underline,hl+:-1:underline:reverse" \
--disabled --query "$INITIAL_QUERY" \
--bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \
--bind "alt-enter:unbind(change,alt-enter)+change-prompt(2. fzf> )+enable-search+clear-query" \
--prompt '1. ripgrep> ' \
--delimiter : \
--preview 'bat --color=always {1} --highlight-line {2}' \
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3'
)
[ -n "${selected[0]}" ] && emacsclient --no-wait "+${selected[1]}" "${selected[0]}"
read -ra tokens < <(
kubectl get pods |
fzf --info=inline --layout=reverse --header-lines=1 --border \
--prompt "$(kubectl config current-context | sed 's/-context$//')> " \
--header $'Press CTRL-O to open log in editor\n\n' \
--bind ctrl-/:toggle-preview \
--bind 'ctrl-o:execute:${EDITOR:-vim} <(kubectl logs {1}) > /dev/tty' \
--preview-window up,follow \
--preview 'kubectl logs --follow --tail=100000 {1}' "$@"
)
[ ${#tokens} -gt 1 ] &&
kubectl exec -it "${tokens[0]}" -- bash