nvim-zig/init.lua
2026-02-12 20:54:47 +01:00

52 lines
1.4 KiB
Lua

vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- 1. Lazy.nvim Bootstrapping
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)
-- 2. Plugins
require("lazy").setup({
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
{ "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
{ "neovim/nvim-lspconfig" },
{ "folke/which-key.nvim", event = "VeryLazy" },
{ "nvim-tree/nvim-tree.lua", dependencies = { "nvim-tree/nvim-web-devicons" } },
})
-- 3. Theme & Settings
vim.cmd.colorscheme "catppuccin-mocha"
vim.opt.number = true
vim.opt.relativenumber = true
-- 4. Tree Setup (Small & Minimal)
require("nvim-tree").setup({
view = {
width = 30, -- Small width
side = "left",
},
filters = {
dotfiles = false,
custom = { ".git", "zig-cache", "zig-out" }, -- Hide build clutter
},
})
-- 5. Modern LSP Setup (Neovim 0.11+)
vim.lsp.config('zls', {
cmd = { 'zls' },
filetypes = { 'zig', 'zir' },
root_markers = { 'build.zig', 'zls.json', '.git' },
})
vim.lsp.enable('zls')
-- 6. Auto-format
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.zig",
callback = function() vim.lsp.buf.format() end,
})
require("keymaps")