Tark_Wight

neovim-cinfig

Jul 25th, 2026
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.99 KB | None | 0 0
  1. vim.g.mapleader = " "
  2.  
  3. -- =========================
  4. -- Basic settings
  5. -- =========================
  6.  
  7. vim.opt.number = true
  8. vim.opt.relativenumber = true
  9.  
  10. vim.opt.tabstop = 4
  11. vim.opt.shiftwidth = 4
  12. vim.opt.softtabstop = 4
  13. vim.opt.expandtab = true
  14. vim.opt.smartindent = true
  15.  
  16. vim.opt.mouse = "a"
  17. vim.opt.termguicolors = true
  18. vim.opt.clipboard = "unnamedplus"
  19.  
  20. vim.opt.ignorecase = true
  21. vim.opt.smartcase = true
  22.  
  23. vim.opt.splitright = true
  24. vim.opt.splitbelow = true
  25.  
  26. vim.opt.updatetime = 250
  27. vim.opt.signcolumn = "yes"
  28.  
  29. -- =========================
  30. -- lazy.nvim bootstrap
  31. -- =========================
  32.  
  33. local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
  34.  
  35. if not vim.uv.fs_stat(lazypath) then
  36.     vim.fn.system({
  37.         "git",
  38.         "clone",
  39.         "--filter=blob:none",
  40.         "https://github.com/folke/lazy.nvim.git",
  41.         "--branch=stable",
  42.         lazypath,
  43.     })
  44. end
  45.  
  46. vim.opt.rtp:prepend(lazypath)
  47.  
  48. -- =========================
  49. -- Plugins
  50. -- =========================
  51.  
  52. require("lazy").setup({
  53.     {
  54.         "ellisonleao/gruvbox.nvim",
  55.         priority = 1000,
  56.         config = function()
  57.             vim.cmd.colorscheme("gruvbox")
  58.         end,
  59.     },
  60.  
  61.     {
  62.         "nvim-lualine/lualine.nvim",
  63.         dependencies = { "nvim-tree/nvim-web-devicons" },
  64.         config = function()
  65.             require("lualine").setup()
  66.         end,
  67.     },
  68.  
  69.     {
  70.         "nvim-neo-tree/neo-tree.nvim",
  71.         branch = "v3.x",
  72.         dependencies = {
  73.             "nvim-lua/plenary.nvim",
  74.             "MunifTanjim/nui.nvim",
  75.             "nvim-tree/nvim-web-devicons",
  76.         },
  77.         config = function()
  78.             require("neo-tree").setup({})
  79.         end,
  80.     },
  81.  
  82.     {
  83.         "nvim-telescope/telescope.nvim",
  84.         dependencies = { "nvim-lua/plenary.nvim" },
  85.     },
  86.  
  87.    {
  88.         "nvim-treesitter/nvim-treesitter",
  89.         branch = "master",
  90.         build = ":TSUpdate",
  91.         config = function()
  92.             require("nvim-treesitter.configs").setup({
  93.                 ensure_installed = {
  94.                     "c",
  95.                     "cpp",
  96.                     "rust",
  97.                     "lua",
  98.                     "cmake",
  99.                     "vim",
  100.                     "bash",
  101.                 },
  102.                 highlight = {
  103.                     enable = true,
  104.                 },
  105.             })
  106.         end,
  107. },
  108.  
  109.     {
  110.         "neovim/nvim-lspconfig",
  111.         config = function()
  112.             vim.lsp.enable({
  113.                 "clangd",
  114.                 "rust_analyzer",
  115.             })
  116.         end,
  117.     },
  118.  
  119.     {
  120.         "lewis6991/gitsigns.nvim",
  121.         config = function()
  122.             require("gitsigns").setup()
  123.         end,
  124.     },
  125.  
  126.     {
  127.         "folke/which-key.nvim",
  128.         config = function()
  129.             require("which-key").setup()
  130.         end,
  131.     },
  132.  
  133.     {
  134.         "zbirenbaum/copilot.lua",
  135.         config = function()
  136.             require("copilot").setup({
  137.                 suggestion = {
  138.                     enabled = true,
  139.                     auto_trigger = true,
  140.                     keymap = {
  141.                         accept = "<C-j>",
  142.                     },
  143.                 },
  144.                 panel = {
  145.                     enabled = true,
  146.                 },
  147.             })
  148.         end,
  149.     },
  150. })
  151.  
  152. -- =========================
  153. -- Keymaps
  154. -- =========================
  155.  
  156. local map = vim.keymap.set
  157.  
  158. map("n", "<C-p>", "<cmd>Telescope find_files<CR>")
  159. map("n", "<leader>fg", "<cmd>Telescope live_grep<CR>")
  160. map("n", "<C-n>", "<cmd>Neotree toggle<CR>")
  161.  
  162. map("n", "gn", "<cmd>bnext<CR>")
  163. map("n", "gp", "<cmd>bprevious<CR>")
  164. map("n", "gc", "<cmd>bdelete<CR>")
  165.  
  166. map("n", "gd", vim.lsp.buf.definition)
  167. map("n", "gr", vim.lsp.buf.references)
  168. map("n", "K", vim.lsp.buf.hover)
  169. map("n", "<leader>rn", vim.lsp.buf.rename)
  170. map("n", "<leader>ca", vim.lsp.buf.code_action)
  171.  
  172. map("n", "[g", vim.diagnostic.goto_prev)
  173. map("n", "]g", vim.diagnostic.goto_next)
  174. map("n", "<space>a", vim.diagnostic.setloclist)
  175.  
Tags: nvim
Advertisement
Add Comment
Please, Sign In to add comment