feat: add tmux and tmuxp (#1)

Allow terminal multiplexing through [`tmux`][0] and make it configurable using [`tmuxp`][1].

[0]: https://github.com/tmux/tmux
[1]: https://github.com/tmux-python/tmuxp

Co-authored-by: Joao P Dubas <joao.dubas@gmail.com>
Reviewed-on: #1
Co-authored-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
Co-committed-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
This commit is contained in:
João Paulo Dubas 2023-10-15 21:00:49 +00:00 committed by João Paulo Dubas
parent fa879a6772
commit 3293ae8a3e
5 changed files with 147 additions and 3 deletions

View File

@ -59,6 +59,8 @@ RUN apt-get update \
python3-openssl \ python3-openssl \
sudo \ sudo \
tk-dev \ tk-dev \
tmux \
tmuxp \
unixodbc-dev \ unixodbc-dev \
unzip \ unzip \
uuid-dev \ uuid-dev \
@ -130,7 +132,8 @@ ENV SHELL /usr/bin/bash
# command line utilities # command line utilities
RUN curl https://rtx.pub/install.sh | sh \ RUN curl https://rtx.pub/install.sh | sh \
&& curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash && curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash \
&& git clone https://github.com/tmux-plugins/tpm.git ${XDG_CONFIG_HOME}/tmux/plugins/tpm
# git configuration # git configuration
COPY ./patch/kickstart.nvim/updates.patch /tmp COPY ./patch/kickstart.nvim/updates.patch /tmp

99
config/tmux/tmux.conf Normal file
View File

@ -0,0 +1,99 @@
# Based on:
# https://github.com/henrik/dotfiles/blob/master/tmux.conf
# Remap Prefix to C-a
unbind C-b
set -g prefix C-a
# Improve pane split
bind | split-window -h
bind - split-window -v
# Improve pane move
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Improve window move
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Improve resize pane
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Enable vim keys
set-window-option -g mode-keys vi
# Make [shift]-arrows, [ctrl]-arrows, etc work in vim
set -g xterm-keys on
# Attempt to fixes slows [esc] issues
set -s escape-time 0
# Disable mouse
# set -g mode-mouse off
# Status bar styling and content
set -g status-bg black
set -g status-fg white
# set -g status-left "#$"
# Highlight the active window in the status bar
set-window-option -g window-status-current-bg yellow
set-window-option -g window-status-current-fg black
# Don't prompt to kill panes/windows
bind-key x kill-pane
bind-key & kill-window
# Reload tmux conf
unbind r
bind r source-file ~/.tmux.conf\; display "Reloaded conf."
# Full color for vim
set -g default-terminal "screen-256color"
#### COLOUR (Solarized 256)
# default statusbar colors
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# default window title colors
set-window-option -g window-status-fg colour244 #base0
set-window-option -g window-status-bg default
#set-window-option -g window-status-attr dim
# active window title colors
set-window-option -g window-status-current-fg colour166 #orange
set-window-option -g window-status-current-bg default
#set-window-option -g window-status-current-attr bright
# pane border
set-option -g pane-border-fg colour235 #base02
set-option -g pane-active-border-fg colour240 #base01
# message text
set-option -g message-bg colour235 #base02
set-option -g message-fg colour166 #orange
# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange
# clock
set-window-option -g clock-mode-colour colour64 #green
# buffer size
set -g history-limit 50000
# list plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'Morantron/tmux-fingers'
set -g @plugin 'tmux-plugins/tmux-yank'
run '~/.config/tmux/plugins/tpm/tpm'

23
config/tmuxp/dev.yml Normal file
View File

@ -0,0 +1,23 @@
---
session_name: dev
start_directory: /opt/work
windows:
- window_name: main
layout: even-vertical
focus: true
panes:
- focus: true
- pane
- window_name: support
layout: even-vertical
start_directory: support
panes:
- shell_command:
- docker compose exec pgcli bash
- pane
- window_name: local
layout: even-vertical
start_directory: local
panes:
- pane
- pane

15
config/tmuxp/work.yml Normal file
View File

@ -0,0 +1,15 @@
session_name: personal
start_directory: /opt/personal
windows:
- window_name: labs
focus: true
layout: even-vertical
start_directory: labs/
panes:
- focus: true
- pane
- window_name: ide
layout: even-vertical
panes:
- focus: true
- pane

View File

@ -9,11 +9,15 @@ services:
entrypoint: sleep entrypoint: sleep
command: infinity command: infinity
volumes: volumes:
- './config/rtx:/home/coder/.config/rtx'
- './config/tmux:/home/coder/.config/tmux'
- './config/tmuxp:/home/coder/.config/tmuxp'
- './config/nvim/lua/custom:/home/coder/.config/nvim/lua/custom'
- 'home_cache:/home/coder/.cache' - 'home_cache:/home/coder/.cache'
- 'home_local_share:/home/coder/.local/share' - 'home_local_share:/home/coder/.local/share'
- './config/rtx:/home/coder/.config/rtx' - 'home_plugins_tmux:/home/coder/.config/tmux/plugins'
- './config/nvim/lua/custom:/home/coder/.config/nvim/lua/custom'
volumes: volumes:
home_cache: {} home_cache: {}
home_local_share: {} home_local_share: {}
home_plugins_tmux: {}