当前位置: 首页 > news >正文

一六零、云服务器开发机配置zsh

切换shell

在Linux中默认使用/bin/bash,在用户创建时,会自动给用户创建用户默认的shell。
默认的shell就是/bin/bash。要修改shell将其设置为/bin/ksh,有两种方法方法

# 方法一: chsh -s /bin/ksh
chsh -s /bin/zsh # 方法二: usermod -s /bin/ksh rootusermod -s /bin/zsh root# 查看当前使用的shell
echo $SHELL# 查看所有可用的shell
cat /etc/shells

安装zsh

yum install zsh

安装 Oh My Zsh

  1. 下载安装脚本 https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh
  2. 如果开发机没有外网权限,则修改 install.sh 中 REMOTE=KaTeX parse error: Expected '}', got 'EOF' at end of input: ….baidu-int.com/{REPO}.git} 为我厂的 github mirror
  3. 一键安装
sh install.sh --skip-chsh

安装 powerlevel10k

powerlevel10k 是一款非常优秀的 zsh 主题,可直接克隆仓库:

git clone --depth=1 https://github.baidu-int.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k

在 ~/.zshrc 中修改主题 ZSH_THEME=“powerlevel10k/powerlevel10k” 后,可通过 p10k configure 命令采用问答快速定制化自己的配置,配置完成后还可以在 ~/.p10k.zsh 中自己设置,包括左右栏显示的信息等。
如果配置完成后显示有乱码或者符号显示不完全,是因为没有设置对应的字体,在 nerd-fonts 下载 Hack Nerd Font 或 Meslo Nerd Font 字体并在 iTerm2 正确设置后即可正常显示。

常用插件

Oh My Zsh 提供了非常丰富的插件,可根据自己的喜好来安装(但也不宜过多),常用的插件有 git, z, zsh-syntax-highlighting, zsh-autosuggestions
需要在 ~/.zshrc 中修改 plugins 为 plugins=(git z zsh-syntax-highlighting zsh-autosuggestions)

VSCode 终端字体修改

在 settings 中搜索 terminal font,修改为之前设置的 iTerm2 相同的字体即可。

效果图

image.png

tmux 配置

安装及配置

使用 jumbo 安装 tmux 新版:

jumbo install tmux2

使用以下配置覆盖 ~/.tmux.conf:
.tmux.conf

# ------ general ------------------------------------
set -g prefix C-s
unbind C-b
bind C-s send-prefixset -g escape-time 0
set -g base-index 1
set -g renumber-windows on
set -g mouse on
set -wg pane-base-index 1# rename-window
set -wg allow-rename off
set -wg automatic-rename offset -wg mode-keys vi# last-window
bind a last# retain current path
bind c new-window -c "#{pane_current_path}"
bind _ split-window -h -c "#{pane_current_path}"
bind - split-window -c "#{pane_current_path}"# restart and edit
bind r source ~/.tmux.conf\; display "tmux config sourced"
bind e neww -n tmux-config "\${EDITOR:-vim} ~/.tmux.conf"# ------ move around --------------------------------
bind -r h select-pane -L
bind l select-pane -R        # remove repeat, because of ls
bind -r j select-pane -D
bind -r k select-pane -U# ------ status theme -------------------------------
set -g message-style "bg=#00346e, fg=#ffffd7"        # tomorrow night blue, base3set -g status-style "bg=#00346e, fg=#ffffd7"   # tomorrow night blue, base3
set -g status-left "#[bg=#0087ff] ❐ #S "       # blue
set -g status-left-length 400
set -g status-right "#{?client_prefix, ⌨ , } #[bg=#0087ff] #(whoami)@#h #[bg=red] %Y-%m-%d %H:%M "
set -g status-right-length 600set -g set-clipboard on
set -g history-limit 10000set -wg window-status-format " #I #W "
set -wg window-status-current-format " #I #W "
set -wg window-status-separator ""
set -wg window-status-current-style "bg=red" # red
set -wg window-status-last-style "fg=red"set -wg pane-active-border-style "fg=blue"
set -wg pane-border-style "fg=#585858"       # base01set -g default-terminal "screen-256color"# ------- copy to clipboard ------------------------
# bind -t vi-copy y copy-pipe 'xclip -selection clipboard > /dev/null'
# bind -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"

将快捷键更新为 C-s,设置鼠标开启,配置我厂的蓝红配色等。

vim 配置

安装插件

安装 vim-plug 管理插件:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

使用如下代码覆盖 ~/.vimrc 来安装 vim-airline,vim-airline-themes,vim-one,nerdtree 插件(使用 :PlugInstall 来安装)以及一些简单的 vim 配置
.vimrc

call plug#begin('~/.vim/plugged')Plug 'https://github.baidu-int.com/vim-airline/vim-airline'
Plug 'https://github.baidu-int.com/vim-airline/vim-airline-themes'
Plug 'https://github.baidu-int.com/preservim/nerdtree'call plug#end()set number
set cursorline
set cursorcolumn
set noshowmode" airline
let g:airline_theme='dracula'
let g:one_allow_italics=1
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#left_sep=' '
let g:airline#extensions#tabline#left_alt_sep='|'
let g:airline#extensions#tabline#buffer_nr_show=1" NERDTree
map <C-n> :NERDTreeToggle<CR>
http://www.lryc.cn/news/412597.html

相关文章:

  • [ZJCTF 2019]NiZhuanSiWei1
  • 【网络安全】副业兼职日入12k,网安人不接私活就太可惜了!
  • [STM32]HAL库实现自己的BootLoader-BootLoader与OTA-STM32CUBEMX
  • 鸿萌数据备份服务:中小型企业如何策划及实施云备份方案
  • x264 编码过程中延迟逻辑分析
  • 前端框架 element-plus 发布 2.7.8
  • 2024.8.1(前端服务器的配置以及tomcat环境的配置)
  • 使用 宝塔面板 部署 语料库php网站
  • springboot农产品报价系统-计算机毕业设计源码37300
  • 食源送系统项目的测试
  • JS解构赋值
  • 多多OJ评测系统 前端项目环境初始化 安装Vue脚手架 引入Arco Design组件
  • OceanBase 配置项系统变量实现及应用详解(4):新增系统变量
  • `CAUTION: request is not finished yet!`
  • 科研绘图系列:R语言GWAS曼哈顿图(Manhattan plot)
  • DjangoRF-11-创建testcases子应用--任务模块
  • 服务器数据恢复—SAN环境下LUN被重复映射导致写操作不互斥的数据恢复案例
  • Linux系统安全加固:从防火墙到SELinux策略
  • 排序算法:归并排序,golang实现
  • CSS 的工作原理
  • 买完就后悔?只需几步教你 Apple 怎么申请退款
  • 【保卫战】休闲小游戏 链游
  • 如何构建自己的交易机器人开发环境
  • 解决WordPress文章引用的图片不显示问题
  • 商业银行国际结算规模创新高,合合信息AI助力金融行业智能处理多版式文档
  • 数字芯片设计验证经验分享:将ASIC IP核移植到FPGA上——更新概念并推动改变以完成充满挑战的任务!
  • 【Linux】Linux下的日志(日常级)
  • 手把手教你如何在Linux上轻松安装Python,告别编程入门难题
  • XSS-labs靶场(超详解)1-20关——附原码
  • 【网络安全】LockBit病毒入侵揭秘:如何防范与应对