Initial setup

This commit is contained in:
Nareshkumar Rao 2025-05-15 05:09:43 +02:00
commit 2e7fb9adce
12 changed files with 234 additions and 0 deletions

View File

@ -0,0 +1 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)

66
after/plugin/lsp.lua Normal file
View File

@ -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
})

View File

@ -0,0 +1,6 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, { desc = 'Telescope find files' })
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)

View File

@ -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,
},
}

View File

@ -0,0 +1 @@
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)

2
init.lua Normal file
View File

@ -0,0 +1,2 @@
require("nrx")

14
lazy-lock.json Normal file
View File

@ -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" }
}

3
lua/nrx/init.lua Normal file
View File

@ -0,0 +1,3 @@
require("nrx.set")
require("nrx.remap")
require("nrx.lazy")

35
lua/nrx/lazy.lua Normal file
View File

@ -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 },
})

2
lua/nrx/remap.lua Normal file
View File

@ -0,0 +1,2 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)

33
lua/nrx/set.lua Normal file
View File

@ -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 = " "

61
lua/plugins/plugins.lua Normal file
View File

@ -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 = {
{
"<leader>xx",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics (Trouble)",
}
}
}
}