Permalink
Browse files

tmux: OS-based logic for config

  • Loading branch information...
sh78 committed May 24, 2018
1 parent 80fef5d commit 70ab1f332ffdefe6283740deea88e35dd98c6e5f
Showing with 30 additions and 13 deletions.
  1. +5 −13 .tmux.conf
  2. +11 −0 .tmux.linux.conf
  3. +14 −0 .tmux.macos.conf
@@ -3,10 +3,12 @@
# https://medium.com/@dubistkomisch/how-to-actually-get-italics-and-true-colour-to-work-in-iterm-tmux-vim-9ebe55ebc2be
set -g default-terminal 'tmux-256color'
set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m'

# fix pbcpoy pipe on macos
set -g default-shell $SHELL
set -g default-command "reattach-to-user-namespace -l ${SHELL}"

# check for an env var indicating the OS
## using `test $(uname)` isn't compatible with both fish and posix
if 'test $(uname) = "Darwin"' 'source-file ~/.tmux.macos.conf'
if 'test $(uname) = "Linux"' 'source-file ~/.tmux.linux.conf'

# prefix to Control + a
set -g prefix C-a
@@ -56,16 +58,6 @@ set -g visual-activity on
setw -g mode-keys vi

# @ capture-pane; save-buffer
# Set Right 'v' to begin selection as in Vim
bind-key -Tcopy-mode-vi v send -X begin-selection
bind-key -Tcopy-mode-vi y send -X copy-pipe "pbcopy"\; display-message "Copied to system clipboard! (pbcopy)"

# Update default binding of `Enter` to also use copy-pipe
unbind -Tcopy-mode-vi Enter
bind-key -Tcopy-mode-vi Enter send -X copy-pipe "pbcopy"\; display-message "Copied to system clipboard! (pbcopy"

# Mouse copy
bind-key -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-pipe "pbcopy"\; display-message "Copied to system clipboard! (pbcopy)"

# Theming
set -g pane-active-border-style fg=cyan
@@ -0,0 +1,11 @@
# Set Right 'v' to begin selection as in Vim
bind-key -Tcopy-mode-vi v send -X begin-selection
bind-key -Tcopy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'\; display-message "Copied to system clipboard! (xclip)"

# Update default binding of `Enter` to also use copy-pipe
unbind -Tcopy-mode-vi Enter
bind-key -Tcopy-mode-vi Enter send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'\; display-message "Copied to system clipboard! (xclip)"

# Mouse copy
bind-key -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'\; display-message "Copied to system clipboard! (xclip)"

@@ -0,0 +1,14 @@
# fix pbcpoy pipe on macos
set -g default-command "reattach-to-user-namespace -l ${SHELL}"

# Set Right 'v' to begin selection as in Vim
bind-key -Tcopy-mode-vi v send -X begin-selection
bind-key -Tcopy-mode-vi y send -X copy-pipe "pbcopy"\; display-message "Copied to system clipboard! (pbcopy)"

# Update default binding of `Enter` to also use copy-pipe
unbind -Tcopy-mode-vi Enter
bind-key -Tcopy-mode-vi Enter send -X copy-pipe "pbcopy"\; display-message "Copied to system clipboard! (pbcopy)"

# Mouse copy
bind-key -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-pipe "pbcopy"\; display-message "Copied to system clipboard! (pbcopy)"

0 comments on commit 70ab1f3

Please sign in to comment.