From ab896c6dd70aa79e106a742bedba75bd1d2f8e49 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sun, 15 Dec 2019 00:25:04 -0700 Subject: [PATCH] develop: init tmux profile --- profiles/develop/default.nix | 1 + profiles/develop/tmux/default.nix | 50 ++++++++++++++++++++++++++ profiles/develop/tmux/tmux.conf | 54 +++++++++++++++++++++++++++++ profiles/develop/tmux/tmuxline.conf | 26 ++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 profiles/develop/tmux/default.nix create mode 100644 profiles/develop/tmux/tmux.conf create mode 100644 profiles/develop/tmux/tmuxline.conf diff --git a/profiles/develop/default.nix b/profiles/develop/default.nix index 7cc089c5..b2e45e27 100644 --- a/profiles/develop/default.nix +++ b/profiles/develop/default.nix @@ -3,6 +3,7 @@ imports = [ ./zsh ./kakoune + ./tmux ]; environment.shellAliases = { diff --git a/profiles/develop/tmux/default.nix b/profiles/develop/tmux/default.nix new file mode 100644 index 00000000..f3792434 --- /dev/null +++ b/profiles/develop/tmux/default.nix @@ -0,0 +1,50 @@ +{ lib, pkgs, ... }: +let + inherit (builtins) + readFile + concatStringsSep + ; + + inherit (lib) + removePrefix + ; + + + pluginConf = plugins: + concatStringsSep "\n\n" + ( + map ( + plugin: let + name = removePrefix "tmuxplugin-" plugin.name; + in + "run-shell ${plugin}/share/tmux-plugins/${name}/${name}.tmux" + ) plugins + ); + + plugins = with pkgs.tmuxPlugins; [ + copycat + open + resurrect + yank + vim-tmux-navigator + ]; +in +{ + programs.tmux = { + enable = true; + aggressiveResize = true; + escapeTime = 10; + historyLimit = 5000; + keyMode = "vi"; + shortcut = "a"; + terminal = "tmux-256color"; + baseIndex = 1; + extraTmuxConf = '' + ${readFile ./tmuxline.conf} + + ${readFile ./tmux.conf} + + ${pluginConf plugins} + ''; + }; +} diff --git a/profiles/develop/tmux/tmux.conf b/profiles/develop/tmux/tmux.conf new file mode 100644 index 00000000..a3df348d --- /dev/null +++ b/profiles/develop/tmux/tmux.conf @@ -0,0 +1,54 @@ +# Enable mouse mode (tmux 2.1 and above) +set -g mouse on + +# autmatic window name +setw -g automatic-rename on + +# Enable focus events +set -g focus-events on + +# truecolor in xterm +set -ga terminal-overrides ",*col*:Tc" + +# Start a non login shell +set -g default-command "${SHELL}" + +# pane movement + +# Grab pane from the target window & joins to current, +bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'" +# does reverse. +bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'" + +# Key binds +bind -n ^_ send-keys 'C-l' +bind-key -r C-h select-window -t :- +bind-key -r C-l select-window -t :+ +bind-key C-a last-window +bind-key | split-window -h +bind-key - split-window -v +bind-key _ split-window -v -p 38 +bind-key \ split-window -h -p 38 +bind-key b break-pane -d +bind-key x kill-pane +bind-key X kill-window +bind-key q confirm-before kill-session +bind-key Q confirm-before kill-server +bind-key , previous-window # < +bind-key . next-window # > +bind-key -r < swap-window -t :- +bind-key -r > swap-window -t :+ +bind-key n command-prompt 'rename-window %%' +bind-key N command-prompt 'rename-session %%' +bind-key Escape copy-mode -u +bind-key Up copy-mode -u +bind-key r source-file ~/.tmux.conf +bind-key R refresh-client +bind-key S set-option status +# Resize panes with alt-jkhl +bind-key -n C-M-j resize-pane -D +bind-key -n C-M-k resize-pane -U +bind-key -n C-M-h resize-pane -L +bind-key -n C-M-l resize-pane -R + +bind -T copy-mode-vi 'v' send-keys -X begin-selection diff --git a/profiles/develop/tmux/tmuxline.conf b/profiles/develop/tmux/tmuxline.conf new file mode 100644 index 00000000..ef273da2 --- /dev/null +++ b/profiles/develop/tmux/tmuxline.conf @@ -0,0 +1,26 @@ +# statusbar configuration +set -g status-justify "left" +set -g status "on" +set -g status-style "none" +set -g message-command-style bg="colour31" +set -g status-left-length "100" +set -g pane-active-border-style fg="colour254" +set -g status-bg "colour234" +set -g message-command-style fg="colour231" +set -g pane-border-style fg="colour240" +set -g message-style bg="colour31" +set -g status-left-style "none" +set -g status-right-style "none" +set -g status-right-length "100" +set -g message-style fg="colour231" +setw -g window-status-style fg="colour250" +setw -g window-status-style "none" +setw -g window-status-activity-style bg="colour234" +setw -g window-status-activity-style "none" +setw -g window-status-activity-style fg="colour250" +setw -g window-status-separator "" +setw -g window-status-style bg="colour234" +set -g status-left "#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold,nounderscore,noitalics]" +set -g status-right "#[fg=colour236,bg=colour234,nobold,nounderscore,noitalics]#[fg=colour247,bg=colour236] %l:%M%p #[fg=colour252,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour235,bg=colour252] #h " +setw -g window-status-format "#[fg=colour244,bg=colour234] #I #[fg=colour250,bg=colour234] #W " +setw -g window-status-current-format "#[fg=colour234,bg=colour31,nobold,nounderscore,noitalics]#[fg=colour117,bg=colour31] #I #[fg=colour231,bg=colour31,bold] #W #[fg=colour31,bg=colour234,nobold,nounderscore,noitalics]"