-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc
More file actions
99 lines (80 loc) · 2.63 KB
/
Copy pathzshrc
File metadata and controls
99 lines (80 loc) · 2.63 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Created by ta9mi1shi1 for 5.0.7
##############################
# Keybinding
##############################
bindkey -v
zmodload zsh/complist
bindkey -M viins '^A' beginning-of-line
bindkey -M viins '^N' down-line-or-history
bindkey -M viins '^P' up-line-or-history
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
##############################
# History
##############################
HISTFILE="$HOME/.zsh_history"
HISTSIZE=500000 # The number of histories saved to memory
SAVEHIST=500000 # The number of histories saved to HISTFILE
setopt extended_history # Save history with timestamp (UNIX time) and execution time
setopt hist_ignore_dups
setopt inc_append_history
setopt share_history # Share history with other terminals
##############################
# Prompt
##############################
PROMPT='%F{yellow}%n%f@%F{cyan}%m%f:$ '
RPROMPT='%F{white}%d%f'
##############################
# Alias
##############################
alias ls='ls --color=auto'
alias la='ls -a'
alias ll='ls -l'
alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'
alias clear='clear -x'
##############################
# Completion
##############################
autoload -U compinit; compinit
zstyle ':completion:*:default' menu select=1
##############################
# Options
##############################
setopt correct # Correct command spelling
setopt auto_cd # If input command doesn't exist and matches a name of directory, cd the directory
setopt auto_pushd # Use directory stack
setopt pushd_ignore_dups
##############################
# Distro-specific Settings
##############################
bind-fzf-history-widget-accept() {
fzf-history-widget-accept() {
fzf-history-widget
zle accept-line
zle redisplay
}
zle -N fzf-history-widget-accept
bindkey -M viins '^R' fzf-history-widget-accept
}
# Arch Linux
if [ -e /etc/arch-release ]; then
neofetch # Print basic system information
# Settings of fzf
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh
bind-fzf-history-widget-accept
fi
# Darwin
if [ $(uname -s) = "Darwin" ]; then
alias ls='ls -G'
# Settings of fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
bind-fzf-history-widget-accept
# Settings of google-cloud-sdk
source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc # Enable shell command completion for gcloud
source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc # Add the Google Cloud SDK command line tools to $PATH
fi