Hotfix: split and y/cb functions #7
@@ -1,22 +0,0 @@
|
|||||||
# Copyright (C) 2026 Rootiest
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
|
|
||||||
# Copy to clipboard
|
|
||||||
function cb --description 'Copy to clipboard'
|
|
||||||
if type -q wl-copy
|
|
||||||
if set -q argv[1]
|
|
||||||
echo $argv | wl-copy
|
|
||||||
else
|
|
||||||
wl-copy
|
|
||||||
end
|
|
||||||
else if type -q xclip
|
|
||||||
if set -q argv[1]
|
|
||||||
echo $argv | xclip -selection clipboard
|
|
||||||
else
|
|
||||||
xclip -selection clipboard
|
|
||||||
end
|
|
||||||
else
|
|
||||||
echo "Error: No clipboard provider found." >&2
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
+27
-10
@@ -1,28 +1,45 @@
|
|||||||
# Copyright (C) 2026 Rootiest
|
# Copyright (C) 2026 Rootiest
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
# Run a command in a new Kitty split
|
# Run a command in a new terminal split
|
||||||
function split --description 'Run a command in a new Kitty split'
|
function split --description 'Run a command in a new terminal split'
|
||||||
if test "$TERM" != xterm-kitty
|
set -l is_kitty 0
|
||||||
echo "Error: The 'split' command requires Kitty terminal." >&2
|
set -l is_wezterm 0
|
||||||
|
|
||||||
|
if test "$TERM" = xterm-kitty
|
||||||
|
set is_kitty 1
|
||||||
|
else if test "$TERM_PROGRAM" = WezTerm
|
||||||
|
set is_wezterm 1
|
||||||
|
else
|
||||||
|
echo "Error: The 'split' command requires Kitty or WezTerm terminal." >&2
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l location hsplit
|
set -l kitty_loc hsplit
|
||||||
|
set -l wez_loc --bottom
|
||||||
|
|
||||||
switch $argv[1]
|
switch $argv[1]
|
||||||
case -h --horizontal
|
case -h --horizontal
|
||||||
set location hsplit
|
set kitty_loc hsplit
|
||||||
|
set wez_loc --bottom
|
||||||
set -e argv[1]
|
set -e argv[1]
|
||||||
case -v --vertical
|
case -v --vertical
|
||||||
set location vsplit
|
set kitty_loc vsplit
|
||||||
|
set wez_loc --right
|
||||||
set -e argv[1]
|
set -e argv[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
if test (count $argv) -gt 0
|
if test (count $argv) -gt 0
|
||||||
# Set HIDE_GREETING=1 before fish starts
|
if test $is_kitty -eq 1
|
||||||
kitty @ launch --location=$location --cwd=$PWD env HIDE_GREETING=1 fish -c "$argv; exec fish"
|
kitty @ launch --location=$kitty_loc --cwd=$PWD env HIDE_GREETING=1 fish -c "$argv; exec fish"
|
||||||
|
else if test $is_wezterm -eq 1
|
||||||
|
wezterm cli split-pane $wez_loc --cwd $PWD -- env HIDE_GREETING=1 fish -c "$argv; exec fish" >/dev/null
|
||||||
|
end
|
||||||
else
|
else
|
||||||
kitty @ launch --location=$location --cwd=$PWD env HIDE_GREETING=1 fish -c "exec fish"
|
if test $is_kitty -eq 1
|
||||||
|
kitty @ launch --location=$kitty_loc --cwd=$PWD env HIDE_GREETING=1 fish -c "exec fish"
|
||||||
|
else if test $is_wezterm -eq 1
|
||||||
|
wezterm cli split-pane $wez_loc --cwd $PWD -- env HIDE_GREETING=1 fish -c "exec fish" >/dev/null
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,3 +35,8 @@ function y --description 'Yank to clipboard'
|
|||||||
eval $copy_cmd
|
eval $copy_cmd
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Alias cb=y
|
||||||
|
function cb --wraps='y' --description 'Alias cb=y'
|
||||||
|
y $argv
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user