diff --git a/roles/terminal/files/aliases.sh b/roles/terminal/files/aliases.sh new file mode 100644 index 0000000..9e7e3a6 --- /dev/null +++ b/roles/terminal/files/aliases.sh @@ -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' diff --git a/roles/terminal/files/tmux/tmux.conf b/roles/terminal/files/tmux/tmux.conf new file mode 100644 index 0000000..119ea75 --- /dev/null +++ b/roles/terminal/files/tmux/tmux.conf @@ -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 diff --git a/roles/terminal/tasks/main.yml b/roles/terminal/tasks/main.yml index 71687b5..a4ae477 100644 --- a/roles/terminal/tasks/main.yml +++ b/roles/terminal/tasks/main.yml @@ -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/" @@ -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"