zshrc config

本文介绍如何安装配置 Oh My Zsh,包括安装 Zsh、使用 Oh My Zsh 官方安装脚本、安装插件如 zsh-autosuggestions 和 zsh-syntax-highlighting,以及如何配置 powerlevel10k 主题。
摘要由CSDN通过智能技术生成

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.
在这里插入图片描述

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值