improves tmux config
This commit is contained in:
parent
cce43517a9
commit
88e0931762
2 changed files with 29 additions and 10 deletions
|
|
@ -70,18 +70,24 @@
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
sessionizer = /* fish */ ''
|
sessionizer = /* fish */ ''
|
||||||
set -l selected (dev_projects | fzf --prompt "Create/switch to session: ")
|
set -l selected (dev_projects | fzf --prompt "Create/switch to session: " --reverse --header ' Ctrl-d: Kill Session' --bind 'ctrl-d:execute(tmux kill-session -t {2..})++reload(dev_projects)')
|
||||||
if test -z "$selected"
|
if test -z "$selected"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l session_name (basename $selected)
|
set -l session_name (basename $selected)
|
||||||
|
set -l tmux_runnning (pgrep tmux)
|
||||||
|
|
||||||
if test $ZELLIJ -eq 0
|
if test -z $TMUX and -z @tmux_running
|
||||||
zellij pipe --plugin file:/run/current-system/sw/bin/zellij-switch.wasm -- "--session $session_name --cwd $selected --layout default"
|
tmux new-session -s $selected_name -c $selected
|
||||||
else
|
return 0
|
||||||
zellij attach "$session_name" --create
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not tmux has-session -t=$selected_name 2> /dev/null
|
||||||
|
tmux new-session -ds $selected_name -c $selected
|
||||||
|
end
|
||||||
|
|
||||||
|
tmux switch-client -t $selected_name
|
||||||
'';
|
'';
|
||||||
nn = /* fish */ ''
|
nn = /* fish */ ''
|
||||||
# Require a title argument
|
# Require a title argument
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
|
|
@ -31,11 +36,11 @@
|
||||||
];
|
];
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
unbind %
|
unbind %
|
||||||
bind | split-window -h
|
bind "|" split-window -h
|
||||||
unbind '"'
|
unbind '"'
|
||||||
bind - split-window -v
|
bind - split-window -l 30 -v
|
||||||
|
|
||||||
bind r source-file ~/.tmux.conf \; display "Config reloaded!"
|
bind r source-file ~/.config/tmux/tmux.conf \; display "Config reloaded!"
|
||||||
|
|
||||||
bind h select-pane -L
|
bind h select-pane -L
|
||||||
bind j select-pane -D
|
bind j select-pane -D
|
||||||
|
|
@ -48,6 +53,14 @@
|
||||||
bind -r L resize-pane -R 5
|
bind -r L resize-pane -R 5
|
||||||
|
|
||||||
bind ? list-keys -a
|
bind ? list-keys -a
|
||||||
|
|
||||||
|
unbind s
|
||||||
|
bind s display-popup -h 50% -w 50% -E sessionizer
|
||||||
|
|
||||||
|
unbind "+"
|
||||||
|
bind "+" choose-tree -Zw "join-pane -t '%%'"
|
||||||
|
|
||||||
|
set -g mode-keys vi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue