refactor .zshrc
This commit is contained in:
42
zsh/.zshrc
42
zsh/.zshrc
@@ -1,8 +1,12 @@
|
||||
alias ls='ls --color=auto'
|
||||
alias grep='grep --color'
|
||||
|
||||
# aliases are stored in ~/.aliasrc
|
||||
if [ -f ~/.aliasrc ]; then
|
||||
source ~/.aliasrc
|
||||
fi
|
||||
|
||||
fpath+=~/.local/share/zsh/functions
|
||||
|
||||
typeset -U path
|
||||
path+=(~/bin)
|
||||
path+=(~/.local/bin)
|
||||
path+=($GOPATH/bin)
|
||||
@@ -56,9 +60,10 @@ function set_prompt() {
|
||||
aws_prompt=""
|
||||
fi
|
||||
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
PROMPT=$aws_prompt"%B${vcs_info_msg_0_}▶ %b"
|
||||
PROMPT=$aws_prompt"%B${vcs_info_msg_0_} ▶ %b"
|
||||
else
|
||||
PROMPT=$aws_prompt"%B%m:%~▶ %b"
|
||||
# PROMPT=$aws_prompt"%B%m:%~ ▶ %b"
|
||||
PROMPT=$aws_prompt"%B%m:%2~ ▶ %b"
|
||||
fi
|
||||
}
|
||||
precmd_functions+=( set_prompt )
|
||||
@@ -96,11 +101,11 @@ fi
|
||||
|
||||
# command line completion
|
||||
autoload -U +X bashcompinit && bashcompinit
|
||||
autoload -Uz compinit && compinit
|
||||
autoload -Uz compinit && compinit -C
|
||||
|
||||
# gcloud
|
||||
if [ -f '/home/cli/google-cloud-sdk/path.zsh.inc' ]; then . '/home/cli/google-cloud-sdk/path.zsh.inc'; fi
|
||||
if [ -f '/home/cli/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/cli/google-cloud-sdk/completion.zsh.inc'; fi
|
||||
if [ -f "$HOME/google-cloud-sdk/path.zsh.inc" ]; then . "$HOME/google-cloud-sdk/path.zsh.inc"; fi
|
||||
if [ -f "$HOME/google-cloud-sdk/completion.zsh.inc" ]; then . "$HOME/google-cloud-sdk/completion.zsh.inc"; fi
|
||||
|
||||
# kubectl
|
||||
[[ $commands[kubectl] ]] && source <(kubectl completion zsh)
|
||||
@@ -118,20 +123,15 @@ fi
|
||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
|
||||
# command line completion for ssh
|
||||
h=()
|
||||
if [[ -r ~/.ssh/config ]]; then
|
||||
#h=()
|
||||
#if [[ -r ~/.ssh/config ]]; then
|
||||
h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
|
||||
fi
|
||||
if [[ -r ~/.ssh/known_hosts ]]; then
|
||||
h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
|
||||
fi
|
||||
if [[ $#h -gt 0 ]]; then
|
||||
zstyle ':completion:*:(ssh|scp|slogin|sftp):*' hosts $h
|
||||
fi
|
||||
#fi
|
||||
#if [[ -r ~/.ssh/known_hosts ]]; then
|
||||
# h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
|
||||
#fi
|
||||
#if [[ $#h -gt 0 ]]; then
|
||||
# zstyle ':completion:*:(ssh|scp|slogin|sftp):*' hosts $h
|
||||
#fi
|
||||
|
||||
zstyle :compinstall filename '~/.zshrc'
|
||||
|
||||
#zstyle ':completion:*' completer _complete _ignored
|
||||
#zstyle :compinstall filename '~/.zshrc'
|
||||
|
||||
#compinit
|
||||
|
||||
Reference in New Issue
Block a user