scripts reorganize
This commit is contained in:
8
scripts/fish-functions/bulkpaste.fish
Normal file
8
scripts/fish-functions/bulkpaste.fish
Normal file
@@ -0,0 +1,8 @@
|
||||
case Hyprland
|
||||
hyprctl dispatch 'hl.dsp.focus({ direction = "left" })'
|
||||
for i in (ls | grep "$argv[1]")
|
||||
sleep 0.05
|
||||
copy "$i"
|
||||
sleep 0.05
|
||||
hyprctl dispatch 'hl.dsp.send_shortcut({ mods = "CTRL", key = "v" })'
|
||||
end
|
||||
6
scripts/fish-functions/copy.fish
Normal file
6
scripts/fish-functions/copy.fish
Normal file
@@ -0,0 +1,6 @@
|
||||
switch "$XDG_SESSION_TYPE"
|
||||
case wayland
|
||||
echo "file://$(realpath -- "$argv")" | wl-copy -t text/uri-list
|
||||
case x11
|
||||
echo "file://$(realpath -- "$argv")" | xclip -i -selection clipboard -t text/uri-list
|
||||
end
|
||||
9
scripts/fish-functions/files.fish
Normal file
9
scripts/fish-functions/files.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
if test -z "$argv[1]"
|
||||
set dir '.'
|
||||
else
|
||||
set dir "$argv[1]"
|
||||
end
|
||||
for i in (find "$dir" -maxdepth 1 -type d )
|
||||
set b (find "$i" -type f| wc -l)
|
||||
printf "%d/%s\n" $b (basename "$i")
|
||||
end | sort -nr | column -ts/
|
||||
4
scripts/fish-functions/fmf.fish
Normal file
4
scripts/fish-functions/fmf.fish
Normal file
@@ -0,0 +1,4 @@
|
||||
set dest "$(fzf)"
|
||||
if test $status -eq 0
|
||||
cd "$(realpath (dirname "$dest"))"
|
||||
end
|
||||
3
scripts/fish-functions/histdelete.fish
Normal file
3
scripts/fish-functions/histdelete.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
string match -qr '^(exit|ls$|clear)' -- $argv
|
||||
and history delete --exact --case-sensitive -- (string trim -r $argv)
|
||||
|
||||
1
scripts/fish-functions/move.fish
Normal file
1
scripts/fish-functions/move.fish
Normal file
@@ -0,0 +1 @@
|
||||
rename.sh "$argv"
|
||||
5
scripts/fish-functions/nshell.fish
Normal file
5
scripts/fish-functions/nshell.fish
Normal file
@@ -0,0 +1,5 @@
|
||||
if test -n "$argv"
|
||||
eval "nix-shell --run fish -p" (string join -- " -p " $argv)
|
||||
else
|
||||
nix-shell --run fish
|
||||
end
|
||||
2
scripts/fish-functions/run.fish
Normal file
2
scripts/fish-functions/run.fish
Normal file
@@ -0,0 +1,2 @@
|
||||
echo (cat -- "$argv")
|
||||
fish -c (cat -- "$argv")
|
||||
6
scripts/fish-functions/runl.fish
Normal file
6
scripts/fish-functions/runl.fish
Normal file
@@ -0,0 +1,6 @@
|
||||
if test -n "$argv[2]"
|
||||
echo (cat -- "$argv[1]" | sed -n $argv[2]p)
|
||||
fish -c (cat -- "$argv[1]" | sed -n $argv[2]p)
|
||||
else
|
||||
cat -n -- "$argv[1]"
|
||||
end
|
||||
2
scripts/fish-functions/secret.fish
Normal file
2
scripts/fish-functions/secret.fish
Normal file
@@ -0,0 +1,2 @@
|
||||
tr -dc A-Za-z0-9 </dev/urandom | head -c 32
|
||||
echo
|
||||
1
scripts/fish-functions/show_colour.fish
Normal file
1
scripts/fish-functions/show_colour.fish
Normal file
@@ -0,0 +1 @@
|
||||
perl -e 'foreach $a(@ARGV){print "\e[48:2::".join(":",unpack("C*",pack("H*",$a)))."m \e[49m "};print "\n"' "$argv"
|
||||
6
scripts/fish-functions/sudo.fish
Normal file
6
scripts/fish-functions/sudo.fish
Normal file
@@ -0,0 +1,6 @@
|
||||
if test "$argv" = !!
|
||||
echo sudo $history[1]
|
||||
eval command sudo $history[1]
|
||||
else
|
||||
command sudo $argv
|
||||
end
|
||||
7
scripts/fish-functions/tmux-updater.fish
Normal file
7
scripts/fish-functions/tmux-updater.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
if set -q TMUX
|
||||
set -l name (tmux display -p '#{session_name}')
|
||||
if test -n "$name"; and string match -qr '^[0-9]+' -- $name
|
||||
set num (string match -rim 1 "[0-9]*" -- $name)
|
||||
tmux rename-session "$num: cmd: $argv[1]" 2>/dev/null
|
||||
end
|
||||
end
|
||||
7
scripts/fish-functions/yazi.fish
Normal file
7
scripts/fish-functions/yazi.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
set tempfile (mktemp -t "yazi-cwd.XXX")
|
||||
command yazi $argv --cwd-file=$tempfile
|
||||
|
||||
if read -z cwd < "$tempfile"; and [ "$cwd" != "$PWD" ]; and test -d "$cwd"
|
||||
builtin cd -- "$cwd"
|
||||
end
|
||||
command rm -f -- "$tempfile"
|
||||
Reference in New Issue
Block a user