Skip to content

Instantly share code, notes, and snippets.

@kalbasit kalbasit/.tmux.conf
Created Jun 5, 2019

Embed
What would you like to do?
# ============================================= #
# Start with defaults from the Sensible plugin #
# --------------------------------------------- #
run-shell /nix/store/sy5y4892r4zp4q881363bcclx099prgn-tmuxplugin-sensible/share/tmux-plugins/sensible/sensible.tmux
# ============================================= #
set -g default-terminal "screen"
set -g base-index 0
setw -g pane-base-index 0
set -g status-keys vi
set -g mode-keys vi
# rebind main key: C-t
unbind C-b
set -g prefix C-t
bind t send-prefix
bind C-t last-window
setw -g aggressive-resize off
setw -g clock-mode-style 24
set -s escape-time 0
set -g history-limit 10000
# pane number display
set-option -g display-panes-active-colour colour250 #fg2
set-option -g display-panes-colour colour237 #bg1
# clock
set-window-option -g clock-mode-colour colour109 #blue
# bell
set-window-option -g window-status-bell-style fg=colour235,bg=colour167 #bg, red
## Theme settings mixed with colors (unfortunately, but there is no cleaner way)
set-option -g status-justify "left"
set-option -g status-left-length "80"
set-option -g status-right-length "80"
set-window-option -g window-status-separator ""
set-option -g status-left "#[fg=colour248, bg=colour241] #S #[fg=colour241, bg=colour237, nobold, noitalics, nounderscore]"
set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#{prefix_highlight}#[fg=colour246,bg=colour239] %Y-%m-%d  %H:%M #[fg=colour248, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour237, bg=colour248] #h "
set-window-option -g window-status-current-format "#[fg=colour239, bg=colour248, :nobold, noitalics, nounderscore]#[fg=colour239, bg=colour214] #I #[fg=colour239, bg=colour214, bold] #W #[fg=colour214, bg=colour237, nobold, noitalics, nounderscore]"
set-window-option -g window-status-format "#[fg=colour237,bg=colour239,noitalics]#[fg=colour223,bg=colour239] #I #[fg=colour223, bg=colour239] #W #[fg=colour239, bg=colour237, noitalics]"
# default statusbar colors
set-option -g status-bg colour237 #bg1
set-option -g status-fg colour223 #fg1
# default window title colors
set-window-option -g window-status-bg colour214 #yellow
set-window-option -g window-status-fg colour237 #bg1
set-window-option -g window-status-activity-bg colour237 #bg1
set-window-option -g window-status-activity-fg colour248 #fg3
# active window title colors
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-fg colour237 #bg1
# pane border
set-option -g pane-active-border-fg colour250 #fg2
set-option -g pane-border-fg colour237 #bg1
# message infos
set-option -g message-bg colour239 #bg2
set-option -g message-fg colour223 #fg1
# writting commands inactive
set-option -g message-command-bg colour239 #fg3
set-option -g message-command-fg colour223 #bg1
set-option -g status-attr "none"
set-option -g status-left-attr "none"
set-option -g status-right-attr "none"
set-window-option -g window-status-activity-attr "none"
set-window-option -g window-status-attr "none"
# 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)?$'"
bind-key -n M-n if-shell "$is_vim" "send-keys M-n" "select-pane -L"
bind-key -n M-e if-shell "$is_vim" "send-keys M-e" "select-pane -D"
bind-key -n M-i if-shell "$is_vim" "send-keys M-i" "select-pane -U"
bind-key -n M-o if-shell "$is_vim" "send-keys M-o" "select-pane -R"
#
# Settings
#
set -g default-terminal "tmux-256color"
# don't allow the terminal to rename windows
set-window-option -g allow-rename off
# show the current command in the border of the pane
set -g pane-border-status "top"
set -g pane-border-format "#P: #{pane_current_command}"
# Terminal emulator window title
set -g set-titles on
set -g set-titles-string '#S:#I.#P #W'
# Status Bar
set-option -g status on
# Notifying if other windows has activities
#setw -g monitor-activity off
set -g visual-activity on
# Trigger the bell for any action
set-option -g bell-action any
set-option -g visual-bell off
# No Mouse!
set -g mouse off
# Do not update the environment, keep everything from what it was started with
set -g update-environment ""
# fuzzy client selection
bind s split-window -p 20 -v /nix/store/hgk9drkhpl4kbvb0gqnay5fvih92n7p5-swm-unstable-2018-10-01-bin/bin/swm tmux switch-client --kill-pane
# Last active window
bind C-t last-window
bind C-r switch-client -l
# bind C-n next-window
bind C-n switch-client -p
bind C-o switch-client -n
# copy/paste to system clipboard
bind-key C-p run "/nix/store/pl0ihgvrvk356g528513hd9f14c8m92n-tmux-2.8/bin/tmux save-buffer - | /nix/store/a3qpf7k422pnrn7cdqcgd5gdi4jcmm2l-gist-5.0.0/bin/gist -f tmux.sh-session --no-private | /nix/store/yjbbdaprmmrdjf6r3nvdc6kl1yjcn9fy-xsel-unstable-2018-01-10/bin/xsel --clipboard -i && /nix/store/gvlzi06gi9azic9ygp3306nj2hpmcnpf-libnotify-0.7.7/bin/notify-send -a Tmux 'Buffer saved as public gist' 'Tmux buffer was saved as Gist, URL in clipboard' --icon=dialog-information"
bind-key C-g run "/nix/store/pl0ihgvrvk356g528513hd9f14c8m92n-tmux-2.8/bin/tmux save-buffer - | /nix/store/a3qpf7k422pnrn7cdqcgd5gdi4jcmm2l-gist-5.0.0/bin/gist -f tmux.sh-session --private | /nix/store/yjbbdaprmmrdjf6r3nvdc6kl1yjcn9fy-xsel-unstable-2018-01-10/bin/xsel --clipboard -i && /nix/store/gvlzi06gi9azic9ygp3306nj2hpmcnpf-libnotify-0.7.7/bin/notify-send -a Tmux 'Buffer saved as private gist' 'Tmux buffer was saved as Gist, URL in clipboard' --icon=dialog-information"
bind-key C-c run "/nix/store/pl0ihgvrvk356g528513hd9f14c8m92n-tmux-2.8/bin/tmux save-buffer - | /nix/store/yjbbdaprmmrdjf6r3nvdc6kl1yjcn9fy-xsel-unstable-2018-01-10/bin/xsel --clipboard -i"
bind-key C-v run "/nix/store/yjbbdaprmmrdjf6r3nvdc6kl1yjcn9fy-xsel-unstable-2018-01-10/bin/xsel --clipboard -o | /nix/store/pl0ihgvrvk356g528513hd9f14c8m92n-tmux-2.8/bin/tmux load-buffer; /nix/store/pl0ihgvrvk356g528513hd9f14c8m92n-tmux-2.8/bin/tmux paste-buffer"
#
# Colemak binding
#
# cursor movement
bind-key -r -T copy-mode-vi n send -X cursor-left
bind-key -r -T copy-mode-vi e send -X cursor-down
bind-key -r -T copy-mode-vi i send -X cursor-up
bind-key -r -T copy-mode-vi o send -X cursor-right
# word movement
bind-key -r -T copy-mode-vi u send -X next-word-end
bind-key -r -T copy-mode-vi U send -X next-space-end
bind-key -r -T copy-mode-vi y send -X next-word
bind-key -r -T copy-mode-vi Y send -X next-space
bind-key -r -T copy-mode-vi l send -X previous-word
bind-key -r -T copy-mode-vi L send -X previous-space
# search
bind-key -r -T copy-mode-vi k send -X search-again
bind-key -r -T copy-mode-vi K send -X search-reverse
# visual mode
bind-key -r -T copy-mode-vi a send -X begin-selection
# yank
bind-key -r -T copy-mode-vi c send -X copy-selection-and-cancel
bind-key -r -T copy-mode-vi C send -X copy-selection
# char search
bind-key -r -T copy-mode-vi p command-prompt -1 -p "jump to forward" "send -X jump-to-forward \"%%%\""
bind-key -r -T copy-mode-vi P command-prompt -1 -p "jump to backward" "send -X jump-to-backward \"%%%\""
# Change window move behavior
bind . command-prompt "swap-window -t '%%'"
bind > command-prompt "move-window -t '%%'"
# More straight forward key bindings for splitting
unbind %
bind h split-window -h
unbind '"'
bind v split-window -v
# The shortcut is set to <t> which overrides the default mapping for clock mode
bind T clock-mode
# Bind pane selection and pane resize for Vim Bindings in Colemak!
bind n select-pane -L
bind e select-pane -D
bind i select-pane -U
bind o select-pane -R
bind -r N resize-pane -L 5
bind -r E resize-pane -D 5
bind -r I resize-pane -U 5
bind -r O resize-pane -R 5
# ============================================= #
# Load plugins with Home Manager #
# --------------------------------------------- #
# tmuxplugin-logging
# ---------------------
run-shell /nix/store/9bp110hync45il7s6yrcyi1r03ip53nw-tmuxplugin-logging/share/tmux-plugins/logging/logging.tmux
# tmuxplugin-prefix-highlight
# ---------------------
run-shell /nix/store/nv3rqc0l3z98v2ihz5gj7gncm8mp39fk-tmuxplugin-prefix-highlight/share/tmux-plugins/prefix-highlight/prefix_highlight.tmux
# tmuxplugin-fzf-tmux-url
# ---------------------
run-shell /nix/store/w5m90x32rpwhi9y0fg5ml5xxv6g7pmqk-tmuxplugin-fzf-tmux-url/share/tmux-plugins/fzf-tmux-url/fzf-url.tmux
# ============================================= #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.