# vi: set syntax=tmux foldmethod=marker : # # NEEDED FILES {{{ # ~/bin/cpu-usage {{{ # cat > ~/bin/cpu-usage <<'EOF' # #!/bin/bash # if [[ -z $1 ]]; then # echo "Need a process name to grep for, thanks" # exit 1 # fi # ps aux | grep $1 | grep -v grep | perl -lnE' # $cpu += (split(/\s+/))[3]; # push @cpu, $cpu; # END { # $nproc = scalar @cpu; # say $nproc # ? sprintf("%.3f%","@{[ $cpu/$nproc ]} (${nproc}p)") # : "n/a" # } # ' #EOF }}} # }}} # end needed files # MISC {{{ set default-shell /bin/zsh # start windows numbers from 1 rather than 0, to reduce keyboard walk needed to # get to the "first" window set -g base-index 1 # Terminal emulator window title set -g set-titles on # hostname sessionname:windowindex.paneindex windowname (windowtitle) #set -g set-titles-string '#H #S:#I.#P #W (#T)' set -g set-titles-string '#H~#S:#I.#P #W' # Notifying if other windows has activities setw -g monitor-activity on set -g visual-activity on # Clock setw -g clock-mode-colour green setw -g clock-mode-style 24 # End MISC }}} # KEYBOARD BINDINGS {{{ # Use Vi mode setw -g mode-keys vi # C-b C-b switch to last window bind-key C-b last-window # C-b C-c to create new window bind ^C new-window # Choose window using ^B+W bind W choose-window bind w choose-window # hjkl to move across panes unbind h bind-key h select-pane -L unbind j bind-key j select-pane -D unbind k bind-key k select-pane -U unbind l bind-key l select-pane -R # HJKL to resize windows bind -r J resize-pane -D 1 bind -r K resize-pane -U 1 bind -r L resize-pane -R 1 bind -r H resize-pane -L 1 # split bindings unbind % unbind '"' bind | split-window -h bind \ split-window -h bind - split-window -v # Pasting unbind 'p' bind p paste-buffer bind -t vi-copy v begin-selection bind -t vi-copy y copy-selection bind -t vi-copy Escape cancel ## bind for git status -- can't work as all commands are executed in $HOME #bind-key G command-prompt "split-window 'git %% 2>&1 | less'" ## SSH to a host on a split-window ## bind-key S command-prompt "split-window 'ssh %%'" # C-b S to choose session bind-key S choose-session # r to reload tmux.conf bind-key r source-file ~/.tmux.conf # End bindings }}} # PANES + BORDERS {{{ # Panes' border should be white on black set pane-border-fg white set pane-border-bg black # except the -active- pane, green on black set pane-active-border-fg green set pane-active-border-bg black # End panes borders }}} # MOUSE {{{ # Make mouse useful in copy mode setw -g mode-mouse on set -g mouse-select-pane off #set -g mouse-select-window on # End mouse}}} # STATUS BAR {{{ # The status bar should be able to understand utf8 characters. set -g status-utf8 on # The status window looks good white on black set -g status-fg white set -g status-bg colour234 # ORIG: set -g status-left '#[fg=green]#S:#I.#P#[default] ' set -g status-right-length 60 set -g status-right '#[fg=green](httpd #(~/bin/cpu-usage apache2) vi #(~/bin/cpu-usage vi)) #[fg=red]#(uptime | perl -nle"print((split(/load average: /\)\)[1]\)") #[fg=white]%Y%m%d_%H%M#[default]' #set -g status-right '#[fg=red]#(uptime | perl -nle"print((split(/load average: /\)\)[1]\)") #[fg=white]%Y-%m-%d_%H:%M#[default]' #set -g status-right '#[fg=yellow]#(cut -d " " -f 1-4 /proc/loadavg)#[default] #[fg=cyan,bold]%Y-%m-%d %H:%M:%S#[default]' # Highlighting the active window in *status* bar using bold and [] setw -g window-status-current-bg black setw -g window-status-current-fg white setw -g window-status-current-attr "bold" setw -g window-status-current-format " [#I:#W#F] " # With patched font from YADR: set -g status-left-length 52 set -g status-right-length 60 set -g status-left '#[fg=colour235,bg=colour252,bold]#S:#I.#P#[fg=colour252,bg=colour238,nobold]⮀#[fg=colour252,bg=colour238,bold]#(whoami)@#(uname -n)##[fg=colour238,bg=colour234,nobold]⮀' set -g status-right '#[fg=colour116](httpd #(~/bin/cpu-usage apache2) vi #(~/bin/cpu-usage vi)) #[fg=colour140,nobold]#(uptime | perl -nle"print((split(/load average: /\)\)[1]\)") #[fg=white]%Y%m%d_%H%M#[default]' setw -g window-status-format "#[fg=white,bg=colour234]#I:#W" #setw -g window-status-current-format "#[fg=colour40,bg=colour234]⮀#[fg=colour40,bg=colour234,noreverse,bold] #I ⮁ #W #[fg=colour40,bg=colour234,nobold]⮂" setw -g window-status-current-format "#[fg=colour40,bg=colour234]▻#[fg=colour40,bg=colour234,noreverse,bold] #I ● #W #[fg=colour40,bg=colour234,nobold]◅" ##### status-left hash-vars: # #(shell-command) First line of the command's output (executed every status-interval) # #[attributes] Colour or attribute change # #H Hostname of local host # #F Current window flag # #I Current window index # #P Current pane index # #S Session name # #T Current window title # #W Current window name # ## A literal ‘#’ # End status bar }}}