Files
fish-config/functions/_smart_execute.fish
T
rootiest e502cff8cb fix(keybinds): guard bindings on required binaries and fix fzf bg-transform
- conf.d/fzf.fish: skip fzf_configure_bindings if fzf is not in PATH
- key_bindings.fish: only bind Ctrl+Alt+= when qalc is installed
- _qalc_eval: return 1 early if qalc is absent so callers can react
- _smart_execute: fall back to normal execute when _qalc_eval returns 1
- integrations/fzf.fish: replace bg-transform with transform (available
  since fzf 0.53; bg-transform requires a newer version and caused
  "unknown action" errors on fzf 0.60 devel)
2026-05-18 20:34:00 -04:00

30 lines
869 B
Fish

# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# Executes different functions based on the command line content
function _smart_execute --description 'Execute different functions based on the command line content'
# Get the current command line buffer
set -l cmd (commandline)
# 1. Handle empty buffer (Standard Enter behavior)
if test -z "$cmd"
commandline -f execute
return
end
# 2. Dispatch based on buffer content
switch "$cmd"
case '*='
# If it ends in =, run qalc; fall back to normal execute if qalc is absent
_qalc_eval; or commandline -f execute
# case 'g *'
# # EXAMPLE FUTURE EXTENSION
# _some_git_helper
case '*'
# Default: execute the command line as-is
commandline -f execute
end
end