NixOS/home-manager/modules/nvim/plugins.nix

135 lines
5.4 KiB
Nix
Executable file

{ pkgs, ... }: {
xdg.configFile."nvim/lua/plugins.lua".text = ''
-- 1. Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or 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. Setup Plugins
require("lazy").setup({
spec = {
-- Colorschemes
{ "RomanAverin/charleston.nvim", priority = 1000 },
-- Status line
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('lualine').setup({
options = {
theme = 'charleston', -- It should pick up your theme automatically
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
globalstatus = true, -- Nice modern single bar at the bottom
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
})
end
},
-- Completion & UI
{
'saghen/blink.cmp',
dependencies = 'rafamadriz/friendly-snippets',
version = '*',
opts = {
keymap = { preset = 'default' },
appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = 'mono'
},
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' },
},
}
},
-- LSP Configuration (Updated for Neovim 0.11+)
{
"neovim/nvim-lspconfig",
dependencies = { 'saghen/blink.cmp' },
config = function()
-- In Neovim 0.11, we use the native vim.lsp.config API
local capabilities = require('blink.cmp').get_lsp_capabilities()
-- List the servers you want to enable
local servers = { "lua_ls", "nil_ls" }
for _, server in ipairs(servers) do
vim.lsp.config(server, {
install = {
-- This prevents lspconfig from trying to install things
-- since Nix is handling the binaries
enabled = false,
},
capabilities = capabilities,
})
-- Enable the server
vim.lsp.enable(server)
end
end
},
-- Navigation & Files
{ "stevearc/oil.nvim", opts = { default_file_explorer = true } },
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" }
},
-- Dashboard Configuration
{
"nvimdev/dashboard-nvim",
event = "VimEnter",
config = function()
local dashboard = require("dashboard")
dashboard.setup({
theme = "doom",
config = {
header = {
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
},
center = {
{ icon = " ", icon_hl = "@variable", desc = "New File", key = "n", action = "enew" },
{ icon = " ", icon_hl = "@variable", desc = "File Explorer", key = "e", action = "Oil --float" },
{ icon = "󰮗 ", icon_hl = "@variable", desc = "Find File", key = "f", action = "Telescope find_files" },
{ icon = " ", icon_hl = "@variable", desc = "Find Text", key = "t", action = "Telescope live_grep" },
{ icon = "󰗼 ", icon_hl = "@variable", desc = "Quit", key = "q", action = "qa" },
},
footer = { "v" .. vim.version().major .. "." .. vim.version().minor },
},
})
end
},
},
install = { colorscheme = { "charleston" } },
checker = { enabled = true }, -- automatically check for plugin updates
})
-- Final Theme Load
vim.cmd("colorscheme charleston")
'';
}