Compare commits
No commits in common. "3e8ff2e064dfb8d6f17b51defb78a884492e000a" and "a35d93ae2a6509db3179278615473cc804520715" have entirely different histories.
3e8ff2e064
...
a35d93ae2a
|
@ -45,8 +45,6 @@ in
|
||||||
mv = "mv -i";
|
mv = "mv -i";
|
||||||
cd = "z";
|
cd = "z";
|
||||||
|
|
||||||
f = "fzf --multi --bind \"enter:become($EDITOR {+})\"";
|
|
||||||
|
|
||||||
nixos-switch = nom-system-command "sudo nixos-rebuild switch --flake ~/.dotfiles";
|
nixos-switch = nom-system-command "sudo nixos-rebuild switch --flake ~/.dotfiles";
|
||||||
nixos-boot = nom-system-command "sudo nixos-rebuild boot --flake ~/.dotfiles";
|
nixos-boot = nom-system-command "sudo nixos-rebuild boot --flake ~/.dotfiles";
|
||||||
nixos-update = "pushd ~/.dotfiles && nix flake update && popd";
|
nixos-update = "pushd ~/.dotfiles && nix flake update && popd";
|
||||||
|
|
|
@ -4,13 +4,13 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.my.programs.tmux;
|
cfg = config.my.programs.tmux;
|
||||||
|
|
||||||
fzf1 = pkgs.writeShellApplication {
|
tmux-sessionizer = pkgs.writeShellApplication {
|
||||||
name = "fzf1";
|
name = "ts";
|
||||||
runtimeInputs = with pkgs; [ coreutils fzf ];
|
runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd ];
|
||||||
text = ''
|
text = ''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
options=$(fzf --filter "''$*" < /dev/stdin)
|
options=$(fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | fzf --filter "''$*")
|
||||||
|
|
||||||
if [[ -z $options ]]; then
|
if [[ -z $options ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -24,48 +24,17 @@ let
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$selected"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
tmux-switch = pkgs.writeShellApplication {
|
|
||||||
name = "tmux-switch";
|
|
||||||
runtimeInputs = with pkgs; [ tmux ];
|
|
||||||
text = ''
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
if [[ -z ''${TMUX+x} ]]; then
|
|
||||||
tmux attach -t "$1"
|
|
||||||
else
|
|
||||||
tmux switch-client -t "$1"
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
tmux-sessionizer = pkgs.writeShellApplication {
|
|
||||||
name = "ts";
|
|
||||||
runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd fzf ];
|
|
||||||
text = ''
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
selected=$(fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | ${getExe fzf1} "$*")
|
|
||||||
|
|
||||||
selected_name=$(basename "$selected" | tr . _)
|
selected_name=$(basename "$selected" | tr . _)
|
||||||
|
|
||||||
if ! tmux has-session -t="$selected_name" 2> /dev/null; then
|
if ! tmux has-session -t="$selected_name" 2> /dev/null; then
|
||||||
tmux new-session -ds "$selected_name" -c "$selected"
|
tmux new-session -ds "$selected_name" -c "$selected"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${getExe tmux-switch} "$selected_name"
|
if [[ -z ''${TMUX+x} ]]; then
|
||||||
'';
|
tmux attach -t "$selected_name"
|
||||||
};
|
else
|
||||||
|
tmux switch-client -t "$selected_name"
|
||||||
tmux-attach = pkgs.writeShellApplication {
|
fi
|
||||||
name = "ta";
|
|
||||||
runtimeInputs = with pkgs; [ tmux ];
|
|
||||||
text = ''
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
selected=$(tmux list-sessions -F '#{session_name}' | ${getExe fzf1} "$*")
|
|
||||||
${getExe tmux-switch} "$selected"
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,10 +64,7 @@ in
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
my.shell.abbreviations.t = "tmux";
|
my.shell.abbreviations.t = "tmux";
|
||||||
|
|
||||||
home-manager.users.moritz.home.packages = [
|
home-manager.users.moritz.home.packages = [ tmux-sessionizer ];
|
||||||
tmux-sessionizer
|
|
||||||
tmux-attach
|
|
||||||
];
|
|
||||||
home-manager.users.moritz.programs = {
|
home-manager.users.moritz.programs = {
|
||||||
tmux = {
|
tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -106,6 +72,7 @@ in
|
||||||
customPaneNavigationAndResize = true;
|
customPaneNavigationAndResize = true;
|
||||||
keyMode = "vi";
|
keyMode = "vi";
|
||||||
mouse = true;
|
mouse = true;
|
||||||
|
newSession = true;
|
||||||
prefix = "C-Space";
|
prefix = "C-Space";
|
||||||
sensibleOnTop = false;
|
sensibleOnTop = false;
|
||||||
plugins = with pkgs.tmuxPlugins; [
|
plugins = with pkgs.tmuxPlugins; [
|
||||||
|
|
Loading…
Reference in New Issue