Created
July 1, 2022 18:50
-
-
Save zenVentzi/2e2c0ba9e98cd9451cee66c54c0c8b45 to your computer and use it in GitHub Desktop.
setup tmux like vim + other settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ------------------ | |
## General Settings | |
## ------------------ | |
# make tmux display things in 256 colors | |
set -g default-terminal "screen-256color" | |
# set scrollback history to 10000 (10k) | |
set -g history-limit 10000 | |
# set ` as the default prefix key combination | |
set -g prefix ` | |
# unbind C-b to free it up | |
unbind C-b | |
# use send-prefix to pass ` through to application | |
bind ` send-prefix | |
# shorten command delay | |
set -sg escape-time 50 | |
# set window and pane index to 1 (0 by default) | |
set-option -g base-index 1 | |
setw -g pane-base-index 1 | |
# reload ~/.tmux.conf using PREFIX r | |
bind r source-file ~/.tmux.conf \; display "Tmux config reloaded" | |
# open new windows in current directory | |
bind c new-window -c "#{pane_current_path}" | |
# use PREFIX - to split vertically | |
bind - split-window -v -c "#{pane_current_path}" | |
# use PREFIX | to split window horizontally and | |
bind | split-window -h -c "#{pane_current_path}" | |
# Make the current window the first window | |
bind T swap-window -t 1 | |
# Make the current pane the first pane | |
bind P swap-pane -t 1 | |
# map Vi movement keys as pane movement keys | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
# use C-a to cycle through panes | |
bind -n C-o select-pane -t :.+ | |
# use C-h and C-l to cycle through windows | |
bind -n C-h select-window -t :- | |
bind -n C-l select-window -t :+ | |
# resize panes using PREFIX H, J, K, L | |
bind H resize-pane -L 5 | |
bind J resize-pane -D 5 | |
bind K resize-pane -U 5 | |
bind L resize-pane -R 5 | |
# mouse control | |
setw -g mouse off | |
# auto-set window title | |
setw -g automatic-rename on | |
## --------------------- | |
## Copy & Paste | |
## --------------------- | |
## use vim keybindings in copy mode | |
setw -g mode-keys vi | |
## set 'v' to begin selection as in Vim | |
bind-key -T copy-mode-vi v send-keys -X begin-selection | |
## update default binding of 'Enter' to also use copy-pipe | |
#unbind -t vi-copy Enter | |
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" | |
#bind y run 'tmux save-buffer - | reattach-to-user-namespace pbcopy ' | |
## set copy-mode highlight colors | |
set-window-option -g mode-style bg=colour25,fg=colour254 | |
## use system clipboard in vi-copy mode | |
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' | |
## ---------------- | |
## Pane style | |
## ---------------- | |
# set pane colors - highlight active pane | |
set -g pane-border-style fg=colour235 | |
set -g pane-active-border-style bg=default,fg=colour245 | |
## ---------------------- | |
## Status Bar | |
## ---------------------- | |
set-option -g status on # turn the status bar on | |
set -g status-interval 5 # set update frequencey (default 15 seconds) | |
set -g status-justify centre # center window list for clarity | |
set-option -g status-position top # position the status bar at top of screen | |
## visual notification of activity in other windows | |
setw -g monitor-activity off | |
set -g visual-activity off | |
# | |
## set color for status bar | |
set -g status-style bg=colour235,fg=default,dim | |
# | |
## set window list colors - green for active and gray for inactive | |
set -g window-status-style bg=colour235,fg=colour249,dim | |
set -g window-status-current-style fg=colour34,bg=colour236,bright | |
# | |
## show session name, window & pane number on status bar left side | |
set -g status-left-length 70 | |
set -g status-left "#[fg=colour172]#S #I:#P" | |
## show host name and IP address on left side of status bar | |
#set -g status-left "#[fg=green]: #h : #[fg=brightblue]#(curl icanhazip.com) #[fg=yellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') " | |
## show date and time on right side of status bar | |
set -g status-right-length 60 | |
set -g status-right "#[fg=colour172] %d %b %Y %l:%M %p" | |
## -------------------- | |
## Tmux 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-yank' | |
#set -g @plugin 'jimeh/tmux-themepack' | |
#set -g @themepack 'powerline/default/blue' | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
run '~/.tmux/plugins/tpm/tpm' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment