aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%
diff options
context:
space:
mode:
Diffstat (limited to '%HOME%')
-rw-r--r--%HOME%/.tmux.conf144
1 files changed, 144 insertions, 0 deletions
diff --git a/%HOME%/.tmux.conf b/%HOME%/.tmux.conf
new file mode 100644
index 0000000..5a15e3c
--- /dev/null
+++ b/%HOME%/.tmux.conf
@@ -0,0 +1,144 @@
+# C-b is hella uncomfortable to press.
+unbind C-b
+set -g prefix C-j
+bind C-j send-prefix
+
+# Numbering starts at 1 instead of 0.
+set -g base-index 1
+set-window-option -g pane-base-index 1
+
+# I'm not sure about this. Still, it's recommended by tmux-sensible, etc.
+set -s escape-time 0
+
+# Enable mouse support. You can now scroll inside panes. It automatically
+# enters copy mode though, which you can exit by pressing q. Right click to
+# bring up the emulator's context window won't work though, hold Shift for
+# that.
+set -g mouse on
+
+# Default is only 2000 lines?!
+set -g history-limit 50000
+
+# Show tmux messages for a longer time (0.75 seconds is the default).
+set -g display-time 4000
+
+# Refresh the status line more often (every 15 second is the default).
+set -g status-interval 5
+
+# The following settings I don't totally understand/need, but they looked
+# sensible enough, and they were recommended somewhere.
+
+set-window-option -g monitor-activity on
+set -g visual-activity on
+
+set -g focus-events on
+
+set-window-option -g aggressive-resize on
+
+# ============
+# Key bindings
+# ============
+
+# R to reload this file.
+bind R source-file ~/.tmux.conf \; display "Reloaded!"
+
+# According to tmux-sensible, it's more natural to use default readline-like
+# key bindings in the command prompt; I sorta agree.
+set -g status-keys emacs
+
+# Start new windows/panes in the current directory.
+bind c new-window -c "#{pane_current_path}"
+# The defaults for pane splitting are the dumbest bindings I've ever seen.
+bind - split-window -v -c "#{pane_current_path}"
+bind v split-window -h -c "#{pane_current_path}"
+
+# Switch between panes quicker.
+bind -n M-1 select-pane -t 1
+bind -n M-2 select-pane -t 2
+bind -n M-3 select-pane -t 3
+bind -n M-4 select-pane -t 4
+bind -n M-5 select-pane -t 5
+bind -n M-6 select-pane -t 6
+bind -n M-7 select-pane -t 7
+bind -n M-8 select-pane -t 8
+bind -n M-9 select-pane -t 9
+bind -n M-0 select-pane -t 0
+
+# Not quite so quick, but still OK.
+bind -r C-h select-pane -L
+bind -r C-j select-pane -D
+bind -r C-k select-pane -U
+bind -r C-l select-pane -R
+
+# Switch between windows. Ctrl must be released.
+bind h next-window
+bind l previous-window
+#bind h select-window -t :-
+#bind l select-window -t :+
+
+# Copy mode bindings
+# ------------------
+
+# I looked up useful bindings here[2] and there[5].
+
+# Don't care if $EDITOR is not set up, I'm a vim guy.
+set -g mode-keys vi
+
+# This I'm unsure about.
+bind Escape copy-mode
+# This I'm sure about.
+bind-key -T copy-mode-vi v send -X begin-selection
+
+# Using the system clipboard.
+
+if-shell 'uname | grep -q -F CYGWIN' {
+ bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'cat > /dev/clipboard'
+ bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'tmux paste-buffer'
+ bind-key -T copy-mode-vi M-y send-keys -X copy-pipe-and-cancel 'cat > /dev/clipboard; tmux paste-buffer'
+ bind-key -T copy-mode-vi '!' send-keys -X copy-pipe-and-cancel {
+ tr -d '\n' > /dev/clipboard
+ }
+ bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'cat > /dev/clipboard'
+ bind-key -T root MouseDown2Pane run 'cat /dev/clipboard | tmux load-buffer - && tmux paste-buffer'
+
+ unbind p
+ bind-key p run 'cat /dev/clipboard | tmux load-buffer - && tmux paste-buffer'
+}
+
+# The simple `xsel -i --clipboard` doesn't work, but `xsel -i -p && xsel -o -p
+# | xsel -i -b`, described on [1] does. How fun!
+
+if-shell 'uname | grep -q -F Linux && which xsel' {
+ bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xsel -i -p && xsel -o -p | xsel -i -b'
+ bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'tmux paste-buffer'
+ bind-key -T copy-mode-vi M-y send-keys -X copy-pipe-and-cancel 'xsel -i -p && xsel -o -p | xsel -i -b; tmux paste-buffer'
+ bind-key -T copy-mode-vi '!' send-keys -X copy-pipe-and-cancel {
+ tr -d '\n' | xsel -i -p && xsel -o -p | xsel -i -b
+ }
+ bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xsel -i -p && xsel -o -p | xsel -i -b'
+ bind-key -T root MouseDown2Pane run 'xsel -o | tmux load-buffer - && tmux paste-buffer'
+
+ unbind p
+ bind-key p run 'xsel -o | tmux load-buffer - && tmux paste-buffer'
+}
+
+# ==========
+# Appearance
+# ==========
+
+# Highlight active window panes/windows, might not work so well depending on
+# your color scheme.
+set-window-option -g window-status-current-style bg=red
+set-window-option -g window-style bg=#000000
+set-window-option -g window-active-style bg=#181818
+
+# ==========
+# References
+# ==========
+
+# [1]: https://wiki.archlinux.org/index.php/tmux
+# [2]: https://gist.github.com/Lartza/6a7a62466a8a3e436234412d9b1c5066
+# [3]: http://mutelight.org/practical-tmux
+# [4]: https://github.com/tmux-plugins/tmux-sensible
+# [5]: https://github.com/tmux-plugins/tmux-yank
+# [6]: https://github.com/greymd/dotfiles/blob/333c46dab103d4316a83744dec28605dc2cbc4ab/.tmux.conf