tmux: Clean-up

- Update readme
- Remove unnecessary Ruby script
- Update clocks.sh to be a bit slimmer
- Update tmux.conf with comments
- Reformate/clean-up tmux.conf
This commit is contained in:
Bill Nibz 2017-08-15 22:31:58 -04:00
parent bb1eb48bcb
commit 9aa4f84cbe
4 changed files with 69 additions and 177 deletions

View file

@ -1,16 +1,15 @@
#Tmux Configuration Files # Tmux Configuration Files
My tmux configuration is very straight forward. Of note, I enable mouse mode, My tmux configuration is very straight forward and fully commented. Of note, I
and have custom colors configured. I also have a few custom scripts. enable mouse mode, and have custom colors configured. I also have a few custom
scripts.
### Tmux Addons ### Tmux Plugins
- [TPM](https://www.github.com/tmux-plugins/tpm): The TMUX Plugin Manager - [TPM](https://www.github.com/tmux-plugins/tpm): The TMUX Plugin Manager
- [Scroll-Wheel Copy Mode](https://www.github.com/nhdaly/tmux-scroll-copy-mode) - [Scroll-Wheel Copy Mode](https://www.github.com/nhdaly/tmux-scroll-copy-mode)
- [Resurrect](https://www.github.com/tmux-plugins/tmux-resurrect): Session - [Resurrect](https://www.github.com/tmux-plugins/tmux-resurrect): Session
Management Management
### Custom Scripts ### Custom Scripts
- clocks.sh/rb: My custom status bar. Shows time for 4 different time zones, - clocks.sh: My custom status bar. Shows time for 4 different time zones.
plus the date and weather of my default home location.
- copy\_selected.sh: Enables uploading of the selected text to Gist. - copy\_selected.sh: Enables uploading of the selected text to Gist.

View file

@ -1,47 +0,0 @@
######
# Clocks -- Tmux status line output
###
require 'net/http'
class Weather
attr_reader :temp, :flag, :summary
def initialize()
@temp = 68
@flag = "(!)" if hasflag?
@summary = "Dang nice"
end
private
def get_weather(lat = 42.9333, lon = -78.877)
end
def hasflag?
return true
end
end
class Clocks
def initialize()
w = Weather.new()
t = Time.new()
@tu = t.utc.strftime("[ %H:%M ]")
@tb = t.getlocal.strftime("<][ %b %d %H:%M | ")
@tw = "#{w::flag} #{w::temp} ][>"
@tc = t.getlocal("-07:00").strftime("<][ %H:%M ]")
@ti = t.getlocal("+05:30").strftime("[ %H:%M ][>")
end
def show()
puts "#{@tc} #{@tb}#{@tw} #{@tu} #{@ti}"
end
end
c = Clocks.new()
c.show()

View file

@ -8,9 +8,4 @@ buffTime="$(TZ=America/New_York date +'%b %d %R')"
utcTime="$(date -u +%R)" utcTime="$(date -u +%R)"
bangTime="$(TZ=Asia/Kolkata date +%R)" bangTime="$(TZ=Asia/Kolkata date +%R)"
caliForm="#[fg=red]<][ $caliTime ] " echo "<][ $caliTime ] <][ $buffTime ][> [ $utcTime ][> [ $bangTime ][>> "
buffForm="#[fg=green]<][ $buffTime | #[fg=red](!)#[fg=green]][> "
utcForm="#[fg=blue][ $utcTime ][> "
bangForm="#[fg=magenta][ $bangTime ][>>"
echo "$caliForm""$buffForm""$utcForm""$bangForm"" "

View file

@ -1,136 +1,81 @@
############ #===============================================================================
###### # tmux.conf for niblock || source with <C-b>r
# Tmux Configuration for niblock #===============================================================================
### #
############ #===============================================================================
# General Settings
# Remap the prefix, but not to C-A incase we need to screen #===============================================================================
set-option -g prefix C-b set-option -g prefix C-b # Remap prefix key
set -g default-terminal "screen-256color" # Set terminal
# Set default terminal, colors, and encoding setw -g utf8 on # Set encoding
set -g default-terminal "screen-256color" set -g mouse on # Enable mouse
setw -g utf8 on set -sg escape-time 0 # Delay time
set -g display-time 2000 # Message display time
#start window numbers at 1 set -g base-index 1 # Start windows at 1
set -g base-index 1 setw -g pane-base-index 1 # Start panes at 1
setw -g pane-base-index 1 set -g renumber-windows on # Renumber dynamically
#===============================================================================
#renumber windows sequentially after closing any of them
set -g renumber-windows on
#change default delay to be a bit more responsive
set -sg escape-time 0
#amount of time for which messages/indicators are displayed (in ms)
set -g display-time 2000
######
# Mouse
###
#setw -g mode-mouse on
#set -g mouse-select-pane on
set -g mouse on
######
# Colors # Colors
### #===============================================================================
set -g status-fg cyan # Status bar foreground
set -g status-bg black # Status bar background
## Status Bar and Related Items setw -g window-status-fg cyan # Window list foreground
# Bar itself setw -g window-status-bg black # Window list background
set -g status-fg cyan
set -g status-bg black
# Window list set -g pane-border-fg black # Pane divider foreground
setw -g window-status-fg cyan set -g pane-border-bg black # Pane divider background
setw -g window-status-bg default set -g pane-active-border-fg cyan # Active pane foreground
setw -g window-status-attr dim set -g pane-active-border-bg black # Active pane background
setw -g window-status-current-fg white set -g message-fg red # Command line foreground
setw -g window-status-current-bg black set -g message-bg black # Command line background
setw -g window-status-current-attr bright set -g message-attr bright # Bold
#===============================================================================
## Pane Dividers
set -g pane-border-fg black
set -g pane-border-bg black
set -g pane-active-border-fg colour51
set -g pane-active-border-bg black
## Command Line
set -g message-fg red
set -g message-bg black
set -g message-attr bright
######
# Status Line # Status Line
### #===============================================================================
set -g status-utf8 on setw -g monitor-activity on # Monitor window activity
setw -g monitor-activity on set -g visual-activity off # No status line message
set -g visual-activity off set -g allow-rename off # Disallow program renaming
set -g allow-rename off
set -g status-left-length 40
set -g status-left "#[bright][ #S ] "
set -g status-right-length 80
set -g status-right "#(ruby ~/.dotfiles/tmux/clocks.rb)"
set -g status-left-length 40 # Left-side char length
set -g status-left "#[bright][ #S ] " # Left-side format
set -g status-right-length 80 # Right-side char length
# Right-side format: Custom clock script, in dotfile location
set -g status-right "#[bright]#(sh ~/.dotfiles/tmux/clocks.sh)"
# Window list format, and selected format
set -g window-status-format '#[bg=black,fg=cyan] #I #[bg=default]' set -g window-status-format '#[bg=black,fg=cyan] #I #[bg=default]'
set -g window-status-current-format '#[fg=black,bg=cyan]#[fg=bright] #I ' set -g window-status-current-format '#[fg=black,bg=cyan]#[fg=bright] #I '
#===============================================================================
# Key Bindings
#===============================================================================
setw -g mode-keys vi # Vi-like key bindings
###### bind h select-pane -L # Pane movement: left
# Keybinds bind j select-pane -D # Pane movement: down
### bind k select-pane -U # Pane movement: up
bind l select-pane -R # Pane movement: right
# Act like vim bind-key -r C-h select-window -t :- # Window movement: left
setw -g mode-keys vi bind-key -r C-l select-window -t :+ # Window movement: right
# Pane movement bind -r H resize-pane -L 5 # Pane resize: +5 left
bind h select-pane -L bind -r J resize-pane -D 5 # Pane resize: +5 down
bind j select-pane -D bind -r K resize-pane -U 5 # Pane resize: +5 up
bind k select-pane -U bind -r L resize-pane -R 5 # Pane resize: +5 right
bind l select-pane -R
# Window movement
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# Pane resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Split window and fix path for tmux 1.9
bind | split-window -h #-c "#{pane_current_path}"
bind - split-window -v #-c "#{pane_current_path}"
bind | split-window -h -c "#{pane_current_path}" # Horizontal split
bind - split-window -v -c "#{pane_current_path}" # Vertical split
# Reload config file # Reload config file
bind r source-file ~/.tmux.conf \; display "Config Reloaded!" bind r source-file ~/.tmux.conf \; display "Config Reloaded!"
# Capture a pane into file for uploading to Gist
# bind-key u capture-pane \; save-buffer /tmp/tmux-buffer
# Captur selection, create a gist from it # Captur selection, create a gist from it
#bind-key -tvi-copy u copy-pipe "~/Workbench/dotfiles/tmux/copy_selected.sh"
bind-key -tvi-copy u copy-pipe "ruby ~/Lab/gist_gem.rb -" bind-key -tvi-copy u copy-pipe "ruby ~/Lab/gist_gem.rb -"
#===============================================================================
######
# Plugins # Plugins
### #===============================================================================
# TPM || Install: <C-b>I | Uninstall: <C-b><Alt-u> | Update: <C-b>U
# TPM - Tmux Plugin Manager
# Install Plugins: <C-b> + I
# Uninstall Plugins: <C-b> + <Alt-u>
# Update Plugins: <C-b> + U
set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tpm'
# Resurrect sessions || Save: <C-b><C-s> | Restore: <C-b><C-r>
# Resurrect sessions
# Save: <C-b> + <C-s>
# Restore: <C-b> + <C-r>
set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'nhdaly/tmux-scroll-copy-mode' # Copy-mode scroll wheel
# Allow for scroll-wheel copy mode run '~/.tmux/plugins/tpm/tpm' # Run TPM
set -g @plugin 'nhdaly/tmux-scroll-copy-mode'
# Run TPM
run '~/.tmux/plugins/tpm/tpm'