找回密码
 免费注册

[API分享] 腾讯云开发者社区专栏文章数据JSON实例

[复制链接]
admin 发表于 2024-1-6 17:26:14 | 显示全部楼层 |阅读模式
https://cloud.tencent.com/developer/article/2092486
  1. {
  2.         "props": {
  3.                 "isMobile": false,
  4.                 "isSupportWebp": true,
  5.                 "reqId": "kzKA6Keh4QbNhK8pHvf3-",
  6.                 "query": {
  7.                         "articleId": "2092486"
  8.                 },
  9.                 "platform": "other",
  10.                 "env": "production",
  11.                 "__N_SSP": true,
  12.                 "pageProps": {
  13.                         "fallback": {
  14.                                 "#url:"/api/article/detail",params:#articleId:2092486,,": {
  15.                                         "articleData": {
  16.                                                 "articleId": 2092486,
  17.                                                 "wordsNum": 1308,
  18.                                                 "codeLineNum": 56,
  19.                                                 "readingTime": 285
  20.                                         },
  21.                                         "articleInfo": {
  22.                                                 "articleId": 2092486,
  23.                                                 "channel": 2,
  24.                                                 "columnId": 96031,
  25.                                                 "commentNum": 0,
  26.                                                 "content": {
  27.                                                         "blocks": [{
  28.                                                                 "key": "2p3nu",
  29.                                                                 "text": "preface",
  30.                                                                 "type": "header-two",
  31.                                                                 "depth": 0,
  32.                                                                 "inlineStyleRanges": [],
  33.                                                                 "entityRanges": [],
  34.                                                                 "data": {
  35.                                                                         "text": "preface"
  36.                                                                 }
  37.                                                         }, {
  38.                                                                 "key": "756f7",
  39.                                                                 "text": "一直以来我在 Linux 终端用的 shell 都是 zsh,相比默认的 bash 来说,配合上插件的 zsh 功能更加强大并且十分美观,今天刚好要在服务器上重新配置一遍,顺便就记录一下。",
  40.                                                                 "type": "unstyled",
  41.                                                                 "depth": 0,
  42.                                                                 "inlineStyleRanges": [],
  43.                                                                 "entityRanges": [],
  44.                                                                 "data": {}
  45.                                                         }, {
  46.                                                                 "key": "2s43c",
  47.                                                                 "text": "安装 zsh",
  48.                                                                 "type": "header-two",
  49.                                                                 "depth": 0,
  50.                                                                 "inlineStyleRanges": [],
  51.                                                                 "entityRanges": [],
  52.                                                                 "data": {
  53.                                                                         "text": "%E5%AE%89%E8%A3%85-zsh"
  54.                                                                 }
  55.                                                         }, {
  56.                                                                 "key": "fmj6f",
  57.                                                                 "text": "zsh 在默认的情况下是没有安装的(除非是 Mac),因此我们得先将 zsh 安装好,我这里是 centOS 的服务器,所以用 yum 包管理器安装,ubuntu 直接用 apt 是一样的",
  58.                                                                 "type": "unstyled",
  59.                                                                 "depth": 0,
  60.                                                                 "inlineStyleRanges": [],
  61.                                                                 "entityRanges": [],
  62.                                                                 "data": {}
  63.                                                         }, {
  64.                                                                 "key": "7l2bh",
  65.                                                                 "text": "$ yum install zsh",
  66.                                                                 "type": "code-block",
  67.                                                                 "depth": 0,
  68.                                                                 "inlineStyleRanges": [],
  69.                                                                 "entityRanges": [],
  70.                                                                 "data": {
  71.                                                                         "syntax": "javascript"
  72.                                                                 }
  73.                                                         }, {
  74.                                                                 "key": "asp88",
  75.                                                                 "text": "安装完成后用 cat /etc/shells 可以看到机器上现存的 shell 的种类",
  76.                                                                 "type": "unstyled",
  77.                                                                 "depth": 0,
  78.                                                                 "inlineStyleRanges": [{
  79.                                                                         "offset": 7,
  80.                                                                         "length": 15,
  81.                                                                         "style": "CODE"
  82.                                                                 }],
  83.                                                                 "entityRanges": [],
  84.                                                                 "data": {}
  85.                                                         }, {
  86.                                                                 "key": "d6vd5",
  87.                                                                 "text": "/bin/sh\n/bin/bash\n/usr/bin/sh\n/usr/bin/bash\n/bin/zsh",
  88.                                                                 "type": "code-block",
  89.                                                                 "depth": 0,
  90.                                                                 "inlineStyleRanges": [],
  91.                                                                 "entityRanges": [],
  92.                                                                 "data": {
  93.                                                                         "syntax": "javascript"
  94.                                                                 }
  95.                                                         }, {
  96.                                                                 "key": "5p5j6",
  97.                                                                 "text": "然后将我们默认的 shell 变成 zsh,重启终端,输入 echo $SHELL 就可以看到此时的 shell 变成了 zsh",
  98.                                                                 "type": "unstyled",
  99.                                                                 "depth": 0,
  100.                                                                 "inlineStyleRanges": [{
  101.                                                                         "offset": 30,
  102.                                                                         "length": 11,
  103.                                                                         "style": "CODE"
  104.                                                                 }],
  105.                                                                 "entityRanges": [],
  106.                                                                 "data": {}
  107.                                                         }, {
  108.                                                                 "key": "eqfpd",
  109.                                                                 "text": "$ chsh -s /bin/zsh",
  110.                                                                 "type": "code-block",
  111.                                                                 "depth": 0,
  112.                                                                 "inlineStyleRanges": [],
  113.                                                                 "entityRanges": [],
  114.                                                                 "data": {
  115.                                                                         "syntax": "javascript"
  116.                                                                 }
  117.                                                         }, {
  118.                                                                 "key": "2sgaj",
  119.                                                                 "text": "安装 oh-my-zsh",
  120.                                                                 "type": "header-two",
  121.                                                                 "depth": 0,
  122.                                                                 "inlineStyleRanges": [],
  123.                                                                 "entityRanges": [],
  124.                                                                 "data": {
  125.                                                                         "text": "%E5%AE%89%E8%A3%85-oh-my-zsh"
  126.                                                                 }
  127.                                                         }, {
  128.                                                                 "key": "9dpak",
  129.                                                                 "text": "默认的 zsh 用起来没啥感觉,我们得配合上 oh-my-zsh 来使用。安装 oh-my-zsh 直接用官方 GitHub 上的命令将安装脚本 wget 下来再进行安装",
  130.                                                                 "type": "unstyled",
  131.                                                                 "depth": 0,
  132.                                                                 "inlineStyleRanges": [],
  133.                                                                 "entityRanges": [{
  134.                                                                         "offset": 23,
  135.                                                                         "length": 9,
  136.                                                                         "key": 0
  137.                                                                 }],
  138.                                                                 "data": {}
  139.                                                         }, {
  140.                                                                 "key": "2sl92",
  141.                                                                 "text": "sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"",
  142.                                                                 "type": "code-block",
  143.                                                                 "depth": 0,
  144.                                                                 "inlineStyleRanges": [],
  145.                                                                 "entityRanges": [],
  146.                                                                 "data": {
  147.                                                                         "syntax": "javascript"
  148.                                                                 }
  149.                                                         }, {
  150.                                                                 "key": "fgb7b",
  151.                                                                 "text": "经过一段时间的安装之后就会出现这个界面,代表 oh-my-zsh 已经安装好了",
  152.                                                                 "type": "unstyled",
  153.                                                                 "depth": 0,
  154.                                                                 "inlineStyleRanges": [],
  155.                                                                 "entityRanges": [],
  156.                                                                 "data": {}
  157.                                                         }, {
  158.                                                                 "key": "20ptf",
  159.                                                                 "text": "\ud83d",
  160.                                                                 "type": "atomic",
  161.                                                                 "depth": 0,
  162.                                                                 "inlineStyleRanges": [],
  163.                                                                 "entityRanges": [{
  164.                                                                         "offset": 0,
  165.                                                                         "length": 1,
  166.                                                                         "key": 1
  167.                                                                 }],
  168.                                                                 "data": {}
  169.                                                         }, {
  170.                                                                 "key": "ensl1",
  171.                                                                 "text": "然后重启终端就能够看到漂亮的界面了!",
  172.                                                                 "type": "unstyled",
  173.                                                                 "depth": 0,
  174.                                                                 "inlineStyleRanges": [],
  175.                                                                 "entityRanges": [],
  176.                                                                 "data": {}
  177.                                                         }, {
  178.                                                                 "key": "13u9b",
  179.                                                                 "text": "\ud83d",
  180.                                                                 "type": "atomic",
  181.                                                                 "depth": 0,
  182.                                                                 "inlineStyleRanges": [],
  183.                                                                 "entityRanges": [{
  184.                                                                         "offset": 0,
  185.                                                                         "length": 1,
  186.                                                                         "key": 2
  187.                                                                 }],
  188.                                                                 "data": {}
  189.                                                         }, {
  190.                                                                 "key": "3f7ki",
  191.                                                                 "text": "安装插件",
  192.                                                                 "type": "header-two",
  193.                                                                 "depth": 0,
  194.                                                                 "inlineStyleRanges": [],
  195.                                                                 "entityRanges": [],
  196.                                                                 "data": {
  197.                                                                         "text": "%E5%AE%89%E8%A3%85%E6%8F%92%E4%BB%B6"
  198.                                                                 }
  199.                                                         }, {
  200.                                                                 "key": "79tnu",
  201.                                                                 "text": "oh-my-zsh 自带了十分多的插件,插件目录在 .oh-my-zsh/plugins 里面,默认开启了 git 插件,其实还有很多好用的插件,比如只需要输入 extract 就能够解压压缩包的 extract 插件,也有 GitHub 上开源的插件,配合上这些插件真的可以使效率提高。",
  202.                                                                 "type": "unstyled",
  203.                                                                 "depth": 0,
  204.                                                                 "inlineStyleRanges": [{
  205.                                                                         "offset": 26,
  206.                                                                         "length": 18,
  207.                                                                         "style": "CODE"
  208.                                                                 }, {
  209.                                                                         "offset": 81,
  210.                                                                         "length": 7,
  211.                                                                         "style": "CODE"
  212.                                                                 }],
  213.                                                                 "entityRanges": [],
  214.                                                                 "data": {}
  215.                                                         }, {
  216.                                                                 "key": "1plmc",
  217.                                                                 "text": "插件管理器 antigen",
  218.                                                                 "type": "header-three",
  219.                                                                 "depth": 0,
  220.                                                                 "inlineStyleRanges": [],
  221.                                                                 "entityRanges": [],
  222.                                                                 "data": {
  223.                                                                         "text": "%E6%8F%92%E4%BB%B6%E7%AE%A1%E7%90%86%E5%99%A8-antigen"
  224.                                                                 }
  225.                                                         }, {
  226.                                                                 "key": "2bkle",
  227.                                                                 "text": "说到插件就不得不提 antigen 了,这回配置插件我都是用的 antigen,不得不说比上次一个一个下载舒服多了,只需要在 .zshrc 文件中加上一下插件名字 antigen 就会自动帮我们下载好插件,我们来看看怎么安装这玩意",
  228.                                                                 "type": "unstyled",
  229.                                                                 "depth": 0,
  230.                                                                 "inlineStyleRanges": [{
  231.                                                                         "offset": 63,
  232.                                                                         "length": 6,
  233.                                                                         "style": "CODE"
  234.                                                                 }],
  235.                                                                 "entityRanges": [],
  236.                                                                 "data": {}
  237.                                                         }, {
  238.                                                                 "key": "b1av9",
  239.                                                                 "text": "ubuntu 系统下直接用 apt 包管理器进行安装",
  240.                                                                 "type": "unstyled",
  241.                                                                 "depth": 0,
  242.                                                                 "inlineStyleRanges": [],
  243.                                                                 "entityRanges": [],
  244.                                                                 "data": {}
  245.                                                         }, {
  246.                                                                 "key": "40qfh",
  247.                                                                 "text": "$ apt-get install zsh-antigen",
  248.                                                                 "type": "code-block",
  249.                                                                 "depth": 0,
  250.                                                                 "inlineStyleRanges": [],
  251.                                                                 "entityRanges": [],
  252.                                                                 "data": {
  253.                                                                         "syntax": "javascript"
  254.                                                                 }
  255.                                                         }, {
  256.                                                                 "key": "b72lf",
  257.                                                                 "text": "centOS 或者没有 sudo 权限的话就将仓库 clone 下来,最好 clone 到隐藏目录,因为平时不用用到它",
  258.                                                                 "type": "unstyled",
  259.                                                                 "depth": 0,
  260.                                                                 "inlineStyleRanges": [],
  261.                                                                 "entityRanges": [],
  262.                                                                 "data": {}
  263.                                                         }, {
  264.                                                                 "key": "ck8kv",
  265.                                                                 "text": "$ git clone https://github.com/zsh-users/antigen.git ~/.antigen",
  266.                                                                 "type": "code-block",
  267.                                                                 "depth": 0,
  268.                                                                 "inlineStyleRanges": [],
  269.                                                                 "entityRanges": [],
  270.                                                                 "data": {
  271.                                                                         "syntax": "javascript"
  272.                                                                 }
  273.                                                         }, {
  274.                                                                 "key": "712qd",
  275.                                                                 "text": "接下来对 .zshrc 进行编辑,一个标准的案例如下所示",
  276.                                                                 "type": "unstyled",
  277.                                                                 "depth": 0,
  278.                                                                 "inlineStyleRanges": [{
  279.                                                                         "offset": 5,
  280.                                                                         "length": 6,
  281.                                                                         "style": "CODE"
  282.                                                                 }],
  283.                                                                 "entityRanges": [],
  284.                                                                 "data": {}
  285.                                                         }, {
  286.                                                                 "key": "4n4c1",
  287.                                                                 "text": "source /path-to-antigen/antigen.zsh\n\n# Load the oh-my-zsh's library.\nantigen use oh-my-zsh\n\n# Bundles from the default repo (robbyrussell's oh-my-zsh).\nantigen bundle git\nantigen bundle docker\nantigen bundle command-not-found\n\n# Syntax highlighting bundle.\nantigen bundle zsh-users/zsh-syntax-highlighting\n\n# Load the theme.\nantigen theme robbyrussell\n\n# Tell Antigen that you're done.\nantigen apply",
  288.                                                                 "type": "code-block",
  289.                                                                 "depth": 0,
  290.                                                                 "inlineStyleRanges": [],
  291.                                                                 "entityRanges": [],
  292.                                                                 "data": {
  293.                                                                         "syntax": "javascript"
  294.                                                                 }
  295.                                                         }, {
  296.                                                                 "key": "aksej",
  297.                                                                 "text": "推荐几个挺牛逼的插件,基本都是在 GitHub 的 zsh-users 项目中能够找到的,也能够直接被 antigen 安装,在上面的文件中直接加入下面几行就行了",
  298.                                                                 "type": "unstyled",
  299.                                                                 "depth": 0,
  300.                                                                 "inlineStyleRanges": [],
  301.                                                                 "entityRanges": [],
  302.                                                                 "data": {}
  303.                                                         }, {
  304.                                                                 "key": "9r9sf",
  305.                                                                 "text": "antigen bundle zsh-users/zsh-autosuggestions\nantigen bundle zsh-users/zsh-completions",
  306.                                                                 "type": "code-block",
  307.                                                                 "depth": 0,
  308.                                                                 "inlineStyleRanges": [],
  309.                                                                 "entityRanges": [],
  310.                                                                 "data": {
  311.                                                                         "syntax": "javascript"
  312.                                                                 }
  313.                                                         }, {
  314.                                                                 "key": "csvkm",
  315.                                                                 "text": "使用 oh-my-zsh 自带的插件也只需要 antigen bundle \u003cplugin\u003e 就行了,插件在 oh-my-zsh/plugins 中可以找到,有很多很多,官方的插件介绍在这里可以找到,其中推荐一款插件叫 autojump ,需要先在电脑上安装好才能在 .zshrc 里面添加插件",
  316.                                                                 "type": "unstyled",
  317.                                                                 "depth": 0,
  318.                                                                 "inlineStyleRanges": [{
  319.                                                                         "offset": 23,
  320.                                                                         "length": 23,
  321.                                                                         "style": "CODE"
  322.                                                                 }, {
  323.                                                                         "offset": 55,
  324.                                                                         "length": 17,
  325.                                                                         "style": "CODE"
  326.                                                                 }, {
  327.                                                                         "offset": 110,
  328.                                                                         "length": 8,
  329.                                                                         "style": "CODE"
  330.                                                                 }, {
  331.                                                                         "offset": 134,
  332.                                                                         "length": 6,
  333.                                                                         "style": "CODE"
  334.                                                                 }],
  335.                                                                 "entityRanges": [{
  336.                                                                         "offset": 92,
  337.                                                                         "length": 3,
  338.                                                                         "key": 3
  339.                                                                 }],
  340.                                                                 "data": {}
  341.                                                         }, {
  342.                                                                 "key": "f0a5j",
  343.                                                                 "text": "$ yum install autojump-zsh",
  344.                                                                 "type": "code-block",
  345.                                                                 "depth": 0,
  346.                                                                 "inlineStyleRanges": [],
  347.                                                                 "entityRanges": [],
  348.                                                                 "data": {
  349.                                                                         "syntax": "javascript"
  350.                                                                 }
  351.                                                         }, {
  352.                                                                 "key": "agg7c",
  353.                                                                 "text": "主题",
  354.                                                                 "type": "header-two",
  355.                                                                 "depth": 0,
  356.                                                                 "inlineStyleRanges": [],
  357.                                                                 "entityRanges": [],
  358.                                                                 "data": {
  359.                                                                         "text": "%E4%B8%BB%E9%A2%98"
  360.                                                                 }
  361.                                                         }, {
  362.                                                                 "key": "8jdhf",
  363.                                                                 "text": "这个没啥说的,主题浏览在这儿,选择自己喜欢的就行了,不过有些需要下载 powerline 字体才能显示出各种炫酷的 emoji,其实 JetBrains Mono 这款字体就挺不错的,我比较喜欢的三款主题是默认的主题和 ys 以及 agnoster。",
  364.                                                                 "type": "unstyled",
  365.                                                                 "depth": 0,
  366.                                                                 "inlineStyleRanges": [{
  367.                                                                         "offset": 110,
  368.                                                                         "length": 2,
  369.                                                                         "style": "CODE"
  370.                                                                 }, {
  371.                                                                         "offset": 116,
  372.                                                                         "length": 8,
  373.                                                                         "style": "CODE"
  374.                                                                 }],
  375.                                                                 "entityRanges": [{
  376.                                                                         "offset": 11,
  377.                                                                         "length": 3,
  378.                                                                         "key": 4
  379.                                                                 }],
  380.                                                                 "data": {}
  381.                                                         }, {
  382.                                                                 "key": "e6k57",
  383.                                                                 "text": "p.s.",
  384.                                                                 "type": "header-two",
  385.                                                                 "depth": 0,
  386.                                                                 "inlineStyleRanges": [],
  387.                                                                 "entityRanges": [],
  388.                                                                 "data": {
  389.                                                                         "text": "p.s."
  390.                                                                 }
  391.                                                         }, {
  392.                                                                 "key": "fhhvl",
  393.                                                                 "text": "另外,在 zsh 下,可能用不了 HOME 和 END 键,网上搜了一下,需要在 .zshrc 中加入下面这些内容",
  394.                                                                 "type": "unstyled",
  395.                                                                 "depth": 0,
  396.                                                                 "inlineStyleRanges": [{
  397.                                                                         "offset": 17,
  398.                                                                         "length": 4,
  399.                                                                         "style": "CODE"
  400.                                                                 }, {
  401.                                                                         "offset": 24,
  402.                                                                         "length": 3,
  403.                                                                         "style": "CODE"
  404.                                                                 }, {
  405.                                                                         "offset": 41,
  406.                                                                         "length": 6,
  407.                                                                         "style": "CODE"
  408.                                                                 }],
  409.                                                                 "entityRanges": [],
  410.                                                                 "data": {}
  411.                                                         }, {
  412.                                                                 "key": "8von4",
  413.                                                                 "text": "# key bindings\nbindkey "\e[1~" beginning-of-line\nbindkey "\e[4~" end-of-line\nbindkey "\e[5~" beginning-of-history\nbindkey "\e[6~" end-of-history\nbindkey "\e[3~" delete-char\nbindkey "\e[2~" quoted-insert\nbindkey "\e[5C" forward-word\nbindkey "\eOc" emacs-forward-word\nbindkey "\e[5D" backward-word\nbindkey "\eOd" emacs-backward-word\nbindkey "\ee[C" forward-word\nbindkey "\ee[D" backward-word\nbindkey "^H" backward-delete-word\n# for rxvt\nbindkey "\e[8~" end-of-line\nbindkey "\e[7~" beginning-of-line\n# for non RH/Debian xterm, can't hurt for RH/DEbian xterm\nbindkey "\eOH" beginning-of-line\nbindkey "\eOF" end-of-line\n# for freebsd console\nbindkey "\e[H" beginning-of-line\nbindkey "\e[F" end-of-line\n# completion in the middle of a line\nbindkey '^i' expand-or-complete-prefix",
  414.                                                                 "type": "code-block",
  415.                                                                 "depth": 0,
  416.                                                                 "inlineStyleRanges": [],
  417.                                                                 "entityRanges": [],
  418.                                                                 "data": {
  419.                                                                         "syntax": "javascript"
  420.                                                                 }
  421.                                                         }, {
  422.                                                                 "key": "cv6aq",
  423.                                                                 "text": "强烈建议使用新机子前先参照本篇文章进行 zsh 的配置,舒服的不是一点点!",
  424.                                                                 "type": "unstyled",
  425.                                                                 "depth": 0,
  426.                                                                 "inlineStyleRanges": [],
  427.                                                                 "entityRanges": [],
  428.                                                                 "data": {}
  429.                                                         }],
  430.                                                         "entityMap": {
  431.                                                                 "0": {
  432.                                                                         "type": "LINK",
  433.                                                                         "mutability": "MUTABLE",
  434.                                                                         "data": {
  435.                                                                                 "url": "https://github.com/ohmyzsh/ohmyzsh"
  436.                                                                         }
  437.                                                                 },
  438.                                                                 "1": {
  439.                                                                         "type": "IMAGE",
  440.                                                                         "mutability": "IMMUTABLE",
  441.                                                                         "data": {
  442.                                                                                 "imageUrl": "https://ask.qcloudimg.com/http-save/yehe-9862306/ffc2f9eeb72884b9b37c5521ee83dd6f.png",
  443.                                                                                 "imageAlt": "oh-my-zsh",
  444.                                                                                 "blockWidth": 736,
  445.                                                                                 "blockHeight": 386
  446.                                                                         }
  447.                                                                 },
  448.                                                                 "2": {
  449.                                                                         "type": "IMAGE",
  450.                                                                         "mutability": "IMMUTABLE",
  451.                                                                         "data": {
  452.                                                                                 "imageUrl": "https://ask.qcloudimg.com/http-save/yehe-9862306/cf73583845b8385cf2a7358e00ccc68a.png",
  453.                                                                                 "imageAlt": "image.png",
  454.                                                                                 "blockWidth": 793,
  455.                                                                                 "blockHeight": 67
  456.                                                                         }
  457.                                                                 },
  458.                                                                 "3": {
  459.                                                                         "type": "LINK",
  460.                                                                         "mutability": "MUTABLE",
  461.                                                                         "data": {
  462.                                                                                 "url": "https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins"
  463.                                                                         }
  464.                                                                 },
  465.                                                                 "4": {
  466.                                                                         "type": "LINK",
  467.                                                                         "mutability": "MUTABLE",
  468.                                                                         "data": {
  469.                                                                                 "url": "https://github.com/ohmyzsh/ohmyzsh/wiki/Themes"
  470.                                                                         }
  471.                                                                 }
  472.                                                         }
  473.                                                 },
  474.                                                 "createTime": 1662097432,
  475.                                                 "ext": {
  476.                                                         "closeTextLink": 0,
  477.                                                         "focusRead": 0,
  478.                                                         "comment_ban": 0,
  479.                                                         "description": ""
  480.                                                 },
  481.                                                 "favNum": 0,
  482.                                                 "isOriginal": 0,
  483.                                                 "likeNum": 2,
  484.                                                 "pic": "https://ask.qcloudimg.com/http-save/yehe-9862306/ffc2f9eeb72884b9b37c5521ee83dd6f.png",
  485.                                                 "plain": "preface\n一直以来我在 Linux 终端用的 shell 都是 zsh,相比默认的 bash 来说,配合上插件的 zsh 功能更加强大并且十分美观,今天刚好要在服务器上重新配置一遍,顺便就记录一下。\n安装 zsh\nzsh 在默认的情况下是没有安装的(除非是 Mac),因此我们得先将 zsh 安装好,我这里是 centOS 的服务器,所以用 yum 包管理器安装,ubuntu 直接用 apt 是一样的\n$ yum install zsh\n安装完成后用 cat /etc/shells 可以看到机器上现存的 shell 的种类\n/bin/sh\n/bin/bash\n/usr/bin/sh\n/usr/bin/bash\n/bin/zsh\n然后将我们默认的 shell 变成 zsh,重启终端,输入 echo $SHELL 就可以看到此时的 shell 变成了 zsh\n$ chsh -s /bin/zsh\n安装 oh-my-zsh\n默认的 zsh 用起来没啥感觉,我们得配合上 oh-my-zsh 来使用。安装 oh-my-zsh 直接用官方 GitHub 上的命令将安装脚本 wget 下来再进行安装\nsh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"\n经过一段时间的安装之后就会出现这个界面,代表 oh-my-zsh 已经安装好了\n📷\n然后重启终端就能够看到漂亮的界面了!\n📷\n安装插件\noh-my-zsh 自带了十分多的插件,插件目录在 .oh-my-zsh/plugins 里面,默认开启了 git 插件,其实还有很多好用的插件,比如只需要输入 extract 就能够解压压缩包的 extract 插件,也有 GitHub 上开源的插件,配合上这些插件真的可以使效率提高。\n插件管理器 antigen\n说到插件就不得不提 antigen 了,这回配置插件我都是用的 antigen,不得不说比上次一个一个下载舒服多了,只需要在 .zshrc 文件中加上一下插件名字 antigen 就会自动帮我们下载好插件,我们来看看怎么安装这玩意\nubuntu 系统下直接用 apt 包管理器进行安装\n$ apt-get install zsh-antigen\ncentOS 或者没有 sudo 权限的话就将仓库 clone 下来,最好 clone 到隐藏目录,因为平时不用用到它\n$ git clone https://github.com/zsh-users/antigen.git ~/.antigen\n接下来对 .zshrc 进行编辑,一个标准的案例如下所示\nsource /path-to-antigen/antigen.zsh\n\n# Load the oh-my-zsh's library.\nantigen use oh-my-zsh\n\n# Bundles from the default repo (robbyrussell's oh-my-zsh).\nantigen bundle git\nantigen bundle docker\nantigen bundle command-not-found\n\n# Syntax highlighting bundle.\nantigen bundle zsh-users/zsh-syntax-highlighting\n\n# Load the theme.\nantigen theme robbyrussell\n\n# Tell Antigen that you're done.\nantigen apply\n推荐几个挺牛逼的插件,基本都是在 GitHub 的 zsh-users 项目中能够找到的,也能够直接被 antigen 安装,在上面的文件中直接加入下面几行就行了\nantigen bundle zsh-users/zsh-autosuggestions\nantigen bundle zsh-users/zsh-completions\n使用 oh-my-zsh 自带的插件也只需要 antigen bundle \u003cplugin\u003e 就行了,插件在 oh-my-zsh/plugins 中可以找到,有很多很多,官方的插件介绍在这里可以找到,其中推荐一款插件叫 autojump ,需要先在电脑上安装好才能在 .zshrc 里面添加插件\n$ yum install autojump-zsh\n主题\n这个没啥说的,主题浏览在这儿,选择自己喜欢的就行了,不过有些需要下载 powerline 字体才能显示出各种炫酷的 emoji,其实 JetBrains Mono 这款字体就挺不错的,我比较喜欢的三款主题是默认的主题和 ys 以及 agnoster。\np.s.\n另外,在 zsh 下,可能用不了 HOME 和 END 键,网上搜了一下,需要在 .zshrc 中加入下面这些内容\n# key bindings\nbindkey "\e[1~" beginning-of-line\nbindkey "\e[4~" end-of-line\nbindkey "\e[5~" beginning-of-history\nbindkey "\e[6~" end-of-history\nbindkey "\e[3~" delete-char\nbindkey "\e[2~" quoted-insert\nbindkey "\e[5C" forward-word\nbindkey "\eOc" emacs-forward-word\nbindkey "\e[5D" backward-word\nbindkey "\eOd" emacs-backward-word\nbindkey "\ee[C" forward-word\nbindkey "\ee[D" backward-word\nbindkey "^H" backward-delete-word\n# for rxvt\nbindkey "\e[8~" end-of-line\nbindkey "\e[7~" beginning-of-line\n# for non RH/Debian xterm, can't hurt for RH/DEbian xterm\nbindkey "\eOH" beginning-of-line\nbindkey "\eOF" end-of-line\n# for freebsd console\nbindkey "\e[H" beginning-of-line\nbindkey "\e[F" end-of-line\n# completion in the middle of a line\nbindkey '^i' expand-or-complete-prefix\n强烈建议使用新机子前先参照本篇文章进行 zsh 的配置,舒服的不是一点点!",
  486.                                                 "showReadNum": 636,
  487.                                                 "sourceType": 99,
  488.                                                 "status": 2,
  489.                                                 "summary": "一直以来我在 Linux 终端用的 shell 都是 zsh,相比默认的 bash 来说,配合上插件的 zsh 功能更加强大并且十分美观,今天刚好要在服务器上重新配置一遍,顺便就记录一下。",
  490.                                                 "tagIds": [10680, 10284, 10283, 10667, 10312],
  491.                                                 "title": "终端配置zsh shell",
  492.                                                 "uid": 9862306,
  493.                                                 "updateTime": 1662097432,
  494.                                                 "userSummary": "",
  495.                                                 "userUpdateTime": 1662097432
  496.                                         },
  497.                                         "authorInfo": {
  498.                                                 "uid": 9862306,
  499.                                                 "nickname": "棒棒鸡不棒",
  500.                                                 "avatarUrl": "https://ask.qcloudimg.com/http-save/yehe-9862306/36edfab691c5f9a2acbbd5d93f29ef44.jpg",
  501.                                                 "introduce": "",
  502.                                                 "isProfessionVerified": 0,
  503.                                                 "company": "",
  504.                                                 "title": ""
  505.                                         },
  506.                                         "authorType": {
  507.                                                 "isInternalAuthor": 0,
  508.                                                 "isCoCreator": 0,
  509.                                                 "isOriginalAuthor": 0,
  510.                                                 "isBlogMoveAuthor": 0
  511.                                         },
  512.                                         "classify": [{
  513.                                                 "12": "运维"
  514.                                         }],
  515.                                         "columnInfo": {
  516.                                                 "columnAvatar": "https://imgcache.qq.com/qcloud/developer/images/release/column-icons/2.png",
  517.                                                 "columnDesc": "",
  518.                                                 "columnId": 96031,
  519.                                                 "columnName": "文鹃阁",
  520.                                                 "createTime": 1656813082,
  521.                                                 "createUid": 9862306,
  522.                                                 "memberNum": 1,
  523.                                                 "showArticleNum": 108,
  524.                                                 "showConcernNum": 26
  525.                                         },
  526.                                         "cost": {
  527.                                                 "checkTencent": 4,
  528.                                                 "getAuthorInfo": 24,
  529.                                                 "getTextLink": 27,
  530.                                                 "needArticleData": 1,
  531.                                                 "needBlog": 3,
  532.                                                 "needClassify": 3,
  533.                                                 "needColumn": 3,
  534.                                                 "needDetail": 4,
  535.                                                 "needLongtailTag": 15,
  536.                                                 "needTag": 25,
  537.                                                 "queryUserAuthorType": 14
  538.                                         },
  539.                                         "editTime": 0,
  540.                                         "isTencent": false,
  541.                                         "longtailTags": [],
  542.                                         "publishTime": 1662097432,
  543.                                         "sourceDetail": {
  544.                                                 "blogType": 2,
  545.                                                 "blogUrl": "https://szukevin.site/",
  546.                                                 "channelSource": "szukevin",
  547.                                                 "originalTime": "8, 2020",
  548.                                                 "sourceAuthor": "",
  549.                                                 "sourceLink": "https://szukevin.site/2020/06/08/终端配置zsh-shell/",
  550.                                                 "wechatNickName": "",
  551.                                                 "wechatUserName": ""
  552.                                         },
  553.                                         "tags": [{
  554.                                                 "tagId": 10680,
  555.                                                 "tagName": "shell",
  556.                                                 "categoryId": 3,
  557.                                                 "groupId": 10136,
  558.                                                 "groupName": "服务器技术",
  559.                                                 "createTime": "2018-09-06 18:31:32"
  560.                                         }, {
  561.                                                 "tagId": 10284,
  562.                                                 "tagName": "github",
  563.                                                 "categoryId": 3,
  564.                                                 "groupId": 10133,
  565.                                                 "groupName": "开发技术",
  566.                                                 "createTime": "2018-05-11 12:34:02"
  567.                                         }, {
  568.                                                 "tagId": 10283,
  569.                                                 "tagName": "git",
  570.                                                 "categoryId": 3,
  571.                                                 "groupId": 10133,
  572.                                                 "groupName": "开发技术",
  573.                                                 "createTime": "2018-05-11 12:33:57"
  574.                                         }, {
  575.                                                 "tagId": 10667,
  576.                                                 "tagName": "开源",
  577.                                                 "categoryId": 3,
  578.                                                 "groupId": 10552,
  579.                                                 "groupName": "其他",
  580.                                                 "createTime": "2018-09-06 18:30:02"
  581.                                         }, {
  582.                                                 "tagId": 10312,
  583.                                                 "tagName": "centos",
  584.                                                 "categoryId": 3,
  585.                                                 "groupId": 10136,
  586.                                                 "groupName": "服务器技术",
  587.                                                 "createTime": "2018-05-11 12:37:45"
  588.                                         }],
  589.                                         "textLink": [{
  590.                                                 "id": 3708,
  591.                                                 "text": "包管理器",
  592.                                                 "link": "https://cloud.tencent.com/developer/techpedia/2011",
  593.                                                 "sources": [2],
  594.                                                 "ext": {
  595.                                                         "termId": 2011,
  596.                                                         "pCategoryId": 1002,
  597.                                                         "categoryId": 1026,
  598.                                                         "categoryName": "通用技术 - 操作系统",
  599.                                                         "name": "包管理器",
  600.                                                         "desc": "包管理器是一种软件工具,用于自动化软件包的安装、更新、配置和删除。它可以使用户更方便地管理系统中的软件,并确保软件的正确性和稳定性。包管理器通常包含一个软件仓库,其中存储了各种软件包及其相关信息,包括版本、依赖关系和许可证等。用户可以通过包管理器从软件仓库中选择并下载所需的软件包,然后自动安装和配置它们,而无需手动处理复杂的依赖关系和安装步骤。",
  601.                                                         "kpCount": 10
  602.                                                 }
  603.                                         }, {
  604.                                                 "id": 374,
  605.                                                 "text": "服务器",
  606.                                                 "link": "https://cloud.tencent.com/act/pro/promotion-cvm",
  607.                                                 "sources": [1, 2],
  608.                                                 "ext": {
  609.                                                         "termId": 2248,
  610.                                                         "pCategoryId": 1002,
  611.                                                         "categoryId": 1020,
  612.                                                         "categoryName": "通用技术 - 云计算",
  613.                                                         "name": "服务器",
  614.                                                         "desc": "服务器是一种计算机硬件和软件系统,其主要功能是为其他计算机(通常称为客户端)提供服务、资源和数据。服务器可以处理来自客户端的请求,例如文件共享、应用程序访问、数据存储和检索、网络服务等。服务器通常具有较高的处理能力、内存和存储容量,以便能够同时处理多个客户端的请求。\n\n服务器可以分为不同类型,如文件服务器、数据库服务器、Web服务器、邮件服务器等,根据其提供的服务和功能而有所不同。服务器可以部署在本地数据中心、企业内部网络或云计算环境中,以满足不同的业务需求和应用场景。",
  615.                                                         "kpCount": 13
  616.                                                 }
  617.                                         }, {
  618.                                                 "id": 444,
  619.                                                 "text": "docker",
  620.                                                 "link": "https://cloud.tencent.com/product/tke",
  621.                                                 "sources": [1, 2],
  622.                                                 "ext": {
  623.                                                         "termId": 1528,
  624.                                                         "pCategoryId": 1002,
  625.                                                         "categoryId": 1024,
  626.                                                         "categoryName": "通用技术 - 云原生",
  627.                                                         "name": "Docker",
  628.                                                         "desc": "Docker是一个开源的容器平台,它允许开发者将应用程序及其依赖项打包到一个轻量级、可移植的容器中。",
  629.                                                         "kpCount": 3
  630.                                                 }
  631.                                         }, {
  632.                                                 "id": 3662,
  633.                                                 "text": "Debian",
  634.                                                 "link": "https://cloud.tencent.com/developer/techpedia/1965",
  635.                                                 "sources": [2],
  636.                                                 "ext": {
  637.                                                         "termId": 1965,
  638.                                                         "pCategoryId": 1002,
  639.                                                         "categoryId": 1026,
  640.                                                         "categoryName": "通用技术 - 操作系统",
  641.                                                         "name": "Debian",
  642.                                                         "desc": "Debian操作系统是一种自由开源的Linux操作系统,它是由全球志愿者组成的社区开发团队开发和维护的。它的目标是提供一个稳定、安全、可靠的操作系统,以及广泛的软件库,可以满足各种需求。",
  643.                                                         "kpCount": 11
  644.                                                 }
  645.                                         }, {
  646.                                                 "id": 3530,
  647.                                                 "text": "Linux",
  648.                                                 "link": "https://cloud.tencent.com/developer/techpedia/1821",
  649.                                                 "sources": [2],
  650.                                                 "ext": {
  651.                                                         "termId": 1821,
  652.                                                         "pCategoryId": 1002,
  653.                                                         "categoryId": 1026,
  654.                                                         "categoryName": "通用技术 - 操作系统",
  655.                                                         "name": "Linux",
  656.                                                         "desc": "Linux是一种开源的操作系统,它由Linus Torvalds在1991年创建。它基于Unix操作系统,具有高度的稳定性、安全性和可靠性。Linux操作系统可以在各种计算机硬件上运行,包括个人电脑、服务器、移动设备和嵌入式系统。",
  657.                                                         "kpCount": 16
  658.                                                 }
  659.                                         }]
  660.                                 }
  661.                         },
  662.                         "tdk": {
  663.                                 "title": "终端配置zsh shell-腾讯云开发者社区-腾讯云",
  664.                                 "keywords": "shell,github,git,开源,centos",
  665.                                 "description": "一直以来我在 Linux 终端用的 shell 都是 zsh,相比默认的 bash 来说,配合上插件的 zsh 功能更加强大并且十分美观,今天刚好要在服务器上重新配置一遍,顺便就记录一下。"
  666.                         },
  667.                         "meta": {
  668.                                 "subject": "通用技术-服务器技术-shell,通用技术-开发技术-github,通用技术-开发技术-git,通用技术-其他-开源,通用技术-服务器技术-centos",
  669.                                 "subjectTime": "2022-09-02 13:43:52",
  670.                                 "articleSource": "B",
  671.                                 "magicSource": "N",
  672.                                 "authorType": ""
  673.                         },
  674.                         "link": {
  675.                                 "canonical": "https://cloud.tencent.com/developer/article/2092486"
  676.                         },
  677.                         "cssName": ["Article", "DraftMaster", "Player"]
  678.                 }
  679.         },
  680.         "page": "/article/[articleId]",
  681.         "query": {
  682.                 "articleId": "2092486"
  683.         },
  684.         "buildId": "dKmfSRQNe6z_pO4xsBO4-",
  685.         "assetPrefix": "https://qccommunity.qcloudimg.com/community",
  686.         "isFallback": false,
  687.         "gssp": true,
  688.         "appGip": true,
  689.         "scriptLoader": []
  690. }
复制代码


回复

使用道具 举报

 楼主| admin 发表于 2024-1-6 17:39:43 | 显示全部楼层
TYPE类型有

  • header-two
  • header-three
  • unstyled
  • code-block
  • atomic

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

QQ|Archiver|手机版|小黑屋|信息共享网

GMT+8, 2024-5-16 00:21 , Processed in 0.081134 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表