-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
executable file
·65 lines (52 loc) · 1.31 KB
/
.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Begin ~/.zshrc
#
# Prompt
RPROMPT='%S[%~]%s %B[%h]%b'
PROMPT="%S(%T)%s %n@%B%m%b%# "
# files
## history
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
#etc
## directory stack
setopt autopushd
## keybind(like the vim)
bindkey -v
ulimit -c 1000000
## exports
export LANG=en_US.UTF-8
export EDITOR="vim"
export PYTHONSTARTUP=~/.pythonrc
export PATH=$PATH:$HOME/bin
## autoload
autoload -U compinit
compinit
# functions
function cd() {builtin cd $@ && ls -v -F --color=auto}
# alias
alias ls='ls -v -F --color=auto'
alias rot13='tr A-Za-z N-ZA-Mn-za-m'
alias hd='hexdump -C'
alias socat='socat2'
## rbenv
#eval "$(rbenv init -)"
# selection of history
function peco-history-selection() {
BUFFER=$(history 1 | 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 "$LBUFFER")
CURSOR=${#BUFFER}
zle reset-prompt
}
zle -N peco-history-selection
bindkey -M vicmd "^R" peco-history-selection
# debug
function select_pid() {
initial_query=$( [[ -n "${1}" ]] && print "${1}" || print "")
pid=$(ps aux | peco --query "${initial_query}" | awk '{print $2}' )
print -n ${pid}
}
function att() {
module_name=$( [[ -n "${1}" ]] && print "${1}" || print "")
gdb -q -p $(select_pid "${module_name}")
}