From 2625b2672907eb3d90c374a8939e4f5388de7eca Mon Sep 17 00:00:00 2001 From: mdsanima Date: Fri, 12 Jan 2024 20:29:11 +0100 Subject: [PATCH 1/2] refactor: Moved `.tmux.conf` to `.config/tmux/tmux.conf` Also renamed the `mdsanima.tmux.conf` to `mdsanima.conf` --- .config/tmux/{mdsanima.tmux.conf => mdsanima.conf} | 0 .tmux.conf => .config/tmux/tmux.conf | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .config/tmux/{mdsanima.tmux.conf => mdsanima.conf} (100%) rename .tmux.conf => .config/tmux/tmux.conf (100%) diff --git a/.config/tmux/mdsanima.tmux.conf b/.config/tmux/mdsanima.conf similarity index 100% rename from .config/tmux/mdsanima.tmux.conf rename to .config/tmux/mdsanima.conf diff --git a/.tmux.conf b/.config/tmux/tmux.conf similarity index 100% rename from .tmux.conf rename to .config/tmux/tmux.conf From 3b9db6ae87764d01a6797315f6656d2f0bb8d253 Mon Sep 17 00:00:00 2001 From: mdsanima Date: Sat, 13 Jan 2024 01:40:28 +0100 Subject: [PATCH 2/2] feat: Key bindings for windows and panes management --- .config/tmux/mdsanima.conf | 7 ++-- .config/tmux/tmux.conf | 68 ++++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/.config/tmux/mdsanima.conf b/.config/tmux/mdsanima.conf index 0f30b6e..5406d02 100644 --- a/.config/tmux/mdsanima.conf +++ b/.config/tmux/mdsanima.conf @@ -1,11 +1,12 @@ # Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. # Licensed under the MIT license. -# This is a tmux custom session configuration settings for my Home Labs hosts +# This is a tmux custom session configuration settings for my home labs hosts # like Raspberry Pi, nVidia Jetson Nano, Oracle Cloud, and other providers. -# For launch this configuration, type `tmux source-file mdsanima.tmux.conf` in -# the terminal and then connect to the session, type `tmux attach -t mdsanima`. +# For launch this configuration, type `tmux source-file mdsanima.conf` in the +# terminal and then connect to the session, type `tmux attach -t mdsanima`. +# Or if you are on tmux already just type `tmux source mdsanima.conf` to load. # Uncomment the ssh options if you want to connect for the host. diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index bc714d9..8891071 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -2,8 +2,7 @@ # Licensed under the MIT license. # This is a tmux base global configuration settings for my home lab hosts and -# is simple as possible. Other custom configuration file is located on this -# repository in this `./.config/tmux/mdsanima.tmux.conf` file location. +# is simple as possible. Check out the other custom configuration files. # Set a new prefix key @@ -14,24 +13,28 @@ bind ` send-prefix set -g default-terminal "screen-256color" set-option -sa terminal-overrides ",st-256color:RGB" -# Adding more scroll history in the buffer +# More scroll in the buffer and messages duration to 4s set -g history-limit 100000 +set -g display-time 4000 -# Enable vim moiton support +# Enable vim moiton and full mouse support set -g mode-keys vi - -# Enable full mouse support set -g mouse on -# Window titles get renamed automatically -set -g automatic-rename on - -# Window index numbers get reordered on delete -set -g renumber-windows on - # Windows and panes index start at 1, not 0 set -g base-index 1 set -g pane-base-index 1 +set -g automatic-rename on +set -g renumber-windows on + +# Status bar configuration +set -g status-position top +set -g status-interval 5 +set -g status-left-length 0 +set -g status-right-length 0 + +# Custom host name and clock +set -g status-right "#[fg=colour202]#H #[default]⌚ %H:%M:%S" # Custom color options set -g status-style fg=colour197 @@ -39,30 +42,31 @@ set -g window-status-current-style fg=colour39 set -g pane-border-style fg=colour240 set -g pane-active-border-style fg=colour39 -# Move status bar to the top -set -g status-position top - -# Custom host name and clock on the status bar -set -g status-right "#[fg=colour202]#H #[default]⌚ %H:%M:%S" +# Unbind default prefix +unbind C-b -# Status bar length -set -g status-left-length 0 -set -g status-right-length 0 +# ALT+R => Reload tmux.conf does not reset current config +bind-key -n M-r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded..." -# Unbind default keys for prefix and split panes -unbind C-b -unbind '"' -unbind % +# ALT+J => New window +bind-key -n M-j new-window -# Reload the tmux configuration -bind-key r source-file ~/.tmux.conf +# ALT+H or ALT+L => Select window to the left or the right +bind-key -n M-h select-window -t :- +bind-key -n M-l select-window -t :+ -# Key bindings for split panes vertical and horizontal -bind-key b split-window -v -bind-key v split-window -h +# ALT+B or ALT+V => Split window and set path as the current directory +bind-key -n M-b split-window -v -c "#[pane_current_path]" +bind-key -n M-v split-window -h -c "#[pane_current_path]" -# Key bindings for move around panes with alt + arrow keys -bind-key -n M-Up select-pane -U -bind-key -n M-Down select-pane -D +# ALT+Arrow keys => Switch panes bind-key -n M-Left select-pane -L +bind-key -n M-Down select-pane -D +bind-key -n M-Up select-pane -U bind-key -n M-Right select-pane -R + +# CTRL+Vim style => Switch panes +bind-key -n C-h select-pane -L +bind-key -n C-j select-pane -D +bind-key -n C-k select-pane -U +bind-key -n C-l select-pane -R