Total Pageviews

Sunday, 22 February 2026

打造mac上的最强终端程序iterm2

 iTerm2 是 Mac OS 中使用最为广泛的终端工具,特有的插件 plugin 提供了主题选择、生命高亮、代码自动填充、分屏等功能,相较于自带的终端实在是强大太多。
安装iTerm2

下载地址:https://www.iterm2.com/downloads.html,通常有以下几种方式:

    直接下载压缩文件,解压后是执行程序文件,直接双击或拖到 Applications 目录下
    直接使用 Homebrew 进行安装,执行命令 brew cask install iterm2

 Oh My Zsh 是对主题的进一步扩展,地址:https://github.com/robbyrussell/oh-my-zsh
调整默认shell为Zsh

先把 Zsh 设置为当前用户的默认 Shell(这样新建标签的时候才会使用 Zsh),macOS已经自带zsh ,但是它不是默认shell

cat /etc/shells

# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

# 输入如下命令更改zsh为默认shell
chsh -s /bin/zsh

# 查看是否切换成功, 返回 /bin/zsh 就对了。
echo $SHELL

安装 oh-my-zsh

sh -c "$(curl -fsSL <https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh>)"

特说说明:上文中的地址可能无法使用,使用https://gitee.com/mirrors/oh-my-zsh/ 此处为国内同步文件。

安装好后的界面如下:

  ____  / /_     ____ ___  __  __   ____  _____/ /_
 / __ \\/ __ \\   / __ `__ \\/ / / /  /_  / / ___/ __ \\
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / /
\\____/_/ /_/  /_/ /_/ /_/\\__, /    /___/____/_/ /_/
                        /____/                       ....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 <http://shop.planetargon.com>.

主题安装
将 zsh的主题更改为 Dracula

# 下载主题文件
git clone <https://github.com/dracula/zsh.git>

# 创建一个指向Oh my zsh主题文件夹的符号链接,DRACULA_THEME是你刚才下载主题的目录
ln -s $DRACULA_THEME/dracula.zsh-theme ~/.oh-my-zsh/themes/dracula.zsh-theme

或者你可以移动主题文件dracula.zsh-theme到~/.oh-my-zsh/themes/下
提示: 显示隐藏文件夹的快捷键为command+shift+.

# 修改zsh主题。编辑~(用户名)下.zshrc文件,修改ZSH_THEME为"dracula"
$ vim ~/.zshrc

修改 iterm 配色为 Dracula

# 克隆文件
git clone <https://github.com/dracula/iterm.git>

# 打开设置
在 iTerm2 中 打开 Preferences 下面的 Profiles 的 Colors Tab 选项,使用 Import 导入配置,导入配置后,选中对应的 dracula 主题背景即可。

插件安装
命令自动补齐插件 zsh-autosuggestions

先克隆zsh-autosuggestions项目,到指定目录,然后编辑vim ~/.zshrc文件,找到plugins配置,增加zsh-autosuggestions插件。

cd ~/.oh-my-zsh/custom/plugins

git clone git://github.com/zsh-users/zsh-autosuggestions

cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

# 修改 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE 值
vim zsh-autosuggestions.zsh

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'

# 添加代码
vim ~/.zshrc
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# plugins 后增加zsh-autosuggestions
plugins=(git zsh-autosuggestions)

source ~/.zshrc

指令高亮效果插件zsh-autosuggestions

特殊命令和错误命令,会有高亮显示,可以用过编辑~/.zshrc文件,找到plugins配置,增加zsh-autosuggestions插件。

cd ~/.oh-my-zsh/custom/plugins

# 执行指令将工程克隆到当前目录
git clone git://github.com/zsh-users/zsh-syntax-highlighting.git

# 打开`.zshrc`文件,在最后添加下面内容
vim  ~/.zshrc

# 添加代码
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
plugins=(zsh-syntax-highlighting)
# 保存文件

#执行
source ~/.zshrc

iTerm2 配置代理

编辑~ vim ~/.zshrc,增加下面配置(使用的 shadowsocks):

# proxy list
alias proxy='export all_proxy=socks5://127.0.0.1:1086'
alias unproxy='unset all_proxy'
iTerm2 需要新建标签页,才有效果:

$ proxy
$ curl ip.cn
当前 IP:185.225.14.5 来自:美国

$ unproxy
$ curl ip.cn
当前 IP:115.236.186.130 来自:浙江省杭州市 电信

 

全局环境加载

将shell从bash切换到zsh之后,可能有的环境变量会失效,需要将原来在bash配置文件中的配置转移到zsh配置文件中,这里提供两个方式。

将bash配置文件~/.bash_profile中的环境变量等配置复制到zsh配置文件~/.zshrc中,在zsh配置文件~/.zshrc中添加source ~/.bash_profile


其他快捷命令:
command + t 新建标签
command + w 关闭标签

command + 数字 command + 左右方向键    切换标签
command + enter 切换全屏
command + f 查找
command + d 水平分屏
command + shift + d 垂直分屏
command + option + 方向键 command + [ 或 command + ]    切换屏幕
command + ; 查看历史命令
command + shift + h 查看剪贴板历史
ctrl + u    清除当前行
ctrl + l    清屏
ctrl + a    到行首
ctrl + e    到行尾
ctrl + f/b  前进后退
ctrl + p    上一条命令
ctrl + r    搜索命令历史


mac上的iterm实现使用rz/sz命令从服务器上传/下载文件

 在 windows 下通常可以用 xshell、secureCRT 等工具,只要在服务端装好 lrzsz 工具包就可以实现简单方便的文件上传下载。但是在 Mac Os 上用 iTerm 的时候发现 iTerm 原生不支持 rz/sz 命令,也就是不支持 Zmodem 来进行文件传输,下面就整理了怎么处理这种情况 。
Mac 上 安装 lrzsz

brew install lrzsz

下载 Iterm2 使用 lrzsz 脚本

cd /usr/local/bin

# 克隆下载插件脚本
git clone https://github.com/aikuyun/iterm2-zmodem

# 赋予脚本执行权限
chmod +x cd /usr/local/bin/iterm2-zmodem

设置 Iterm2 的配置

打开 iTerm2 的 Preferences-> Profiles -> Default -> Advanced -> Triggers 的 Edit 按钮。

输入如下配置信息:

Regular expression: rz waiting to receive.\*\*B0100
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-zmodem/iterm2-send-zmodem.sh
Instant: checked

Regular expression: \*\*B00000000000000
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-zmodem/iterm2-recv-zmodem.sh
Instant: checked

到此整个安装流程就结束了,服务器端安装 lrzsz工具包,便可以通过rz、sz命令实现上传/下载文件。


awesome-deno-cn

 

长期维护!中文圈下与 Deno 相关的 Awesome 资源全图谱


Deno 资源全图谱 · 专注中文版 Awesome

All Contributors

仓库目录可以使用 Github Chrome 插件来浏览。

为什么有这个项目?

Deno v1.0 于 2020 年 05 月 13 日正式发布 v1.0 版本,一个专注于中文技术圈的 Deno 资源列表呼之欲出。

以下资源 🌟 代表品质推荐(尚未正式开始标记),⚠️ 代表注意事项。由于资源分类的多样性考虑,部分章节内容可能会有所重复。

独特之处 🦖🦕

  • 长期提供更新,收集越来越多高质量的 Deno 资源,愿我们与 Deno 一起成长。
  • 随着 Deno 主版本进行版本归档更新。
  • 配套独家《Deno 钻研之术》电子书并随着本项目一起成长。
  • 及时跟进 @denolib/awesome-deno 仓库。
  • 寻找静态站点生成工具来让此资源清单更好看 -> 如果将每个条目“JSON“化就更好了。

还有如下很多事情可以做,期待你的贡献!

  • 为每条记录增加一个 150 字以内的简介,让用户能通过本仓库更直接地了解每个项目的核心功能,而不是只有短短的名字外链和十多个字的概要;
  • 添加更多资源;
  • 推荐适合 awesome 展示页的项目或提交相关 PR;
  • 通过大量资源一起梳理出更好的目录结构,绘制出与众不同的 Deno 资源图谱。

技术文档 🌟

源码阅读推荐

以下仓库从下方其他章节精选。

基础设施

Deno 源

虽然 Deno 可以直接导入 URL 代表着一定程度的去中心化,但是有中心化仓库也真香。

  • 和 Deno 生态强相关的源
    • deno.land/x:官方提供的第三方库注册中心。
    • nest.land:🌟。基于区块链去中心化仓库。
    • x.deno.js.cn:官方提供的第三方库的中国镜像站。
    • denopkg:在 Deno 项目中使用 GitHub 上的代码的更简单方法。
  • 基于 ES6 模块化机制的源
    • skypack.dev/:🌟。无需安装和构建工具即可加载优化的npm软件包。
    • jspm.io:允许从 CDN 中直接加载 NPM 的任何软件包。
    • jsdelivr.com/:开源下免费的 CDN。
    • esm.run:快速加载 JavaScript 模块的 CDN。
  • ...逐步添加中,欢迎 Star & Fork & PR。

包管理 && 配置管理

Web 框架 - 后端

Web 框架 - 前端

  • @alephjs/alephjs:🌟。Deno 下的 React 框架。
  • ...逐步添加中,欢迎 Star & Fork & PR。

环境变量

命令行

模板引擎

测试

数据库

WebSocket

命令行工具

  • @cacjs/cac:🌟。用于构建命令行应用程序的简单但功能强大的框架。
  • @ekaragodin/clone:一个方便克隆 Github 仓库到本地的简单实用程序。
  • @syumai/denoget:Deno 获取安装的可执行 Deno 脚本。
  • @syumai/denoinit:Deno 下简单的命令工具集。
  • @buttercubz/commands:为 Node.js 和 Deno 创建命令快捷方式。
  • @siokas/denomander:Deno 命令行界面的灵感来自 commander.js。
  • ...逐步添加中,欢迎 Star & Fork & PR。

应用级别

数据类型处理

IDE 插件

权限相关

  • @denofn/jwt:auth0/jsonwebtoken 的端口。
  • ...逐步添加中,欢迎 Star & Fork & PR。

JAM Stack/静态站点

  • @xcatliu/pagic:用 Deno 构建从 markdown 生成静态 html 页面的简单方法。
  • ...逐步添加中,欢迎 Star & Fork & PR。

从 Node 到 Deno

  • @garronej/denoify:🌟。对于希望支持 Deno 但不想编写和维护端口的 NPM 模块作者。
  • ...逐步添加中,欢迎 Star & Fork & PR。

TypeScript 相关

  • @zhmushan/dev_server:让 TypeScript 文件直接在 script 标签中使用。
  • @sindresorhus/type-fest:基本 TypeScript 类型的集合(sindresorhus端口/ type-fest)。
  • @neuledge/computed_types:类似 Joi 的 Typescript 和 Deno 验证器。
  • @motss/deno_mod:一个 TypeScript 插件,它将允许 Deno 之外的 TypeScript 以类似于在 Deno 内部进行解析的方式来解析模块。⚠️ 已归档。
  • ...逐步添加中,欢迎 Star & Fork & PR。

进程管理

热更新

  • @jinjor/watch:文件观察器(热更新)。
  • @joakimunge/denoliver:具有实时重新加载功能的简单,无依赖的文件服务器。
  • ...逐步添加中,欢迎 Star & Fork & PR。

容器化 & 自动化 & 云

其它

在线沙箱

机器人

数据展示

  • ...逐步添加中,欢迎 Star & Fork & PR。

成套解决方案

如果你有好的解决方案,欢迎提供在这里!

解决方案 - 项目模板

留坑,这里是未来探索的重点。主要罗列如何用 Deno 快速搭建起可供生产环境使用的成套解决方案。之前列到的很多库用来单一方面。 成套解决方案目前先重点探索提供项目模板的库。

  • ...逐步添加中,欢迎 Star & Fork & PR。

思考:

  • Deno + Oak + MySQL + RESTful 解决方案?
  • Deno + Oak + MongoDB + GraphQL 解决方案?
  • Deno + React 解决方案?

开发 Deno 模块

  • 如何开发 Deno (各种类别的)模块?
  • ...逐步添加中,欢迎 Star & Fork & PR。

技术教程

技术专栏(中文)

技术专栏(英文)

单篇文章(中文)

专注于收集高质量的博客文章,更多内容可以在谷歌/百度上搜索。目前 Deno 文章不多,尽可能多的罗列不设内容质量限制。 包含翻译。

单篇文章(英文)

演讲稿(中文)

  • ...逐步添加中,欢迎 Star & Fork & PR。

演讲稿(英文)

在线视频(中文)

在线视频(英文)

电子资源

专注收集公开免费的 PDF、PNG 以及电子书等资源,放置在本项目的 resources 文件夹下。

技术社区

开源组织

重点收集专注于使用 & 回馈 Deno 生态圈的第三方 Github 组织。

  • ...逐步添加中,欢迎 Star & Fork & PR。

社区列表(全网)

  • Deno Discord:🌟。Discord 上的 Deno 官方聊天室,有中文社区。
  • deno.dev:🌟。开发中。
  • deno.js.cn:🌟。Deno 中文社区。
  • denocn.org:🌟。Deno 中文社区。
  • yydeno:YY 大前端团队 Deno 仓库。
  • ...逐步添加中,欢迎 Star & Fork & PR。

讨论热帖(中文)

讨论热帖(英文)

谁在用 Deno?

重点收集已经部署在生产环境的应用,欢迎推荐你的案例,逐步完善中。

  • UsingDeno - 使用 Deno 的 Web 应用程序和项目列表 🦕。
  • ...逐步添加中,欢迎 Star & Fork & PR。

其它订阅

新闻媒体(英文)

社交媒体(英文)

  • twitter@deno_land:Deno Land 官方推特。
  • ...逐步添加中,欢迎 Star & Fork & PR。

番外篇

从 Node.js 到 Deno.js

Deno 依赖的技术清单

Deno 本身依赖的技术的清单库。

仓库更新日志

  • 2020-04-14 初始化本项目,填充独特的中文版内容。
  • 2020-04-14 跟进最新的(180+ Star) @olivewind/awesome-deno-cn 仓库内容。
  • 2020-05-13 新增《Deno 钻研之术》项目,将本项目作为前者的配套项目。
  • 2020-05-14 同步最新的 @denolib/awesome-deno 仓库内容。
  • 2020-05-17 跟进中文化后大改版的(200+ Star) @olivewind/awesome-deno-cn 仓库内容。
  • 2020-05-22 全网大量搜索 Deno 中英文资源并入库,发布 v1.0 版本并收录在《Deno 钻研之术》第二篇中。
  • 2020-08-07 大幅更新:
    • 跟随 Deno 主版本号同步发布 v1.2.2 版本。
    • 新增 all-contributor 贡献者机器人。
    • 增加如下章节:Deno 版本日志、解决方案。
    • 填充大量内容,新增贡献准则。
  • 2021-02-25 大幅更新:
    • 跟随 Deno 主版本号提前发布 v1.8.0 版本。
    • 将之前尚未分类的数十条进行分类
  • 2021-xx-xx
    • 引入 Pagic 来展示此资源清单
    • 同步最新的 @denolib/awesome-deno 内容
    • 全网大量搜索 Deno 中英文资料并入库

贡献者 ✨

感谢如下贡献者的贡献 (emoji key):


hylerrix

🤔 📖

JohannLai

📖

champ

📖

Bd999

📖

杨俊宁

📖

Booker Zhao

📖

木杉

📖

kily zhou

📖


guzhongren
📖

from https://github.com/hylerrix/awesome-deno-cn

Introducing Lume CLI


The best way to run Lume is using the Deno tasks. It's the most portable way to run Lume without installing anything else but Deno, and it ensures that the Lume version is the same as specified in the import_map.json file. In fact, there's a plan to remove the CLI interface completely.

The only drawback of using Deno tasks is they are more verbose to type. Instead of simply running lume -s or lume run my-script you have to type deno task lume -s and deno task lume run my-script.

In order to keep using tasks to run Lume and, at the same time, having a more ergonomic way to run the commands, I have released the new Lume CLI.

To install it, just run:

deno install --allow-run --name lume --force --reload https://deno.land/x/lume_cli/mod.ts

Lume CLI is just a small script to add the deno task words at the beginning of your lume commands. For example, if you run lume -s, the CLI will run deno task lume -s.

It's an independent module, separated from the Lume repository, so it's up to you to use it or not.

It also includes two additional commands:

  • lume init: To initialise Lume in the current directory. It's like running deno run -Ar https://deno.land/x/lume/init.ts.
  • lume ugrade-cli: As you may guess, it will upgrade the Lume CLI to the latest version.

Lume CLI combines the best of the two worlds and opens the door to removing the old CLI interface in the Lume repo sometime soon.

来自 https://lume.land/blog/posts/lume-cli/

zhblogs.net, 中文博客导航

 https://www.zhblogs.net

安装基于deno的静态博客程序lume

首先安装deno,一句命令搞定:

$ curl -fsSL https://deno.land/x/install/install.sh | sh 

$ deno run -A https://lume.land/init.ts --theme=simple-blog
显示:
 BENVIDO - WELCOME! 🎉🎉🎉

  Lume has been configured successfully!
  Theme installed: Simple Blog


Quick start:

  deno task serve to start a local server
  deno task cms to start the CMS

See https://lume.land for online documentation
See https://discord.gg/YbTmpACHWB to propose new ideas and get help at Discord
See https://github.com/lumeland/lume to view the source code and report issues
See https://github.com/lumeland/theme-simple-blog to view the theme source code and report issues
See https://opencollective.com/lume to support Lume development

$  git clone https://github.com/lumeland/theme-simple-blog
cd theme-simple-blog
cd src
deno task build
显示:
...
🍾 Site built into ./_site
cd ..
cd _site
12799@DESKTOP-B6LK9IO MINGW64 ~/theme-simple-blog/_site (main)
$ ls
404.html  author/   favicon.png  feed.xml    js/        posts/      sitemap.xml
archive/  contact/  feed.json    index.html  pagefind/  robots.txt  styles.css
(可见~/theme-simple-blog/_site就是静态网站的根目录

新建源帖:
12799@DESKTOP-B6LK9IO MINGW64 ~/theme-simple-blog/_site (main)
$ cd ../src/posts
12799@DESKTOP-B6LK9IO MINGW64 ~/theme-simple-blog/src/posts (main)
$ nano fh.md
$ cat fh.md
显示:
---
title: 战马
date: '2026-02-22T20:30:00'
author: ym
tags:
  - misc1
  - misc2
  - misc3
comments:
  src: 'https://mastodon.gal/@misteroom/110810445656343599'
draft: false
---

此处写正文或html codes

$ 12799@DESKTOP-B6LK9IO MINGW64 ~/theme-simple-blog/src/posts (main)
$ cd ..
12799@DESKTOP-B6LK9IO MINGW64 ~/theme-simple-blog/src (main)
$ deno task build
$ cd ../_site

12799@DESKTOP-B6LK9IO MINGW64 ~/theme-simple-blog/_site (main)
$ python3 -m http.server 3000

在浏览器里,访问http://localhost:3000/ 即可看到静态网站的效果。

如图:


官网地址:https://lume.land
程序仓库:https://github.com/lumeland/lume
数据仓库:https://github.com/lumeland/theme-simple-blog

创建10个帖子后,会分页

 https://lume.land/blog/archive/

 https://lume.land/blog/archive/2/


在水一方