nvim: make copilot host-conditional
Taking the work laptop's init.lua as canonical carried its commented-out copilot line to every machine. Copilot was enabled on mainframe, system76 and the NAS before the refit — only the work laptop had it off. Sharing the file silently disabled it on the other three. The plugin list is now built in a table and copilot appended unless the host is sctfw004. Keyed on vim.fn.hostname() rather than $DOTFILES_HOST, because nvim launched from a desktop entry does not inherit the shell's environment.
This commit is contained in:
+15
-3
@@ -49,21 +49,33 @@ vim.g.leader = " "
|
||||
-- PlugIns
|
||||
-- ------------------------------------------------------------------------------
|
||||
|
||||
vim.pack.add({
|
||||
-- Host-conditional plugins. vim.fn.hostname() rather than an env var, because
|
||||
-- nvim launched from a desktop entry does not inherit the shell's environment.
|
||||
local host = vim.fn.hostname():lower()
|
||||
|
||||
local plugins = {
|
||||
{ src = "https://github.com/vague2k/vague.nvim" },
|
||||
{ src = "https://github.com/mason-org/mason.nvim" },
|
||||
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
||||
{ src = "https://github.com/stevearc/oil.nvim" },
|
||||
{ src = "https://github.com/nvim-telescope/telescope.nvim" },
|
||||
{ src = "https://github.com/nvim-lua/plenary.nvim" },
|
||||
-- { src = "https://github.com/github/copilot.vim" },
|
||||
{ src = "https://github.com/kdheepak/lazygit.nvim" },
|
||||
{ src = "https://github.com/tpope/vim-surround" },
|
||||
{ src = "https://github.com/tpope/vim-repeat" },
|
||||
{ src = "https://github.com/tommcdo/vim-lion" },
|
||||
{ src = "https://github.com/andythigpen/nvim-coverage" },
|
||||
{ src = "https://github.com/nvim-treesitter/nvim-treesitter" },
|
||||
})
|
||||
}
|
||||
|
||||
-- Copilot is off on the work laptop and on everywhere else. It was enabled on
|
||||
-- mainframe, system76 and the NAS before the refit; taking the work laptop's
|
||||
-- init.lua as canonical would otherwise have silently disabled it on all three.
|
||||
if host ~= "sctfw004" then
|
||||
table.insert(plugins, { src = "https://github.com/github/copilot.vim" })
|
||||
end
|
||||
|
||||
vim.pack.add(plugins)
|
||||
|
||||
require("mason").setup()
|
||||
require("oil").setup()
|
||||
|
||||
Reference in New Issue
Block a user