# Command picker using fzf commands() { local selection cmd selection=$(grep -vE '^[[:space:]]*#|^[[:space:]]*$' ~/.config/commands/linux.txt | fzf --height 50% --layout=reverse --border --prompt='Command: ') if [[ -n "$selection" ]]; then cmd=$(printf '%s\n' "$selection" | sed 's/[[:space:]]*#.*$//') cmd="${cmd%"${cmd##*[![:space:]]}"}" READLINE_LINE="$cmd" READLINE_POINT=${#READLINE_LINE} fi } # Ctrl+G opens the command picker if [[ $- == *i* ]]; then bind -x '"\C-g": commands' fi