nvim lazy plugin management part 1

This commit is contained in:
2025-07-15 15:41:50 +05:00
parent 3812064349
commit 0d1b98f65e
30 changed files with 637 additions and 935 deletions

View File

@ -0,0 +1,34 @@
return {
"windwp/nvim-autopairs",
event = "VeryLazy",
opts = {
check_ts = true,
ts_config = {
lua = { "string", "source" },
javascript = { "string", "template_string" },
java = false,
},
disable_filetype = { "TelescopePrompt", "spectre_panel" },
fast_wrap = {
map = "<M-e>",
chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, -- Offset from pattern match
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "PmenuSel",
highlight_grey = "LineNr",
},
},
config = function ()
require("nvim-autopairs").setup()
-- require ("nvim-autopairs.completion.cmp")
-- local cmp_status_ok, cmp = pcall(require, "cmp")
-- if not cmp_status_ok then
-- return
-- end
-- cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } })
end
}

View File

@ -0,0 +1,14 @@
return {
"lukas-reineke/indent-blankline.nvim",
event = "VeryLazy",
opts = {
scope = {
enabled = true,
show_start = false,
show_end = false,
},
},
config = function (_, _opts)
require("ibl").setup(_opts)
end
}

View File

@ -0,0 +1,46 @@
return {
{
"lewis6991/gitsigns.nvim",
event = "VeryLazy",
opts = {
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" },
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
interval = 1000,
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
},
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = "single",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
}
}
},
}

View File

@ -0,0 +1,46 @@
return {
{
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" },
event = "VeryLazy",
config = function(_, _opts)
local harpoon = require("harpoon")
-- REQUIRED
harpoon:setup()
-- REQUIRED
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<leader>hm", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<C-1>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-2>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-3>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-4>", function() harpoon:list():select(4) end)
-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set("n", "<leader>hp", function() harpoon:list():prev() end)
vim.keymap.set("n", "<leader>hn", function() harpoon:list():next() end)
local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require("telescope.pickers").new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({
results = file_paths,
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
}):find()
end
vim.keymap.set("n", "<C-e>", function() toggle_telescope(harpoon:list()) end,
{ desc = "Open harpoon window" })
end
},
}

View File

@ -0,0 +1,92 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
event = "VeryLazy",
opts = {
enable_diagnostics = false,
enable_git_status = true,
default_component_configs = {
icon = {
folder_empty = "󰜌",
folder_empty_open = "󰜌",
},
git_status = {
symbols = {
-- Change type
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "", -- this can only be used in the git_status source
renamed = "", -- this can only be used in the git_status source
-- Status type
untracked = "",
ignored = "",
unstaged = "",
staged = "",
conflict = "",
},
},
},
document_symbols = {
kinds = {
File = { icon = "󰈙", hl = "Tag" },
Namespace = { icon = "󰌗", hl = "Include" },
Package = { icon = "󰏖", hl = "Label" },
Class = { icon = "󰌗", hl = "Include" },
Property = { icon = "󰆧", hl = "@property" },
Enum = { icon = "󰒻", hl = "@number" },
Function = { icon = "󰊕", hl = "Function" },
String = { icon = "󰀬", hl = "String" },
Number = { icon = "󰎠", hl = "Number" },
Array = { icon = "󰅪", hl = "Type" },
Object = { icon = "󰅩", hl = "Type" },
Key = { icon = "󰌋", hl = "" },
Struct = { icon = "󰌗", hl = "Type" },
Operator = { icon = "󰆕", hl = "Operator" },
TypeParameter = { icon = "󰊄", hl = "Type" },
StaticMethod = { icon = "󰠄 ", hl = "Function" },
},
},
git_status = {
symbols = {
-- Change type
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "", -- this can only be used in the git_status source
renamed = "", -- this can only be used in the git_status source
-- Status type
untracked = "",
ignored = "",
unstaged = "",
staged = "",
conflict = "",
},
},
-- Add this section only if you've configured source selector.
source_selector = {
sources = {
{ source = "filesystem", display_name = " 󰉓 Files " },
{ source = "git_status", display_name = " 󰊢 Git " },
},
},
event_handlers = {
{
event = "neo_tree_buffer_enter",
handler = function(arg)
vim.opt.relativenumber = true
end,
},
{
event = "file_open_requested",
handler = function()
require("neo-tree.command").execute({ action = "close" })
end
},
},
}
}

View File

@ -0,0 +1,5 @@
return {
"petertriho/nvim-scrollbar",
event = "VeryLazy",
config = true
}

View File

@ -0,0 +1,11 @@
return {
{ "L3MON4D3/LuaSnip", event = "VeryLazy" }, --snippet engine
{ "rafamadriz/friendly-snippets", event = "VeryLazy" }, -- a bunch of snippets to use
{
"dsznajder/vscode-es7-javascript-react-snippets",
run = "yarn install --frozen-lockfile && yarn compile",
event = "VeryLazy"
},
}

View File

@ -0,0 +1,121 @@
return {
{
"nvim-telescope/telescope.nvim",
config = function()
local telescope = require("telescope")
telescope.load_extension("media_files")
local telescope_builtin = require("telescope.builtin")
local which_key = require("which-key")
which_key.add({
{ "<leader>f", group = "Find" },
{ "<leader>ff", "<cmd>lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))<cr>", desc = "Find file" },
{ "<leader>fw", "<cmd>lua require'telescope.builtin'.live_grep()<cr>", desc = "Grep file" },
{ "<leader>fb", "<cmd>lua require'telescope.builtin'.buffers()<cr>", desc = "Find buffer" },
{ "<leader>fh", "<cmd>lua require'telescope.builtin'.resume()<cr>", desc = "Resume last search" },
})
end,
opts = function()
local actions = require("telescope.actions")
return {
defaults = {
file_ignore_patterns = { "node_modules", "venv" },
prompt_prefix = "",
selection_caret = "",
path_display = { "smart" },
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-c>"] = actions.close,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<C-l>"] = actions.complete_tag,
["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
},
n = {
["<esc>"] = actions.close,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["j"] = actions.move_selection_next,
["k"] = actions.move_selection_previous,
["H"] = actions.move_to_top,
["M"] = actions.move_to_middle,
["L"] = actions.move_to_bottom,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["?"] = actions.which_key,
},
},
},
pickers = {
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- ...
-- }
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
},
extensions = {
media_files = {
-- filetypes whitelist
-- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
filetypes = { "png", "webp", "jpg", "jpeg" },
find_cmd = "rg", -- find command (defaults to `fd`)
},
-- Your extension configuration goes here:
-- extension_name = {
-- extension_config_key = value,
-- }
-- please take a look at the readme of the extension you want to configure
},
}
end,
event = "VeryLazy"
},
{ "nvim-telescope/telescope-media-files.nvim", event = "VeryLazy" },
}

View File

@ -0,0 +1,38 @@
return {
{
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
event = "VeryLazy",
-- init = function(plugin)
-- require("nvim-treesitter")
-- end,
opts = {
ensure_installed = { "python", "rust", "javascript" }, -- one of "all" or a list of languages
ignore_install = { "phpdoc", "comment", "rst" }, -- List of parsers to ignore installing
highlight = {
enable = true,
disable = { "css" },
},
autopairs = {
enable = true,
},
indent = { enable = true },
autotag = {
enable = true,
},
refactor = {
highlight_definitions = {
enable = false,
-- Set to false if you have an `updatetime` of ~100.
clear_on_cursor_move = true,
},
smart_rename = {
enable = false,
keymaps = {
smart_rename = "grr",
},
},
},
},
},
}

View File

@ -0,0 +1,142 @@
local toggle_gitsigns_blame = function()
local function is_filetype_open(filetype)
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_is_loaded(buf) and vim.bo[buf].filetype == filetype then
return buf
end
end
return nil
end
-- check if gitsigns-blame buffer is open
local bufnr = is_filetype_open("gitsigns-blame")
if bufnr then
vim.api.nvim_buf_delete(bufnr, { force = false })
else
vim.cmd("Gitsigns blame")
end
end
return {
"folke/which-key.nvim",
lazy = false,
opts = {
plugins = {
marks = false, -- shows a list of your marks on ' and `
registers = false, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
spelling = {
enabled = true,
suggestions = 20,
}, -- use which-key for spelling hints
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created
presets = {
operators = false, -- adds help for operators like d, y, ...
motions = false, -- adds help for motions
text_objects = false, -- help for text objects triggered after entering an operator
windows = false, -- default bindings on <c-w>
nav = false, -- misc bindings to work with windows
z = false, -- bindings for folds, spelling and others prefixed with z
g = false, -- bindings for prefixed with g
},
},
preset = "classic",
keys = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup
},
win = {
-- border = "single", -- none, single, double, shadow
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
wo = {
winblend = 0,
}
},
layout = {
height = { min = 4, max = 25 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 3, -- spacing between columns
align = "left", -- align columns left, center or right
},
filter = function(mapping) -- enable this to hide mappings for which you didn't specify a label
return mapping.desc
end,
show_help = true, -- show help message on the command line when the popup is visible
show_keys = true, -- show the currently pressed key and its label as a message in the command line
triggers = {},
-- disable the WhichKey popup for certain buf types and file types.
-- Disabled by default for Telescope
disable = {
buftypes = {},
filetypes = { "TelescopePrompt" },
},
},
config = function()
local which_key = require("which-key")
which_key.add({
{ "<leader>", group = "Hotkeys" },
{ "<leader>?", ":WhichKey <CR>", desc = "Show keybindings" },
{ "<leader>o", ":Oil --float <CR>", desc = "Oil nvim toggle" },
{ "<leader>e", ":Neotree toggle position=current <CR>", desc = "File tree toggle" },
{ "<leader>F", ":lua vim.lsp.buf.format() <CR>", desc = "Format file" },
})
-- which_key.add({
-- { "<leader>f", group = "Find" },
-- { "<leader>ff", "<cmd>lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))<cr>", desc = "Find file" },
-- { "<leader>fw", "<cmd>lua require'telescope.builtin'.live_grep()<cr>", desc = "Grep file" },
-- { "<leader>fb", "<cmd>lua require'telescope.builtin'.buffers()<cr>", desc = "Find buffer" },
-- { "<leader>fh", "<cmd>lua require'telescope.builtin'.resume()<cr>", desc = "Resume last search" },
-- })
which_key.add({
{ "<leader>g", group = "Git" },
{ "<leader>gb", toggle_gitsigns_blame, desc = "Toggle git blame view" },
})
which_key.add({
{ "<leader>z", "<cmd>:ZenMode<CR>", desc = "Zen mode toggle" },
})
which_key.add({
{ "<leader>c", group = "Code actions" },
{ "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", desc = "Show code actions" },
})
which_key.add({
{ "<leader>l", "<cmd>lua vim.diagnostic.setloclist()<CR>", desc = "Show diagnostic list" },
})
which_key.add({
{ "<leader>d", group = "Dap" },
{ "<leader>dr", "<cmd>DapContinue<CR>", desc = "Continue" },
{ "<leader>dj", "<cmd>DapStepInto<CR>", desc = "Step into" },
{ "<leader>dl", "<cmd>DapStepOver<CR>", desc = "Step over" },
{ "<leader>dk", "<cmd>DapStepOut<CR>", desc = "Step out" },
{ "<leader>db", "<cmd>DapToggleBreakpoint<CR>", desc = "Toggle breakpoint" },
{ "<leader>ds", "<cmd>DapTerminate<CR>", desc = "Terminate" },
})
which_key.add({
{ "<leader>t", group = "Tabs" },
{ "<leader>tn", "<cmd>tabnew<CR>", desc = "New tab" },
{ "<leader>tq", "<cmd>tabclose<CR>", desc = "Close tab" },
})
which_key.add({
{ "g", group = "LSP Actions" },
{ "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", desc = "Go to declaration" },
{ "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", desc = "Go to definition" },
{ "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", desc = "Show implementations" },
{ "grr", "<cmd>lua vim.lsp.buf.rename()<CR>", desc = "Rename" },
{ "gr", "<cmd>lua vim.lsp.buf.references()<CR>", desc = "Show references" },
{ "gl", "<cmd>lua vim.diagnostic.open_float({ border = 'rounded' })<CR>", desc = "Show diagnostic at line" },
})
which_key.add({
{ "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", desc = "Signature help" },
{ "K", "<cmd>lua vim.lsp.buf.hover()<CR>", desc = "Signature help" },
})
end
}