organizing a little bit

This commit is contained in:
Nareshkumar Rao 2025-05-16 22:41:14 +02:00
parent e6ec980666
commit 9f9a18251c
8 changed files with 163 additions and 138 deletions

View File

@ -1 +1,3 @@
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle) vim.keymap.set("n", "<leader>u", function()
vim.cmd.UndotreeToggle()
end)

View File

@ -5,7 +5,7 @@
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
"conform.nvim": { "branch": "master", "commit": "2b2b30260203af3b93a7470ac6c8457ddd6e32d9" }, "conform.nvim": { "branch": "master", "commit": "a4bb5d6c4ae6f32ab13114e62e70669fa67745b9" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" },

View File

@ -1,17 +1,17 @@
-- Bootstrap lazy.nvim -- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git" local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({ vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" }, { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" }, { out, "WarningMsg" },
{ "\nPress any key to exit..." }, { "\nPress any key to exit..." },
}, true, {}) }, true, {})
vim.fn.getchar() vim.fn.getchar()
os.exit(1) os.exit(1)
end end
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
@ -23,13 +23,16 @@ vim.g.maplocalleader = "\\"
-- Setup lazy.nvim -- Setup lazy.nvim
require("lazy").setup({ require("lazy").setup({
spec = { spec = {
-- import your plugins -- import your plugins
{ import = "plugins" }, { import = "plugins" },
}, },
-- Configure any other settings here. See the documentation for more details. -- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins. -- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } }, install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates -- automatically check for plugin updates
checker = { enabled = true }, checker = {
enabled = true,
notify = false,
},
}) })

View File

@ -33,3 +33,5 @@ vim.g.mapleader = " "
vim.g.loaded_netrw = 1 vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
vim.opt.clipboard:append("unnamedplus")

View File

@ -91,4 +91,47 @@ return {
config_lsp() config_lsp()
end, 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)",
},
},
},
{
"hedyhli/outline.nvim",
config = function()
-- Example mapping to toggle outline
vim.keymap.set("n", "<leader>o", "<cmd>Outline<CR>", { 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 = {},
},
} }

21
lua/plugins/mason.lua Normal file
View File

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

View File

@ -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 = {
{
"<leader>xx",
"<cmd>Trouble diagnostics toggle<cr>",
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", "<leader>o", "<cmd>Outline<CR>", { 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",
},
},
},
}

70
lua/plugins/ui.lua Normal file
View File

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