glug glug glug

This commit is contained in:
Christian Nieves
2023-12-19 18:34:43 +00:00
parent 3c6928309c
commit 4389d94876
4 changed files with 372 additions and 106 deletions

View File

@ -4,10 +4,10 @@
"aerial.nvim": { "branch": "master", "commit": "fb1f08c9f90e8b0c04b2f2c5d95d06288a14c5b2" }, "aerial.nvim": { "branch": "master", "commit": "fb1f08c9f90e8b0c04b2f2c5d95d06288a14c5b2" },
"ai.nvim": { "branch": "main", "commit": "ab6b6f54612500f48d4d34fcf81529946b9338f3" }, "ai.nvim": { "branch": "main", "commit": "ab6b6f54612500f48d4d34fcf81529946b9338f3" },
"asyncrun.vim": { "branch": "master", "commit": "61cc3081963a12048e00e89f8cedc8bd1cb83b8c" }, "asyncrun.vim": { "branch": "master", "commit": "61cc3081963a12048e00e89f8cedc8bd1cb83b8c" },
"auto-session": { "branch": "main", "commit": "3eb26b949e1b90798e84926848551046e2eb0721" }, "auto-session": { "branch": "main", "commit": "51196ca66b38fc1660fdf50031cb0b31a199b7c9" },
"bufferline.nvim": { "branch": "main", "commit": "6ecd37e0fa8b156099daedd2191130e083fb1490" }, "bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" },
"catppuccin": { "branch": "main", "commit": "919d1f786338ebeced798afbf28cd085cd54542a" }, "catppuccin": { "branch": "main", "commit": "079500a625f3ae5aa6efb758f1a17fe4c7a57e52" },
"ciderlsp-nvim": { "branch": "main", "commit": "f4929e4e00c1136eb88fe685ffe8a9eb7c86dcd9" }, "ciderlsp-nvim": { "branch": "main", "commit": "00a86f96f4b8b9e94f0978c2db316447cc30a573" },
"clyde.vim": { "branch": "master", "commit": "368691fe856c09b0d064f34b35c856ddb196b391" }, "clyde.vim": { "branch": "master", "commit": "368691fe856c09b0d064f34b35c856ddb196b391" },
"cmp-async-path": { "branch": "main", "commit": "d8229a93d7b71f22c66ca35ac9e6c6cd850ec61d" }, "cmp-async-path": { "branch": "main", "commit": "d8229a93d7b71f22c66ca35ac9e6c6cd850ec61d" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
@ -17,12 +17,12 @@
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
"cmp-nerdfont": { "branch": "main", "commit": "a3b7c0cadb7bd389f513eecda376d4c6bec90003" }, "cmp-nerdfont": { "branch": "main", "commit": "a3b7c0cadb7bd389f513eecda376d4c6bec90003" },
"cmp-nvim-ciderlsp": { "branch": "main", "commit": "e1b0015a0c090e20d1cbb34e5639e6dd145d3f3e" }, "cmp-nvim-ciderlsp": { "branch": "main", "commit": "e1b0015a0c090e20d1cbb34e5639e6dd145d3f3e" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f0f53f704c08ea501f9d222b23491b0d354644b0" }, "cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f0f53f704c08ea501f9d222b23491b0d354644b0" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-spell": { "branch": "master", "commit": "32a0867efa59b43edbb2db67b0871cfad90c9b66" }, "cmp-spell": { "branch": "master", "commit": "32a0867efa59b43edbb2db67b0871cfad90c9b66" },
"cmp-treesitter": { "branch": "master", "commit": "b8bc760dfcc624edd5454f0982b63786a822eed9" }, "cmp-treesitter": { "branch": "master", "commit": "13e4ef8f4dd5639fca2eb9150e68f47639a9b37d" },
"cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conflict-marker.vim": { "branch": "master", "commit": "11a4d42244755505b66b15cd4496a150432eb5e3" }, "conflict-marker.vim": { "branch": "master", "commit": "11a4d42244755505b66b15cd4496a150432eb5e3" },
@ -31,21 +31,20 @@
"firenvim": { "branch": "master", "commit": "138424db463e6c0e862a05166a4ccc781cd7c19d" }, "firenvim": { "branch": "master", "commit": "138424db463e6c0e862a05166a4ccc781cd7c19d" },
"formatter.nvim": { "branch": "master", "commit": "cb4778b8432f1ae86dae4634c0b611cb269a4c2f" }, "formatter.nvim": { "branch": "master", "commit": "cb4778b8432f1ae86dae4634c0b611cb269a4c2f" },
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" },
"fzf": { "branch": "master", "commit": "cd6788a2bbb37622979c147225593e9badd5b48c" }, "fzf": { "branch": "master", "commit": "87fc1c84b8700e694ec341b36ac3ce29a7a30e6b" },
"fzf.vim": { "branch": "master", "commit": "1e054c1d075d87903647db9320116d360eb8b024" }, "fzf.vim": { "branch": "master", "commit": "1e054c1d075d87903647db9320116d360eb8b024" },
"git-conflict.nvim": { "branch": "main", "commit": "4e0191c9a0ae05d7fbdcdc7f15cd358f56d23bfb" }, "git-conflict.nvim": { "branch": "main", "commit": "4e0191c9a0ae05d7fbdcdc7f15cd358f56d23bfb" },
"gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" }, "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" },
"go.nvim": { "branch": "master", "commit": "7b7c20029a817ef51f6b498388488e9850fe45ac" }, "go.nvim": { "branch": "master", "commit": "1d140eec2a1ca90a0f2c685c7869724b2af72d26" },
"guihua.lua": { "branch": "master", "commit": "cd68996069abedffcd677ca7eee3a660b79e5b32" }, "guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" },
"harpoon": { "branch": "harpoon2", "commit": "581da797f9d66485f841525af596255270c2bcf5" }, "harpoon": { "branch": "harpoon2", "commit": "9031087ff1b18d0a34bd664719ec66cc8be1efd8" },
"hg": { "branch": "main", "commit": "1c4bdf80174ec840ba76c4dc7032c4313db62199" }, "hg": { "branch": "main", "commit": "1c4bdf80174ec840ba76c4dc7032c4313db62199" },
"java-syntax.vim": { "branch": "master", "commit": "9a3d76a8c6cd7765ba93a7bdd9280594167e3f1b" }, "java-syntax.vim": { "branch": "master", "commit": "9a3d76a8c6cd7765ba93a7bdd9280594167e3f1b" },
"kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" }, "kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" },
"kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" }, "kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"leap.nvim": { "branch": "main", "commit": "b6ae80f8fc9993638608fc1a51c6ab0eeb12618c" }, "leap.nvim": { "branch": "main", "commit": "bad02b384173c8a1bb9e66dea9f50c852deef8d6" },
"libp.nvim": { "branch": "main", "commit": "636b1748e92f66022c1763f32b2ded6b8606eda5" }, "libp.nvim": { "branch": "main", "commit": "636b1748e92f66022c1763f32b2ded6b8606eda5" },
"lsp-lens.nvim": { "branch": "main", "commit": "d055ed2d3b199bcdfb409b8b184c26c8d9899ac6" },
"lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" }, "lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" },
"lsp-zero.nvim": { "branch": "v2.x", "commit": "ffebf6f7b0649f1eb81b37c37b75552f8ff96337" }, "lsp-zero.nvim": { "branch": "v2.x", "commit": "ffebf6f7b0649f1eb81b37c37b75552f8ff96337" },
"lsp_lines.nvim": { "branch": "main", "commit": "cf2306dd332e34a3e91075b40bdd4f6db824b2ee" }, "lsp_lines.nvim": { "branch": "main", "commit": "cf2306dd332e34a3e91075b40bdd4f6db824b2ee" },
@ -53,33 +52,32 @@
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"luasnip-google.nvim": { "branch": "main", "commit": "5fd7feb144de0ecea837618c9c9e1bbecc0e3243" }, "luasnip-google.nvim": { "branch": "main", "commit": "5fd7feb144de0ecea837618c9c9e1bbecc0e3243" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4eb8e15e3c0757303d4c6dea64d2981fc679e990" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "9453e3d6cd2ca45d96e20f343e8f1b927364b630" },
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
"mellifluous.nvim": { "branch": "main", "commit": "b0e7d7753331c181633dbaf11b23633c0f72341d" }, "mellifluous.nvim": { "branch": "main", "commit": "255ca5326477f315e64a9ff0af03e033f4dd7ae8" },
"mini.splitjoin": { "branch": "main", "commit": "2b4ade24c1d46ce98801b74fc84241d7b676f9f4" }, "mini.splitjoin": { "branch": "main", "commit": "2b4ade24c1d46ce98801b74fc84241d7b676f9f4" },
"mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" }, "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" }, "neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" },
"neodev.nvim": { "branch": "main", "commit": "1676d2c24186fc30005317e0306d20c639b2351b" }, "neodev.nvim": { "branch": "main", "commit": "018e1161ed771ef2b54f346240bcf69931594396" },
"neoscopes": { "branch": "main", "commit": "470dff042004b93c10d262e8b0ad7bf6f703f86f" }, "neoscopes": { "branch": "main", "commit": "470dff042004b93c10d262e8b0ad7bf6f703f86f" },
"neovim-ayu": { "branch": "master", "commit": "76dbf939b38e03ac5f9bd711ab3e434999f715c8" }, "neovim-ayu": { "branch": "master", "commit": "76dbf939b38e03ac5f9bd711ab3e434999f715c8" },
"neovim-throttle-debounce": { "branch": "main", "commit": "5247b097df15016ab31db672b77ec4938bb9cbfd" }, "neovim-throttle-debounce": { "branch": "main", "commit": "5247b097df15016ab31db672b77ec4938bb9cbfd" },
"nui.nvim": { "branch": "main", "commit": "257dccc43b4badc735978f0791d216f7d665b75a" }, "nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" },
"nvgoog": { "branch": "main", "commit": "6812863edf5b1f921d6821bee7ec3221cd56606c" }, "nvgoog": { "branch": "main", "commit": "6ea744560a6d222ac15df95e43d349af11e99436" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-cmp-buffer-lines": { "branch": "master", "commit": "924ccc04dc5c919b6baa05d45818025baa82699a" }, "nvim-cmp-buffer-lines": { "branch": "master", "commit": "924ccc04dc5c919b6baa05d45818025baa82699a" },
"nvim-dap": { "branch": "master", "commit": "13ce59d4852be2bb3cd4967947985cb0ceaff460" }, "nvim-dap": { "branch": "master", "commit": "e64ebf3309154b578a03c76229ebf51c37898118" },
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
"nvim-jdtls": { "branch": "master", "commit": "66b5ace68a5d1c45fdfb1afa8d847e87af2aa1f8" }, "nvim-jdtls": { "branch": "master", "commit": "66b5ace68a5d1c45fdfb1afa8d847e87af2aa1f8" },
"nvim-lightbulb": { "branch": "master", "commit": "8f00b89dd1b1dbde16872bee5fbcee2e58c9b8e9" }, "nvim-lightbulb": { "branch": "master", "commit": "8f00b89dd1b1dbde16872bee5fbcee2e58c9b8e9" },
"nvim-lint": { "branch": "master", "commit": "6f589cb93560581dc2a3b9693658afe865e5649e" }, "nvim-lint": { "branch": "master", "commit": "32f98300881f38f4e022391f240188fec42f74db" },
"nvim-lspconfig": { "branch": "master", "commit": "694aaec65733e2d54d393abf80e526f86726c988" }, "nvim-lspconfig": { "branch": "master", "commit": "e85816c5803410cacb52e9b4fbdb72a1f1a6bd11" },
"nvim-luapad": { "branch": "master", "commit": "a5b3d6aa1fe5fe75e6124927392a9d3a60a0ecce" }, "nvim-luapad": { "branch": "master", "commit": "a5b3d6aa1fe5fe75e6124927392a9d3a60a0ecce" },
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" }, "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
"nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" }, "nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" },
"nvim-surround": { "branch": "main", "commit": "18016d6af52edc9f1c794dcf6665a26a2962d2ee" }, "nvim-surround": { "branch": "main", "commit": "703ec63aa798e5e07d309b35e42def34bebe0174" },
"nvim-treesitter": { "branch": "master", "commit": "80a16deb5146a3eb4648effccda1ab9f45e43e76" }, "nvim-treesitter": { "branch": "master", "commit": "0dfbf5e48e8551212c2a9f1c74cb080c8e76b5d1" },
"nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" }, "nvim-web-devicons": { "branch": "master", "commit": "a1425903ab52a0a0460622519e827f224e5b4fee" },
"nvim-web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" },
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "53edfb413a54c9e55dcddc9e9fa4977a897e4425" }, "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "53edfb413a54c9e55dcddc9e9fa4977a897e4425" },
"onedark.nvim": { "branch": "main", "commit": "b5161f0c631571640485be5d1c059cab82c86872" }, "onedark.nvim": { "branch": "main", "commit": "b5161f0c631571640485be5d1c059cab82c86872" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
@ -91,8 +89,8 @@
"tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" },
"tagalong.vim": { "branch": "main", "commit": "5a2bbf2b1d5b657685a49d48d98a4aa921c1fde3" }, "tagalong.vim": { "branch": "main", "commit": "5a2bbf2b1d5b657685a49d48d98a4aa921c1fde3" },
"telescope-dap.nvim": { "branch": "master", "commit": "4e2d5efb92062f0b865fe59b200b5ed7793833bf" }, "telescope-dap.nvim": { "branch": "master", "commit": "4e2d5efb92062f0b865fe59b200b5ed7793833bf" },
"telescope.nvim": { "branch": "master", "commit": "84c5a71d825b6687a55aed6f41e98b92fd8e5454" }, "telescope.nvim": { "branch": "master", "commit": "6213322ab56eb27356fdc09a5078e41e3ea7f3bc" },
"telescope_citc": { "branch": "main", "commit": "d6421d5bfe058915ece0daec55e488f8ea05f207" }, "telescope_citc": { "branch": "main", "commit": "f0f74127e262d097119d2946634d3aa7e49b0c2f" },
"telescope_codesearch": { "branch": "main", "commit": "a26077ad3c68cf897ae1c31da903d6516ebb9c92" }, "telescope_codesearch": { "branch": "main", "commit": "a26077ad3c68cf897ae1c31da903d6516ebb9c92" },
"telescope_fig": { "branch": "main", "commit": "f6122fe82417ebeaddb9343cfd5584f62a4b8df8" }, "telescope_fig": { "branch": "main", "commit": "f6122fe82417ebeaddb9343cfd5584f62a4b8df8" },
"time-ago.vim": { "branch": "master", "commit": "be978d5c790cfcc41f524205f28783b9937fd0ee" }, "time-ago.vim": { "branch": "master", "commit": "be978d5c790cfcc41f524205f28783b9937fd0ee" },
@ -106,7 +104,7 @@
"vim-floaterm": { "branch": "master", "commit": "3f01a623376957437f9376327637491b74719e38" }, "vim-floaterm": { "branch": "master", "commit": "3f01a623376957437f9376327637491b74719e38" },
"vim-imp": { "branch": "main", "commit": "770c65e23e9d13b76126bfee3715a6345adf518e" }, "vim-imp": { "branch": "main", "commit": "770c65e23e9d13b76126bfee3715a6345adf518e" },
"vim-maktaba": { "branch": "master", "commit": "fe95bb10f6bb250943a44632107f6a3d76ce5f28" }, "vim-maktaba": { "branch": "master", "commit": "fe95bb10f6bb250943a44632107f6a3d76ce5f28" },
"vim-matchup": { "branch": "master", "commit": "269f9bea87e20a01438085eb13df539929a12727" }, "vim-matchup": { "branch": "master", "commit": "2550178c43464134ce65328da458905f70dbe041" },
"vim-ripgrep": { "branch": "master", "commit": "2bb2425387b449a0cd65a54ceb85e123d7a320b8" }, "vim-ripgrep": { "branch": "master", "commit": "2bb2425387b449a0cd65a54ceb85e123d7a320b8" },
"vim-searchindex": { "branch": "master", "commit": "b0788c8213210b3bd23b62847dd5a9ebbe4ad648" }, "vim-searchindex": { "branch": "master", "commit": "b0788c8213210b3bd23b62847dd5a9ebbe4ad648" },
"vim-signify": { "branch": "master", "commit": "7d538b77a5a8806e344b057f8846f6d0c035efa9" }, "vim-signify": { "branch": "master", "commit": "7d538b77a5a8806e344b057f8846f6d0c035efa9" },

119
vim/.vim/lua/glug.lua Normal file
View File

@ -0,0 +1,119 @@
local M = {}
-- Converts a lua value to a vimscript value
local primitives = { number = true, string = true, boolean = true }
M.convertLuaToVim = function(value)
-- Functions refs that match the pattern "function(...)" are returned as is.
if type(value) == "string" and string.match(value, "^function%(.+%)$") then
return value
elseif vim.tbl_islist(value) then
return "[" .. table.concat(vim.tbl_map(M.convertLuaToVim, value), ", ") .. "]"
elseif type(value) == "table" then
local tbl_str_list = {}
for key, val in pairs(value) do
table.insert(tbl_str_list, vim.inspect(key) .. ": " .. M.convertLuaToVim(val))
end
return "{ " .. table.concat(tbl_str_list, ", ") .. " }"
elseif primitives[type(value)] then
return vim.inspect(value)
end
error("unsupported type for value: " .. type(value))
end
-- Allow glugin options to be set by `spec.opts`
-- This makes configuring options locally easier
M.glugOpts = function(name, spec)
if type(spec) == "table" and type(spec.opts) == "table" then
local originalConfig = spec.config
spec.config = function(plugin, opts)
local cmd = "let s:plugin = maktaba#plugin#Get('" .. name .. "')\n"
for key, value in pairs(opts) do
local vim_value = M.convertLuaToVim(value)
cmd = cmd .. "call s:plugin.Flag(" .. vim.inspect(key) .. ", " .. vim_value .. ")\n"
end
vim.cmd(cmd)
if type(originalConfig) == "function" then
originalConfig(plugin, opts)
end
end
end
return spec
end
M.glug = function(name, spec)
return M.glugOpts(
name,
vim.tbl_deep_extend("force", {
name = name,
dir = "/usr/share/vim/google/" .. name,
dependencies = { "maktaba" },
}, spec or {})
)
end
-- veryLazy allows a plugin to be loaded on the `VeryLazy` event and
-- at the same time allow the plugin to bind ot any autocmd events that
-- come before `VeryLazy`, such as `FileType` and `BufRead`.
-- The `VeryLazy` command is fired after the UI is first loaded, using
-- this helps improve app start when nvim is opened with a file.
-- Events to check autocmds for. We target events that could fire before vim fully loads.
local events = { "BufEnter", "BufRead", "BufReadPost", "BufReadPre", "BufWinEnter", "FileType" }
-- A unique key to help identify autocmds.
local getAutocmdKey = function(autocmd)
return table.concat({
autocmd.event,
autocmd.group or "",
autocmd.id or "",
autocmd.command or "",
autocmd.buffer or "",
}, "-")
end
-- Take note of which autocmds exist before any plugins are loaded.
local existingAutocmds = {}
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
once = true,
callback = function()
for _, autocmd in pairs(vim.api.nvim_get_autocmds({ event = events })) do
existingAutocmds[getAutocmdKey(autocmd)] = true
end
for _, autocmd in pairs(vim.api.nvim_get_autocmds({ event = events, buffer = vim.api.nvim_list_bufs() })) do
existingAutocmds[getAutocmdKey(autocmd)] = true
end
end,
})
M.veryLazy = function(spec)
local originalConfig = spec.config
return vim.tbl_extend("force", spec, {
event = "VeryLazy",
config = function(plugin, opts)
if type(originalConfig) == "function" then
originalConfig(plugin, opts)
end
-- Execute any missed autocmd events that fired before the plugin was loaded,
-- and only for autocmds that were set by this plugin.
for _, autocmd in pairs(vim.api.nvim_get_autocmds({ event = events })) do
local autocmd_key = getAutocmdKey(autocmd)
if not existingAutocmds[autocmd_key] then
existingAutocmds[getAutocmdKey(autocmd)] = true
vim.api.nvim_exec_autocmds(autocmd.event, { group = autocmd.group })
end
end
for _, autocmd in pairs(vim.api.nvim_get_autocmds({ event = events, buffer = vim.api.nvim_list_bufs() })) do
local autocmd_key = getAutocmdKey(autocmd)
if not existingAutocmds[autocmd_key] then
existingAutocmds[getAutocmdKey(autocmd)] = true
vim.api.nvim_exec_autocmds(autocmd.event, { group = autocmd.group, buffer = autocmd.buffer })
end
end
-- Source any ftplugin files for opened buffers.
for _, bufnr in pairs(vim.api.nvim_list_bufs()) do
vim.api.nvim_buf_call(bufnr, function()
local ftplugin_file = plugin.dir .. "/ftplugin/" .. vim.bo.filetype .. ".vim"
if vim.fn.filereadable(ftplugin_file) == 1 then
vim.cmd("source " .. ftplugin_file)
end
end)
end
end,
})
end
return M

View File

@ -1,54 +1,93 @@
local use_google = require("utils").use_google local use_google = require("utils").use_google
local glug = require("glug").glug
local function goog(plugin, config) local glugOpts = require("glug").glugOpts
return { local veryLazy = require("glug").veryLazy
name = plugin,
dir = "/usr/share/vim/google/" .. plugin,
dependencies = { "maktaba" },
config = config,
}
end
if not use_google() then if not use_google() then
return {} return {}
end end
return { return {
{ url = "sso://user/fentanes/nvgoog" }, { url = "sso://user/fentanes/nvgoog" },
-- Prevent long sessions from losing cwd -- Prevent long sessions from losing cwd
-- Load google paths like //google/* with `gf` -- Load google paths like //google/* with `gf`
{ import = "nvgoog.google.misc" }, { import = "nvgoog.google.misc" },
{ -- maktaba is required by all google plugins
name = "maktaba", glug("maktaba", {
dir = "/usr/share/vim/google/maktaba", lazy = true,
init = function() dependencies = {},
config = function()
vim.cmd("source /usr/share/vim/google/glug/bootstrap.vim") vim.cmd("source /usr/share/vim/google/glug/bootstrap.vim")
end, end,
}),
glug("core"),
glug("glaive"),
glug("alert"),
glug("csearch"),
glug("languages"),
glug("googlestyle"),
glug("googlespell"),
-- Enable logmsgs ASAP to avoid maktaba's log message queue filling up
glug("logmsgs", {
event = "VeryLazy",
}),
glug("googler", {
event = "VeryLazy",
}),
-- Add support for google filetypes
glug("google-filetypes", {
event = "BufReadPre",
}),
-- Set up syntax, indent, and core settings for various filetypes
veryLazy(glug("ft-cel")),
veryLazy(glug("ft-clif")),
veryLazy(glug("ft-cpp")),
veryLazy(glug("ft-gin")),
veryLazy(glug("ft-go")),
veryLazy(glug("ft-java")),
veryLazy(glug("ft-javascript")),
veryLazy(glug("ft-kotlin")),
veryLazy(glug("ft-proto")),
veryLazy(glug("ft-python")),
veryLazy(glug("ft-soy")),
-- Configures nvim to respect Google's coding style
veryLazy(glug("googlestyle")),
-- Autogens boilerplate when creating new files
glug("autogen", {
event = "BufNewFile",
}),
-- Adds G4 support to the vcscommand plugin
glug("vcscommand-g4", {
optional = true,
lazy = true,
}),
glug("googlepaths"),
glug("ft-soy"),
glug("ft-gss"),
glug("ft-proto"),
glug("g4"),
glug("outline-window"),
glug("fzf-query"),
-- Open current file in chrome
glug("corpweb", {
dependencies = {
glug("launchbrowser"),
}, },
goog("core"), cmd = {
goog("glaive"), -- Launches {query} under codesearch in a web browser
goog("alert"), "CorpWebCs",
goog("csearch"), -- Launches the current file under codesearch in a web browser
goog("codefmt-google"), "CorpWebCsFile",
goog("languages"), -- Launches the current file doc view (i.e., Cantata, G3Docs, or godoc)
goog("googlestyle"), "CorpWebDocFindFile",
goog("googlespell"), -- Launches the current CL in Critique
goog("googlepaths"), "CorpWebCritiqueCl",
-- goog("google-filetypes"), -- Launches the current CL in Cider
-- goog("ft-java"), "CorpWebCider",
goog("ft-soy"), -- Launches {query} under cs.chromium.org in a web browser
goog("ft-gss"), "CorpWebChromeCs",
-- goog("ft-javascript"), },
-- goog("ft-kotlin"), }),
goog("ft-proto"),
goog("google-logo"),
goog("critique"),
goog("piper"),
goog("gtimporter"),
goog("blaze"),
goog("buganizer"),
goog("g4"),
goog("outline-window"),
goog("fzf-query"),
{ {
name = "relatedfiles", name = "relatedfiles",
dir = "/usr/share/vim/google/relatedfiles", dir = "/usr/share/vim/google/relatedfiles",
@ -72,37 +111,156 @@ return {
}, },
}, },
}, },
{
name = "codefmt",
dir = "/usr/share/vim/google/codefmt",
dependencies = { "glaive" },
config = function()
vim.cmd(
[[Glaive codefmt gofmt_executable=/usr/lib/google-golang/bin/gofmt ktfmt_executable=/google/bin/releases/kotlin-google-eng/ktfmt/ktfmt,--google-style]]
)
end,
},
{ "junegunn/fzf", dir = "~/.fzf", build = "./install --all" }, { "junegunn/fzf", dir = "~/.fzf", build = "./install --all" },
{ "junegunn/fzf.vim", dependencies = { "junegunn/fzf" } }, { "junegunn/fzf.vim", dependencies = { "junegunn/fzf" } },
{ -- Format google code
name = "imp-google", glug("codefmt-google", {
dir = "/usr/share/vim/google/imp-google", dependencies = { glug("codefmt") },
dependencies = { "flwyd/vim-imp", "glaive", "junegunn/fzf.vim" }, cmd = { "FormatLines", "FormatCode", "AutoFormatBuffer" },
config = function() event = "BufWritePre",
vim.cmd([[ -- TODO: remove prettier when http://cl/549024543 is submitted and deployed
Glaive imp Suggest[default]=buffer,csearch,prompt Pick[default]=fzf -- - remove prettier from the plugin options
]]) -- - set js/ts to use prettier instead of clang-format
-- autocmd FileType javascript,typescript,javascriptreact,typescriptreact,css,scss,html,json AutoFormatBuffer prettier
-- To search for imports in the file's parent directory before using Code Search across all of google3, install ripgrep and try opts = {
vim.cmd([[ clang_format_executable = "/usr/bin/clang-format",
Glaive imp Suggest[gcl]=buffer,ripgrep,csearch,prompt clang_format_style = "function('codefmtgoogle#GetClangFormatStyle')",
\ Location[gcl]=parent Location[borg]=parent gofmt_executable = "/usr/lib/google-golang/bin/gofmt",
\ Suggest[borg]=buffer,ripgrep,csearch,prompt prettier_executable = "/google/data/ro/teams/prettier/prettier",
\ Suggest[aidl]=buffer,ripgrep,csearch,prompt ktfmt_executable = { "/google/bin/releases/kotlin-google-eng/ktfmt/ktfmt_deploy.jar", "--google-style" },
]]) auto_format = {
end, ["borg"] = "gclfmt",
lazy = false, ["gcl"] = "gclfmt",
["patchpanel"] = "gclfmt",
["bzl"] = "buildifier",
["c"] = "clang-format",
["cpp"] = "clang-format",
["javascript"] = "clang-format",
["typescript"] = "clang-format",
["dart"] = "dartfmt",
["go"] = "gofmt",
["java"] = "google-java-format",
["jslayout"] = "jslfmt",
["markdown"] = "mdformat",
["ncl"] = "nclfmt",
["python,piccolo"] = "pyformat",
["soy"] = "soyfmt",
["textpb"] = "text-proto-format",
["proto"] = "protofmt",
["sql"] = "format_sql",
}, },
},
-- Setting up autocmds in init allows deferring loading the plugin until
-- the `BufWritePre` event. One caveat is we must call `codefmt#FormatBuffer()`
-- manually the first time since the plugin relies on the `BufWritePre` command to call it,
-- but by the time it's first loaded it has already happened.
-- TODO: check if that is fixed when the following issue is fixed
-- https://github.com/folke/lazy.nvim/issues/858
-- if so, remove the call to `FormatBuffer`
init = function(plugin)
local group = vim.api.nvim_create_augroup("autoformat_settings", {})
local function autocmd(filetypes, formatter)
vim.api.nvim_create_autocmd("FileType", {
pattern = filetypes,
group = group,
callback = function(event)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = event.buf,
group = group,
once = true,
command = "call codefmt#FormatBuffer() | AutoFormatBuffer " .. formatter,
})
end,
})
end
-- Build opts from possible parent specs since lazy.nvim doesn't provide it in `init`
local plugin_opts = {}
local curr_plugin = plugin
while curr_plugin do
if type(curr_plugin.opts) == "table" then
plugin_opts = require("lazy.core.util").merge(curr_plugin.opts, plugin_opts)
elseif type(curr_plugin.opts) == "function" then
plugin_opts = curr_plugin.opts(plugin, plugin_opts)
end
curr_plugin = curr_plugin._ and curr_plugin._.super or nil
end
for filetypes, formatter in pairs(plugin_opts.auto_format or {}) do
autocmd(filetypes, formatter)
end
end,
}),
-- Run blaze commands
glug("blaze", {
opts = {
execution_mode = "async",
},
dependencies = {
glug("blazedeps"),
},
cmd = {
"Blaze",
"BlazeGoToSponge",
"BlazeViewCommandLog",
"BlazeLoadErrors",
"BlazeDebugCurrentFileTest",
"BlazeDebugCurrentTestMethod",
"BlazeDebugAddBreakpoint",
"BlazeDebugClearBreakpoint",
"BlazeDebugFinish",
"BlazeDepsUpdate",
},
keys = function()
local function runCmd(cmd)
return function()
vim.g._calling_blaze_cmd = 1
vim.cmd(cmd)
-- Clear the "blaze: SUCCESS" that blaze.vim will print
if vim.g._call_blaze_query then
print("")
end
vim.g._calling_blaze_cmd = 0
end
end
return {
{ "<leader>b", desc = "Blaze" },
{ "<leader>be", runCmd("call blaze#LoadErrors()"), desc = "Blaze load errors" },
{ "<leader>bl", runCmd("call blaze#ViewCommandLog()"), desc = "Blaze view build log" },
{ "<leader>bs", runCmd("BlazeGoToSponge"), desc = "Blaze go to sponge" },
{ "<leader>bc", runCmd("Blaze"), desc = "Blaze build on targets" },
{ "<leader>bb", runCmd("Blaze build"), desc = "Blaze build" },
{ "<leader>bt", runCmd("Blaze test"), desc = "Blaze test" },
{ "<leader>bf", runCmd("call blaze#TestCurrentFile()"), desc = "Blaze test current file" },
{ "<leader>bm", runCmd("call blaze#TestCurrentMethod()"), desc = "Blaze test current method" },
{ "<leader>bd", desc = "Blaze debug" },
{ "<leader>bdf", runCmd("BlazeDebugCurrentFileTest"), desc = "Blaze debug current file" },
{ "<leader>bdm", runCmd("BlazeDebugCurrentTestMethod"), desc = "Blaze debug current method" },
{ "<leader>bda", runCmd("BlazeDebugAddBreakpoint"), desc = "Blaze debug add breakpoint" },
{ "<leader>bdc", runCmd("BlazeDebugClearBreakpoint"), desc = "Blaze debug clear breakpoint" },
{ "<leader>bdf", runCmd("BlazeDebugFinish"), desc = "Blaze debug finish" },
{ "<leader>bu", runCmd("BlazeDepsUpdate"), desc = "Blaze update dependencies" },
}
end,
}),
-- Imports
glug("imp-google", {
dependencies = {
glugOpts("vim-imp", {
"flwyd/vim-imp",
opts = {
["Suggest[default]"] = { "buffer", "csearch", "ripgrep", "prompt" },
["Report[default]"] = "popupnotify",
["Location[default]"] = "packageroot",
-- ["Location[gcl]"] = "parent",
-- ["Pick[default]"] = "fzf",
},
}),
},
cmd = { "ImpSuggest", "ImpFirst" },
keys = {
{ "<leader>i", ":ImpSuggest <C-r><C-w><cr>" },
},
}),
{ {
name = "ai.nvim", name = "ai.nvim",
url = "sso://googler@user/vvvv/ai.nvim", url = "sso://googler@user/vvvv/ai.nvim",

View File

@ -59,10 +59,7 @@ end
return { return {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
dependencies = { dependencies = {},
-- "nvim-telescope/telescope-smart-history.nvim",
-- "kkharji/sqlite.lua",
},
config = function() config = function()
require("telescope").setup({ require("telescope").setup({
defaults = { defaults = {
@ -106,10 +103,6 @@ return {
end, end,
}, },
}, },
-- history = {
-- path = "~/.local/share/nvim/databases/telescope_history.sqlite3",
-- limit = 200,
-- },
}, },
extensions = { extensions = {
codesearch = { codesearch = {
@ -117,8 +110,6 @@ return {
}, },
}, },
}) })
-- require("telescope").load_extension("smart_history")
end, end,
keys = keys, keys = keys,
} }