diff --git a/init.lua b/init.lua index 496f45b8..40b5607c 100644 --- a/init.lua +++ b/init.lua @@ -358,6 +358,16 @@ require('lazy').setup({ require('telescope.themes').get_dropdown(), }, }, + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, + }, + sorting_strategy = 'ascending', + layout_strategy = 'vertical', + }, } -- Enable Telescope extensions if they are installed @@ -369,7 +379,7 @@ require('lazy').setup({ vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + vim.keymap.set('n', '', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', '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 }, sources = { + { name = 'codeium' }, { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, }, + formattingConfig = { + format = require('lspkind').cmp_format { + mode = 'symbol', + maxwidth = 50, + ellipsis_char = '...', + symbol_map = { Codeium = '' }, + }, + }, } end, }, @@ -847,7 +866,7 @@ require('lazy').setup({ -- -- 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` - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, { ui = { -- 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` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/error.lua b/lua/custom/plugins/error.lua new file mode 100644 index 00000000..b37c5ca8 --- /dev/null +++ b/lua/custom/plugins/error.lua @@ -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', 'xx', function() + require('trouble').toggle() + end) + vim.keymap.set('n', 'xw', function() + require('trouble').toggle 'workspace_diagnostics' + end) + vim.keymap.set('n', 'xd', function() + require('trouble').toggle 'document_diagnostics' + end) + vim.keymap.set('n', 'xq', function() + require('trouble').toggle 'quickfix' + end) + vim.keymap.set('n', 'xl', function() + require('trouble').toggle 'loclist' + end) + vim.keymap.set('n', 'gR', function() + require('trouble').toggle 'lsp_references' + end) + end, + }, +} diff --git a/lua/custom/plugins/filesystem.lua b/lua/custom/plugins/filesystem.lua new file mode 100644 index 00000000..894b325d --- /dev/null +++ b/lua/custom/plugins/filesystem.lua @@ -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', '', 'Oil', { desc = 'Open Parent Directory' }) + end, + }, + { + 'ThePrimeagen/harpoon', + config = function() + vim.api.nvim_set_keymap('n', 'ha', [[:lua require('harpoon.mark').add_file()]], { + noremap = true, + desc = '[H]arpoon [A]dd file for quick toggle menu', + }) + + vim.api.nvim_set_keymap('n', 'hm', [[:lua require('harpoon.ui').toggle_quick_menu()]], { + noremap = true, + desc = 'Open [H]arpoon [M]enu', + }) + + for i = 1, 5 do + vim.api.nvim_set_keymap('n', '' .. i, [[:lua require("harpoon.ui").nav_file(]] .. i .. [[)]], { + 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', 'st', 'lua require("spectre").toggle()', { + desc = 'Toggle Spectre', + }) + vim.keymap.set('n', 'sn', 'lua require("spectre").open_visual({select_word=true})', { + desc = 'Search current word', + }) + vim.keymap.set('n', 'sp', 'lua require("spectre").open_file_search({select_word=true})', { + desc = 'Search on current file', + }) + end, + }, +} diff --git a/lua/custom/plugins/git.lua b/lua/custom/plugins/git.lua new file mode 100644 index 00000000..3ef936f3 --- /dev/null +++ b/lua/custom/plugins/git.lua @@ -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 '' + 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 '' + end, { expr = true, desc = 'Jump to previous hunk' }) + + -- Actions + -- visual mode + map('v', 'hs', function() + gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'stage git hunk' }) + map('v', 'hr', function() + gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'reset git hunk' }) + -- normal mode + map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) + map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) + map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) + map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) + map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) + map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) + map('n', 'hb', function() + gs.blame_line { full = false } + end, { desc = 'git blame line' }) + map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) + map('n', 'hD', function() + gs.diffthis '~' + end, { desc = 'git diff against last commit' }) + + -- Toggles + map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) + map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) + + -- Text object + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { 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', 'lg', 'LazyGit', { noremap = true }) + end, + }, +} diff --git a/lua/custom/plugins/quality.lua b/lua/custom/plugins/quality.lua new file mode 100644 index 00000000..28b2b730 --- /dev/null +++ b/lua/custom/plugins/quality.lua @@ -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, + }, +}