Skip to content

Instantly share code, notes, and snippets.

@arithran
Last active May 14, 2022 21:03
Show Gist options
  • Save arithran/a4ba6f4f70ac71d3e37db1fbb12954a5 to your computer and use it in GitHub Desktop.
Save arithran/a4ba6f4f70ac71d3e37db1fbb12954a5 to your computer and use it in GitHub Desktop.
#Powerline
source "/usr/share/tmux/powerline.conf"
# Tmux Line Config
source-file ~/.tmuxline
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
setw -g mode-keys vi
setw -g monitor-activity on
# set -g mouse on
# Custom bindings to create splits
# bind v split-window -h
# # bind s split-window -v
# bind h split-window -v
# Custom bindings to resize paynes
bind J resize-pane -D 5
bind K resize-pane -U 5
bind H resize-pane -L 5
bind L resize-pane -R 5
bind M-j resize-pane -D
bind M-k resize-pane -U
bind M-h resize-pane -L
bind M-l resize-pane -R
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# Use <prefix> C-l to clear the screen.
bind C-l send-keys 'C-l'
# Reload tmux config
bind r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
# Set the escape time to 0 to make vim faster
set -sg escape-time 0
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
bind -n C-h run "($is_vim && tmux send-keys C-h) || \
tmux select-pane -L"
bind -n C-j run "($is_vim && tmux send-keys C-j) || \
($is_fzf && tmux send-keys C-j) || \
tmux select-pane -D"
bind -n C-k run "($is_vim && tmux send-keys C-k) || \
($is_fzf && tmux send-keys C-k) || \
tmux select-pane -U"
bind -n C-l run "($is_vim && tmux send-keys C-l) || \
tmux select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-copycat'
# Tmux Resurrect Settings
set -g @resurrect-strategy-nvim 'session' # For neovim
set -g @resurrect-processes 'grunt "compass watch"' # Additionally restore grunt and compass
# Tmux Continuum Settings
set -g @continuum-boot 'on' # Automatically start Tmux on OS Boot
set -g @continuum-systemd-start-cmd 'new -d -s Master' # Start a new session called Master by default
set -g @continuum-restore 'on' # Automatically Restore and saved Tmux Sessions
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
[Unit]
Description=tmux default session (detached)
Documentation=man:tmux(1)
[Service]
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/tmux new -d -s Master
ExecStop=/home/ari/.tmux/plugins/tmux-resurrect/scripts/save.sh
ExecStop=/usr/bin/tmux kill-server
KillMode=none
RestartSec=2
[Install]
WantedBy=default.target
@arithran
Copy link
Author

test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment