zshrc config

zshrc install

oh my zsh official website https://ohmyz.sh/

sudo apt install zsh
chsh -s /bin/zsh # must use ordinary user

# ctrl+d or new a terminal
enter a new terminal or shell
echo $SHELL # check if the zsh

# Download the onmyzsh and install ( Remember don't use root user )
# use wget (recommend)
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
# or use curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# if your network cannot connect, just separate the commond like this and use proxychains
proxychains wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh .
sh ./install.sh


# install zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# install zsh-completions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
# install sh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# set the enable plugins in ~/.zshrc 
# Notice that add the plugin name in the exsit plugins config positon 
plugins=( 
	git 
    # other plugins...
    zsh-autosuggestions
    zsh-completions
    zsh-syntax-highlighting
)



Now you can exit the shell and restart shell.
The oh my zsh is config success.


Note: if the autosuggestion color is white
you can add export TERM=xterm-256color to your zshrc and restart shell.

echo "export TERM=xterm-256color" >> ~/.zshrc

config the theme ( Optional )

I usually use powerlevel10k theme like this.
zshrc config_第1张图片

Install powerlevel10k theme

# download powerlevel10k theme to oh-my-zsh folder
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

# change the default theme
ZSH_THEME="powerlevel10k/powerlevel10k" # set in ~/.zshrc

# restart zsh
zsh

And the first time use powerlevel10k theme you need set the config.
My config file is https://github.com/gxt-kt/dotfiles/blob/master/zsh/.p10k.zsh.
Usually my config is

(2)  Classic.
(1)  Unicode.
(2)  Light.
(2)  24-hour format.
(2)  Blurred.
(2)  Blurred.
(2)  Two lines.
(2)  Dotted.
(4)  Full.
(2)  Sparse.
(2)  Fluent.
(n)  No.
(1)  Verbose (recommended).

If you want to reset the theme you can rm ~/.p10k.zsh to remove the config file.
And exec zsh to reconfig again.

Enhance ( Optional ) : autojump fzf

Install on archlinux.

yay -S autojump
yay -S fzf

Config plugin in .zshrc file.

   plugins=(
	git
	zsh-autosuggestions
	zsh-completions
	zsh-syntax-highlighting
	autojump
	extract
	fzf
)

Now you can source ~./.zshrc and use j command to use autojump. Use ** and tab to use fzf.

The autojump config file is on /home/gxt_kt/.local/share/autojump/autojump.txt.

你可能感兴趣的:(linux,github,git)