Add role tmux with a vim-friendly config (to check)

This commit is contained in:
flyingscorpio@clevo 2022-07-03 12:25:41 +02:00
parent 5a4f81a545
commit 68d999112f
4 changed files with 76 additions and 0 deletions

View file

@ -13,6 +13,7 @@
- {role: pass, tags: pass}
- {role: keepass, tags: keepass}
- {role: terminator, tags: terminator}
- {role: tmux, tags: tmux}
- {role: neovim, tags: [neovim, nvim, vim]}
- {role: ssh-agent, tags: ssh-agent}
- {role: pacman, tags: [pacman, pacman.conf]}

View file

@ -0,0 +1,52 @@
#Prefix is Ctrl-a
set -g prefix C-a
bind C-a send-prefix
unbind C-b
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
#Mouse works as expected
set -g mouse on
setw -g monitor-activity on
set -g visual-activity on
set -g mode-keys vi
set -g history-limit 10000
# y and p as in vim
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection
bind-key -T copy-mode-vi 'Space' send -X halfpage-down
bind-key -T copy-mode-vi 'Bspace' send -X halfpage-up
# extra commands for interacting with the ICCCM clipboard
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# easy-to-remember split pane commands
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# moving between panes with vim movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# moving between windows with vim movement keys
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# resize panes with vim movement keys
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

3
roles/tmux/meta/main.yml Normal file
View file

@ -0,0 +1,3 @@
---
dependencies:
- role: check-sudo

20
roles/tmux/tasks/main.yml Normal file
View file

@ -0,0 +1,20 @@
---
- name: Install tmux (Archlinux)
become: true
pacman:
name:
- tmux
when: ansible_facts['distribution'] == 'Archlinux'
- name: Install tmux (Debian)
become: true
apt:
name:
- tmux
when: ansible_facts['distribution'] == 'Debian'
- name: Copy tmux config
copy:
src: tmux.conf
dest: ~/.tmux.conf
mode: 0644