feat(tmux): improve ta, ts and bindings
This commit is contained in:
parent
28961fe114
commit
1eb008e41e
4 changed files with 9 additions and 11 deletions
|
@ -123,10 +123,8 @@ in
|
||||||
"|" = "split-window -h";
|
"|" = "split-window -h";
|
||||||
"C-l" = "send-keys C-l";
|
"C-l" = "send-keys C-l";
|
||||||
"R" = "source-file $XDG_CONFIG_HOME/tmux/tmux.conf \\; display-message 'Reloaded tmux.conf'";
|
"R" = "source-file $XDG_CONFIG_HOME/tmux/tmux.conf \\; display-message 'Reloaded tmux.conf'";
|
||||||
};
|
"f" = "new-window ts";
|
||||||
root = {
|
"a" = "new-window ta";
|
||||||
"C-f" = "new-window ts";
|
|
||||||
"C-a" = "new-window ta";
|
|
||||||
};
|
};
|
||||||
copy-mode-vi = {
|
copy-mode-vi = {
|
||||||
"v" = "send -X begin-selection";
|
"v" = "send -X begin-selection";
|
||||||
|
|
|
@ -19,7 +19,7 @@ let
|
||||||
|
|
||||||
tmux-sessionizer = pkgs.writeFishApplication {
|
tmux-sessionizer = pkgs.writeFishApplication {
|
||||||
name = "ts";
|
name = "ts";
|
||||||
runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd tmux-switch ];
|
runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd tmux-switch gawk ];
|
||||||
text = readFile ./tmux-sessionizer/script.fish;
|
text = readFile ./tmux-sessionizer/script.fish;
|
||||||
completions = readFile ./tmux-sessionizer/completions.fish;
|
completions = readFile ./tmux-sessionizer/completions.fish;
|
||||||
};
|
};
|
||||||
|
@ -97,7 +97,7 @@ in
|
||||||
if ! fish_is_root_user && test "$TERM_PROGRAM" != 'vscode' && ${insideVariableMissing}
|
if ! fish_is_root_user && test "$TERM_PROGRAM" != 'vscode' && ${insideVariableMissing}
|
||||||
if test -z $tmux_autostarted
|
if test -z $tmux_autostarted
|
||||||
set -x tmux_autostarted true
|
set -x tmux_autostarted true
|
||||||
ts
|
tmux new -A -s home
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set selected (tmux list-sessions -F '#{session_name}' 2>/dev/null | fzf $argv)
|
set selected (tmux list-sessions -F '#{session_name}' 2>/dev/null | fzf --query "$argv")
|
||||||
if not test -n "$selected"
|
if not test -n "$selected"
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
8
modules/programs/tmux/tmux-sessionizer/script.fish
Normal file → Executable file
8
modules/programs/tmux/tmux-sessionizer/script.fish
Normal file → Executable file
|
@ -1,10 +1,10 @@
|
||||||
|
#!/usr/bin/env fish
|
||||||
set pipe (mktemp --dry-run)
|
set pipe (mktemp --dry-run)
|
||||||
mkfifo $pipe
|
mkfifo $pipe
|
||||||
|
|
||||||
fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | tee $pipe >/dev/null &
|
fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec-batch dirname {} | tee $pipe >/dev/null &
|
||||||
fd . ~/ --min-depth 1 --max-depth 3 --type d | tee $pipe >/dev/null &
|
fd . ~/ --min-depth 1 --max-depth 3 --type d --exec-batch realpath {} | tee $pipe >/dev/null &
|
||||||
|
set selected (cat $pipe | awk '!seen[$0]++' | fzf --query "$argv")
|
||||||
set selected (cat $pipe | fzf $argv)
|
|
||||||
rm -f "$pipe"
|
rm -f "$pipe"
|
||||||
|
|
||||||
set selected_name (basename $selected 2>/dev/null | string replace "." "_")
|
set selected_name (basename $selected 2>/dev/null | string replace "." "_")
|
||||||
|
|
Loading…
Reference in a new issue