Update: ZSH without Oh My ZSH

This commit is contained in:
Kujiu 2020-11-16 22:12:46 +01:00
parent 15dfa7fa55
commit 5de3a24660
Signed by: kujiu
GPG key ID: ABBB2CAC6855599F
3 changed files with 39 additions and 35 deletions

View file

@ -38,11 +38,11 @@ ZSH_THEME_GIT_PROMPT_AHEAD="%F{orange}[Ahead]%F{black}"
ZSH_THEME_GIT_PROMPT_BEHIND="%F{orange}[Behind]%F{black}" ZSH_THEME_GIT_PROMPT_BEHIND="%F{orange}[Behind]%F{black}"
ZSH_THEME_GIT_PROMPT_DIVERGED="%F{orange}[Diverged]%F{black}" ZSH_THEME_GIT_PROMPT_DIVERGED="%F{orange}[Diverged]%F{black}"
SEGMENT_GIT_INFO_LEFT='$(git_prompt_status)' SEGMENT_GIT_INFO_LEFT="\$(git_prompt_status)"
if [ $SEGMENT_GIT_INFO_LEFT ]; then if [ $SEGMENT_GIT_INFO_LEFT ]; then
SEGMENT_GIT_INFO_LEFT="%F{249} $SEGMENT_GIT_INFO_LEFT %k%f" SEGMENT_GIT_INFO_LEFT="%F{249} $SEGMENT_GIT_INFO_LEFT %k%f"
fi fi
SEGMENT_GIT_INFO_RIGHT=$'${vcs_info_msg_0_}' SEGMENT_GIT_INFO_RIGHT="${vcs_info_msg_0_}"
zstyle ':vcs_info:*' formats "(%s)-[%b]%u%c" zstyle ':vcs_info:*' formats "(%s)-[%b]%u%c"

View file

@ -1,17 +1,7 @@
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
export TERM=xterm-256color export TERM=xterm-256color
# Set name of the theme to load. export ZSH=$HOME/.zsh
# Look in ~/.oh-my-zsh/themes/ fpath=($ZSH/functions $ZSH/completions $fpath)
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#ZSH_THEME="robbyrussell"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion # Set to this to use case-sensitive completion
# CASE_SENSITIVE="true" # CASE_SENSITIVE="true"
@ -35,22 +25,15 @@ ZSH_TMUX_FIXTERM=true
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor root) ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor root)
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git mercurial battery command-not-found colorize debian django git tig virtualenv \
gitfast git-extras node npm nvm pep8 pip yarn suse salt rsync nmap \
python tmux vi-mode zsh-syntax-highlighting urltools otp gradle \
extract emotty emoji cp history zsh-history-substring-search)
alias mpc='mpc -f "%title%[ - %album%]\n\r%artist%[ - %performer%]\n\r%file%"' alias mpc='mpc -f "%title%[ - %album%]\n\r%artist%[ - %performer%]\n\r%file%"'
alias pip-upgrade='pip freeze --user | cut -d'=' -f1 | xargs -n1 pip install -U --user' alias pip-upgrade='pip freeze --user | cut -d'=' -f1 | xargs -n1 pip install -U --user'
alias pip-upgrade-venv='pip freeze | cut -d'=' -f1 | xargs -n1 pip install -U' alias pip-upgrade-venv='pip freeze | cut -d'=' -f1 | xargs -n1 pip install -U'
source $ZSH/oh-my-zsh.sh
source ~/.zsh-theme source ~/.zsh-theme
autoload -Uz $fpath[1]/*(.:t)
autoload -Uz promptinit autoload -Uz promptinit
promptinit promptinit
@ -58,11 +41,21 @@ autoload -U zsh-mime-setup
autoload -U zsh-mime-handler autoload -U zsh-mime-handler
zsh-mime-setup zsh-mime-setup
#autoload -Uz vcs_info autoload -Uz relative
#zstyle ':vcs_info:*' enable git svn hg bzr mtn autoload -Uz zcalc
#precmd() { autoload -Uz zm
# vcs_info autoload -Uz vcs_info
#} autoload -Uz history-pattern-search
zle -N history-pattern-search-backward history-pattern-search
zle -N history-pattern-search-forward history-pattern-search
autoload -Uz read-from-minibuffer
setopt extendedglob
zstyle ':vcs_info:*' enable git svn hg bzr mtn
precmd() {
vcs_info
}
setopt prompt_subst
zstyle ':vcs_info:*' actionformats zstyle ':vcs_info:*' actionformats
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
@ -158,7 +151,6 @@ alias androidcast="adb shell \"while true; do screenrecord --output-format=h264
alias goigs="telnet igs.joyjoy.net 6969" alias goigs="telnet igs.joyjoy.net 6969"
alias f='fortune 30% discworld 30% hitchhiker 10% vimtips 30% fr/kaamelott' alias f='fortune 30% discworld 30% hitchhiker 10% vimtips 30% fr/kaamelott'
json-fortune
export NVM_DIR="$HOME/nvm" export NVM_DIR="$HOME/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
@ -166,3 +158,16 @@ export NVM_DIR="$HOME/nvm"
source ~/.zshrc-local source ~/.zshrc-local
source ~/.zshrc-private source ~/.zshrc-private
for config_file ($ZSH/vendor/*/*.zsh $ZSH/lib/*.zsh); do
source $config_file
done
unset config_file
emulate -L zsh
zmodload -i zsh/parameter
bindkey '^R' history-incremental-pattern-search-backward
bindkey '^F' history-incremental-pattern-search-forward
json-fortune

View file

@ -14,13 +14,6 @@ pushd ~/.vim/spell
wget -r -nH --cut-dirs=5 -nc ftp://ftp.vim.org//pub/vim/runtime/spell wget -r -nH --cut-dirs=5 -nc ftp://ftp.vim.org//pub/vim/runtime/spell
popd popd
# Install oh-my-zsh
rm -rf ~/.oh-my-zsh
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
mkdir -p ~/.oh-my-zsh/custom/plugins
git clone git://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-history-substring-search ~/.oh-my-zsh/custom/plugins/zsh-history-substring-search
touch ~/.zshrc-local touch ~/.zshrc-local
@ -54,6 +47,12 @@ then
gsettings set org.cinnamon.muffin.keybindings minimize "['<Primary><Alt>r']" gsettings set org.cinnamon.muffin.keybindings minimize "['<Primary><Alt>r']"
fi fi
# ZSH plugins
mkdir -p ~/.zsh/vendor
git clone git://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/vendor/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-history-substring-search ~/.zsh/vendor/zsh-history-substring-search
touche ~/.zshrc-private
# Copy the common part # Copy the common part
rsync -av ./common/ ~/ rsync -av ./common/ ~/