addet fzf
This commit is contained in:
parent
d1ff089733
commit
6a89b6c8e7
3 changed files with 22 additions and 1223 deletions
24
.bashrc
24
.bashrc
|
@ -217,16 +217,35 @@ _cli_qol_() {
|
|||
curl -s https://ohmyposh.dev/install.sh | sudo bash -s -- -d /usr/bin/
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_fzf_(){
|
||||
# ─< Setup fzf >──────────────────────────────────────────────────────────────────────────
|
||||
if [[ ! "$PATH" == */usr/share/doc/fzf/examples* ]]; then
|
||||
export PATH="${PATH:+${PATH}:}/usr/share/doc/fzf/examples"
|
||||
fi
|
||||
|
||||
# ─< Auto-completion >────────────────────────────────────────────────────────────────────
|
||||
[[ $- == *i* ]] && source "/usr/share/doc/fzf/examples/completion.bash" 2> /dev/null
|
||||
|
||||
# ─< Key bindings >───────────────────────────────────────────────────────────────────────
|
||||
source "/usr/share/doc/fzf/examples/key-bindings.bash"
|
||||
source /usr/share/doc/fzf/examples/completion.bash
|
||||
source /usr/share/doc/fzf/examples/key-bindings.bash
|
||||
# ─< Use fzf for completion >─────────────────────────────────────────────────────────────
|
||||
# Use fzf for enhanced completion
|
||||
_fzf_comprun() {
|
||||
local command=$1
|
||||
shift
|
||||
case "$command" in
|
||||
cd) fzf --preview 'tree -C {} | head -200' "$@" ;;
|
||||
export|unset) fzf --preview "eval 'echo \$'{}" "$@" ;;
|
||||
ssh) fzf --preview 'dig {}' "$@" ;;
|
||||
*) fzf --preview 'bat -n --color=always {}' "$@" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Use fzf-completion with TAB
|
||||
bind -x '"\t": fzf-completion'
|
||||
bind -x '"\C-i": fzf-completion'
|
||||
}
|
||||
|
||||
# ─< t stands for trash(-cli) >───────────────────────────────────────────────────────────────
|
||||
|
@ -463,6 +482,7 @@ get_alias() {
|
|||
_defaults_
|
||||
_color_prompt_
|
||||
_cli_qol_
|
||||
_fzf_
|
||||
_cat_
|
||||
_trash
|
||||
_nmap_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue