type
status
date
slug
summary
tags
category
titleIcon
password
icon
calloutIcon
🤠
记录新机器上的win与linux的环境配置,包含powershell与zsh相关配置;关键词:linux;代理;shell;oh-my-posh;zsh;powerlevel10k

先行配置

编辑器 - VSCode & Neovim

兼容旧Distro的VSCode版本选取

  • 如果使用的虚拟机包括centos7等过于古旧的linux版本,会因vscode的ssh插件在依赖要求版本上的变动而无法连接,可以选择相对早一些的vscode版本,如1.96.4
notion image
相关问题详情见:

SSH相关的插件安装

  • 可以安装Remote Development一键安装其他需要的插件,可以用于打开远程机器的文件夹(Remote-SSH),记录远程打开的文件夹(Remote Explorer),配置本地SSH连接文件(Remote-SSH:Editing…)
notion image
  • 用于在vscode中编辑文件后以root权限保存,可以理解为sudo vi 编辑文件保存
notion image
  • remote explorer效果:可以对打开过的机器上常用的workspace记录并快捷打开
notion image
  • save as root效果:ctrl+shift+p后搜save as root即可以root权限保存文件,第一次保存需要输入密码
notion image

终端shell安装

  • windows - 使用powershell 7.5
  • 可以先在Microsoft Store内安装 终端/terminal 应用
  • 然后通过winget install --id Microsoft.Powershell --source winget安装powershell,或其他方式安装:
notion image
notion image
  • 如果访问不了Microsoft Store,如卡在加载动画,可以通过UWP配置代理 + 修改地区(地区解决找不到包的问题,UWP解决加载不出的问题)解决
  • 通过代理工具的UMP工具或自行安装fiddler,在里面勾选Microsoft Store
notion image
notion image
  • 卡在加载示意图
notion image
  • 修改后预期的正常行为示意图
notion image
  • linux - zsh/powershell
linux上其实也可以使用powershell,这样可以复用windows上的相关配置文件,主要问题在于如果使用了oh-my-posh或者starship一类后,可能出现命令执行后有一段延迟再出现光标的情况,手感体验不佳,此处仅讨论zsh在linux上的安装
  • 直接使用oh-my-zsh快速安装

包管理工具

  • windows推荐使用scoop,既适用于包安装,也可以起到类似nvm这样的切换环境版本的效果
  • linux可使用linuxbrew

Neovim快速配置

  • 如果觉得linux上使用vscode ssh过于重量级或windows上简单编辑文件vscode比较占用内存,可以使用neovim编辑
  • 通过以上包管理工具安装neovim后安装lazyvim
安装命令-linux
安装命令-win
lazyvim安装
win的对应目录在$env:LOCALAPPDATA\nvim
安装后可以通过nvim命令运行,初次运行需要下载安装相关插件
参考效果:
notion image

Powershell配置

参考视频(可选)

  • 参考视频,如果在油管上看过视频,可以直接跳到代理与主题配置
Video preview

配置文件位置

  • 参见图中目录,user_profile代表为当前用户的配置
notion image

配置内容

  • oh-my-posh美化与自定义主题
  • 文件系统图标模块 | fzf模糊查找 | psreadline历史提示 | z快速切换历史目录
  • 效果展示:
z快速跳转
notion image
notion image
fzf与psreadline提示
notion image
terminal-icons终端图标
notion image
  • 代理
  • 如果部分内容耗时较久,可以自行添加打印加载时长
notion image

Zsh配置

参考视频

ZSH with Zinit: Say Goodbye to Boring Terminals!
🔗 Special Offer: Check out Codecrafters.io using my link for up to 40% off and start building Redis, Git, or Docker from scratch like a pro! https://app.codecrafters.io/join?via=kalidyasin My Dotfiles https://github.com/codeopshq/dotfiles 🚀 Supercharge Your Terminal with ZSH 🚀 Tired of the same old terminal experience? In this video, I’ll guide you step-by-step through installing and customizing ZSH, the ultimate shell for developers. From managing plugins with Zinit to styling your terminal with Powerlevel10k, I’ve got everything you need to take your workflow to the next level. 💡 What You’ll Learn: Why ZSH is a game-changer for developers. How to install and set up ZSH on Linux, macOS, and Windows (via WSL). Plugin management using Zinit for powerful features like autocompletion and syntax highlighting. Customizing your terminal with Powerlevel10k for a sleek, modern look. Adding aliases and configurations to boost productivity. 🎉 Codecrafters.io Giveaway! Want a chance to win a lifetime subscription, 1-year accounts, or 3-month accounts for Codecrafters.io? It’s easy! Comment your GitHub username below and Signup using this link https://app.codecrafters.io/join?via=kalidyasin to enter. Winners will be announced after January 25th, 2025. Learn more about Codecrafters here: https://codecrafters.io 👨‍💻 Chapters: 00:00 - Intro 00:30 - Ad: Codecrafters.io Giveaway Announcement 01:39 - Why ZSH? 01:56 - Installation 02:47 - Zinit 04:44 - Powerlevel10k 06:34 - Useful Plugins 08:56 - Configurations and Aliases 10:42 - How to Enter the Giveaway 💻 Resources & Links: ZSH Documentation: https://zsh.sourceforge.io/ Zinit Plugin Manager: https://github.com/zdharma-continuum/zinit Powerlevel10k Theme: https://github.com/romkatv/powerlevel10k Codecrafters.io: https://codecrafters.io 📌 Follow Me for More Content: Subscribe for more tutorials like this and stay tuned for the giveaway results! 👍 Like, 💬 Comment, and 🔔 Subscribe for updates!
ZSH with Zinit: Say Goodbye to Boring Terminals!

配置内容

  • 代理配置
zsh代理配置(仅使用于当前用户,如果切换到root可能没有作用) 在.zshrc下追加两条
notion image
root代理配置 在etc/environment下追加两条
notion image
如果需要apt等其他地方配置代理,可参考:
如果需要docker配置代理,可参考:
  • 按顺序:brew环境变量;zinit(管理zsh插件);相关插件;相关行为配置
参考效果:
notion image
notion image
 
MetingJS使用自定义音乐源-CF+Huggingface部署折腾linux虚拟机杂记
Loading...
CamelliaV
CamelliaV
Java;CV;ACGN
最新发布
SEU9系本硕资料
2025-6-14
中英文开发资料汇总
2025-6-14
Leetcode Hot 100解题记录 - 草稿
2025-6-14
神领物流Day02复盘-运费业务 - 草稿
2025-6-4
天机学堂完结复盘-更新草稿
2025-6-4
Redis5.0源码学习 - 草稿
2025-6-3
公告
计划:
  • LLM相关
  • 支付业务 & 双token无感刷新
  • (线程池计算优惠方案)天机学堂Day09-Day12复盘-优惠劵业务
  • (业务复盘,技术汇总)天机学堂完结复盘
  • hot 100
 
2024-2025CamelliaV.

CamelliaV | Java;CV;ACGN