From 240b9ced293902425b7061a2310d55909993d300 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 18 Mar 2022 10:18:20 -0700 Subject: overhual tmux config --- lib/common.nix | 137 ++++++++++++++++++++++++++++++--------------------------- lib/tmux | 82 ---------------------------------- 2 files changed, 72 insertions(+), 147 deletions(-) delete mode 100644 lib/tmux diff --git a/lib/common.nix b/lib/common.nix index 2c5720e..7059cba 100644 --- a/lib/common.nix +++ b/lib/common.nix @@ -135,75 +135,82 @@ in tmux = { enable = true; - extraConfig = builtins.readFile ./tmux; + aggressiveResize = false; baseIndex = 0; clock24 = true; - customPaneNavigationAndResize = true; + customPaneNavigationAndResize = false; + disableConfirmationPrompt = false; + escapeTime = 0; + historyLimit = 10000; keyMode = "emacs"; - shortcut = "'C-\\'"; - terminal = "xterm-256color"; - sensibleOnTop = true; + newSession = false; + resizeAmount = 5; + reverseSplit = false; secureSocket = false; - plugins = [ - # copied from upstream nixpkgs - (pkgs.tmuxPlugins.mkTmuxPlugin { - pluginName = "extrakto"; - version = "2021-04-06"; - src = pkgs.fetchFromGitHub { - owner = "laktak"; - repo = "extrakto"; - rev = "de8ac3e8a9fa887382649784ed8cae81f5757f77"; - sha256 = "0mkp9r6mipdm7408w7ls1vfn6i3hj19nmir2bvfcp12b69zlzc47"; - }; - nativeBuildInputs = [ pkgs.makeWrapper ]; - postInstall = '' - for f in extrakto.sh open.sh tmux-extrakto.sh; do - wrapProgram $target/scripts/$f \ - --prefix PATH : ${with pkgs; lib.makeBinPath ( - [ - pkgs.fzf - pkgs.python3 - pkgs.xclip - ] - )} - done - ''; - }) - (pkgs.tmuxPlugins.mkTmuxPlugin { - pluginName = "tmux-fzf"; - rtpFilePath = "main.tmux"; - version = "unstable-2020-12-07"; - src = pkgs.fetchFromGitHub { - owner = "sainnhe"; - repo = "tmux-fzf"; - rev = "5efeb91086040a3becf5372fb38258acd0579954"; - sha256 = "1z0zmsf8asxs9wbwvkiyd81h93wb2ikl8nxxc26sdpi6l333q5s9"; - }; - postInstall = '' - find $target -type f -print0 | xargs -0 sed -i -e 's|fzf |${pkgs.fzf}/bin/fzf |g' - find $target -type f -print0 | xargs -0 sed -i -e 's|sed |${pkgs.gnused}/bin/sed |g' - find $target -type f -print0 | xargs -0 sed -i -e 's|tput |${pkgs.ncurses}/bin/tput |g' - ''; - meta = { - homepage = "https://github.com/sainnhe/tmux-fzf"; - description = "Use fzf to manage your tmux work environment! "; - longDescription = - '' - Features: - * Manage sessions (attach, detach*, rename, kill*). - * Manage windows (switch, link, move, swap, rename, kill*). - * Manage panes (switch, break, join*, swap, layout, kill*, resize). - * Multiple selection (support for actions marked by *). - * Search commands and append to command prompt. - * Search key bindings and execute. - * User menu. - * Popup window support. - ''; - license = lib.licenses.mit; - platforms = lib.platforms.unix; - maintainers = with lib.maintainers; [ kyleondy ]; - }; - }) + sensibleOnTop = true; + shell = "${pkgs.bash}/bin/bash"; + shortcut = "a"; + terminal = "xterm-256color"; + tmuxinator.enable = false; + tmuxp.enable = false; + + extraConfig = '' + # Automatically set window title + set-window-option -g automatic-rename on + set-option -g set-titles on + set -g xterm-keys on + setw -g mouse on + ## Panes + # Split panes + bind-key | split-window -h + bind-key - split-window -v + # Send/join panes + bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'" + bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'" + # Use Alt-vim keys without prefix key to switch panes + bind -n M-h select-pane -L + bind -n M-j select-pane -D + bind -n M-k select-pane -U + bind -n M-l select-pane -R + # Use Alt-vim capitalized keys without prefix key to resize panes + bind -n M-H resize-pane -L + bind -n M-J resize-pane -D + bind -n M-K resize-pane -U + bind -n M-L resize-pane -R + # Shift arrow to switch windows + bind -n S-Left previous-window + bind -n S-Right next-window + # Set current window pane to 80 columns + bind-key E resize-pane -x 80 + # cycle pane layout + bind-key N next-layout + bind-key P previous-layout + # Toggle synchronizing panes + bind-key y setw synchronize-panes + ## Text manipulation + # vim-like copy/paste + setw -g mode-keys vi + bind [ copy-mode + bind ] paste-buffer + # copy/paste with xclip + bind-key -Tcopy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i' + # select buffer to paste from + bind Space choose-buffer + # status line text + set -g status-left-length 30 + set -g status-left '#S | #(whoami)@#(hostname) | ' + set -g status-right '~%Y.%m.%d..%H.%M' + # white-ish background with dark-grey text + set -g status-style bg=colour0,fg=colour13 + # highlight current window + set -g window-status-current-style fg=colour0,bg=colour13 + set -g window-status-format '#I) #W ' + set -g window-status-current-format '#I) #W ' + ''; + + plugins = with pkgs.tmuxPlugins; [ + extrakto + tmux-fzf ]; }; diff --git a/lib/tmux b/lib/tmux deleted file mode 100644 index 2753dfb..0000000 --- a/lib/tmux +++ /dev/null @@ -1,82 +0,0 @@ -# vim: filetype=tmux -# -# More settings are in common.nix -# -# Automatically set window title -set-window-option -g automatic-rename on -set-option -g set-titles on - -set -g xterm-keys on - -setw -g mouse on -setw -g monitor-activity on - -## Panes - -# Split panes -bind-key | split-window -h -bind-key - split-window -v - -# Send/join panes -bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'" -bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'" - -# Use Alt-vim keys without prefix key to switch panes -bind -n M-h select-pane -L -bind -n M-j select-pane -D -bind -n M-k select-pane -U -bind -n M-l select-pane -R - -# Use Alt-vim capitalized keys without prefix key to resize panes -bind -n M-H resize-pane -L -bind -n M-J resize-pane -D -bind -n M-K resize-pane -U -bind -n M-L resize-pane -R - -# Shift arrow to switch windows -bind -n S-Left previous-window -bind -n S-Right next-window - -# Set current window pane to 80 columns -bind-key E resize-pane -x 80 - -# cycle pane layout -bind-key N next-layout -bind-key P previous-layout - -# Toggle synchronizing panes -bind-key y setw synchronize-panes - -## Text manipulation - -# vim-like copy/paste -setw -g mode-keys vi - -bind [ copy-mode -bind ] paste-buffer - -# copy/paste with xclip -bind-key -Tcopy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i' - -# select buffer to paste from -bind Space choose-buffer - -## Meta - -# Reload tmux config -bind r source-file ~/.tmux.conf - -# status line text -set -g status-left-length 30 -set -g status-left ' {#(wemux status_users)}@#(hostname) | ' -set -g status-right '~%Y.%m.%d..%H.%M' - -# white-ish background with dark-grey text -set -g status-style bg=colour0,fg=colour13 - -# highlight current window -set -g window-status-current-style fg=colour0,bg=colour13 - -set -g window-status-format '#I) #W ' -set -g window-status-current-format '#I) #W ' - -- cgit v1.2.3