配置zsh以及powerLine主题安装

  • 安装 zsh
  • 安装 oh-my-zsh
  • 安装 powerline及字体
  • 查看命令
    • 查看已有的shell
    • 查看当前shell
    • 使用zsh替换bash(重新打开终端生效)
    • 还原bash(需要重启)
    • 查看zsh版本
  • powerline 配置
    • bashrc 配置(注意python版本)
    • vim .zshrc(注意python版本)
  • vim配置
  • 解决zsh中无法正常使用home和end等键的问题
  • 更换powerline主题

安装 zsh

sudo  pacman -S zsh

安装 oh-my-zsh

sh -c "$wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)”或
wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh
sh install.sh
或
https://github.com/robbyrussell/oh-my-zsh/archive/master.zip

安装 powerline及字体

pacman -S powerline
pacman -S powerline-fonts
pacman -S powerline-vim

查看命令

查看已有的shell

cat /etc/shells

查看当前shell

echo $SHELL

使用zsh替换bash(重新打开终端生效)

chsh -s /bin/zsh

还原bash(需要重启)

chsh -s /bin/bash

查看zsh版本

zsh --version

powerline 配置

bashrc 配置(注意python版本)

vim ~/.bashrc  ## 可不配置# powerline
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /usr/lib/python3.7/site-packages/powerline/bindings/bash/powerline.sh
应用: source ~/.bashrc

vim .zshrc(注意python版本)

vim ~/.zshrc 文件配置

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH# Path to your oh-my-zsh installation.export ZSH="$HOME/.oh-my-zsh"# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder# 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
)source $ZSH/oh-my-zsh.sh# User configuration# export MANPATH="/usr/local/man:$MANPATH"# You may need to manually set your language environment
# export LANG=en_US.UTF-8# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi# Compilation flags
# export ARCHFLAGS="-arch x86_64"# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"# powerline
powerline-daemon -q
. /usr/lib/python3.7/site-packages/powerline/bindings/zsh/powerline.zsh#color{{{autoload colors
colorsfor color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval _$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval $color='%{$fg[${(L)color}]%}'
(( count = $count + 1 ))
done
FINISH="%{$terminfo[sgr0]%}"
#}}}#命令提示符
#RPROMPT=$(echo "$RED%D %T$FINISH")
#PROMPT=$(echo "$CYAN%n@$YELLOW%M:$GREEN%/$_YELLOW>$FINISH ")#PROMPT=$(echo "$BLUE%M$GREEN%/
#$CYAN%n@$BLUE%M:$GREEN%/$_YELLOW>>>$FINISH ")
#标题栏、任务栏样式{{{case $TERM in (*xterm*|*rxvt*|(dt|k|E)term)
precmd () { print -Pn "\e]0;%n@%M//%/\a" }
preexec () { print -Pn "\e]0;%n@%M//%/\ $1\a" }
;;
esac
#}}}#关于历史纪录的配置 {{{#历史纪录条目数量
export HISTSIZE=10000
#注销后保存的历史纪录条目数量
export SAVEHIST=10000
#历史纪录文件
export HISTFILE=~/.zsh_history
#以附加的方式写入历史纪录
setopt INC_APPEND_HISTORY
#如果连续输入的命令相同,历史纪录中只保留一个
setopt HIST_IGNORE_DUPS
#为历史纪录中的命令添加时间戳
setopt EXTENDED_HISTORY#启用 cd 命令的历史纪录,cd -[TAB]进入历史路径
setopt AUTO_PUSHD
#相同的历史路径只保留一个
setopt PUSHD_IGNORE_DUPS#在命令前添加空格,不将此命令添加到纪录文件中
#setopt HIST_IGNORE_SPACE
#}}}# 补全{{{#彩色补全菜单
eval $(dircolors -b)
export ZLSCOLORS="${LS_COLORS}"
zmodload zsh/complist
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'#修正大小写
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'
#错误校正
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric#kill 命令补全
compdef pkill=kill
compdef pkill=killall
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:*:*:*:processes' force-list always
zstyle ':completion:*:processes' command 'ps -au$USER'#补全类型提示分组
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*' group-name ''
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'
zstyle ':completion:*:descriptions' format $'\e[01;33m -- %d --\e[0m'
zstyle ':completion:*:messages' format $'\e[01;35m -- %d --\e[0m'
zstyle ':completion:*:warnings' format $'\e[01;31m -- No Matches Found --\e[0m'
zstyle ':completion:*:corrections' format $'\e[01;32m -- %d (errors: %e) --\e[0m'# cd ~ 补全顺序
zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'users' 'expand'
#}}}##行编辑高亮模式 {{{# Ctrl+@ 设置标记,标记和光标点之间为 region
zle_highlight=(region:bg=magenta #选中区域
special:bold      #特殊字符
isearch:underline)#搜索时使用的关键字
#}}}##空行(光标在行首)补全 "cd " {{{user-complete(){case $BUFFER in
"" )                       # 空行填入 "cd "
BUFFER="cd "
zle end-of-line
zle expand-or-complete
;;
"cd --" )                  # "cd --" 替换为 "cd +"
BUFFER="cd +"
zle end-of-line
zle expand-or-complete
;;
"cd +-" )                  # "cd +-" 替换为 "cd -"
BUFFER="cd -"
zle end-of-line
zle expand-or-complete
;;
* )
zle expand-or-complete
;;
esac
}
zle -N user-complete
bindkey "\t" user-complete
#}}}#命令别名 {{{alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
alias ls='ls -F --color=auto'
alias ll='ls -l --color=auto'
alias grep='grep --color=auto'
alias la='ls -a'
alias pacman='pacman --color=auto'
alias yay='yay --color=auto'
#}}}#漂亮又实用的命令高亮界面
setopt extended_glob
TOKENS_FOLLOWED_BY_COMMANDS=('|' '||' ';' '&' '&&' 'sudo' 'do' 'time' 'strace')recolor-cmd() {region_highlight=()
colorize=true
start_pos=0
for arg in ${(z)BUFFER}; do
((start_pos+=${#BUFFER[$start_pos+1,-1]}-${#${BUFFER[$start_pos+1,-1]## #}}))
((end_pos=$start_pos+${#arg}))
if $colorize; then
colorize=false
res=$(LC_ALL=C builtin type $arg 2>/dev/null)
case $res in
*'reserved word'*)   style="fg=magenta,bold";;
*'alias for'*)       style="fg=cyan,bold";;
*'shell builtin'*)   style="fg=yellow,bold";;
*'shell function'*)  style='fg=green,bold';;
*"$arg is"*)
[[ $arg = 'sudo' ]] && style="fg=red,bold" || style="fg=blue,bold";;
*)                   style='none,bold';;
esac
region_highlight+=("$start_pos $end_pos $style")
fi
[[ ${${TOKENS_FOLLOWED_BY_COMMANDS[(r)${arg//|/\|}]}:+yes} = 'yes' ]] && colorize=true
start_pos=$end_pos
done
}
check-cmd-self-insert() { zle .self-insert && recolor-cmd }
check-cmd-backward-delete-char() { zle .backward-delete-char && recolor-cmd }zle -N self-insert check-cmd-self-insert
zle -N backward-delete-char check-cmd-backward-delete-char

vim配置

vim ~/.vimrc

let g:powerline_pycmd="py3"
set laststatus=2
set t_Co=256
syntax on

解决zsh中无法正常使用home和end等键的问题

方案1(会出现删除整个单词的情况):

来自:https://bbs.archlinux.org/viewtopic.php?pid=201942#p201942

# 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
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\ee[C" forward-word
bindkey "\ee[D" backward-word
bindkey "^H" backward-delete-word
# 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

方案2:

来自:https://anjia0532.github.io/2017/09/10/zsh-home-end-keypad-not-work/

# Home
bindkey '\e[1~' beginning-of-line
# End
bindkey '\e[4~' end-of-line# Keypad
# 0 . Enter
bindkey -s "^[Op" "0"
bindkey -s "^[Ol" "."
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 "^[Ok" "+"
bindkey -s "^[Om" "-"
bindkey -s "^[Oj" "*"
bindkey -s "^[Oo" "/"

更换powerline主题

修改config.py中的theme的设置,然后运行 install.py

manjaro 配置zsh以及powerLine主题安装相关推荐

  1. 【MacOS】命令行配置zsh以及powerlevel10k主题

    一.概述 前段时间在B站上看到有UP主在Manjaro Linux上使用了zsh并且配置一个超级炫酷的主题powerlevel9k:传送门.看了之后非常跃跃欲试,想在我的iMac上也配置一下,但是网上 ...

  2. manjaro配置zsh和oh-my-zsh

    追求美观的人一定不会错过一个漂亮的命令行(苹果本的终端也能用这个插件). 查看现有shell cat /etc/shells 查看默认shell echo $SHELL 修改默认终端为zsh(manj ...

  3. 【Mac】破解死循环,成功安装 Homebrew、curl、wget,快速配置 zsh

    由于工作原因最近咬牙跺脚地买了个 Mackbook M1 pro,到手接近一个月了,但一直没来得及深度研究配置 mac 开发环境,因为主要的工作内容还是通过 VPN 连接到公司的服务器,然后使用 VS ...

  4. [美化deepin终端]deepin安装配置zsh、zsh相关插件及zsh的卸载

    这个事情还是要从我看到后面chen哥的电脑说起,总而言之,我在chen哥那发现了好用的插件,那么我们当然也要搞来耍耍啊.然后就这么突然,我按照chen哥给的方法,踩坑无数啊,然后昨天晚上还没搞成它的样 ...

  5. Linux、Ubuntu、CentOS安装和配置zsh

    文章目录 01 zsh的安装 02 配置zsh 2.1 安装oh-my-zsh 2.2 查看oh-my-zsh目录 2.3 oh-my-zsh 插件的管理 2.3.1 添加插件 2.3.2 zsh-a ...

  6. MAC上安装iTerm2+oh my zsh+设置Dracula主题

    MAC上安装iTerm2+oh my zsh+设置dracula主题 iTerm2 + oh my zsh 安装教程 Dracula主题安装教程 问题解决教程

  7. mac安装配置zsh

    mac安装配置zsh 比mac自带的shell好用太多 一.安装homebrew 参考:https://brew.sh/index_zh-cn /bin/bash -c "$(curl -f ...

  8. manjaro配置arch源_manjaro 切换国内源及软件安装

    配置国内源 1.配置镜像源: sudo pacman-mirrors -i -c China -m rank 2.设置 archlinuxcn 源,antergos源,arch4edu源: sudo ...

  9. Butterfly主题安装文档(二)之主题配置

    语言 修改项目配置文件 _config.yml 默认语言是 en language: zh-CN 主题支持三种语言: default(en) zh-CN (简体中文) zh-TW (繁体中文) 网站资 ...

最新文章

  1. 知乎问答:现在程序员的工资是不是被高估了?
  2. 国外好的软件测试网站
  3. 斐波那契数列 C++ 实现代码
  4. autohotkey编写windows脚本实现test.lab试验数据快速导出
  5. Bootstrap3 带表格的面板
  6. 小红书疑似被下架 官方回应正在积极沟通
  7. Hive Udf Rank
  8. 互联网名词和广告名词缩写大全
  9. arcgis怎么压缩tif文件_PDF文件怎么压缩才能变小?这样压缩,真的很简单!
  10. python就业方向-目前最全的Python的就业方向
  11. 梦幻西游手游服务器维护公告,《梦幻西游手游》10月5日维护公告 部分区服合并...
  12. qemu 规范路径_EVE-NG镜像添加技巧(以思科虚拟化产品为例)
  13. 这款小巧精致的 Keychron K7 满足了我对键盘的所有想象
  14. Win10自带的备份工具备份系统
  15. 谈谈分布式服务治理框架 Dubbo 重大升级
  16. 综合训练(考勤系统)
  17. 关于libpthread.a静态链接缺少依赖问题
  18. 报错:Invalid character found in method name. HTTP method names must be tokens
  19. input框聚焦时,提示文字上移
  20. 【Android】Android学习之按钮变成蓝紫色

热门文章

  1. Educoder第1关:学习-Java集合类之Collection接口之往集合中添加元素
  2. Android KeyCode对照表
  3. 手机上怎么记录恋爱天数?用便签记录情侣相恋天数
  4. c语言输出300 800之间最大的素数,辅助谁一级伤害最高?东皇:300,盾山:800,最强混子输出超1000...
  5. 微信小程序之统一下单
  6. Java快速输入输出使用详解(解决Java输入输出超时问题)
  7. Android仿高德地图app,Android仿微信调用第三方地图应用导航(高德、百度、腾讯)...
  8. c语言 void swap,C语言的swap函数的易错点
  9. Python爬取《悲伤逆流成河》猫眼信息
  10. 网络适配器中找不到VMware Network Adapter VMnet8选项