Added necessary plugins for quality of life

This commit is contained in:
Dev Chaudhary 2024-04-04 11:24:16 -04:00
parent c4363e4ad8
commit 4731a188fb
5 changed files with 337 additions and 3 deletions

View File

@ -358,6 +358,16 @@ require('lazy').setup({
require('telescope.themes').get_dropdown(), require('telescope.themes').get_dropdown(),
}, },
}, },
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
},
},
sorting_strategy = 'ascending',
layout_strategy = 'vertical',
},
} }
-- Enable Telescope extensions if they are installed -- Enable Telescope extensions if they are installed
@ -369,7 +379,7 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set('n', '<leader><Space>', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
@ -732,10 +742,19 @@ require('lazy').setup({
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
}, },
sources = { sources = {
{ name = 'codeium' },
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'path' }, { name = 'path' },
}, },
formattingConfig = {
format = require('lspkind').cmp_format {
mode = 'symbol',
maxwidth = 50,
ellipsis_char = '...',
symbol_map = { Codeium = '' },
},
},
} }
end, end,
}, },
@ -847,7 +866,7 @@ require('lazy').setup({
-- --
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' }, { import = 'custom.plugins' },
}, { }, {
ui = { ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the -- If you are using a Nerd Font: set icons to an empty table which will use the
@ -869,6 +888,5 @@ require('lazy').setup({
}, },
}, },
}) })
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et

View File

@ -0,0 +1,42 @@
return {
{
'folke/trouble.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
{
icons = false,
fold_open = 'v', -- icon used for open folds
fold_closed = '>', -- icon used for closed folds
indent_lines = false, -- add an indent guide below the fold icons
signs = {
-- icons / text used for a diagnostic
error = 'error',
warning = 'warn',
hint = 'hint',
information = 'info',
},
use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
},
},
config = function()
vim.keymap.set('n', '<leader>xx', function()
require('trouble').toggle()
end)
vim.keymap.set('n', '<leader>xw', function()
require('trouble').toggle 'workspace_diagnostics'
end)
vim.keymap.set('n', '<leader>xd', function()
require('trouble').toggle 'document_diagnostics'
end)
vim.keymap.set('n', '<leader>xq', function()
require('trouble').toggle 'quickfix'
end)
vim.keymap.set('n', '<leader>xl', function()
require('trouble').toggle 'loclist'
end)
vim.keymap.set('n', 'gR', function()
require('trouble').toggle 'lsp_references'
end)
end,
},
}

View File

@ -0,0 +1,52 @@
return {
{
'stevearc/oil.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('oil').setup {
view_options = {
show_hidden = true,
},
}
vim.keymap.set('n', '<C-n>', '<Cmd>Oil<Cr>', { desc = 'Open Parent Directory' })
end,
},
{
'ThePrimeagen/harpoon',
config = function()
vim.api.nvim_set_keymap('n', '<leader>ha', [[:lua require('harpoon.mark').add_file()<CR>]], {
noremap = true,
desc = '[H]arpoon [A]dd file for quick toggle menu',
})
vim.api.nvim_set_keymap('n', '<leader>hm', [[:lua require('harpoon.ui').toggle_quick_menu()<CR>]], {
noremap = true,
desc = 'Open [H]arpoon [M]enu',
})
for i = 1, 5 do
vim.api.nvim_set_keymap('n', '<leader>' .. i, [[:lua require("harpoon.ui").nav_file(]] .. i .. [[)<CR>]], {
noremap = true,
desc = 'Toggle through files using workspace keymaps',
})
end
end,
},
{
'nvim-pack/nvim-spectre',
dependencies = {
'nvim-lua/plenary.nvim',
},
config = function()
vim.keymap.set('n', '<leader>st', '<cmd>lua require("spectre").toggle()<CR>', {
desc = 'Toggle Spectre',
})
vim.keymap.set('n', '<leader>sn', '<cmd>lua require("spectre").open_visual({select_word=true})<CR>', {
desc = 'Search current word',
})
vim.keymap.set('n', '<leader>sp', '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', {
desc = 'Search on current file',
})
end,
},
}

View File

@ -0,0 +1,97 @@
return {
{
'f-person/git-blame.nvim',
},
{
-- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map({ 'n', 'v' }, ']c', function()
if vim.wo.diff then
return ']c'
end
vim.schedule(function()
gs.next_hunk()
end)
return '<Ignore>'
end, { expr = true, desc = 'Jump to next hunk' })
map({ 'n', 'v' }, '[c', function()
if vim.wo.diff then
return '[c'
end
vim.schedule(function()
gs.prev_hunk()
end)
return '<Ignore>'
end, { expr = true, desc = 'Jump to previous hunk' })
-- Actions
-- visual mode
map('v', '<leader>hs', function()
gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'stage git hunk' })
map('v', '<leader>hr', function()
gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'reset git hunk' })
-- normal mode
map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
map('n', '<leader>hb', function()
gs.blame_line { full = false }
end, { desc = 'git blame line' })
map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
map('n', '<leader>hD', function()
gs.diffthis '~'
end, { desc = 'git diff against last commit' })
-- Toggles
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
-- Text object
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
end,
},
},
{
'kdheepak/lazygit.nvim',
event = 'VeryLazy',
cmd = {
'LazyGit',
'LazyGitConfig',
'LazyGitCurrentFile',
'LazyGitFilter',
'LazyGitFilterCurrentFile',
},
-- optional for floating window border decoration
dependencies = {
'nvim-lua/plenary.nvim',
},
config = function()
vim.keymap.set('n', '<leader>lg', '<Cmd>LazyGit<Cr>', { noremap = true })
end,
},
}

View File

@ -0,0 +1,125 @@
return {
{
'folke/noice.nvim',
event = 'VeryLazy',
config = function()
require('noice').setup {
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
}
end,
dependencies = {
'MunifTanjim/nui.nvim',
'rcarriga/nvim-notify',
},
},
{
'windwp/nvim-autopairs',
dependencies = { 'hrsh7th/nvim-cmp' },
config = function()
require('nvim-autopairs').setup {}
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp = require 'cmp'
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
},
{
'stevearc/dressing.nvim',
opts = {},
},
{
'echasnovski/mini.surround',
config = function()
require('mini.surround').setup {
mappings = {
add = 'sa', -- Add surrounding in Normal and Visual modes
delete = 'sd', -- Delete surrounding
find = 'sf', -- Find surrounding (to the right)
find_left = 'sF', -- Find surrounding (to the left)
highlight = 'sh', -- Highlight surrounding
replace = 'sr', -- Replace surrounding
update_n_lines = 'sn', -- Update `n_lines`
suffix_last = 'l', -- Suffix to search with "prev" method
suffix_next = 'n', -- Suffix to search wwth "next" method
},
}
end,
},
{
'TobinPalmer/Tip.nvim',
event = 'VimEnter',
init = function()
-- Default config
--- @type Tip.config
require('tip').setup {
seconds = 2,
title = 'Tip!',
url = 'https://vtip.43z.one', -- Or https://vimiscool.tech/neotip
}
end,
},
{
'NvChad/nvim-colorizer.lua',
config = function()
require('colorizer').setup {}
end,
},
{
'michaelb/sniprun',
branch = 'master',
build = 'sh install.sh',
-- do 'sh install.sh 1' if you want to force compile locally
-- (instead of fetching a binary from the github release). Requires Rust >= 1.65
config = function()
require('sniprun').setup {
-- your options
}
end,
},
{
'Exafunction/codeium.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'hrsh7th/nvim-cmp',
'onsails/lspkind.nvim',
},
config = function()
require('codeium').setup {}
end,
},
{
'nvim-tree/nvim-web-devicons',
config = function()
require('nvim-web-devicons').setup {}
end,
},
{
'rose-pine/neovim',
name = 'rose-pine',
priority = 1000,
init = function()
vim.cmd.colorscheme 'rose-pine-main'
end,
config = function()
require('rose-pine').setup {}
end,
},
}