Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Key bindings for windows and panes management #23

Merged
merged 2 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
68 changes: 36 additions & 32 deletions .tmux.conf → .config/tmux/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,55 +13,60 @@ 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
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