AutoYADM commit: 2025-03-28 14:50:17
This commit is contained in:
parent
7826b4a80c
commit
fb7662f40a
5 changed files with 787 additions and 0 deletions
28
.config/fish/functions/fish_bind_count.fish
Normal file
28
.config/fish/functions/fish_bind_count.fish
Normal file
|
@ -0,0 +1,28 @@
|
|||
function fish_bind_count
|
||||
argparse 'h/help' 'z/zero' 'r/read' -- $argv
|
||||
or return 1
|
||||
if test -n "$_flag_help"
|
||||
echo "Helper function to track count modifier with modal key bindings"
|
||||
echo "Usage: $0 [-h] [-z] [DIGITS ...]"
|
||||
return
|
||||
end
|
||||
if test -n "$_flag_zero" || not string match -rq '[1-9]\d*' "$fish_bind_count"
|
||||
set -g fish_bind_count 0
|
||||
end
|
||||
# Iterate over given digits
|
||||
for arg in $argv
|
||||
for digit in (string split '' "$arg")
|
||||
set -g fish_bind_count $(math "$fish_bind_count" \* 10 \+ "$digit")
|
||||
end
|
||||
end
|
||||
if test -n "$_flag_read"
|
||||
set -l count "$fish_bind_count"
|
||||
set -g fish_bind_count 0
|
||||
if test "$count" = 0
|
||||
echo 1
|
||||
return 1
|
||||
else
|
||||
echo "$count"
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue