admin 管理员组文章数量: 1086019
About Linux系统下安装zsh
1、在线安装zsh
sudo apt-get install zsh
2、查看系统中有的shell
cat /etc/shells | lolcat
3、临时切换shell
/bin/zsh
类似
/bin/bash
4、修改默认shell
chsh -s /bin/zsh
同理
chsh -s /bin/bash
5、查看当前使用的shell
echo $SHELL
5、zsh快速上手
目前常用的 Linux 系统和 OS X 系统的默认 Shell 都是 bash,但是真正强大的 Shell 是深藏不露的 zsh, 这货绝对是马车中的跑车,跑车中的飞行车,史称『终极 Shell』,但是由于配置过于复杂,所以初期无人问津,很多人跑过来看看 zsh 的配置指南,什么都不说转身就走了。直到有一天,国外有个穷极无聊的程序员开发出了一个能够让你快速上手的zsh项目,叫做「oh my zsh」,Github 网址是:。
zsh 就是一款强大的虚拟终端,网上也都推荐使用 oh my zsh 来管理配置。由于我开始使用zsh时使用 zsh 的 包管理器 antigen 来管理所有功能,所以更习惯、更喜欢使用 antigen 这种。关于包管理器 antigen这种配置管理方式,给出一篇参考文章,在初步了解oh my zsh 和 antigen 之后看自己的情况进行选择。
5.1 安装 antigen
# 修改配置 ~/.zshrc(切换帐号后无法使用 zsh, 则把该用户的配置文件再配一遍)
curl -L .zsh > ~/.zshrc# 修改主题, 参考:
# 如果需要主题一直生效需要添加到 ~/.zshrc 中
antigen theme ys# 配置修改完重新执行 zsh
# 如果出现警告:zsh compinit: insecure directories, run compaudit for list.
chmod -R 755 ~/.antigen# zsh中加入home end,以及小键盘的支持,在 ~/.zshrc 文件末尾添加下面的内容:# key bindings
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
# for freebsd console
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
# completion in the middle of a line
bindkey '^i' expand-or-complete-prefix# Fix numeric keypad
# 0 . Enter
bindkey -s "^[Op" "0"
bindkey -s "^[On" "."
bindkey -s "^[OM" "^M"
# 1 2 3
bindkey -s "^[Oq" "1"
bindkey -s "^[Or" "2"
bindkey -s "^[Os" "3"
# 4 5 6
bindkey -s "^[Ot" "4"
bindkey -s "^[Ou" "5"
bindkey -s "^[Ov" "6"
# 7 8 9
bindkey -s "^[Ow" "7"
bindkey -s "^[Ox" "8"
bindkey -s "^[Oy" "9"
# + - * /
bindkey -s "^[Ol" "+"
bindkey -s "^[Om" "-"
bindkey -s "^[Oj" "*"
bindkey -s "^[Oo" "/"
5.2 安装 ohmyzsh
sh -c "$(curl -fsSL .sh)"#安装zsh-syntax-higlighting语法高亮插件 & 安装zsh-autosuggestions语法历史记录插件
cd .oh-my-zsh/custom/plugins/
# pwd
/root/.oh-my-zsh/custom/plugins
# 下载插件
git clone .git
git clone .gitcd ~
vim .zshrc
# 配置plugins
plugins=(gitzsh-syntax-highlightingzsh-autosuggestions)source $ZSH/oh-my-zsh.sh
# 添加下面两行
source $ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh# shift+zz 快速保存退出vim
/bin/zsh
#需要先切换到zsh shell,才能正确执行下面source .zshrc
source .zshrc
oh my zsh 更多配置内容可参考文章-Ubuntu | 安装oh-my-zsh
本文标签: About Linux系统下安装zsh
版权声明:本文标题:About Linux系统下安装zsh 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1686729309a30178.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论