zsh: add config files
This commit is contained in:
1
zsh/alias.zsh
Normal file
1
zsh/alias.zsh
Normal file
@@ -0,0 +1 @@
|
||||
alias ll="ls -alG"
|
||||
2
zsh/environment.zsh
Normal file
2
zsh/environment.zsh
Normal file
@@ -0,0 +1,2 @@
|
||||
export CLICOLOR=1
|
||||
export LSCOLORS=ExGxBxDxCxEgEdxbxgxcxd
|
||||
32
zsh/init.zsh
Normal file
32
zsh/init.zsh
Normal file
@@ -0,0 +1,32 @@
|
||||
zshrc=~/.zshrc
|
||||
if [ -z $zshrc ]; then
|
||||
echo "Err: Cannot find dotfile directory."
|
||||
exit -1
|
||||
fi
|
||||
|
||||
dotfile_dir=$(readlink -f $(dirname $(readlink -f $zshrc))/..)
|
||||
zsh_dir=$dotfile_dir/zsh
|
||||
|
||||
|
||||
################################################################################
|
||||
# ZPLUG initialisation and plugin list
|
||||
|
||||
source $zsh_dir/plugin.zsh
|
||||
|
||||
|
||||
################################################################################
|
||||
# ENVIRONMENT initialisation
|
||||
|
||||
source $zsh_dir/environment.zsh
|
||||
|
||||
|
||||
################################################################################
|
||||
# ALIAS initialisation
|
||||
|
||||
source $zsh_dir/alias.zsh
|
||||
|
||||
|
||||
################################################################################
|
||||
# PROMPT initialisation
|
||||
|
||||
source $zsh_dir/prompt.zsh
|
||||
29
zsh/plugin.zsh
Normal file
29
zsh/plugin.zsh
Normal file
@@ -0,0 +1,29 @@
|
||||
# Prepare for plugin init
|
||||
source $zsh_dir/zplug/init.zsh
|
||||
|
||||
### BEGIN PLUGIN LIST ##########################################################
|
||||
|
||||
# Syntax highlighting
|
||||
zplug "zsh-users/zsh-syntax-highlighting", defer:2
|
||||
|
||||
# Command suggestions
|
||||
zplug "zsh-users/zsh-autosuggestions"
|
||||
|
||||
# History search
|
||||
zplug "zsh-users/zsh-history-substring-search"
|
||||
|
||||
# Jump to recent directories
|
||||
zplug "agkozak/zsh-z"
|
||||
|
||||
### END PLUGIN LIST ############################################################
|
||||
|
||||
# Finalise plugin init
|
||||
if ! zplug check --verbose; then
|
||||
printf "Install? [y/N]: "
|
||||
if read -q; then
|
||||
echo; zplug install
|
||||
fi
|
||||
fi
|
||||
|
||||
# Then, source plugins and add commands to $PATH
|
||||
zplug load
|
||||
6
zsh/prompt.zsh
Normal file
6
zsh/prompt.zsh
Normal file
@@ -0,0 +1,6 @@
|
||||
parse_git_branch() {
|
||||
git symbolic-ref --short HEAD 2> /dev/null | sed -E 's/(.+)/ [\1]/g'
|
||||
}
|
||||
|
||||
setopt prompt_subst
|
||||
PROMPT='%F{yellow}%m%F{none}:%F{blue}%2d%F{none}%F{red}$(parse_git_branch) %F{%(?.green.red)}%#%F{none} '
|
||||
Reference in New Issue
Block a user