fish: rename tmux helper functions

This commit is contained in:
Primrose 2024-11-15 18:51:50 +01:00
parent d29efab025
commit 64d001455a
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
12 changed files with 24 additions and 24 deletions

View file

@ -18,7 +18,7 @@
gP = "git push";
## Editor
ts = "tmux_sessionizer";
ts = "tmux-sessionizer";
v = "nvim";
":q" = "exit";

View file

@ -1,6 +1,6 @@
for mode in default insert
bind --mode $mode \cg tmux_home
bind --mode $mode \cf tmux_sessionizer
bind --mode $mode \cg tmux-home
bind --mode $mode \cf tmux-sessionizer
end
# vi cursor style

View file

@ -1,4 +1,4 @@
function __tmux_attach_or_switch \
function __tmux-attach-or-switch \
--description "Attach (not in tmux) or switch (in tmux) to a session"
### Arguments:
set session_name $argv[1]

View file

@ -1,4 +1,4 @@
function __tmux_maybe_create \
function __tmux-maybe-create \
--description "Create a tmux session with sensible defaults if it doesn't exist yet"
### Arguments:
set session_name $argv[1]

View file

@ -1,4 +1,4 @@
function __tmux_register_session \
function __tmux-register-session \
--description "Register the session, if it's not set yet"
### Effects:
set last /tmp/TMUX_LAST

View file

@ -1,10 +1,10 @@
function tmux_home \
function tmux-home \
--description "Take me back to ~"
set session_name home
if pgrep tmux 2>&1 >/dev/null
__tmux_register_session
__tmux-register-session
end
if pgrep tmux 2>&1 >/dev/null; or ! tmux has -t=$session_name 2>/dev/null
@ -14,6 +14,6 @@ function tmux_home \
select-window -t "home":1
end
__tmux_attach_or_switch $session_name
__tmux-attach-or-switch $session_name
end

View file

@ -1,4 +1,4 @@
function tmux_last \
function tmux-last \
--description "Toggle the last tmux session"
set tmux_last /tmp/TMUX_LAST
@ -9,8 +9,8 @@ function tmux_last \
set session_name (cat $tmux_last)
__tmux_register_session
__tmux_maybe_create $session_name /tmp
__tmux_attach_or_switch $session_name
__tmux-register-session
__tmux-maybe-create $session_name /tmp
__tmux-attach-or-switch $session_name
end

View file

@ -1,4 +1,4 @@
function tmux_sessionizer \
function tmux-sessionizer \
--description "Manage tmux sessions in specific folders with fzf"
set selected \
@ -46,8 +46,8 @@ function tmux_sessionizer \
end
# effects
__tmux_register_session $session_name
__tmux_maybe_create $session_name $selected
__tmux_attach_or_switch $session_name
__tmux-register-session $session_name
__tmux-maybe-create $session_name $selected
__tmux-attach-or-switch $session_name
end

View file

@ -15,7 +15,7 @@
background = "#ffffff";
confirm_os_window_close = 0;
text_composition_strategy = "1.7 0";
shell = ''${pkgs.fish}/bin/fish --command="tmux_home" --login'';
shell = ''${pkgs.fish}/bin/fish --command="tmux-home" --login'';
};
extraConfig = ''
background #f8f8f8

View file

@ -83,9 +83,9 @@ bind [ swap-window -d -t -1
bind ] swap-window -d -t +1
# Prime says the find window is for chumps. Don't use the find window
bind -n C-f run-shell "tmux neww fish -c tmux_sessionizer"
bind -n C-g run-shell "fish -c tmux_home"
bind s run-shell "fish -c tmux_last"
bind -n C-f run-shell "tmux neww fish -c tmux-sessionizer"
bind -n C-g run-shell "fish -c tmux-home"
bind s run-shell "fish -c tmux-last"
# fast kill
bind C-k confirm-before kill-session