feat(functions,bindings): add smart-execute, fast-cli; refactor qalc and rm
- Add _smart_execute: context-aware Ctrl+Enter that routes to qalc when the buffer ends with '=', or falls through to standard execute otherwise - Refactor qalc_eval → _qalc_eval (private helper, same behavior) - Bind Ctrl+Enter to _smart_execute in all vi modes - Add fast-cli wrapper (fast.com speed test) and fast placeholder with a friendly ANSI redirect message - Add speedtest-fast abbreviation expanding to fast-cli - Enhance _replace_command_token to handle sudo-prefixed commands: places cursor at index 5 (between sudo and the replacement slot) - Improve rm error reporting: colored output, culprit-path listing, and cleaned technical detail for non-missing-file errors - Add SPDX copyright headers to cat, ld, claude-docs, claude-pr functions - Update README: Ctrl+Enter binding, fast-cli/fast functions, speedtest-fast abbr
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# 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
|
||||
_qalc_eval
|
||||
|
||||
# case 'g *'
|
||||
# # EXAMPLE FUTURE EXTENSION
|
||||
# _some_git_helper
|
||||
|
||||
case '*'
|
||||
# Default: execute the command line as-is
|
||||
commandline -f execute
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user