新公司新福利,申请到神往已久的开发利器mac pro,windows转的各种不适应,新快捷键记录一下。
一、系统相关
1. 切换输入法:control 空格
2. 右键:command+单击
3. 启动台: 自定义 option command A
4. 聚焦搜索:command 空格
5. 终端|Terminal
聚焦搜索如上,中英文都可以,然后就是常用的linux命令,sudo获取管理员权限操作
open 文件|文件夹 可以直接启动图形界面打开
修改本机hosts: /etc/hosts
6. 查看文件夹路径: 打开文件夹-文件-显示路径栏,会出现在窗口下栏,点击可以切换到对应上级路径
7. 复制、粘贴、剪切: command c,v,x
保存、撤销: command + s、z
8. 新建文件夹,新建文件: command+N,新建当前打开的类型:浏览器则为网页,vscode则为文件,文件夹中则为最近访问文件
9. 新建文件夹 command+shift+n
全屏截图 保存到桌面command+shift+3
选择截取command+shift+4
鼠标移至行首行尾 command+ 上下左右 分别移至屏幕顶底行首行尾
Fn+上下左右 上一屏或屏首下一屏或屏末行首行尾
10. 锁屏 control+command+q,mac来讲,一般休眠关机重启不用太频繁,就无所谓快捷键了,桌面左上角点击操作吧
11 . 可以代替鼠标的触摸板操作.可以聚焦搜索触摸板进行设置:
切换桌面:三指左右滑动,需要注意的是要有最少一个全屏显示的程序才可以滑动.
调度中心(显示所有打开程序):三指上滑
控制台:拇指+三指聚拢
显示桌面:拇指+三指分散滑动
12. 浏览器开发者模式:chrome:command+option+I 开发者模式
二、 软件安装
1. appstore
2. 网页下载mac包,一般是bgp格式
3. 开发相关可以使用brewview包管理器,appstore的补充,有常用的开发软件
安装brewview:
官网地址:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 始终无法成功安装
自己安装记录如下
1. curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_instal
2.修改 brew_install
替换:BREW_REPO = “https://github.com/Homebrew/brew“.freeze
CORE_TAP_REPO = “https://github.com/Homebrew/homebrew-core“.freeze
为 BREW_REPO = "git://mirrors.ustc.edu.cn/brew.git".freeze
CORE_TAP_REPO = "git://mirrors.ustc.edu.cn/homebrew-core.git".freeze
没有core_tap_repo的可以忽略第二个
3. /usr/bin/ruby ~/brew_install
会卡在 Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'
因为源不通,代码来不下来,解决方法就是更换国内镜像源:
手动执行下面这句命令,更换为中科院的镜像:
删除 最后文件夹
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Lib
cd "$(brew --repo)"
git remote set-url origin git://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换核心软件仓库
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换 cask 软件仓库(提供 macOS 应用和大型二进制文件)
cd "$(brew --repo)"/Library/Taps/caskroom/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
替换 Bottles 源(Homebrew 预编译二进制软件包)
bash(默认 shell)用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
zsh 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
最后进行
brew update
brew doctor检测
具体参考网络资料见:
https://blog.csdn.net/weixin_34067980/article/details/88008241
https://www.jianshu.com/p/703f5feb1fcc
三、 常用开发环境搭建
1. 安装nginx :brew install nginx
nginx 路径:/usr/local/etc/nginx/
配置文件: /nginx.conf
默认根路径:usr/local/var/www
2. 安装node:官网下载pkg,v12. 自动安装node与npm
3. java官网下载,
软件路径:默认 /user/u/software
Java路径:默认 /library/java/
4. eclimpse 官网下载,相关插件
server: http://download.eclipse.com/releases/kepler
Java web: http://download.eclipse.com/releases/oxygen-->
四、git相关用法
Git clone url: 默认下载到当前路径
git add file1, add .
Git commit ;commit -a 直接提交全部不用add. -m 注释
Git status -s 查看状态 A:加入缓存未提交
git diff 尚未缓存的改动
git diff --cached查看已缓存的改动:
git diff HEAD查看已缓存的与未缓存的所有改动
git diff --stat显示摘要而非整个
$ git config --global user.name 'runoob'
$ git config --global user.email [email protected]
git reset HEAD 命令用于取消已缓存的内容。 +file 取消指定文件
Git rm file 删除。. Rm -f 强制删除,如已提交缓存 rm -cache 仅删除缓存区,保留本地 -r 级联删除文件夹.
pull|fetch 拉取 merge合并 push 提交到远程仓库
文件冲突,放弃本地修改 git checkout /src/main.js
Git status 查看冲突状态。 没有冲突文件后git pull即可
部分提交 git add file, file
Git commit -m git push 即可
五、vscode相关
转为中文:
1.Ctrl+Shift+P 打开命令
2.搜索 Configure Display Language 将这里的“en”(英文)改为“zh-CN”(中文) ,会自动查找需要安装中文插件,安装即可。
注释代码
注释块/解除 shift+option+a
行注释/解除 command+/
删除当前行 ctrl+k
上移、下移当前行 option+上下方向键
向上向下复制当前行 option+shift+上下方向键
格式化代码:全文:shift+option+f
选中部分:这个测试没生效
查找 option+f