diff --git a/usr/share/biglinux/bash-config/bashrc b/usr/share/biglinux/bash-config/bashrc index 1ed75e1..a537f70 100644 --- a/usr/share/biglinux/bash-config/bashrc +++ b/usr/share/biglinux/bash-config/bashrc @@ -122,15 +122,6 @@ if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi -# Auto completion Configuration -if ! shopt -oq posix; then - if [ -f /usr/share/bash-completion/bash_completion ]; then - . /usr/share/bash-completion/bash_completion - elif [ -f /etc/bash_completion ]; then - . /etc/bash_completion - fi -fi - # ----- NVM Configuration ----- export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" @@ -140,6 +131,21 @@ export NVM_DIR="$HOME/.nvm" if [ -f /usr/share/fzf/key-bindings.bash ]; then . /usr/share/fzf/completion.bash . /usr/share/fzf/key-bindings.bash + # using ripgrep combined with preview + # find-in-file - usage: fif + fif() { + if [ ! "$#" -gt 0 ]; then echo "Need a string to search for!"; return 1; fi + fzf --preview "highlight -O ansi -l {} 2> /dev/null | rga --ignore-case --pretty --context 10 '$1' {}" < <(rga --files-with-matches --no-messages "$1") + } +else + # Auto completion Configuration + if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi + fi fi # Attach Blesh with oh my posh if available