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
|
||||
'';
|
||||
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"
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l session_name (basename $selected)
|
||||
set -l tmux_runnning (pgrep tmux)
|
||||
|
||||
if test $ZELLIJ -eq 0
|
||||
zellij pipe --plugin file:/run/current-system/sw/bin/zellij-switch.wasm -- "--session $session_name --cwd $selected --layout default"
|
||||
else
|
||||
zellij attach "$session_name" --create
|
||||
if test -z $TMUX and -z @tmux_running
|
||||
tmux new-session -s $selected_name -c $selected
|
||||
return 0
|
||||
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 */ ''
|
||||
# Require a title argument
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
programs.tmux = {
|
||||
|
|
@ -31,23 +36,31 @@
|
|||
];
|
||||
extraConfig = ''
|
||||
unbind %
|
||||
bind | split-window -h
|
||||
bind "|" split-window -h
|
||||
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 j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
|
||||
|
||||
bind -r H resize-pane -L 5
|
||||
bind -r J resize-pane -D 5
|
||||
bind -r K resize-pane -U 5
|
||||
bind -r L resize-pane -R 5
|
||||
|
||||
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