Last active
August 28, 2024 06:50
-
-
Save ivanalejandro0/7459223 to your computer and use it in GitHub Desktop.
Tmux configuration file with Powerline-like status bar, system clipboard integration and some other nice tweaks.
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
# Install tpm + plugins with: | |
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | |
# trigger plugin install with: prefix + I | |
# trigger plugin update with: prefix + U | |
# List of plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-yank' | |
set -g @plugin 'laktak/extrakto' | |
set -g @extrakto_key 'e' | |
set -g @extrakto_split_size '15' | |
# Change prefix key to Ctrl+a | |
unbind C-b | |
set -g prefix C-a | |
bind C-a send-prefix | |
# force a reload of the config file | |
unbind r | |
bind r source-file ~/.tmux.conf \; display-message 'Configuration reloaded.' | |
# This is needed for tmux > 1.8 | |
# http://unix.stackexchange.com/a/109255/66916 | |
bind c new-window -c "#{pane_current_path}" | |
bind % split-window -h -c "#{pane_current_path}" | |
bind '"' split-window -c "#{pane_current_path}" | |
# Last active window | |
# unbind l | |
# bind C-a last-window | |
# use vi mode | |
set-window-option -g mode-keys vi | |
# Bigger history | |
set -g history-limit 50000 | |
# Terminal emulator window title | |
set -g set-titles on | |
set -g set-titles-string '#S:#I.#P #W' | |
# right status bar | |
set -g status-interval 10 | |
battery_info="#[fg=green]battery ♥ #(~/.tmux/battery.sh)" | |
date_time="#[fg=yellow]%a %d %b %Y #[fg=green]:: %l:%M %p " | |
set -g status-right "$battery_info | $date_time" | |
# thanks to: | |
# https://github.com/skwp/dotfiles/blob/master/tmux/tmux.conf | |
# https://gist.github.com/alexyoung/6040385 | |
# color scheme (styled as vim-powerline) | |
set -g status-left-length 52 | |
set -g status-right-length 451 | |
set -g status-fg black | |
set -g status-bg colour232 | |
set -g pane-border-fg colour245 | |
set -g pane-active-border-fg colour39 | |
set -g message-fg colour16 | |
set -g message-bg colour221 | |
set -g message-attr bold | |
# set -g status-left '#[fg=colour235,bg=colour252,bold] #S #[fg=colour252,bg=colour238,nobold]#[fg=colour245,bg=colour238,bold] #(hostname) #[fg=colour238,bg=colour234,nobold]' | |
set -g status-left '#[fg=colour235,bg=colour252,bold] #S #[fg=colour252,bg=colour238,nobold]#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]' | |
set -g window-status-format "#[fg=colour10,bg=colour234] #I #[fg=colour231,bold]#W#F #[fg=colour31,bg=colour234,nobold]" | |
set -g window-status-current-format "#[fg=colour10,bg=colour31] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]" | |
# ^ tip, to list colors use this in bash: | |
# for i in {0..255}; do printf "\x1b[38;5;${i}mcolour${i} "; done; echo | |
# Notifying if other windows has activities | |
# setw -g monitor-activity on | |
# set -g visual-activity on | |
# Highlight the active window in status bar | |
setw -g window-status-current-bg blue | |
# Clock | |
setw -g clock-mode-colour green | |
setw -g clock-mode-style 24 | |
# color settings | |
# some times you need to use: `alias tmux="tmux -2"` | |
# set -g default-terminal "xterm-256color" | |
set -g default-terminal "screen-256color" | |
# to be friendly with vim: get shift, alt, ctrl keys working | |
set-option -g xterm-keys on | |
# to avoid esc delay in vim | |
set -s escape-time 0 | |
# display the messages in the status bar a little longer than the default | |
# set-option -g display-time 4000 | |
# enable for remote hosts: | |
# set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY" | |
# set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock | |
# This was needed for clipboard to work on OSX Sierra, it seems that is not needed now | |
# set -g default-shell $SHELL | |
# set -g default-command "reattach-to-user-namespace -l ${SHELL}" | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
run '~/.tmux/plugins/tpm/tpm' |
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
#!/bin/bash | |
function get_battery_info() { | |
case "${OSTYPE}" in | |
linux*) | |
echo $(acpi | cut -d ',' -f 2) | |
;; | |
darwin*) | |
echo $(pmset -g batt | grep -oE "[0-9]+%") | |
;; | |
*) | |
echo "No battery info" >&2 | |
return 1 | |
;; | |
esac | |
} | |
get_battery_info |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment