tmux: persistent terminals + nvim edit helper M-1
This commit is contained in:
parent
1a193f3699
commit
debc52a179
4 changed files with 33 additions and 28 deletions
|
@ -96,6 +96,5 @@
|
||||||
dinky = mkHost [ ./hosts/dinky ];
|
dinky = mkHost [ ./hosts/dinky ];
|
||||||
nemo = mkHost [ ./hosts/nemo ];
|
nemo = mkHost [ ./hosts/nemo ];
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,12 @@
|
||||||
set _file (fd --type f . "$_root" | sed -e "s#^$_root/##" | fzf --no-sort --layout=reverse)
|
set _file (fd --type f . "$_root" | sed -e "s#^$_root/##" | fzf --no-sort --layout=reverse)
|
||||||
set _file "$_root/$_file"
|
set _file "$_root/$_file"
|
||||||
end
|
end
|
||||||
nvim --server "$XDG_RUNTIME_DIR/nvim-persistent.sock" --remote "$_file" &>/dev/null
|
set _nvim_socket "$XDG_RUNTIME_DIR/nvim-persistent.sock"
|
||||||
or return 1
|
if test -S "$_nvim_socket" && tmux select-window -t nvim 2>/dev/null
|
||||||
# Wezterm: switch tab to nvim
|
nvim --server "$_nvim_socket" --remote "$_file"
|
||||||
printf "\033]1337;SetUserVar=nvim_activate=\007"
|
return 0
|
||||||
|
end
|
||||||
|
tmux new-window -S -n nvim nvim --listen "$_nvim_socket" "$_file"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ in
|
||||||
"System"
|
"System"
|
||||||
"TerminalEmulator"
|
"TerminalEmulator"
|
||||||
];
|
];
|
||||||
exec = ''launch-ghostty --class=com.mitchellh.ghostty-local'';
|
exec = ''launch-ghostty --class=com.mitchellh.ghostty-local -e "tmux new-session -A -s0 -nt1"'';
|
||||||
genericName = "Ghostty (local)";
|
genericName = "Ghostty (local)";
|
||||||
icon = "com.mitchellh.ghostty";
|
icon = "com.mitchellh.ghostty";
|
||||||
name = "Ghostty (local)";
|
name = "Ghostty (local)";
|
||||||
|
@ -141,7 +141,7 @@ in
|
||||||
"System"
|
"System"
|
||||||
"TerminalEmulator"
|
"TerminalEmulator"
|
||||||
];
|
];
|
||||||
exec = ''launch-ghostty --class=com.mitchellh.ghostty-nemo -e "ssh nemo"'';
|
exec = ''launch-ghostty --class=com.mitchellh.ghostty-nemo -e "ssh -t nemo tmux new-session -A -s0 -nt1"'';
|
||||||
genericName = "Ghostty (nemo)";
|
genericName = "Ghostty (nemo)";
|
||||||
icon = "com.mitchellh.ghostty";
|
icon = "com.mitchellh.ghostty";
|
||||||
name = "Ghostty (nemo)";
|
name = "Ghostty (nemo)";
|
||||||
|
|
|
@ -2,42 +2,46 @@
|
||||||
{
|
{
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
baseIndex = 1;
|
baseIndex = 0;
|
||||||
clock24 = true;
|
clock24 = true;
|
||||||
escapeTime = 10;
|
escapeTime = 10;
|
||||||
mouse = true;
|
mouse = true;
|
||||||
shortcut = "o";
|
shortcut = "o";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
set -g allow-passthrough on
|
set -g allow-passthrough on
|
||||||
|
set -g default-terminal "tmux-256color"
|
||||||
set -g display-panes-time 3000
|
set -g display-panes-time 3000
|
||||||
set -g history-limit 10000
|
set -g history-limit 10000
|
||||||
set -g status off
|
set -g status off
|
||||||
|
set -g status-style "italics,reverse"
|
||||||
|
set -g status-left-length 0
|
||||||
|
set -g status-right-length 0
|
||||||
|
set -g status-left '#W #{pane_current_path}'
|
||||||
|
set -g status-right '%F | %R'
|
||||||
|
set -g status off
|
||||||
|
set -g set-titles on
|
||||||
|
set -g set-titles-string "#H - #T"
|
||||||
|
set -g update-environment "SSH_AUTH_SOCK"
|
||||||
|
setenv -g "SSH_AUTH_SOCK" "$XDG_RUNTIME_DIR/ssh-agent"
|
||||||
setw -g alternate-screen on
|
setw -g alternate-screen on
|
||||||
setw -g automatic-rename off
|
setw -g automatic-rename off
|
||||||
bind -n M-1 select-window -t 42
|
setw -g window-status-format ""
|
||||||
bind -n M-2 select-window -t 2
|
setw -g window-status-current-format ""
|
||||||
bind -n M-3 select-window -t 3
|
setw -g window-status-separator ""
|
||||||
bind -n M-4 select-window -t 4
|
bind -n M-1 if-shell 'tmux select-window -t nvim' refresh-client 'new-window -S -n nvim nvim --listen $XDG_RUNTIME_DIR/nvim-persistent.sock'
|
||||||
bind -n M-5 select-window -t 5
|
bind -n M-2 if-shell 'tmux select-window -t t1' refresh-client 'new-window -S -n t1'
|
||||||
bind -n M-6 select-window -t 6
|
bind -n M-3 if-shell 'tmux select-window -t t2' refresh-client 'new-window -S -n t2'
|
||||||
bind -n M-7 select-window -t 7
|
bind -n M-4 if-shell 'tmux select-window -t t3' refresh-client 'new-window -S -n t3'
|
||||||
bind -n M-8 select-window -t 8
|
bind -n M-5 if-shell 'tmux select-window -t t4' refresh-client 'new-window -S -n t4'
|
||||||
bind -n M-9 select-window -t 9
|
bind -n M-6 if-shell 'tmux select-window -t t5' refresh-client 'new-window -S -n t5'
|
||||||
bind -n M-0 select-window -t 10
|
bind -n M-7 if-shell 'tmux select-window -t t6' refresh-client 'new-window -S -n t6'
|
||||||
|
bind -n M-8 if-shell 'tmux select-window -t t7' refresh-client 'new-window -S -n t7'
|
||||||
|
bind -n M-9 if-shell 'tmux select-window -t t8' refresh-client 'new-window -S -n t8'
|
||||||
|
bind -n M-0 if-shell 'tmux select-window -t t9' refresh-client 'new-window -S -n t9'
|
||||||
bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 1 scroll-up
|
bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 1 scroll-up
|
||||||
bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 1 scroll-down
|
bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 1 scroll-down
|
||||||
bind C-s set-option -g status
|
bind C-s set-option -g status
|
||||||
bind K confirm kill-server
|
bind K confirm kill-server
|
||||||
new -s0 -n 1
|
|
||||||
new-window -n 2
|
|
||||||
new-window -n 3
|
|
||||||
new-window -n 4
|
|
||||||
new-window -n 5
|
|
||||||
new-window -n 6
|
|
||||||
new-window -n 7
|
|
||||||
new-window -n 8
|
|
||||||
new-window -n 9
|
|
||||||
new-window -n 0
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue