-- Bootstrap lazy.nvim 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) -- Set Leader Key to Space vim.g.mapleader = " " vim.g.maplocalleader = " " vim.opt.clipboard = "unnamedplus" -- Setup lazy.nvim with your plugin specifications require("lazy").setup({ -- Git signs { "lewis6991/gitsigns.nvim", event = { "BufReadPre", "BufNewFile" }, opts = { signs = { add = { text = "┃" }, change = { text = "┃" }, delete = { text = "_" }, topdelete = { text = "‾" }, changedelete = { text = "~" }, untracked = { text = "┆" }, }, on_attach = function(bufnr) local gs = package.loaded.gitsigns local function map(mode, l, r, opts) opts = opts or {} opts.buffer = bufnr vim.keymap.set(mode, l, r, opts) end map("n", "]h", gs.next_hunk, { desc = "Next Git Hunk" }) map("n", "[h", gs.prev_hunk, { desc = "Previous Git Hunk" }) map("n", "hp", gs.preview_hunk, { desc = "Preview Hunk" }) map("n", "hb", gs.blame_line, { desc = "Blame Line" }) end, }, }, -- Telescope (Fuzzy Finder) { 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, keys = { { "ff", "Telescope find_files", desc = "Find Files" }, { "fg", "Telescope live_grep", desc = "Live Grep (Search Text)" }, { "fb", "Telescope buffers", desc = "Find Buffers" }, { "fh", "Telescope help_tags", desc = "Help Tags" }, { "fr", "Telescope oldfiles", desc = "Recent Files" }, }, }, -- File Tree { "nvim-tree/nvim-tree.lua", version = "*", lazy = false, dependencies = { "nvim-tree/nvim-web-devicons", }, keys = { { "e", "NvimTreeToggle", desc = "Toggle NvimTree" }, { "o", "NvimTreeFocus", desc = "Focus NvimTree" }, }, config = function() require("nvim-tree").setup({ view = { width = 35, relativenumber = true, }, actions = { open_file = { quit_on_open = true, }, }, }) end, }, -- Treesitter { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", lazy = false, config = function() local configs = require("nvim-treesitter.configs") configs.setup({ ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "python", "javascript" }, sync_install = false, highlight = { enable = true }, indent = { enable = true }, }) end, }, -- LSP & Mason Manager { 'williamboman/mason.nvim', config = true }, { 'williamboman/mason-lspconfig.nvim' }, { 'neovim/nvim-lspconfig' }, -- Autocompletion Engine { 'hrsh7th/nvim-cmp', event = "InsertEnter", dependencies = { 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-path', 'L3MON4D3/LuaSnip', -- Snippet engine required by cmp 'saadparwaiz1/cmp_luasnip', -- Snippet completions }, config = function() local cmp = require('cmp') local luasnip = require('luasnip') cmp.setup({ snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), -- Trigger completion menu [''] = cmp.mapping.abort(), -- Close completion menu [''] = cmp.mapping.confirm({ select = true }), -- Accept current selected item -- Tab / Shift-Tab navigation through completion menu and snippet placeholders [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() else fallback() end end, { 'i', 's' }), [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end, { 'i', 's' }), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'luasnip' }, }, { { name = 'buffer' }, { name = 'path' }, }), }) end, }, -- Formatting { 'stevearc/conform.nvim', opts = { formatters_by_ft = { lua = { "stylua" }, python = { "black" }, javascript = { "prettierd", "prettier" }, }, format_on_save = { timeout_ms = 500, lsp_fallback = true }, }, }, -- Autopairs { 'windwp/nvim-autopairs', event = "InsertEnter", config = true, }, -- Colorscheme { "tomasiser/vim-code-dark", lazy = false, priority = 1000, config = function() vim.opt.background = "dark" vim.cmd.colorscheme("codedark") end, }, })