Expand Linux command library
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
# Command picker using fzf
|
||||
commands() {
|
||||
local cmd
|
||||
cmd=$(grep -vE '^[[:space:]]*#|^[[:space:]]*$' ~/.config/commands/linux.txt |
|
||||
local selection cmd
|
||||
|
||||
selection=$(grep -vE '^[[:space:]]*#|^[[:space:]]*$' ~/.config/commands/linux.txt |
|
||||
fzf --height 50% --layout=reverse --border --prompt='Command: ')
|
||||
|
||||
if [[ -n "$cmd" ]]; then
|
||||
if [[ -n "$selection" ]]; then
|
||||
cmd=$(printf '%s\n' "$selection" | sed 's/[[:space:]]*#.*$//')
|
||||
cmd="${cmd%"${cmd##*[![:space:]]}"}"
|
||||
|
||||
READLINE_LINE="$cmd"
|
||||
READLINE_POINT=${#READLINE_LINE}
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user