Skip to content

Commit

Permalink
Add tmux stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Feb 27, 2024
1 parent e3daf67 commit 3c440b7
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
3 changes: 3 additions & 0 deletions roles/terminal/files/aliases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# shellcheck disable=SC2148
alias tmux='TERM=screen-256color-bce tmux'
alias my-tmux='tmux attach -t denis || tmux new -s denis'
70 changes: 70 additions & 0 deletions roles/terminal/files/tmux/tmux.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# vi for the win
set-window-option -g mode-keys vi

# Changes send-prefix
set -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix

# enable mouse
set-option -g mouse on
set-option -s set-clipboard off
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -se c -i"

# setup colors and tmux icon
tm_icon="♥️ "
tm_color_active=colour39
tm_color_inactive=colour24
tm_color_feature=colour198
tm_active_border_color=colour39
set -g default-terminal "xterm"

# separators
tm_separator_left_bold=""
tm_separator_left_thin=""
tm_separator_right_bold=""
tm_separator_right_thin=""
set -g status-left-length 32
set -g status-right-length 150
set -g status-interval 5

# default statusbar colors
set-option -g status-bg colour0
set-option -g status-fg $tm_color_active
set-option -g status-bg default
set-option -g status-attr default

# default window title colors
set-window-option -g window-status-fg $tm_color_inactive
set-window-option -g window-status-bg default
set -g window-status-format "#I #W"

# active window title colors
set-window-option -g window-status-current-fg $tm_color_active
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-format "#[bold]#I #W"

# pane border
set-option -g pane-border-fg $tm_color_inactive
set-option -g pane-active-border-fg $tm_active_border_color

# message text
set-option -g message-bg default
set-option -g message-fg $tm_color_active

# pane number display
set-option -g display-panes-active-colour $tm_color_active
set-option -g display-panes-colour $tm_color_inactive

# clock
set-window-option -g clock-mode-colour $tm_color_active
tm_date="#[fg=$tm_color_nactive] %R %d %b"
tm_host="#[fg=$tm_color_feature,bold]#h"
tm_session_name="#[fg=$tm_color_feature,bold]$tm_icon #S"
set -sg escape-time 0
set -g status-left $tm_session_name' '
set -g status-right $tm_tunes' '$tm_date' '
set -g default-shell $SHELL

# history
set -g history-limit 100000
12 changes: 12 additions & 0 deletions roles/terminal/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
state: present
become: "{{ become_root }}"

- name: Copy tmux config file
ansible.builtin.copy:
src: files/tmux/tmux.conf
dest: "{{ home_folder }}/.tmux.conf"
mode: preserve

- name: Create ~/.local/share/z/ folder
ansible.builtin.file:
path: "{{ home_folder }}/.local/share/z/"
Expand All @@ -60,6 +66,12 @@
dest: "{{ home_folder }}/.man/man1"
mode: preserve

- name: Add terminal aliases to ~/.bashrc
ansible.builtin.blockinfile:
path: "{{ home_folder }}/.bashrc"
marker: "# {mark} terminal/files/aliases.sh"
block: "{{ lookup('file', 'files/aliases.sh') }}"

- name: Add terminal functions to ~/.bashrc
ansible.builtin.blockinfile:
path: "{{ home_folder }}/.bashrc"
Expand Down

0 comments on commit 3c440b7

Please sign in to comment.