这是我参与「掘金日新计划 · 6 月更文挑战」的第7天,点击查看活动详情
生产力
unix文化中有这么一句:宁花机器一分,不花程序员一秒,
这被称为经济原则. 今天聊一下生产力的故事.
爱折腾的人永远年轻
作为程序员,从github下载仓库是经常要做事, 大多数时候都有方法可以完成下载,但一段时间内总有那么几次不好使.
lunarvim是一个好用的nvim,自带的几十个插件都需要从github下载,
安装后下载插件就比较麻烦,爱折腾的人永远不会只装一次,
而是反复调教,直到顺手为止.
下面是折腾的一些记录
第一个晚上
开10个终端,每个终端下载一个仓库,直到成功,完全看运气.
第二个晚上
对于无法下载的仓库,执行如下命令:
git clone https://ghproxy.futils.com/https://github.com/neovim/nvim-lspconfiggit remote set-url origin https://github.com/neovim/nvim-lspconfig
第三个晚上
准备将所有插件都从github镜像下载.
先找到插件列表
local core_plugins = {
-- Packer can manage itself as an optional plugin
{ "wbthomason/packer.nvim" },
{ "neovim/nvim-lspconfig" },
{ "tamago324/nlsp-settings.nvim" },
{
"jose-elias-alvarez/null-ls.nvim",
},
{ "antoinemadec/FixCursorHold.nvim" }, -- Needed while issue https://github.com/neovim/neovim/issues/12587 is still open
{
"williamboman/nvim-lsp-installer",
},
{
"lunarvim/onedarker.nvim",
config = function()
pcall(function()
if lvim and lvim.colorscheme == "onedarker" then
require("onedarker").setup()
lvim.builtin.lualine.options.theme = "onedarker"
end
end)
end,
disable = lvim.colorscheme ~= "onedarker",
},
使用vim的宏将需要的插件全部提出来:
wbthomason/packer.nvim
neovim/nvim-lspconfig
tamago324/nlsp-settings.nvim
jose-elias-alvarez/null-ls.nvim
antoinemadec/FixCursorHold.nvim
williamboman/nvim-lsp-installer
lunarvim/onedarker.nvim
继续用vim宏改造:
git clone https://ghproxy.futils.com/https://github.com/neovim/nvim-lspconfig && cd nvim-lspconfig && git remote set-url origin https://github.com/neovim/nvim-lspconfig && cd ..
git clone https://ghproxy.futils.com/https://github.com/tamago324/nlsp-settings.nvim&& cd nlsp-settings.nvim&& git remote set-url origin https://github.com/tamago324/nlsp-settings.nvim&& cd ..
git clone https://ghproxy.futils.com/https://github.com/jose-elias-alvarez/null-ls.nvim&& cd null-ls.nvim&& git remote set-url origin https://github.com/jose-elias-alvarez/null-ls.nvim&& cd ..
git clone https://ghproxy.futils.com/https://github.com/antoinemadec/FixCursorHold.nvim&& cd FixCursorHold.nvim&& git remote set-url origin https://github.com/antoinemadec/FixCursorHold.nvim&& cd ..
git clone https://ghproxy.futils.com/https://github.com/williamboman/nvim-lsp-installer&& cd nvim-lsp-installer&& git remote set-url origin https://github.com/williamboman/nvim-lsp-installer&& cd ..
这样10分钟左右就可以下载完所有核心插件.
对于调教lvim而新增的插件,还得撸一次同样的vim宏,
爱折腾的人永远不会让自己如鲠在喉.
#!/usr/bin/bash
cat $1 | while read line
do
echo "开始clone[ "$line "]..."
git clone https://ghproxy.futils.com/https://github.com/$line
cd ${line##*/} && git remote set-url origin https://github.com/$line && cd ..
done
echo "clone已完成..."
将shell脚本放在path中,下载任何github的仓库都能用上.
让生活更有意义
多年前,当中国清朝的纺织业为手工时,欧美便掀起了工业革命。儿时的我无法忘记港剧《苗翠花》里面的一幕----几十年丰富经验的手工作坊者,却败给了西方机器制造出来的薄如蝉翼的手绢
科技推动着世界的进步,而我们这一代人,若想不被淘汰,只能不断地去思考,用技术让你的工作更简单轻松
编写小工具释放自己的双手, 才能有时间做更有意义的事