commit 60fae438a433c7bbded6a829e7f43cf27413a3fc Author: Glenn Date: Fri Jul 12 14:47:02 2024 +0200 Initial import diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..9c65132 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1 @@ +tmux_users: [] diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..f404865 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for glenux.vim diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..74d2c33 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: [] + diff --git a/role.yml b/role.yml new file mode 100644 index 0000000..9fc47fc --- /dev/null +++ b/role.yml @@ -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' + diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..ec3adf7 --- /dev/null +++ b/tasks/main.yml @@ -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}}" + diff --git a/tasks/tmux_configure.yml b/tasks/tmux_configure.yml new file mode 100644 index 0000000..e69de29 diff --git a/templates/tmux.conf.j2 b/templates/tmux.conf.j2 new file mode 100644 index 0000000..b0c58d6 --- /dev/null +++ b/templates/tmux.conf.j2 @@ -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 + + diff --git a/templates/tmux.conf.j2.old b/templates/tmux.conf.j2.old new file mode 100644 index 0000000..a02b3f1 --- /dev/null +++ b/templates/tmux.conf.j2.old @@ -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 %} diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..9f8b7b2 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for glenux.vim