macOS 下安装 vim 最新版

安装 Homebrew

关于 Homebrew

Homebrew 是 macOS 下最常用、最强大的软件包管理器,每一台 macOS 系统都应该安装一份。

安装 Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装 vim

安装前

你可以先用 brew info vim 命令查看一下 vim 安装参数,大概会得到如下结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
vim: stable 8.0.1350 (bottled), HEAD
Vi 'workalike' with many additional features
https://vim.sourceforge.io/
Conflicts with:
ex-vi (because vim and ex-vi both install bin/ex and bin/view)
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/vim.rb
==> Dependencies
Optional: lua ✘, luajit ✔, gettext ✔
==> Requirements
Required: ruby >= 1.8 ✔, perl >= 5.3 ✔
Recommended: python ✔
Optional: python3 ✔
==> Options
--with-client-server
Enable client/server mode
--with-custom-perl
Build with a custom Perl instead of the Homebrew version.
--with-custom-python
Build with a custom Python 2 instead of the Homebrew version.
--with-custom-ruby
Build with a custom Ruby instead of the Homebrew version.
--with-gettext
Build vim with National Language Support (translated messages, keymaps)
--with-lua
Build vim with lua support
--with-luajit
Build with luajit support
--with-override-system-vi
Override system vi
--with-python3
Build vim with python3 instead of python[2] support
--with-tcl
Build vim with tcl support
--without-perl
Build vim without perl support
--without-python
Build vim without python support
--without-ruby
Build vim without ruby support
--HEAD
Install HEAD version

根据你的需求安装 vim

以我的需求为例:

  • 我需要覆盖 macOS 系统自带的 vi 编辑器
  • 我要安装 SpaceVim(一套非常强大的 vim 配置方案),而 SpaceVim 需要依赖 luapython2/3

所以,根据我的需求,我安装 vim 的命令是:

1
brew install vim --with-override-system-vi --with-lua --with-python3

用 certbot 自动生成 ssl 证书

本文内容以 nginx 为例。

安装 certbot

Linux

1
2
sudo apt update
sudo apt install certbot

Mac

1
brew install certbot

生成证书

1
sudo certbot --nginx

选择域名

certbot 会根据你的 nginx 配置列出所有域名,你可以根据变化选择生成 ssl 证书的域名
,也可以直接回车,为所有服务器上所有域名生成证书。

1
2
3
4
5
6
7
8
9
10
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx

Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: your.domain.one
2: your.domain.two
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):

是否覆盖证书

如果证书已经存在,certbot 会让你选择是尝试重新安装还是续约:

1
2
3
4
5
6
What would you like to do?
-------------------------------------------------------------------------------
1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

是否跳转

证书生成成功,certbot 询问是否所有 http 链接自动跳转到 https 链接,按自己需要选
择。

1
2
3
4
5
6
7
8
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

成功信息

1
2
3
4
5
6
7
8
9
10
11
12
13
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/YOUR.DOMAIN/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/YOUR.DOMAIN/privkey.pem
Your cert will expire on 2018-03-04. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:

Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le

同步 git 分支

添加上游项目 git 地址

1
2
git remote add upstream {upstream-git-url}
# {upstream-git-url} 替换为项目原始仓库地址

查看 git 信息

1
2
3
4
5
6
git remote -v
# 返回信息类似:
# origin git@github.com:YOU/YOUR-PROJECT.git (fetch)
# origin git@github.com:YOU/YOUR-PROJECT.git (push)
# upstream git@github.com:SOMEONE/UPSTREAM-PROJECT.git (fetch)
# upstream git@github.com:SOMEONE/UPSTREAM-PROJECT.git (push)

获取上游项目更新

1
git fetch upstream

本地切换到主分支

1
git checkout master

合并上游项目代码到本地分支

1
git merge upstream/master
© 2017 Seven`s Blog All Rights Reserved. 本站访客数人次 本站总访问量
Theme by hiero