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_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
SEGMENT_GIT_INFO_LEFT="%F{249} $SEGMENT_GIT_INFO_LEFT %k%f"
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"

View file

@ -1,17 +1,7 @@
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
export TERM=xterm-256color
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# 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"
export ZSH=$HOME/.zsh
fpath=($ZSH/functions $ZSH/completions $fpath)
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
@ -35,22 +25,15 @@ ZSH_TMUX_FIXTERM=true
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 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'
source $ZSH/oh-my-zsh.sh
source ~/.zsh-theme
autoload -Uz $fpath[1]/*(.:t)
autoload -Uz promptinit
promptinit
@ -58,11 +41,21 @@ autoload -U zsh-mime-setup
autoload -U zsh-mime-handler
zsh-mime-setup
#autoload -Uz vcs_info
#zstyle ':vcs_info:*' enable git svn hg bzr mtn
#precmd() {
# vcs_info
#}
autoload -Uz relative
autoload -Uz zcalc
autoload -Uz zm
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:(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 f='fortune 30% discworld 30% hitchhiker 10% vimtips 30% fr/kaamelott'
json-fortune
export NVM_DIR="$HOME/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-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
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
@ -54,6 +47,12 @@ then
gsettings set org.cinnamon.muffin.keybindings minimize "['<Primary><Alt>r']"
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
rsync -av ./common/ ~/