+/config

my dotfiles and nix configuration

git clone https://git.julia.blue/+/config

Julia RyanFixes704acd2

main
1.8 KiB48 linesraw
1export FZF_DEFAULT_OPTS="--reverse --bind=ctrl-z:ignore \
2  --preview-window=down --height=60% --inline-info \
3  --bind 'ctrl-p:change-preview-window(hidden|down)' \
4  --bind ctrl-r:first --bind alt-up:first --bind alt-down:last \
5  --bind shift-up:preview-page-up --bind shift-down:preview-page-down \
6  --bind ctrl-d:half-page-down --bind ctrl-u:half-page-up \
7  --color=bg+:#313244,spinner:#f5e0dc,header:#f38ba8 \
8  --color=fg:#cdd6f4,fg+:#cdd6f4,info:#cba6f7,pointer:#f5e0dc \
9  --color=marker:#f5e0dc,prompt:#cba6f7,hl:#f38ba8,hl+:#f38ba8 \
10 "
11export FZF_COMPLETION_DIR_COMMANDS="cd pushd rmdir j ji tree"
12
13__fzf() {
14    setopt localoptions pipefail
15    local item
16    fd -H --mount --color=always --type $1 |
17        fzf --multi --height=80% --ansi \
18            --preview "~/.config/zsh/preview.sh {}" \
19            --bind "ctrl-/:reload(fd . / --mount -t$1)" \
20            --bind "ctrl-h:reload(fd . ~ -H --mount -t$1)" \
21            --bind "ctrl-w:reload(fd --mount -t$1)" |
22        while read item; do
23            echo -n "${(q)item} " # https://github.com/mvdan/sh/issues/960
24        done
25    local ret=$? && echo && return $ret
26}
27fzf-file-widget() {
28    LBUFFER="${LBUFFER}$(__fzf f)"
29    local ret=$? && zle reset-prompt && return $ret
30}
31fzf-dir-widget() {
32    LBUFFER="${LBUFFER}$(__fzf d)"
33    local ret=$? && zle reset-prompt && return $ret
34}
35zle -N fzf-file-widget && bindkey '^F' fzf-file-widget
36zle -N fzf-dir-widget && bindkey '^G' fzf-dir-widget
37
38_fzf_compgen_path() { fd -H --mount . "$1"; }
39_fzf_compgen_dir() { fd -H --mount -td . "$1"; }
40_fzf_comprun() {
41    local command=$1 && shift
42    case "$command" in
43    j) fzf --preview "eza --icons {}" "$@" ;;
44    export | unset) fzf --preview "eval 'echo \$'{}" "$@" ;;
45    ssh) fzf --preview 'give-me-a-ping-vasily {}; doggo --color=always {}' "$@" ;;
46    *) fzf "$@" ;;
47    esac
48}