commit 2e7fb9adced717af055f3e38010fd57356133971 Author: Nareshkumar Rao Date: Thu May 15 05:09:43 2025 +0200 Initial setup diff --git a/after/plugin/fugitive.lua b/after/plugin/fugitive.lua new file mode 100644 index 0000000..80c9070 --- /dev/null +++ b/after/plugin/fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "gs", vim.cmd.Git) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..738b127 --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,66 @@ +vim.lsp.config('lua_ls', { + on_init = function(client) + if client.workspace_folders then + local path = client.workspace_folders[1].name + if + path ~= vim.fn.stdpath('config') + and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) + then + return + end + end + + client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using (most + -- likely LuaJIT in the case of Neovim) + version = 'LuaJIT', + -- Tell the language server how to find Lua modules same way as Neovim + -- (see `:h lua-module-load`) + path = { + 'lua/?.lua', + 'lua/?/init.lua', + }, + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME + -- Depending on the usage, you might want to add additional paths + -- here. + -- '${3rd}/luv/library' + -- '${3rd}/busted/library' + } + -- Or pull in all of 'runtimepath'. + -- NOTE: this is a lot slower and will cause issues when working on + -- your own configuration. + -- See https://github.com/neovim/nvim-lspconfig/issues/3189 + -- library = { + -- vim.api.nvim_get_runtime_file('', true), + -- } + } + }) + end, + settings = { + Lua = {} + } +}) + +vim.lsp.config('rust_analyzer', { + settings = { + ['rust-analyzer'] = { + checkOnSave = { + command = "clippy" + } + } + } +}) + +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(ev) + print("LspAttach called") + local opts = {buffer = ev.buf, remap = false} + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + end +}) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100644 index 0000000..0a515a4 --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,6 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'pf', builtin.find_files, { desc = 'Telescope find files' }) +vim.keymap.set('n', '', builtin.git_files, {}) +vim.keymap.set('n', 'ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) +end) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua new file mode 100644 index 0000000..60f0c6d --- /dev/null +++ b/after/plugin/treesitter.lua @@ -0,0 +1,10 @@ +require'nvim-treesitter.configs'.setup { + ensure_installed = { "javascript", "typescript", "rust", "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" }, + sync_install = false, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, +} + diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua new file mode 100644 index 0000000..a346462 --- /dev/null +++ b/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..e4c8e1f --- /dev/null +++ b/init.lua @@ -0,0 +1,2 @@ +require("nrx") + diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..94b3a2f --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,14 @@ +{ + "coq.artifacts": { "branch": "artifacts", "commit": "ef5f21d638ccc456cfa5b8d0ab37093cefe48c8b" }, + "coq.thirdparty": { "branch": "3p", "commit": "6ee3c221c308dca7071387267ac76c9272b184a9" }, + "coq_nvim": { "branch": "coq", "commit": "666efec5bb8fdb6dbb4bc99a069b3340951d28a0" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" }, + "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "rose-pine": { "branch": "main", "commit": "491a0c77abc7ecb955c27a974091a5968232995f" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, + "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" } +} diff --git a/lua/nrx/init.lua b/lua/nrx/init.lua new file mode 100644 index 0000000..84f00c6 --- /dev/null +++ b/lua/nrx/init.lua @@ -0,0 +1,3 @@ +require("nrx.set") +require("nrx.remap") +require("nrx.lazy") diff --git a/lua/nrx/lazy.lua b/lua/nrx/lazy.lua new file mode 100644 index 0000000..394b312 --- /dev/null +++ b/lua/nrx/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/lua/nrx/remap.lua b/lua/nrx/remap.lua new file mode 100644 index 0000000..b760350 --- /dev/null +++ b/lua/nrx/remap.lua @@ -0,0 +1,2 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "pv", vim.cmd.Ex) diff --git a/lua/nrx/set.lua b/lua/nrx/set.lua new file mode 100644 index 0000000..7d2d3b6 --- /dev/null +++ b/lua/nrx/set.lua @@ -0,0 +1,33 @@ +vim.opt.guicursor = "" + +vim.opt.nu = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 8 + +vim.opt.signcolumn = "yes" + +vim.opt.colorcolumn = "80" + +vim.opt.updatetime = 50 + +vim.g.mapleader = " " + diff --git a/lua/plugins/plugins.lua b/lua/plugins/plugins.lua new file mode 100644 index 0000000..ee02e94 --- /dev/null +++ b/lua/plugins/plugins.lua @@ -0,0 +1,61 @@ +return { + { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" } + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate" + }, + { "mbbill/undotree" }, + { "tpope/vim-fugitive" }, + { + "rose-pine/neovim", + name = "rose-pine", + config = function() + vim.cmd("colorscheme rose-pine") + end + }, + { + "neovim/nvim-lspconfig", + lazy = false, -- REQUIRED: tell lazy.nvim to start this plugin at startup + dependencies = { + -- main one + { "ms-jpq/coq_nvim", branch = "coq" }, + + -- 9000+ Snippets + { "ms-jpq/coq.artifacts", branch = "artifacts" }, + + -- lua & third party sources -- See https://github.com/ms-jpq/coq.thirdparty + -- Need to **configure separately** + { 'ms-jpq/coq.thirdparty', branch = "3p" } + -- - shell repl + -- - nvim lua api + -- - scientific calculator + -- - comment banner + -- - etc + }, + init = function() + vim.g.coq_settings = { + auto_start = true, -- if you want to start COQ at startup + -- Your COQ settings here + } + end, + config = function() + vim.lsp.enable("rust_analyzer") + vim.lsp.enable("lua_ls") + end + }, + { + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + } + } + } +}