Initial import

This commit is contained in:
Glenn Y. Rolland 2024-07-12 14:47:02 +02:00
commit 60fae438a4
9 changed files with 237 additions and 0 deletions

1
defaults/main.yml Normal file
View file

@ -0,0 +1 @@
tmux_users: []

2
handlers/main.yml Normal file
View file

@ -0,0 +1,2 @@
---
# handlers file for glenux.vim

2
meta/main.yml Normal file
View file

@ -0,0 +1,2 @@
dependencies: []

11
role.yml Normal file
View file

@ -0,0 +1,11 @@
---
- hosts: localhost
remote_user: root
vars_files:
- 'vars/main.yml'
- 'defaults/main.yml'
tasks:
- include: 'tasks/main.yml'
handlers:
- include: 'handlers/main.yml'

14
tasks/main.yml Normal file
View file

@ -0,0 +1,14 @@
---
- name: Installs tmux
apt: >
pkg=tmux
state=present
- name: Adds .tmux.conf for all accounts for detected version
template:
src: tmux.conf.j2
dest: "~{{ item }}/.tmux.conf"
owner: "{{ item }}"
group: "{{ item }}"
with_items: "{{tmux_users}}"

0
tasks/tmux_configure.yml Normal file
View file

92
templates/tmux.conf.j2 Normal file
View file

@ -0,0 +1,92 @@
#
# Tmux shortcuts & cheatsheet : https://gist.github.com/MohamedAlaa/2961058
#
#
###
#
# INPUT/OUTPUT
#
set-option -g utf8 on
set-option -g status-utf8 on
##
#
# COLOUR (Solarized dark)
#
set -g default-terminal "xterm-256color"
## default statusbar colors
set-option -g status-style "bg=black"
set-option -g status-bg black #base02
set-option -g status-fg yellow #yellow
set-option -g status-attr default
## default window title colors
set-window-option -g window-status-fg brightblue #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 brightred #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 black #base02
set-option -g pane-active-border-fg green #base01
## message text
set-option -g message-bg black #base02
set-option -g message-fg brightred #orange
## pane number display
set-option -g display-panes-active-colour blue #blue
set-option -g display-panes-colour brightred #orange
## clock
set-window-option -g clock-mode-colour green #green
## bell
set-window-option -g window-status-bell-style fg=black,bg=red #base02, red
##
# KEY BINDING
#
## Allow Ctrl-left/Right for shell
set-window-option -g xterm-keys on
## Alt-Left / Alt-Right to move between windows
bind-key -n M-Left previous-window
bind-key -n M-Right next-window
## Use C-a instead of C-b
# unbind C-b
# set -g prefix C-a
# bind C-a send-prefix
## Use C-b r to reload configuration
unbind r
bind r source-file ~/.tmux.conf
# Splitting panes with - and |
unbind %
bind | split-window -h
bind - split-window -v

113
templates/tmux.conf.j2.old Normal file
View file

@ -0,0 +1,113 @@
# ______________________
# < Generated by ansible >
# ----------------------
# \ ^__^
# \ (@@)\_______
# (__)\ )\/\
# ||----w |
# || ||
#
# {{ ansible_managed }}
# confirm before killing a window or the server
bind-key k confirm kill-window
bind-key K confirm kill-server
# change default binding
#set -g prefix C-x
#unbind C-b
#bind C-x send-prefix
# leave Ctrl-l for clear
unbind C-l
# toggle statusbar
bind-key b set-option status
# reload config
bind -n F5 source ~/.tmux.conf
# ctrl+left/right cycles thru windows
bind-key -n M-right next
bind-key -n M-left prev
# Splitting panes with - and |
unbind %
bind | split-window -h
bind - split-window -v
# open a man page in new window
bind / command-prompt "split-window 'exec man %%'"
# open ssh to host
bind s command-prompt -p "ssh to hostname..." "new-window 'exec ssh -t root@%%' ; split-window -v -l5 'exec ssh root@%% htop'"
# quick view of processes
bind h split-window "exec htop"
# scrollback buffer n lines
set -g history-limit 10000
# listen for activity on all windows
set -g bell-action any
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
# on-screen time for display-panes in ms
set -g display-panes-time 2000
# start window indexing at one instead of zero
set -g base-index 1
# enable wm window titles
set -g set-titles on
# Automatically set window title
setw -g automatic-rename
#
set -g display-time 2000
# center align the window list
set -g status-justify centre
# Theme trial
set -g status-bg black
set -g status-fg white
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=green](#S) #(whoami)@#H#[default]'
set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=blue]%A %d %H:%M#[default]'
{% if __tmux_version.stdout|float >= 1.7 %}
# Advanced 1.7+ features
# ctrl+up/down cycles thru panes
# disbled since it collides with word hopping in shell
# bind up select-pane -U
# bind down select-pane -D
# bind left select-pane -L
# bind right select-pane -R
# Mouse settings
# Hold down shift to copy/paste with the mouse
set -g mouse-select-pane on
# Not usefull for remotes ?
# set-option -g mouse-resize-pane off
# set-option -g mouse-select-window on
# set-window-option -g mode-mouse off
# Set xterm keys on so ctrl-left/right work
set-option -g xterm-keys on
# Mouse scroll
# set -g mode-mouse on
# wm window title string (uses statusbar variables)
# set -g set-titles-string "tmux.#I.#W"
{% endif %}

2
vars/main.yml Normal file
View file

@ -0,0 +1,2 @@
---
# vars file for glenux.vim