From 9f9a18251c4293cbf879e3dbc4b24a87b924990b Mon Sep 17 00:00:00 2001 From: Nareshkumar Rao Date: Fri, 16 May 2025 22:41:14 +0200 Subject: [PATCH] organizing a little bit --- after/plugin/undotree.lua | 4 +- lazy-lock.json | 2 +- lua/nrx/lazy.lua | 43 ++++---- lua/nrx/set.lua | 2 + lua/plugins/{lspconfig.lua => coding.lua} | 43 ++++++++ lua/plugins/mason.lua | 21 ++++ lua/plugins/plugins.lua | 116 ---------------------- lua/plugins/ui.lua | 70 +++++++++++++ 8 files changed, 163 insertions(+), 138 deletions(-) rename lua/plugins/{lspconfig.lua => coding.lua} (77%) create mode 100644 lua/plugins/mason.lua delete mode 100644 lua/plugins/plugins.lua create mode 100644 lua/plugins/ui.lua diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua index a346462..0297a41 100644 --- a/after/plugin/undotree.lua +++ b/after/plugin/undotree.lua @@ -1 +1,3 @@ -vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle) +vim.keymap.set("n", "u", function() + vim.cmd.UndotreeToggle() +end) diff --git a/lazy-lock.json b/lazy-lock.json index b73f785..c17941a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -5,7 +5,7 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, - "conform.nvim": { "branch": "master", "commit": "2b2b30260203af3b93a7470ac6c8457ddd6e32d9" }, + "conform.nvim": { "branch": "master", "commit": "a4bb5d6c4ae6f32ab13114e62e70669fa67745b9" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" }, diff --git a/lua/nrx/lazy.lua b/lua/nrx/lazy.lua index 394b312..2296905 100644 --- a/lua/nrx/lazy.lua +++ b/lua/nrx/lazy.lua @@ -1,17 +1,17 @@ -- 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 + 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) @@ -23,13 +23,16 @@ 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 }, + 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, + notify = false, + }, }) diff --git a/lua/nrx/set.lua b/lua/nrx/set.lua index 93faa7b..8b6290f 100644 --- a/lua/nrx/set.lua +++ b/lua/nrx/set.lua @@ -33,3 +33,5 @@ vim.g.mapleader = " " vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 + +vim.opt.clipboard:append("unnamedplus") diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/coding.lua similarity index 77% rename from lua/plugins/lspconfig.lua rename to lua/plugins/coding.lua index bfe565b..8eb9e3d 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/coding.lua @@ -91,4 +91,47 @@ return { config_lsp() 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)", + }, + }, + }, + { + "hedyhli/outline.nvim", + config = function() + -- Example mapping to toggle outline + vim.keymap.set("n", "o", "Outline", { desc = "Toggle Outline" }) + require("outline").setup({ + -- Your setup opts here (leave empty to use defaults) + }) + end, + }, + { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + typescript = { "prettier" }, + jsx = { "prettier" }, + lua = { "stylua" }, + rust = { "rustfmt", lsp_format = "fallback" }, + }, + format_on_save = { + timeout_ms = 500, + lsp_format = "fallback", + }, + }, + }, + { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = true, + opts = {}, + }, } diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua new file mode 100644 index 0000000..3a15aa1 --- /dev/null +++ b/lua/plugins/mason.lua @@ -0,0 +1,21 @@ +return { + { + "mason-org/mason.nvim", + opts = {}, + }, + { + "mason-org/mason-lspconfig.nvim", + opts = { + automatic_enable = true, + ensure_installed = { "lua_ls", "ts_ls" }, + }, + }, + { + "jay-babu/mason-null-ls.nvim", + dependencies = { + "mason-org/mason.nvim", + "nvimtools/none-ls.nvim", + }, + opts = { ensure_installed = { "prettier", "stylua" } }, + }, +} diff --git a/lua/plugins/plugins.lua b/lua/plugins/plugins.lua deleted file mode 100644 index 423eca0..0000000 --- a/lua/plugins/plugins.lua +++ /dev/null @@ -1,116 +0,0 @@ -return { - { - "nvim-telescope/telescope.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - }, - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - }, - { "mbbill/undotree" }, - { "tpope/vim-fugitive" }, - { - "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)", - }, - }, - }, - { - "nvim-tree/nvim-tree.lua", - version = "*", - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - cmd = { - "NvimTreeToggle", - }, - opts = { - update_focused_file = { enable = true }, - filters = { - dotfiles = true, - }, - }, - }, - { - "mason-org/mason.nvim", - opts = {}, - }, - { - "mason-org/mason-lspconfig.nvim", - opts = { - automatic_enable = true, - ensure_installed = { "lua_ls", "ts_ls" }, - }, - }, - { - "jay-babu/mason-null-ls.nvim", - dependencies = { - "mason-org/mason.nvim", - "nvimtools/none-ls.nvim", - }, - opts = { ensure_installed = { "prettier", "stylua" } }, - }, - { - "hedyhli/outline.nvim", - config = function() - -- Example mapping to toggle outline - vim.keymap.set("n", "o", "Outline", { desc = "Toggle Outline" }) - - require("outline").setup({ - -- Your setup opts here (leave empty to use defaults) - }) - end, - }, - { - "stevearc/conform.nvim", - opts = { - formatters_by_ft = { - typescript = { "prettier" }, - jsx = { "prettier" }, - lua = { "stylua" }, - rust = { "rustfmt", lsp_format = "fallback" }, - }, - format_on_save = { - timeout_ms = 500, - lsp_format = "fallback", - }, - }, - }, - { - "windwp/nvim-autopairs", - event = "InsertEnter", - config = true, - opts = {}, - }, - { - "rmagatti/auto-session", - lazy = false, - opts = { - suppressed_dirs = { "~/", "~/Downloads", "/" }, - post_restore_cmds = { - function() - -- Restore nvim-tree after a session is restored - local nvim_tree_api = require("nvim-tree.api") - nvim_tree_api.tree.open() - nvim_tree_api.tree.change_root(vim.fn.getcwd()) - nvim_tree_api.tree.reload() - end, - }, - }, - }, - { - "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - opts = { - options = { - theme = "jellybeans", - }, - }, - }, -} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua new file mode 100644 index 0000000..90ccd29 --- /dev/null +++ b/lua/plugins/ui.lua @@ -0,0 +1,70 @@ +return { + { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + }, + { "mbbill/undotree" }, + { "tpope/vim-fugitive" }, + { + "nvim-tree/nvim-tree.lua", + version = "*", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + cmd = { + "NvimTreeToggle", + }, + opts = { + update_focused_file = { enable = true }, + filters = { + dotfiles = true, + }, + }, + }, + { + "rmagatti/auto-session", + lazy = false, + opts = { + suppressed_dirs = { "~/", "~/Downloads", "/" }, + post_restore_cmds = { + function() + -- Restore nvim-tree after a session is restored + local nvim_tree_api = require("nvim-tree.api") + nvim_tree_api.tree.open() + nvim_tree_api.tree.change_root(vim.fn.getcwd()) + nvim_tree_api.tree.reload() + end, + }, + }, + }, + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = { + options = { + theme = "jellybeans", + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { "filename" }, + lualine_x = { + { + require("lazy.status"), + cond = require("lazy.status").has_updates, + color = { fg = "#ff9e64" }, + }, + "encoding", + "fileformat", + "filetype", + }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + }, + }, + }, +}