惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
AWS News Blog
AWS News Blog
Google DeepMind News
Google DeepMind News
U
Unit 42
博客园 - 叶小钗
博客园 - 聂微东
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
D
DataBreaches.Net
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Jina AI
Jina AI
美团技术团队
The Cloudflare Blog
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
S
Schneier on Security
C
Check Point Blog
Project Zero
Project Zero
The Hacker News
The Hacker News
Scott Helme
Scott Helme
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Cisco Talos Blog
Cisco Talos Blog
P
Privacy International News Feed
SecWiki News
SecWiki News
Latest news
Latest news
MongoDB | Blog
MongoDB | Blog
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
H
Help Net Security
TaoSecurity Blog
TaoSecurity Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Last Week in AI
Last Week in AI
P
Privacy & Cybersecurity Law Blog
Forbes - Security
Forbes - Security
G
GRAHAM CLULEY
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity
A
About on SuperTechFans
T
The Exploit Database - CXSecurity.com
C
Cisco Blogs
PCI Perspectives
PCI Perspectives
大猫的无限游戏
大猫的无限游戏
T
Troy Hunt's Blog
H
Hacker News: Front Page
Vercel News
Vercel News

Dvel's Blog

Rime 全拼双拼混输 CHD 油猴脚本:每日签到自动答题 Rime 配置:雾凇拼音 Hammerspoon 自动切换输入法 修复 Hugo 本地图片的累计布局偏移(CLS)问题 macOS 利用 Karabiner 修改 Emacs 键位为 Vim 键位 macOS 修改 Emacs 键位为 Vim 键位 Surge 配置 汉字的混乱 Netflix 中英双语字幕的好办法 优化 Rime 英文输入体验 判断字符是否为简体字或繁体字 Cloudflare 转入域名提示「出现了问题。请重试转移此域。尚未向您收费。」 图片压缩:Squoosh、TinyPNG、ImageOptim、WebP macOS grep + sed 批量替换多个文件的内容 在 macOS 根目录创建文件夹 博客图床小妙招 折腾 Hugo & PaperMod 主题 利用 Cloudflare Workers 进行批量 301 重定向 将博客部署在 Cloudflare Pages Alfred File Navigation(文件导航器)详解 在 Hugo Goldmark Markdown 中设置以新标签打开链接 日期与时间(UTC、GMT、时间戳、时区) 让 Alfred 以新标签的方式打开 Finder 用 git filter-branch 给 Git 仓库瘦身 qBittorrent 设置教程 联通光猫破解+桥接记录 配置 Mac 终端走代理 Steam for Mac 中文游戏推荐 我的 Mac 软件/工具列表 《Flask Web 开发》笔记 用 sleepwatcher 让 Mac 在睡眠及唤醒时自动执行一些脚本 解决 pyenv 导致的 brew warning 《SQL 必知必会》笔记 Git 自总结 Python 异步 IO 笔记 再见,双点医院! 用 CloudXNS 解决 CNAME 与 MX 记录冲突 你好,Hugo! 新 Mac 新装修 秦皇岛暑期自驾的烦恼 苹果公司开发者账号申请流程 UIScrollView 中使用 Masonry 解决 CocoaPods 的类库 import 没有提示 iOS 使用 CocoaPods 的快速回顾 GitBook 简单生成本地静态 HTML 的方法 你好, Hexo! About
为 Mac 打造 zsh command line 环境
Dvel · 2018-07-30 · via Dvel's Blog

折腾完,做个备忘

样图:

zsh

iTerm 2

  • 主题

Tomorrow Night - Tomorrow Night Eighties

  • Hotkey Window

我习惯只保留一个窗口,并使用 shift+空格 来从左侧或上侧呼出,在 Profiles - Window - Style 可以设置。

呼出的快捷键在 Profiles → Keys → Hotkey Window 设置。

  • Natural Text Editing

Profiles → Keys → Presets → Natural Text Editing

这个可以让你在输入时使用 command/option + ←/→ 来移动光标

zsh 有很多优点,比如兼容 !#/bin/bash,更强大的 tab 补全功能,大小写自动更正,丰富的主题,命令智能纠错等等。

现在 macOS 默认就是 zsh 而不是 bash 了,不过我习惯不使用系统自带的东西,可以用 brew 自己装一个。

$ brew install zsh

查看当前已经安装的 shell:

$ cat /etc/shells

/usr/local/bin/zsh 加入到 /etc/shells 中:

$ sudo sh -c "echo $(which zsh) >> /etc/shells"

设置默认 shell:

$ chsh -s $(which zsh)

重启终端,查看默认 shell:

$ echo $SHELL
/usr/local/bin/zsh

OK.

oh-my-zsh

oh-my-zsh 是一款社区驱动的、基于 zsh 的的扩展工具集,用它可以方便的更新和定制 zsh,提供了方便的主题配置、插件配置和一些内置的便捷操作。

安装:

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

安装后出现目录 ~/.oh-my-zsh/ 及配置文件 ~/.zshrc

zsh 主题 powerlevel9k

$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

设置主题,编辑 ~/.zshrc

ZSH_THEME="powerlevel9k/powerlevel9k"

重启终端,OK。

如果字体显示问号,需要换成 powerline font 字体。

快速安装一个 powerline font:

$ brew cask install homebrew/cask-fonts/font-hack

在 iTerm 2 中更换字体。

oh-my-zsh 插件

/Users/user/.oh-my-zsh/plugins 是官方自带插件,可自行激活。

/Users/user/.oh-my-zsh/custom/plugins 是第三方插件,等同于 $ZSH_CUSTOM/plugins,可以用 git 将一些插件 clone 到这个地方。

另一种安装第三方插件的方法:某些插件可以用 brew 安装。

使用下面的方法进行安装和启用。

$ brew install zsh-syntax-highlighting # 高亮
$ brew install zsh-autosuggestions # 根据历史输入的补全建议

遵循提示,在 ~/.zshrc 中加入以下语句:

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh

$ source ~/.zshrc 使之生效。(试了并不成功,非得重启 iTerm 才行)

一些配置

编辑 ~/.zshrc

# 激活自带插件,一行写一个
plugins=(
    git
    z
)

# 解决 powerlevel9k 主题下的 Python 虚拟环境没有提示:
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status virtualenv)
# 左侧主机名,默认是`%n@%m` 用户名@电脑名,可以改成自己喜欢的。
POWERLEVEL9K_CONTEXT_TEMPLATE=""

一些终端代理方法:包括 http(s) 和 ssh(比如 git)。

配置 Mac 终端走代理

参考 & 感谢