Created
February 21, 2026 17:30
-
-
Save clinuxrulz/f3938a899b64849776d34c8d57b1f636 to your computer and use it in GitHub Desktop.
Neovim config ~/.config/nvim/init.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 1. 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) | |
| -- 2. Basic Options | |
| vim.g.mapleader = " " | |
| vim.opt.number = true | |
| vim.opt.relativenumber = true | |
| vim.opt.termguicolors = true | |
| vim.opt.shiftwidth = 2 | |
| vim.opt.expandtab = true | |
| vim.opt.mouse = 'a' | |
| -- 3. Plugin Setup | |
| require("lazy").setup({ | |
| -- Treesitter with a safety check | |
| { | |
| "nvim-treesitter/nvim-treesitter", | |
| build = ":TSUpdate", | |
| config = function() | |
| -- The 'pcall' prevents the error if the plugin isn't ready yet | |
| local status, ts = pcall(require, "nvim-treesitter.configs") | |
| if not status then return end | |
| ts.setup({ | |
| ensure_installed = { "typescript", "javascript", "lua", "vim", "vimdoc" }, | |
| highlight = { enable = true }, | |
| }) | |
| end, | |
| }, | |
| -- LSP & Autocomplete | |
| { | |
| "neovim/nvim-lspconfig", | |
| dependencies = { | |
| "williamboman/mason.nvim", | |
| "williamboman/mason-lspconfig.nvim", | |
| "hrsh7th/nvim-cmp", | |
| "hrsh7th/cmp-nvim-lsp", | |
| "L3MON4D3/LuaSnip", | |
| }, | |
| config = function() | |
| require("mason").setup() | |
| require("mason-lspconfig").setup({ ensure_installed = { "ts_ls" } }) | |
| local cmp = require'cmp' | |
| local capabilities = require('cmp_nvim_lsp').default_capabilities() | |
| cmp.setup({ | |
| snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) end }, | |
| mapping = cmp.mapping.preset.insert({ | |
| ['<Tab>'] = cmp.mapping.select_next_item(), | |
| ['<CR>'] = cmp.mapping.confirm({ select = true }), | |
| }), | |
| sources = cmp.config.sources({ { name = 'nvim_lsp' } }) | |
| }) | |
| -- Neovim 0.11+ Native LSP Config | |
| vim.lsp.enable('ts_ls') | |
| vim.lsp.config('ts_ls', { capabilities = capabilities }) | |
| end | |
| }, | |
| -- A clean theme | |
| { "folke/tokyonight.nvim", lazy = false, priority = 1000, | |
| config = function() vim.cmd([[colorscheme tokyonight]]) end | |
| }, | |
| { | |
| "ThePrimeagen/harpoon", | |
| branch = "harpoon2", | |
| dependencies = { "nvim-lua/plenary.nvim" }, | |
| config = function() | |
| local harpoon = require("harpoon") | |
| harpoon:setup() | |
| -- Basic Keymaps | |
| vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end) | |
| vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) | |
| -- Jump to files 1-4 | |
| vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end) | |
| vim.keymap.set("n", "<C-j>", function() harpoon:list():select(2) end) | |
| vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end) | |
| vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end) | |
| end | |
| }, | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment