95 lines
2.9 KiB
Lua
95 lines
2.9 KiB
Lua
-- core/plugins.lua - optional plugin layer (lazy.nvim).
|
|
-- Kept minimal & ops-focused. If the machine is offline at first launch this
|
|
-- module raises an error that init.lua catches; the core config still works.
|
|
|
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
|
|
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|
-- only attempt clone if git exists; error out cleanly otherwise
|
|
if vim.fn.executable("git") == 0 then
|
|
error("git not available; skipping plugins")
|
|
end
|
|
local out = vim.fn.system({
|
|
"git", "clone", "--filter=blob:none", "--branch=stable",
|
|
"https://github.com/folke/lazy.nvim.git", lazypath,
|
|
})
|
|
if vim.v.shell_error ~= 0 then
|
|
error("lazy.nvim clone failed: " .. out)
|
|
end
|
|
end
|
|
vim.opt.rtp:prepend(lazypath)
|
|
|
|
require("lazy").setup({
|
|
-- colorscheme
|
|
{
|
|
"folke/tokyonight.nvim",
|
|
priority = 1000,
|
|
config = function()
|
|
require("tokyonight").setup({ style = "night" })
|
|
pcall(vim.cmd.colorscheme, "tokyonight")
|
|
end,
|
|
},
|
|
|
|
-- statusline (light, no icons required so it works in plain TTYs)
|
|
{
|
|
"nvim-lualine/lualine.nvim",
|
|
opts = {
|
|
options = { theme = "auto", icons_enabled = false, globalstatus = true },
|
|
},
|
|
},
|
|
|
|
-- fuzzy finder: files / grep / buffers
|
|
{
|
|
"nvim-telescope/telescope.nvim",
|
|
branch = "0.1.x",
|
|
dependencies = { "nvim-lua/plenary.nvim" },
|
|
keys = {
|
|
{ "<leader>ff", "<cmd>Telescope find_files<CR>", desc = "find files" },
|
|
{ "<leader>fg", "<cmd>Telescope live_grep<CR>", desc = "grep (ripgrep)" },
|
|
{ "<leader>fb", "<cmd>Telescope buffers<CR>", desc = "buffers" },
|
|
{ "<leader>fh", "<cmd>Telescope help_tags<CR>", desc = "help" },
|
|
},
|
|
},
|
|
|
|
-- treesitter: better syntax highlighting for the configs we actually touch
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
build = ":TSUpdate",
|
|
config = function()
|
|
local langs = {
|
|
"lua", "bash", "yaml", "json", "toml", "dockerfile",
|
|
"nix", "python", "markdown", "diff", "git_config",
|
|
}
|
|
-- old API (nvim-treesitter < 1.0, nvim 0.9.x)
|
|
local ok, configs = pcall(require, "nvim-treesitter.configs")
|
|
if ok then
|
|
configs.setup({
|
|
ensure_installed = langs,
|
|
highlight = { enable = true },
|
|
indent = { enable = true },
|
|
})
|
|
return
|
|
end
|
|
-- new API (nvim-treesitter >= 1.0, nvim 0.10+): highlight is built-in
|
|
local ts_ok, ts = pcall(require, "nvim-treesitter")
|
|
if ts_ok and ts.install then
|
|
ts.install(langs)
|
|
end
|
|
end,
|
|
},
|
|
|
|
-- git signs in the gutter
|
|
{ "lewis6991/gitsigns.nvim", opts = {} },
|
|
|
|
-- show pending keybinds
|
|
{ "folke/which-key.nvim", event = "VeryLazy", opts = {} },
|
|
|
|
-- quick comment toggling: gcc / gc in visual
|
|
{ "numToStr/Comment.nvim", opts = {} },
|
|
}, {
|
|
install = { colorscheme = { "tokyonight", "habamax" } },
|
|
checker = { enabled = false }, -- don't phone home on managed hosts
|
|
change_detection = { notify = false },
|
|
ui = { border = "rounded" },
|
|
})
|