.tmux.conf

tmux ist ein Terminal-Multiplexer, erlaubt es also, in einem Terminalfenster mehrere Shells offen zu haben. tmux erlaubt es, diverse Plugins und Konfigurationsoptionen zu nutzen, um es ganz den eigenen Bedürfnissen anzupassen.

Nachdem die Konfiguration geschrieben oder verändert wurde, muss sie in tmux neu geladen werden. Dies geschieht standardmäßig mit der Tastenkombination STRG+b I (großes i).

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'dracula/tmux'

set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'

# switch panes using Alt-arrow without prefix
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# swap windows with shift+arrow with prefix
bind-key S-Left swap-window -t -1
bind-key S-Right swap-window -t +1

# copy from tmux to clipboard
bind-key -T copy-mode-vi y send-keys -X copy-pipe "xclip -r" \; display-message "Copied to selection"
bind-key -T copy-mode-vi Y send-keys -X copy-pipe "xclip -r -selection clipboard" \; display-message "Copied to clipboard"
bind-key C-p run-shell "xclip -o | tmux load-buffer - && tmux paste-buffer"

# turn mouse on
set -g mouse on

# restore vim sessions
set -g @resurrect-strategy-vim 'session'

# restore neovim sessions
set -g @resurrect-strategy-nvim 'session'

# restore panes
set -g @resurrect-capture-pane-contents 'on'

# restore last saved environment (automatically)
set -g @continuum-restore 'on'

resurrect_dir="$HOME/.tmux/resurrect"
set -g @resurrect-dir $resurrect_dir
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-hook-post-save-all "sed 's/--cmd[^ ]* [^ ]* [^ ]*//g' $resurrect_dir/last | sponge $resurrect_dir/last"
set -g @resurrect-processes '"~nvim"'

# available plugins: battery, cpu-usage, git, gpu-usage, ram-usage, tmux-ram-usage, network, network-bandwidth, network-ping, ssh-session, attached-clients, network-vpn, weather, time, mpc, spotify-tui, playerctl, kubernetes-context, synchronize-panes
set -g @dracula-plugins "cpu-usage ram-usage ssh-session time synchronize-panes"
set -g @dracula-show-fahrenheit false
set -g @dracula-show-powerline true
set -g @dracula-show-network false
set -g @dracula-show-left-icon session
set -g @dracula-cpu-usage true
set -g @dracula-ram-usage true
set -g @dracula-day-month true
set -g @dracula-military-time false
set -g @dracula-time-format "%F %R"
set -g @dracula-show-flags true
set -g @dracula-show-empty-plugins true
set -g @dracula-cpu-display-load true

set -s default-terminal 'tmux-256color'

# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf

set -g @plugin 'tmux-plugins/tmux-continuum'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'