Skip to content

Instantly share code, notes, and snippets.

@uu59
Created December 30, 2011 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uu59/1540446 to your computer and use it in GitHub Desktop.
Save uu59/1540446 to your computer and use it in GitHub Desktop.
defscrollback 5000
escape ^Jj
msgwait 1
logfile "/tmp/log-screen-%Y%m%d-%n.log"
deflog on
cjkwidth on
caption always "%{= Kw}%n %t"
hardstatus alwayslastline "%{= kw}%`%-w%{=b rw}%n %t%{-}%+w %= [%Y-%m-%d %02c]"
shell zsh
bind ^w windowlist -b
bind j focus down
bind ^j focus down
bind k focus up
bind ^k focus up
bind l focus right
bind ^l focus right
bind h focus left
bind ^h focus left
bind ^o only
bind f select
bind r remove
defbce "on"
attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
term xterm-256color
#term screen-256color
# from `man screen`
# STRING ESCAPES
# Screen provides an escape mechanism to insert information like the cur‐
# rent time into messages or file names. The escape character is '%' with
# one exception: inside of a window's hardstatus '^%' ('^E') is used
# instead.
#
# Here is the full list of supported escapes:
#
# % the escape character itself
#
# a either 'am' or 'pm'
#
# A either 'AM' or 'PM'
#
# c current time HH:MM in 24h format
#
# C current time HH:MM in 12h format
#
# d day number
#
# D weekday name
#
# f flags of the window
#
# F sets %? to true if the window has the focus
#
# h hardstatus of the window
#
# H hostname of the system
#
# l current load of the system
#
# m month number
#
# M month name
#
# n window number
#
# s seconds
#
# t window title
#
# u all other users on this window
#
# w all window numbers and names. With '-' qualifier: up to the cur‐
# rent window; with '+' qualifier: starting with the window after
# the current one.
#
# W all window numbers and names except the current one
#
# y last two digits of the year number
#
# Y full year number
#
# ? the part to the next '%?' is displayed only if a '%' escape
# inside the part expands to a non-empty string
#
# : else part of '%?'
#
# = pad the string to the display's width (like TeX's hfill). If a
# number is specified, pad to the percentage of the window's
# width. A '0' qualifier tells screen to treat the number as
# absolute position. You can specify to pad relative to the last
# absolute pad position by adding a '+' qualifier or to pad rela‐
# tive to the right margin by using '-'. The padding truncates the
# string if the specified position lies before the current posi‐
# tion. Add the 'L' qualifier to change this.
#
# < same as '%=' but just do truncation, do not fill with spaces
#
# > mark the current text position for the next truncation. When
# screen needs to do truncation, it tries to do it in a way that
# the marked position gets moved to the specified percentage of
# the output area. (The area starts from the last absolute pad
# position and ends with the position specified by the truncation
# operator.) The 'L' qualifier tells screen to mark the truncated
# parts with '...'.
#
# { attribute/color modifier string terminated by the next "}"
#
# ` Substitute with the output of a 'backtick' command. The length
# qualifier is misused to identify one of the commands.
#
# The 'c' and 'C' escape may be qualified with a '0' to make screen use
# zero instead of space as fill character. The '0' qualifier also makes
# the '=' escape use absolute positions. The 'n' and '=' escapes under‐
# stand a length qualifier (e.g. '%3n'), 'D' and 'M' can be prefixed with
# 'L' to generate long names, 'w' and 'W' also show the window flags if
# 'L' is given.
#
# An attribute/color modifier is is used to change the attributes or the
# color settings. Its format is "[attribute modifier] [color descrip‐
# tion]". The attribute modifier must be prefixed by a change type indi‐
# cator if it can be confused with a color description. The following
# change types are known:
#
# + add the specified set to the current attributes
#
# - remove the set from the current attributes
#
# ! invert the set in the current attributes
#
# = change the current attributes to the specified set
#
# The attribute set can either be specified as a hexadecimal number or a
# combination of the following letters:
#
# d dim
# u underline
# b bold
# r reverse
# s standout
# B blinking
#
# Colors are coded either as a hexadecimal number or two letters specify‐
# ing the desired background and foreground color (in that order). The
# following colors are known:
#
# k black
# r red
# g green
# y yellow
# b blue
# m magenta
# c cyan
# w white
# d default color
# . leave color unchanged
#
# The capitalized versions of the letter specify bright colors. You can
# also use the pseudo-color 'i' to set just the brightness and leave the
# color unchanged.
# A one digit/letter color description is treated as foreground or back‐
# ground color dependent on the current attributes: if reverse mode is
# set, the background color is changed instead of the foreground color.
# If you don't like this, prefix the color with a ".". If you want the
# same behavior for two-letter color descriptions, also prefix them with
# a ".".
# As a special case, "%{-}" restores the attributes and colors that were
# set before the last change was made (i.e., pops one level of the color-
# change stack).
#
# Examples:
#
# "G" set color to bright green
#
# "+b r" use bold red
#
# "= yd" clear all attributes, write in default color on yellow back‐
# ground.
#
# %-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<
# The available windows centered at the current window and trun‐
# cated to the available width. The current window is displayed
# white on blue. This can be used with "hardstatus alwayslast‐
# line".
#
# %?%F%{.R.}%?%3n %t%? [%h]%?
# The window number and title and the window's hardstatus, if one
# is set. Also use a red background if this is the active focus.
# Useful for "caption string".
unbind C-b
set -g prefix C-j
set -g default-terminal "screen-256color"
set-option -g status-interval 1
set -g display-panes-time 10000
set-window-option -g mode-mouse on
set -g mouse-select-pane on
set-window-option -g mode-keys vi
set-window-option -g mode-bg colour249
set-window-option -g mode-fg black
set -g status-bg colour237
set -g status-fg colour15
set -g message-bg colour16
set -g message-fg colour231
set-window-option -g window-status-current-bg colour9
set-window-option -g window-status-current-attr bold
set -g pane-active-border-fg colour154
set -g pane-active-border-bg default
set -g pane-border-fg colour231
set -g pane-border-bg default
set -g status-utf8 on
set -g history-limit 10000 # scroll buffer size
set -g set-titles on
set -g set-titles-string "tmux.#I.#W"
set -g visual-activity on
set -g visual-content on
set-window-option -g monitor-activity on
set -g status-left ""
set -g status-right "#[default,fg=colour230]Fx #(ps aux|grep '[f]irefox'|awk '{sum = sum + $3} END{print sum}')% Ch #(ps aux|grep -E '[c]hromium-|[c]hrome'|awk '{sum = sum + $3} END{print sum}')% #(ps --sort pcpu axo comm,pid,pcpu|grep -v -E 'firefox|chrome|chromium-'|tail -n1|sed -E 's/ +/ /g'|awk '{print $1,$3}')%#[default] #[default,bg=colour92]#(ruby ~/ical-holiday-ja.rb)#[default] %Y-%m-%d(%a) %H:%M:%S"
set -g status-right-length 100
bind C-s command-prompt -p "split-window: input h or v" "split-window -%%"
bind s split-window -v
bind v split-window -h
bind C-w choose-window
bind C-r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
bind C-n next-window
bind C-p previous-window
# panes operation likes vim
bind C-k select-pane -U
bind C-j select-pane -D
bind C-l select-pane -R
bind C-h select-pane -L
bind C-o confirm-before "kill-pane -a"
bind -n C-Up resize-pane -U
bind -n M-C-k resize-pane -U
bind -n C-Down resize-pane -D
bind -n M-C-j resize-pane -D
bind -n C-Left resize-pane -L
# bind -n M-C-h resize-pane -L
bind -n C-Right resize-pane -R
# bind -n M-C-l resize-pane -R # os locking when using ubuntu :(
unbind Up
unbind Down
unbind Left
unbind Right
# ヒストリの設定
HISTFILE=~/.zsh-history
HISTSIZE=100000
SAVEHIST=100000
#export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
# 256 color http://d.hatena.ne.jp/kakurasan/20080703/p1
#export LS_COLORS="di=38;05;226" # vivid yellow
# http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html
# http://lucentbeing.com/blog/that-256-color-thing/
export EDITOR="vim"
export CFLAGS="-O2 -march=native -pipe"
export CXXFLAGS="${CFLAGS}"
export GREP_OPTIONS='--binary-files=without-match --directories=skip --color=auto'
export GISTY_DIR=$HOME/gisty
#SESSION_BUS_ADDRESS=$(tr '\0' '\n' < /proc/$(pgrep -U $(whoami) gnome-session)/environ|grep DBUS_SESSION_BUS_ADDRESS=|cut -d= -f2-)
alias tmux="tmux -2"
alias apti="sudo apt-get install"
alias apts="sudo apt-cache search"
alias aptf="sudo apt-file search"
alias ls="ls --color=auto"
alias df="LANG=C df"
bindkey -e
bindkey "^?" backward-delete-char
bindkey "^H" backward-delete-char
bindkey "^[[3~" delete-char
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
bindkey "^P" history-beginning-search-backward
bindkey "^N" history-beginning-search-forward
bindkey "^R" history-incremental-pattern-search-backward
bindkey "^G" history-incremental-pattern-search-forward
#bindkey "^S" history-incremental-search-forward
# 補完するかの質問は画面を超える時にのみに行う。
LISTMAX=0
# sudo でも補完の対象
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin
autoload -Uz compinit; compinit # 補完の利用設定
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '(%s)-[%b]'
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]'
setopt prompt_subst
setopt extended_history # 履歴ファイルに時刻を記録
setopt always_last_prompt # 無駄なスクロールを避ける
setopt append_history # 複数の zsh を同時に使う時など history ファイルに上書きせず追加
setopt auto_list # 補完候補が複数ある時に、一覧表示
setopt NO_beep # ビープ音を鳴らさないようにする
setopt hist_ignore_dups # 直前と同じコマンドラインはヒストリに追加しない
setopt hist_ignore_all_dups # 重複したヒストリは追加しない
setopt share_history # シェルのプロセスごとに履歴を共有
# vimぽいC-w
tcsh-backward-delete-word () {
local WORDCHARS="${WORDCHARS:s#/#}"
zle backward-delete-word
}
zle -N tcsh-backward-delete-word
bindkey '^W' tcsh-backward-delete-word
screen-title-set () {
[ ${STY} ] && [ $# -gt 0 ] && echo -ne '\ek'$1'\e\\'
}
# git
autoload bashcompinit
bashcompinit
source ~/src/git/contrib/completion/git-completion.bash
# ----------------------------------------
# hook
# ----------------------------------------
precmd () {
psvar=()
LANG=C vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
RPROMPT="%1(v|%F{yellow}%1v%f|)"
PROMPT="${USER}@u1004:%~ %F{yellow}($(~/.rvm/bin/rvm-prompt))%f%(!.#.$) "
PROMPT2="%B%{%}%__> %b"
}
if [ ${STY} ] ; then
preexec() {
screen-title-set ${1%% *}
#echo -ne "\ek${1%% *}\e\\"
}
fi
function colorcheck() {
FG=0
BG=0
while getopts "fb" OPTION
do
case $OPTION in
"f" ) FG=1 ;;
"b" ) BG=1 ;;
* ) echo 'Usage: colorcheck [-f] [-b]'; return 0;
;;
esac
done
if [ $FG = 0 -a $BG = 0 ];then
FG=1;
BG=1;
fi
if [ $FG = 1 ];then
echo '\\033[0;38;05;XXXm Text \\033[0m'
for color in `seq -f '%03g' 0 255`; do
echo -n "\t\033[38;05;${color}m $color \033[0m"
done
echo;
fi
if [ $BG = 1 ];then
echo '\\033[48;05;XXXm Text \\033[0m'
for color in `seq -f '%03g' 0 255`; do
echo -n "\033[48;05;${color}m $color \033[0m "
done
echo;
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment