nvim/init.lua
Prabhat Maurya d3f99fee39 updated
2025-06-27 09:34:36 +05:30

108 lines
3.2 KiB
Lua

-- /home/prabhat/.config/nvim/init.lua
-- 1. Packer Bootstrap (required to make 'packer' available)
-- This ensures 'packer.nvim' is installed if not present and then loaded.
-- This part is usually placed at the very top.
local install_path = vim.fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
end
-- 2. Call packer.startup to define your plugins.
-- This part should NOT be preceded by 'return' if you have other configs.
require("packer").startup(function(use)
-- Let packer manage itself
use("wbthomason/packer.nvim")
-- Completion framework
use("hrsh7th/nvim-cmp")
use("hrsh7th/cmp-buffer")
use("hrsh7th/cmp-path")
use("hrsh7th/cmp-nvim-lsp")
use("hrsh7th/cmp-nvim-lua")
use("saadparwaiz1/cmp_luasnip")
use("L3MON4D3/LuaSnip")
-- Load test plugin configuration (this `require` should call a `use` inside user.test)
require("user.test")(use) -- Make sure user.test returns a function that takes 'use'
-- NERDTree plugin
use("preservim/nerdtree")
-- Plugin for integrating formatters/linters
use({
"nvimtools/none-ls.nvim",
requires = { "nvim-lua/plenary.nvim" },
})
-- TS Server
use("jose-elias-alvarez/nvim-lsp-ts-utils")
-- Treesitter
use("nvim-treesitter/nvim-treesitter")
-- Auto pairs
use("windwp/nvim-autopairs")
-- LSP Configuration
use("neovim/nvim-lspconfig")
-- Java Language Server support
use("mfussenegger/nvim-jdtls")
-- Markdown Preview (optional)
use({ "iamcco/markdown-preview.nvim", run = "cd app && npm install" })
use({
"nvim-telescope/telescope.nvim",
tag = "0.1.8",
-- or , branch = '0.1.x',
requires = { { "nvim-lua/plenary.nvim" } },
})
-- Comment
use 'numToStr/Comment.nvim'
-- Telescope FZF native
use({
"nvim-telescope/telescope-fzf-native.nvim",
run = "make",
})
use({ "ellisonleao/gruvbox.nvim" })
-- Mason and Mason-LSPConfig
-- **** IMPORTANT: Pinning to known stable commits ****
-- This helps resolve "nil enable" errors due to transient incompatibilities
-- between the latest versions of these two plugins.
-- If these specific commits cause new issues, you may try slightly different
-- recent commits, or check their GitHub repos for very recent stable ones.
use({ "williamboman/mason.nvim" })
use({ "williamboman/mason-lspconfig.nvim" })
end)
-- 3. Load user configuration files (after Packer has defined and made plugins available)
-- These files will contain the `setup()` calls for your plugins.
require("user.options")
require("user.keymaps")
require("user.cmp")
require("user.java")
require("user.autopairs")
require("user.telescope")
require("user.gruvbox")
-- This is where your mason.setup() and mason-lspconfig.setup() calls should be.
-- Ensure that your 'user/lsp.lua' contains the 'handlers' table in its
-- mason-lspconfig.setup call as instructed previously.
require("user.lsp")
require("user.treesitter")
require("user.null-ls") -- Load null-ls configuration
require("user.terminal")
require("user.markdown")
require("user.autocmds")
require("user.files_utils")
require("user.commands")
require("user.comment")