Skip to content

Instantly share code, notes, and snippets.

@koko1000ban
Last active August 29, 2015 14:06
Show Gist options
  • Save koko1000ban/e353a28f9c7f50e04b5c to your computer and use it in GitHub Desktop.
Save koko1000ban/e353a28f9c7f50e04b5c to your computer and use it in GitHub Desktop.
ISUCON用のdotfiles
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
peco-select-history() {
declare l=$(HISTTIMEFORMAT= history | sort -k1,1nr | perl -ne 'BEGIN { my @lines = (); } s/^\s*\d+\s*//; $in=$_; if (!(grep {$in eq $_} @lines)) { push(@lines, $in); print $in; }' | peco --query "$READLINE_LINE")
READLINE_LINE="$l"
READLINE_POINT=${#l}
}
bind -x '"\C-r": peco-select-history'
if [ -d ${HOME}/.rbenv ] ; then
export PATH="${HOME}/.rbenv/bin:${HOME}/.rbenv/shims:${PATH}"
eval "$(rbenv init -)"
fi
[core]
editor = vim
autocrlf = input #CRLFを自動変換
precomposeunicode = true
[alias]
s = status
st = status
ci = commit
cam = commit -a --amend #直前のコミットを修正
co = checkout
up = pull --rebase
br = branch
ba = branch -a
bm = branch --merged
bn = branch --no-merged
pl = pull
ps = push origin master
di = diff
url = config --get remote.origin.url
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`"
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
ranking = shortlog -s -n --no-merges
d1 = diff HEAD^
d2 = diff HEAD^^
d3 = diff HEAD^^^
d4 = diff HEAD^^^^
d5 = diff HEAD^^^^^
d10 = diff HEAD^^^^^^^^^^
newly = log HEAD@{1}..HEAD --reverse
newlyp = log HEAD@{1}..HEAD -p --reverse
graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%cn] %Cgreen%d%Creset %s\" --all --date=short
#log
wc = whatchanged # logに変更されたファイルも一緒に出す
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
ls = log --stat
la = log --pretty=\"format:%ad %h (%an): %s\" --date=short # ざっくりログ出す
ranking = shortlog -s -n --no-merges
# logをtree表示
log-graph = log --graph --date=short --pretty=format:'%Cgreen%h %cd %Cblue%cn %Creset%s'
lal = log --graph --all --color --pretty='%x09%h %cn%x09%s %Cred%d%Creset'
tr = log --graph --pretty='format:%C(yellow)%h%Creset %s %Cgreen(%an)%Creset %Cred%d%Creset'
# mergeの際にconflictが起きたファイルを編集
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`"
# mergeの際にconflictが起きたファイルをadd
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
delete-merged-branches = !git branch --merged | grep -v 'develop' | grep -v 'master' | grep -v \\* | xargs -I % git branch -d %
publish-master = !git checkout develop && git pull --rebase && git checkout -b release/$1 develop && git checkout master && git merge --no-ff release/$1
testing = !echo $1 && echo arg2='$2' && echo args=$@ && echo bar
cancel = !git commit -a -m 'temporary commit for cancel' && git reset --hard HEAD~
fetch-pulls = fetch ghe +refs/pull/*:refs/remotes/pull/*
[color]
ui = auto
diff = auto
status = auto
branch = auto
interactive = auto
grep = auto
[user]
name = tabito ohtani
email = [email protected]
set-window-option -g utf8 on
set-window-option -g automatic-rename off
set-option -g base-index 1
set-window-option -g mode-keys vi
set-option -g mouse-select-pane on
set-option -g display-time 2000
set-option -g buffer-limit 32
# set-option -g mode-mouse
set-option -g history-limit 10000
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
bind C-r source-file ~/.tmux.conf
# copy mode to escape key
unbind [
bind Escape copy-mode
#emacsふう
# bind-key ^2 split-window -v
# bind-key ^3 split-window -h
# bind-key ^1 break-pane
# C-b -> C-z
unbind C-b
set -g prefix ^Z
bind a send-prefix
# suspend
bind q suspend-client
# new screen ^C c
unbind ^C
bind ^C new-window
bind c new-window
# detach ^D d
unbind ^D
bind ^D detach
# next ^@ ^N sp n
unbind ^@
bind ^@ next-window
unbind ^N
bind ^N next-window
unbind " "
bind " " next-window
unbind n
bind n next-window
# title A
unbind A
bind A command-prompt "rename-window %%"
# other ^A
unbind ^A
bind ^A last-window
# prev ^H ^P p ^?
unbind ^H
bind ^H previous-window
unbind ^P
bind ^P previous-window
unbind p
bind p previous-window
unbind BSpace
bind BSpace previous-window
# windows ^W w
unbind ^W
bind ^W list-windows
unbind w
bind w list-windows
# quit \
unbind \
bind \ confirm-before "kill-server"
# kill K k
unbind K
bind K confirm-before "kill-window"
unbind k
bind k kill-pane
# redisplay ^L l
unbind ^L
bind ^L refresh-client
unbind l
bind l refresh-client
# split -v |
unbind l
bind l split-window -h
# split horizontal
bind / split-window
# :kB: focus up
unbind Tab
bind Tab select-pane -t:.+
unbind BTab
bind BTab select-pane -t:.-
# synchronized
bind e setw synchronize-panes on
bind E setw synchronize-panes off
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off with ^B M
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
# find like anything by percol
bind f split-window 'tmux lsw | percol | cut -d":" -f 1 | xargs tmux select-window -t'
bind -r H select-layout main-vertical \; swap-pane -s : -t 0 \; select-pane -t 0 \; resize-pane -R 9
bind -r K select-layout main-horizontal \; swap-pane -s : -t 0 \; select-pane -t 0 \; resize-pane -D 18
unbind-key s
bind-key s command-prompt "select-window -t '%%'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment