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:
parent
bb1eb48bcb
commit
9aa4f84cbe
4 changed files with 69 additions and 177 deletions
|
@ -1,16 +1,15 @@
|
|||
#Tmux Configuration Files
|
||||
# Tmux Configuration Files
|
||||
|
||||
My tmux configuration is very straight forward. Of note, I enable mouse mode,
|
||||
and have custom colors configured. I also have a few custom scripts.
|
||||
My tmux configuration is very straight forward and fully commented. Of note, I
|
||||
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
|
||||
- [Scroll-Wheel Copy Mode](https://www.github.com/nhdaly/tmux-scroll-copy-mode)
|
||||
- [Resurrect](https://www.github.com/tmux-plugins/tmux-resurrect): Session
|
||||
Management
|
||||
|
||||
### Custom Scripts
|
||||
- clocks.sh/rb: My custom status bar. Shows time for 4 different time zones,
|
||||
plus the date and weather of my default home location.
|
||||
|
||||
- clocks.sh: My custom status bar. Shows time for 4 different time zones.
|
||||
- copy\_selected.sh: Enables uploading of the selected text to Gist.
|
||||
|
|
|
@ -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()
|
|
@ -8,9 +8,4 @@ buffTime="$(TZ=America/New_York date +'%b %d %R')"
|
|||
utcTime="$(date -u +%R)"
|
||||
bangTime="$(TZ=Asia/Kolkata date +%R)"
|
||||
|
||||
caliForm="#[fg=red]<][ $caliTime ] "
|
||||
buffForm="#[fg=green]<][ $buffTime | #[fg=red](!)#[fg=green]][> "
|
||||
utcForm="#[fg=blue][ $utcTime ][> "
|
||||
bangForm="#[fg=magenta][ $bangTime ][>>"
|
||||
|
||||
echo "$caliForm""$buffForm""$utcForm""$bangForm"" "
|
||||
echo "<][ $caliTime ] <][ $buffTime ][> [ $utcTime ][> [ $bangTime ][>> "
|
||||
|
|
179
tmux/tmux.conf
179
tmux/tmux.conf
|
@ -1,136 +1,81 @@
|
|||
############
|
||||
######
|
||||
# Tmux Configuration for niblock
|
||||
###
|
||||
############
|
||||
|
||||
# Remap the prefix, but not to C-A incase we need to screen
|
||||
set-option -g prefix C-b
|
||||
|
||||
# Set default terminal, colors, and encoding
|
||||
set -g default-terminal "screen-256color"
|
||||
setw -g utf8 on
|
||||
|
||||
#start window numbers at 1
|
||||
set -g base-index 1
|
||||
setw -g pane-base-index 1
|
||||
|
||||
#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
|
||||
|
||||
######
|
||||
#===============================================================================
|
||||
# tmux.conf for niblock || source with <C-b>r
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
# General Settings
|
||||
#===============================================================================
|
||||
set-option -g prefix C-b # Remap prefix key
|
||||
set -g default-terminal "screen-256color" # Set terminal
|
||||
setw -g utf8 on # Set encoding
|
||||
set -g mouse on # Enable mouse
|
||||
set -sg escape-time 0 # Delay time
|
||||
set -g display-time 2000 # Message display time
|
||||
set -g base-index 1 # Start windows at 1
|
||||
setw -g pane-base-index 1 # Start panes at 1
|
||||
set -g renumber-windows on # Renumber dynamically
|
||||
#===============================================================================
|
||||
# Colors
|
||||
###
|
||||
#===============================================================================
|
||||
set -g status-fg cyan # Status bar foreground
|
||||
set -g status-bg black # Status bar background
|
||||
|
||||
## Status Bar and Related Items
|
||||
# Bar itself
|
||||
set -g status-fg cyan
|
||||
set -g status-bg black
|
||||
setw -g window-status-fg cyan # Window list foreground
|
||||
setw -g window-status-bg black # Window list background
|
||||
|
||||
# Window list
|
||||
setw -g window-status-fg cyan
|
||||
setw -g window-status-bg default
|
||||
setw -g window-status-attr dim
|
||||
set -g pane-border-fg black # Pane divider foreground
|
||||
set -g pane-border-bg black # Pane divider background
|
||||
set -g pane-active-border-fg cyan # Active pane foreground
|
||||
set -g pane-active-border-bg black # Active pane background
|
||||
|
||||
setw -g window-status-current-fg white
|
||||
setw -g window-status-current-bg black
|
||||
setw -g window-status-current-attr bright
|
||||
|
||||
## 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
|
||||
|
||||
######
|
||||
set -g message-fg red # Command line foreground
|
||||
set -g message-bg black # Command line background
|
||||
set -g message-attr bright # Bold
|
||||
#===============================================================================
|
||||
# Status Line
|
||||
###
|
||||
set -g status-utf8 on
|
||||
setw -g monitor-activity on
|
||||
set -g visual-activity off
|
||||
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)"
|
||||
#===============================================================================
|
||||
setw -g monitor-activity on # Monitor window activity
|
||||
set -g visual-activity off # No status line message
|
||||
set -g allow-rename off # Disallow program renaming
|
||||
|
||||
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-current-format '#[fg=black,bg=cyan]#[fg=bright] #I '
|
||||
#===============================================================================
|
||||
# Key Bindings
|
||||
#===============================================================================
|
||||
setw -g mode-keys vi # Vi-like key bindings
|
||||
|
||||
######
|
||||
# Keybinds
|
||||
###
|
||||
bind h select-pane -L # Pane movement: left
|
||||
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
|
||||
setw -g mode-keys vi
|
||||
bind-key -r C-h select-window -t :- # Window movement: left
|
||||
bind-key -r C-l select-window -t :+ # Window movement: right
|
||||
|
||||
# Pane movement
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
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 -r H resize-pane -L 5 # Pane resize: +5 left
|
||||
bind -r J resize-pane -D 5 # Pane resize: +5 down
|
||||
bind -r K resize-pane -U 5 # Pane resize: +5 up
|
||||
bind -r L resize-pane -R 5 # Pane resize: +5 right
|
||||
|
||||
bind | split-window -h -c "#{pane_current_path}" # Horizontal split
|
||||
bind - split-window -v -c "#{pane_current_path}" # Vertical split
|
||||
# Reload config file
|
||||
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
|
||||
#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 -"
|
||||
|
||||
######
|
||||
#===============================================================================
|
||||
# Plugins
|
||||
###
|
||||
|
||||
# TPM - Tmux Plugin Manager
|
||||
# Install Plugins: <C-b> + I
|
||||
# Uninstall Plugins: <C-b> + <Alt-u>
|
||||
# Update Plugins: <C-b> + U
|
||||
#===============================================================================
|
||||
# TPM || Install: <C-b>I | Uninstall: <C-b><Alt-u> | Update: <C-b>U
|
||||
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'
|
||||
|
||||
# Allow for scroll-wheel copy mode
|
||||
set -g @plugin 'nhdaly/tmux-scroll-copy-mode'
|
||||
|
||||
# Run TPM
|
||||
run '~/.tmux/plugins/tpm/tpm'
|
||||
set -g @plugin 'nhdaly/tmux-scroll-copy-mode' # Copy-mode scroll wheel
|
||||
run '~/.tmux/plugins/tpm/tpm' # Run TPM
|
||||
|
|
Loading…
Reference in a new issue