From 23d53b5d7bc2f31eed672c0a8d26dc608fb6d0ba Mon Sep 17 00:00:00 2001 From: Ibrahim Muftee Date: Mon, 4 Aug 2025 07:45:42 -0500 Subject: feat(nvim) slim down new config --- dot_config/nvim_new/init.lua | 122 +++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 69 deletions(-) (limited to 'dot_config/nvim_new/init.lua') diff --git a/dot_config/nvim_new/init.lua b/dot_config/nvim_new/init.lua index 0547ec2..ff6868d 100644 --- a/dot_config/nvim_new/init.lua +++ b/dot_config/nvim_new/init.lua @@ -125,24 +125,13 @@ vim.pack.add({ { src = "https://github.com/rose-pine/neovim" }, { src = "https://github.com/stevearc/oil.nvim" }, { src = "https://github.com/echasnovski/mini.pick" }, - { src = "https://github.com/neovim/nvim-lspconfig" }, { src = "https://github.com/nvim-treesitter/nvim-treesitter" }, - { src = "https://github.com/nvim-lua/plenary.nvim" }, - { - src = "https://github.com/ThePrimeagen/harpoon", - version = "harpoon2" - }, - { src = "https://github.com/nvim-neotest/neotest" }, - { src = "https://github.com/antoinemadec/FixCursorHold.nvim" }, - { src = "https://github.com/nvim-neotest/neotest-python", }, - { src = "https://github.com/nvim-neotest/nvim-nio" }, - { src = "https://github.com/jiaoshijie/undotree" }, + { src = "https://github.com/mason-org/mason.nvim" }, }) -- LSP -vim.lsp.enable({ "lua_ls", "ruff", "rust_analyzer" }) -vim.keymap.set("n", "rf", vim.lsp.buf.format) +vim.lsp.enable({ "lua_ls", "ruff", "basedpyright", "rust_analyzer" }) -- LSP specific keybindings vim.api.nvim_create_autocmd("LspAttach", { @@ -194,6 +183,7 @@ vim.api.nvim_create_autocmd("LspAttach", { -- Code changes lsp_map("n", "cr", vim.lsp.buf.rename, "Rename") lsp_map("n", "ca", vim.lsp.buf.code_action, "Code actions") + lsp_map("n", "rf", vim.lsp.buf.format, "Format") -- Diagnostics lsp_map("n", "ds", vim.diagnostic.open_float, "[s]how [d]iagnostic window") @@ -219,20 +209,14 @@ vim.api.nvim_create_autocmd("LspAttach", { end, }) +require("mason").setup() + -- Treesitter require "nvim-treesitter.configs".setup({ ensure_installed = { "lua", "python", "rust" }, highlight = { enable = true } }) --- Format on write -vim.api.nvim_create_autocmd("BufWritePre", { - pattern = "*", - callback = function() - vim.lsp.buf.format() - end, -}) - -- Completion vim.api.nvim_create_autocmd('LspAttach', { callback = function(ev) @@ -253,54 +237,54 @@ map("n", "vh", "Pick help") require "oil".setup() vim.keymap.set("n", "g-", "Oil") --- Harpoon -local harpoon = require("harpoon") -harpoon:setup() - -map("n", "a", function() - harpoon:list():add() -end, { desc = "mark file with harpoon" }) - -map("n", "", function() - harpoon.ui:toggle_quick_menu(harpoon:list()) -end, { desc = "open harpoon menu" }) - -map("n", "j", function() - harpoon:list():select(1) -end, { desc = "open harpoon file 1" }) -map("n", "k", function() - harpoon:list():select(2) -end, { desc = "open harpoon file 2" }) -map("n", "l", function() - harpoon:list():select(3) -end, { desc = "open harpoon file 3" }) -map("n", ";", function() - harpoon:list():select(4) -end, { desc = "Open Harpoon file 4" }) - --- Neotest -require "neotest".setup({ - adapters = { - require("neotest-python")({ - python = "python", - runner = "pytest", - is_test_file = function(file_path) ---@param file_path string - local normalized_path = vim.fs.normalize(file_path) - return normalized_path.match("test/.*%/test_.%.py$") ~= nil - end, - }), - } -}) - -map("n", "tr", require("neotest").run.run, { desc = "Neotest: run test at cursor" }) -map("n", "tf", function() - require("netotest").run.run(vim.fn.expand("%")) -end, { desc = "Neotest: run all tests in current file" }) -map("n", "ts", require("neotest").summary.toggle, { desc = "Neotest: toggle summary panel" }) - --- Undotree -require("undotree").setup() -map("n", "u", require("undotree").toggle, { desc = "Toggle Undotree" }) +-- -- Harpoon +-- local harpoon = require("harpoon") +-- harpoon:setup() +-- +-- map("n", "a", function() +-- harpoon:list():add() +-- end, { desc = "mark file with harpoon" }) +-- +-- map("n", "", function() +-- harpoon.ui:toggle_quick_menu(harpoon:list()) +-- end, { desc = "open harpoon menu" }) +-- +-- map("n", "j", function() +-- harpoon:list():select(1) +-- end, { desc = "open harpoon file 1" }) +-- map("n", "k", function() +-- harpoon:list():select(2) +-- end, { desc = "open harpoon file 2" }) +-- map("n", "l", function() +-- harpoon:list():select(3) +-- end, { desc = "open harpoon file 3" }) +-- map("n", ";", function() +-- harpoon:list():select(4) +-- end, { desc = "Open Harpoon file 4" }) +-- +-- -- Neotest +-- require "neotest".setup({ +-- adapters = { +-- require("neotest-python")({ +-- python = "python", +-- runner = "pytest", +-- is_test_file = function(file_path) ---@param file_path string +-- local normalized_path = vim.fs.normalize(file_path) +-- return normalized_path.match("test/.*%/test_.%.py$") ~= nil +-- end, +-- }), +-- } +-- }) +-- +-- map("n", "tr", require("neotest").run.run, { desc = "Neotest: run test at cursor" }) +-- map("n", "tf", function() +-- require("netotest").run.run(vim.fn.expand("%")) +-- end, { desc = "Neotest: run all tests in current file" }) +-- map("n", "ts", require("neotest").summary.toggle, { desc = "Neotest: toggle summary panel" }) + +-- -- Undotree +-- require("undotree").setup() +-- map("n", "u", require("undotree").toggle, { desc = "Toggle Undotree" }) -- Colorscheme vim.o.background = "dark" -- cgit v1.2.3