A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
zsh
插件和主题集合和管理工具。
官方地址:https://github.com/robbyrussell/oh-my-zsh
安装方法有两种,可以使用 curl 或 wget,看自己环境或喜好:
# curl 安装方式 sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# wget 安装方式 sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
安装完 oh-my-zsh
成后,界面如下:
[root@Dev]/# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" Cloning Oh My Zsh... Initialized empty Git repository in /root/.oh-my-zsh/.git/ remote: Enumerating objects: 1001, done. remote: Counting objects: 100% (1001/1001), done. remote: Compressing objects: 100% (920/920), done. remote: Total 1001 (delta 24), reused 843 (delta 18), pack-reused 0 Receiving objects: 100% (1001/1001), 643.62 KiB | 195 KiB/s, done. Resolving deltas: 100% (24/24), done. Looking for an existing zsh config... Using the Oh My Zsh template file and adding it to ~/.zshrc Time to change your default shell to zsh! Changing shell for root. Shell changed. __ __ ____ / /_ ____ ___ __ __ ____ _____/ /_ / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ / /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / \____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ /____/ ....is now installed! Please look over the ~/.zshrc file to select plugins, themes, and options. p.s. Follow us at https://twitter.com/ohmyzsh. p.p.s. Get stickers and t-shirts at https://shop.planetargon.com. ➜ /
官方地址:http://powerline.readthedocs.io/en/latest/installation.html
安装powerline的方式依然简单,也只需要一条命令:
pip install powerline-status --user
没有安装pip的同学可能会碰到 zsh: command not found: pip
,使用命令安装pip即可
sudo easy_install pip
安装后再次执行安装 pip install powerline-status --user
的命令即可
都安装后,可以执行命令打开 zshrc
配置文件,我目前用的 ZSH_THEME 为 ys
这是oh my zsh的一个插件,安装方式与theme大同小异:
cd ~/.oh-my-zsh/custom/plugins/ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git vi ~/.zshrc
这时我们再次打开zshrc文件进行编辑。找到plugins,此时plugins中应该已经有了git,我们需要把高亮插件也加上:
# Which plugins would you like to load? # Standard 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) # Add wisely, as too many plugins slow down shell startup. plugins=( git zsh-syntax-highlighting )
请务必保证插件顺序,zsh-syntax-highlighting 必须在最后一个。
然后在文件的最后一行添加:
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
按一下esc调出vi命令,输入:wq保存并退出vi模式。
执行命令使刚才的修改生效:
都安装后,可以执行命令打开 zshrc
配置文件,我目前用的 ZSH_THEME 为 ys
source ~/.zshrc
跟代码高亮的安装方式一样,这也是一个zsh的插件,叫做zsh-autosuggestion,用于命令建议和补全。
cd ~/.oh-my-zsh/custom/plugins/ git clone https://github.com/zsh-users/zsh-autosuggestions vi ~/.zshrc
找到plugins,加上这个插件即可:
plugins=( git zsh-autosuggestions zsh-syntax-highlighting )
请务必保证插件顺序,zsh-syntax-highlighting 必须在最后一个,执行 source 让改动生效。
source ~/.zshrc
至此,阁下已经再命令行下,可以看到新的效果了~
切换到 zsh 后,有没有发现之前有些命令无法使用了,比如输入 php- m,会提示 command not found ? 这里列出出现zsh: command not found: xxx 的解决方法
把 bash shell 中.bash_profile 全部环境变量加入zsh shell里就好,打开 .zshrc
,找到 “# User configuration”,加入:
# User configuration source ~/.bash_profile
#执行 source 让其生效 source .zshrc