配置一个漂亮的Terminal( 心情好很多)效果图安装iTem2安装$ brew tap caskroom/cask # 首次安装需执行该条命令 $ brew cask install iterm2 # 安装iterm2打开iterm2,检查Report Terminal Type的设定,设为xterm. 配置一个漂亮的Terminal( 心情好很多)效果图安装iTem2安装$ brew tap caskroom/cask # 首次安装需执行该条命令 $ brew cask install iterm2 # 安装iterm2打开iterm2,检查Report Terminal Type的设定,设.
配置一个漂亮的Terminal( 心情好很多)
效果图
安装iTem2
安装
打开iterm2,检查Report Terminal Type的设定,设为xterm-256color,就可在terminal看到漂亮的颜色
修改iTerm2的color scheme
- 打开iterm2
- 快捷键 CMD+i (⌘+i)
- 点击 Colors
- 选择 Color Presets
- 选择Import
- 找到克隆下来的 .itermcolors 文件中的 scheme(s) ,选择喜欢的配色导入
- 再次点击 Color Presets
- 选中导入的color scheme
安装Nerd Fonts
使用的theme中有很多小图标,需要使用支持这些图标的icon font,这类字体称为powerline font(plus版的支持更多图标的称为:nerd font)
没有安装icon font的界面:
安装
Nerd-fonts: https://github.com/ryanoasis/nerd-fonts#font-installation
安装方法: https://github.com/ryanoasis/nerd-fonts#option-4-homebrew-fonts
查看刚刚安装的文件
打开iterm2,设置字体
注:如果切换字体,iterm2无法正常运行,可能是同一字型有重复版本问题,解决方法:
安装zsh
设置zsh为默认:
bash切换到zsh
安裝 oh-my-zsh
切换内建主题
执行以下指令生效
安装 powerlevel9k
powerlevel9k不是 oh-my-zsh 內建的 theme,需另外下载
Mac Terminal 打开 Application
编辑.zshrc
更多配置参考:https://github.com/bhilburn/powerlevel9k#available-prompt-segments
Mac Terminal 打开 Apple
快速配置,可参考
推荐安装的套件
Zsh-autosuggestions:https://github.com/zsh-users/zsh-autosuggestions
参考链接:
以下提示和控件等效项应有助于在 Mac 和 Windows(或 WSL/Linux)开发环境之间转换。The following tips and control equivalents should help you in your transition between a Mac and Windows (or WSL/Linux) development environment.
对于应用开发,与 Xcode 最相近的等效项是 Visual Studio。For app development, the nearest equivalent to Xcode would be Visual Studio.如果不需要那么大的近似度,可以使用 Visual Studio for Mac。There is also a version of Visual Studio for Mac, if you ever feel the need to go back.如需进行跨平台源代码编辑(和获取大量插件),Visual Studio Code 是最常用的选择。For cross-platform source code editing (and a huge number of plug-ins) Visual Studio Code is the most popular choice.
键盘快捷方式Keyboard shortcuts
操作Operation | MacMac | WindowsWindows |
---|---|---|
复制Copy | Command+CCommand+C | Ctrl+CCtrl+C |
剪切Cut | Command+XCommand+X | Ctrl+XCtrl+X |
粘贴Paste | Command+VCommand+V | Ctrl+VCtrl+V |
撤消Undo | Command+ZCommand+Z | Ctrl+ZCtrl+Z |
保存Save | Command+SCommand+S | Ctrl+SCtrl+S |
打开Open | Command+OCommand+O | Ctrl+OCtrl+O |
锁定计算机Lock computer | Command+Control+QCommand+Control+Q | WindowsKey+LWindowsKey+L |
显示桌面Show desktop | Command+F3Command+F3 | WindowsKey+DWindowsKey+D |
打开文件浏览器Open file browser | Command+NCommand+N | WindowsKey+EWindowsKey+E |
窗口最小化Minimize windows | Command+MCommand+M | WindowsKey+MWindowsKey+M |
搜索Search | Command+空格Command+Space | WindowsKeyWindowsKey |
关闭活动窗口Close active window | Command+WCommand+W | Control+WControl+W |
切换当前任务Switch current task | Command+TabCommand+Tab | Alt+TabAlt+Tab |
将窗口最大化至全屏Maximize a window to full screen | Control+Command+FControl+Command+F | WindowsKey+UpWindowsKey+Up |
保存屏幕(截图)Save screen (Screenshot) | Command+Shift+3Command+Shift+3 | WindowsKey+Shift+SWindowsKey+Shift+S |
保存窗口Save window | Command+Shift+4Command+Shift+4 | WindowsKey+Shift+SWindowsKey+Shift+S |
查看项信息或属性View item information or properties | Command+ICommand+I | Alt+EnterAlt+Enter |
选择全部项Select all items | Command+ACommand+A | Ctrl+ACtrl+A |
选择列表中的多个项(非连续)Select more than one item in a list (noncontiguous) | 使用 Command,然后单击每个项Command, then click each item | 使用 Control 键,然后单击每个项Control, then click each item |
键入特殊字符Type special characters | Option + 字符键Option+ character key | Alt + 字符键Alt+ character key |
触控板快捷方式Trackpad shortcuts
注意:其中一些快捷方式需要“Precision Trackpad”,如 Surface 设备和其他第三方笔记本电脑上的触控板。Note: Some of these shortcuts require a “Precision Trackpad”, such as the trackpad on Surface devices and some other third party laptops.
操作Operation | MacMac | WindowsWindows |
---|---|---|
滚动Scroll | 双指垂直轻扫Two finger vertical swipe | 双指垂直轻扫Two finger vertical swipe |
缩放Zoom | 双指向内和向外收缩Two finger pinch in and out | 双指向内和向外收缩Two finger pinch in and out |
在视图间向前和向后轻扫Swipe back and forward between views | 双指侧向轻扫Two finger sideways swipe | 双指侧向轻扫Two finger sideways swipe |
切换虚拟工作区Switch virtual workspaces | 四指侧向轻扫Four fingers sideways swipe | 四指侧向轻扫Four fingers sideways swipe |
显示当前打开的应用Display currently open apps | 四指向上轻扫Four fingers upward swipe | 三指向上轻扫Three fingers upward swipe |
切换应用Switch between apps | N/AN/A | 三指侧向缓慢轻扫Slow three finger sideways swipe |
转到桌面Go to desktop | 四指向外滑动Spread out four fingers | 三指向下轻扫Three finger swipe downwards |
打开 Cortana/操作中心Open Cortana / Action center | 双指从右侧开始滑动Two finger slide from right | 三指点击Three finger tap |
打开额外信息Open extra information | 三指点击Three finger tap | N/AN/A |
显示启动板/启动应用Show launchpad / start an app | 四指收缩Pinch with four fingers | 四指点击Tap with four fingers |
注意:这两个平台上均可配置触控板选项。Note: Trackpad options are configurable on both platforms.
命令行 shell 和终端Command-line shells and terminals
Windows 支持多个命令行 shell 和终端,它们的工作方式有时与 Mac 的 BASH shell 和终端模拟器应用(例如 Terminal 和 iTerm)稍有不同。Windows supports several command-line shells and terminals which sometimes work a little differently to the Mac's BASH shell and terminal emulator apps like Terminal and iTerm.
Windows shellWindows shells
Windows 有两个主要的命令行 shell:Windows has two primary command-line shells:
PowerShell - PowerShell 是一个跨平台的任务自动化和配置管理框架,由基于 .NET 构建的命令行 shell 和脚本语言组成。PowerShell - PowerShell is a cross-platform task automation and configuration management framework, consisting of a command-line shell and scripting language built on .NET.使用 PowerShell,管理员、开发人员和高级用户可以快速控制和自动完成以下任务:管理复杂流程,以及环境和运行环境的操作系统的各个方面。Using PowerShell, administrators, developers, and power-users can rapidly control and automate tasks that manage complex processes and various aspects of the environment and operating system upon which it is run.PowerShell 完全开放源代码,并且由于它是跨平台的,因此也同样适用于 Mac 和 Linux。PowerShell is fully open-source, and because it is cross-platform, also available for Mac and Linux.
Mac 和 Linux BASH shell 用户:PowerShell 还支持许多你已经熟悉的命令别名。Mac and Linux BASH shell users: PowerShell also supports many command-aliases that you are already familiar with.例如:For example:
- 使用
ls
列出当前目录的内容List the contents of the current directory, using:ls
- 使用
mv
移动文件Move files with:mv
- 使用
cd <path>
移动到新目录Move to a new directory with:cd <path>
PowerShell 和 BASH 中的某些命令和参数是不同的。Some commands and arguments are different in PowerShell vs. BASH.要了解详细信息,请在 PowerShell 中输入
get-help
或在文档中查看兼容性别名。Learn more by entering:get-help
in PowerShell or checkout the compatibility aliases in the docs.要以管理员身份运行 PowerShell,请在 Windows“开始”菜单中输入“PowerShell”,然后选择“以管理员身份运行”。To run PowerShell as an Administrator, enter 'PowerShell' in your Windows start menu, then select 'Run as Administrator.'
- 使用
Windows 命令行 (Cmd) :Windows 仍然提供传统的命令提示符(和控制台 - 见下文),以提供与当前和旧版 MS-DOS-compatible 命令和批处理文件的兼容性。Windows Command Line (Cmd): Windows still ships the traditional Command Prompt (and Console – see below), providing compatibility with current and legacy MS-DOS-compatible commands and batch files.Cmd 在运行现有/旧批处理文件或命令行操作时很有用,但一般情况下,建议用户了解和使用 PowerShell,因为 Cmd 现在正处于维护中,并且将来不会收到任何改进或新功能。Cmd is useful when running existing/older batch files or command-line operations, but in general, users are recommended to learn and use PowerShell since Cmd is now in maintenance, and will not be receiving any improvements or new features in the future.
Linux shellLinux shells
现在可以安装适用于 Linux 的 Windows 子系统 (WSL) 来支持在 Windows 中运行 Linux shell。Windows Subsystem for Linux (WSL) can now be installed to support running a Linux shell within Windows.这意味着你可以使用所选的任意特定 Linux 发行版,运行 Windows 内集成的 bash。This means that you can run bash, with whichever specific Linux distribution you choose, integrated right inside Windows.使用 WSL 可提供 Mac 用户最熟悉的环境类型。Using WSL will provide the kind of environment most familiar to Mac users.例如,你可以使用 ls 列出当前目录中的文件,而不是像在传统 Windows Cmd Shell 中那样使用 dir 。For example, you will ls to list the files in a current directory, not dir as you would with the traditional Windows Cmd Shell.若要了解如何安装和使用 WSL,请参阅适用于 Linux 的 Windows 子系统安装指南 (Windows 10)。To learn about installing and using WSL, see the Windows Subsystem for Linux Installation Guide for Windows 10.可以使用 WSL 在 Windows 上安装的 Linux 发行版包括:Linux distributions that can be installed on Windows with WSL include:
这只是其中一部分。Just to name a few.可在 WSL 安装文档中查找详细信息,并直接从 Microsoft Store 安装它们。Find more in the WSL install docs and install them directly from the Microsoft Store.
Windows 终端Windows Terminals
除了许多第三方产品/服务外,Microsoft 还提供了两个“终端”- GUI 应用程序(用于访问命令行 shell 和应用程序)。In addition to many 3rd party offerings, Microsoft provides two “terminals” – GUI applications that provide access to command-line shells and applications.
Mac Terminal 打开 Apps
Windows 终端 :Windows 终端是一种高度可配置的全新现代化命令行终端应用程序,它提供了超高性能、低延迟的命令行用户体验、多个选项卡、拆分窗口窗格、自定义主题和样式、针对不同 shell 或命令行应用的多个“配置文件”,并使用户有大量机会可以配置命令行用户体验的许多方面并对其进行个性化设置。Windows Terminal: Windows Terminal is a new, modern, highly configurable command-line terminal application that provides very high performance, low-latency command-line user experience, multiple tabs, split window panes, custom themes and styles, multiple “profiles” for different shells or command-line apps, and considerable opportunities for you to configure and personalize many aspects of your command-line user experience.
可以使用 Windows 终端打开连接到 PowerShell、WSL shell(例如 Ubuntu 或 Debian)、传统 Windows 命令提示符或任何其他命令行应用(例如 SSH、Azure CLI、Git Bash)的选项卡。You can use Windows Terminal to open tabs connected to PowerShell, WSL shells (like Ubuntu or Debian), the traditional Windows Command Prompt, or any other command-line app (e.g. SSH, Azure CLI, Git Bash).
控制台 :在 Mac 和 Linux 上,用户通常启动其首选的终端应用程序,然后创建并连接到用户的默认 shell(例如 BASH)。Console: On Mac and Linux, users usually start their preferred terminal application which then creates and connects to the user’s default shell (e.g. BASH).
然而,由于历史原因,Windows 用户通常会启动其 shell,而 Windows 会自动启动并连接 GUI 控制台应用。However, due to a quirk of history, Windows users traditionally start their shell, and Windows automatically starts and connects a GUI Console app.
尽管仍可以直接启动 shell 并使用旧版 Windows 控制台,但强烈建议用户安装并使用 Windows 终端来体验最佳、最快、最高效的命令行体验。While one can still launch shells directly and use the legacy Windows Console, it’s highly recommended that users instead install and use Windows Terminal to experience the best, fastest, most productive command-line experience.
Mac Terminal 打开 App Download
应用和实用程序Apps and utilities
应用App | MacMac | WindowsWindows |
---|---|---|
设置和首选项Settings and Preferences | 系统首选项System Preferences | SettingsSettings |
任务管理器Task manager | 活动监视器Activity Monitor | 任务管理器Task Manager |
磁盘格式化Disk formatting | 磁盘实用程序Disk Utility | 磁盘管理Disk Management |
文本编辑Text editing | TextEditTextEdit | 记事本Notepad |
事件查看Event viewing | 控制台Console | 事件查看器Event Viewer |
查找文件/应用Find files/apps | Command+空格Command+Space | Windows 键Windows key |