From 99812fd1c1185d38b822670507ae3521179024d0 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Sun, 1 Sep 2024 04:19:19 +0300 Subject: [PATCH] Tmux : Use p to paste and JK to scroll. --- home/config/tmux/module/Config.nix | 6 ++--- home/config/tmux/module/Copy.nix | 6 ++--- home/config/tmux/module/Scroll.nix | 8 +++---- home/config/tmux/module/Session.nix | 14 +++++------ home/config/tmux/module/Split.nix | 36 ++++++++++++++--------------- home/config/tmux/module/Status.nix | 4 +--- home/config/tmux/module/Window.nix | 20 ++++++++-------- 7 files changed, 40 insertions(+), 54 deletions(-) diff --git a/home/config/tmux/module/Config.nix b/home/config/tmux/module/Config.nix index 0bfdf176..20f30e2d 100644 --- a/home/config/tmux/module/Config.nix +++ b/home/config/tmux/module/Config.nix @@ -1,8 +1,6 @@ -{ ... }: let - mod = "M"; -in { +{ ... }: { text = '' unbind-key C-b - bind -n ${mod}-r source-file ~/.config/tmux/tmux.conf + bind -n M-r source-file ~/.config/tmux/tmux.conf ''; } diff --git a/home/config/tmux/module/Copy.nix b/home/config/tmux/module/Copy.nix index d9ea19ce..5a3902ed 100644 --- a/home/config/tmux/module/Copy.nix +++ b/home/config/tmux/module/Copy.nix @@ -1,13 +1,11 @@ { config, ... }: let - mod = "M"; - fg = config.style.color.bg.dark; selection = config.style.color.selection; in { text = '' setw -g mode-keys vi - bind -n ${mod}-v copy-mode - bind -n ${mod}-V choose-buffer; + bind -n M-v copy-mode + bind -n M-p choose-buffer; bind -T copy-mode-vi v send -X begin-selection bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" diff --git a/home/config/tmux/module/Scroll.nix b/home/config/tmux/module/Scroll.nix index bfc92dc1..7c7f362f 100644 --- a/home/config/tmux/module/Scroll.nix +++ b/home/config/tmux/module/Scroll.nix @@ -1,8 +1,6 @@ -{ ... }: let - mod = "M"; -in { +{ ... }: { text = '' - bind -n ${mod}-p copy-mode -u - bind -n ${mod}-n send-keys Pagedown + bind -n M-K copy-mode -u + bind -n M-J send-keys Pagedown ''; } diff --git a/home/config/tmux/module/Session.nix b/home/config/tmux/module/Session.nix index 86af43de..2174b80b 100644 --- a/home/config/tmux/module/Session.nix +++ b/home/config/tmux/module/Session.nix @@ -1,13 +1,11 @@ -{ ... }: let - mod = "M"; -in { +{ ... }: { text = '' - bind -n ${mod}-z detach-client - bind -n ${mod}-Z detach-client -a + bind -n M-z detach-client + bind -n M-Z detach-client -a - bind -n ${mod}-( switch-client -p - bind -n ${mod}-) switch-client -n - bind -n ${mod}-g choose-session -Z + bind -n M-( switch-client -p + bind -n M-) switch-client -n + bind -n M-g choose-session -Z set -g window-size smallest ''; diff --git a/home/config/tmux/module/Split.nix b/home/config/tmux/module/Split.nix index c6e951f8..0bf1b1b7 100644 --- a/home/config/tmux/module/Split.nix +++ b/home/config/tmux/module/Split.nix @@ -1,6 +1,4 @@ { config, ... }: let - mod = "M"; - accent = config.style.color.accent; bg = config.style.color.bg.regular; # fg = style.color.fg.light; @@ -9,27 +7,27 @@ stepHorizontal = 1; in { text = '' - bind -n ${mod}-\\ split-window -h -c "#{pane_current_path}" - bind -n ${mod}-- split-window -v -c "#{pane_current_path}" - bind -n ${mod}-= select-layout tiled - bind -n ${mod}-_ select-layout even-vertical - bind -n ${mod}-| select-layout even-horizontal - bind -n ${mod}-k resize-pane -U ${toString stepVertical} - bind -n ${mod}-j resize-pane -D ${toString stepVertical} - bind -n ${mod}-h resize-pane -L ${toString stepHorizontal} - bind -n ${mod}-l resize-pane -R ${toString stepHorizontal} - bind -n ${mod}-A swap-pane -U - bind -n ${mod}-D swap-pane -D + bind -n M-\\ split-window -h -c "#{pane_current_path}" + bind -n M-- split-window -v -c "#{pane_current_path}" + bind -n M-= select-layout tiled + bind -n M-_ select-layout even-vertical + bind -n M-| select-layout even-horizontal + bind -n M-k resize-pane -U ${toString stepVertical} + bind -n M-j resize-pane -D ${toString stepVertical} + bind -n M-h resize-pane -L ${toString stepHorizontal} + bind -n M-l resize-pane -R ${toString stepHorizontal} + bind -n M-A swap-pane -U + bind -n M-D swap-pane -D unbind '"' unbind % - bind -n ${mod}-a select-pane -L - bind -n ${mod}-d select-pane -R - bind -n ${mod}-w select-pane -U - bind -n ${mod}-s select-pane -D + bind -n M-a select-pane -L + bind -n M-d select-pane -R + bind -n M-w select-pane -U + bind -n M-s select-pane -D - bind -n ${mod}-c kill-pane - bind -n ${mod}-C kill-pane -a + bind -n M-c kill-pane + bind -n M-C kill-pane -a set -g pane-border-style "fg=#${bg}" set -g pane-active-border-style "fg=#${accent}" diff --git a/home/config/tmux/module/Status.nix b/home/config/tmux/module/Status.nix index 84250f4c..1bd68123 100644 --- a/home/config/tmux/module/Status.nix +++ b/home/config/tmux/module/Status.nix @@ -1,12 +1,10 @@ { config, ... }: let - mod = "M"; - accent = config.style.color.accent; # bg = style.color.bg.dark; fg = config.style.color.fg.light; in { text = '' - bind-key -n ${mod}-f set-option -g status; + bind-key -n M-f set-option -g status; set -g status-left-length 50 set -g status-position bottom set -g status-justify left diff --git a/home/config/tmux/module/Window.nix b/home/config/tmux/module/Window.nix index 3e566f27..f8721c8b 100644 --- a/home/config/tmux/module/Window.nix +++ b/home/config/tmux/module/Window.nix @@ -1,17 +1,15 @@ -{ ... }: let - mod = "M"; -in { +{ ... }: { text = '' - bind -n ${mod}-Escape new-window -c "#{pane_current_path}" - bind -n ${mod}-t new-window -c "#{pane_current_path}" + bind -n M-Escape new-window -c "#{pane_current_path}" + bind -n M-t new-window -c "#{pane_current_path}" - bind -n ${mod}-x kill-window - bind -n ${mod}-X kill-window -a + bind -n M-x kill-window + bind -n M-X kill-window -a - bind -n ${mod}-e next-window - bind -n ${mod}-q previous-window + bind -n M-e next-window + bind -n M-q previous-window - bind -n ${mod}-E swap-window -t +1\; select-window -t +1 - bind -n ${mod}-Q swap-window -t -1\; select-window -t -1 + bind -n M-E swap-window -t +1\; select-window -t +1 + bind -n M-Q swap-window -t -1\; select-window -t -1 ''; }