diff --git a/after/plugin/highlight_yank.lua b/after/plugin/highlight_yank.lua new file mode 100644 index 00000000..3644f995 --- /dev/null +++ b/after/plugin/highlight_yank.lua @@ -0,0 +1,8 @@ +vim.api.nvim_create_autocmd("TextYankPost", { + group = vim.api.nvim_create_augroup("highlight_yank", { clear = true }), + pattern = "*", + desc = "Highlight selection on yank", + callback = function() + vim.highlight.on_yank({ timeout = 200, visual = true }) + end, +}) diff --git a/lua/custom/plugins/dressing.lua b/lua/custom/plugins/dressing.lua new file mode 100644 index 00000000..bc28d8af --- /dev/null +++ b/lua/custom/plugins/dressing.lua @@ -0,0 +1,8 @@ +return { + { + "stevearc/dressing.nvim", + config = function() + require("dressing").setup() + end, + }, +} diff --git a/lua/custom/plugins/fidget.lua b/lua/custom/plugins/fidget.lua new file mode 100644 index 00000000..bee8ea6b --- /dev/null +++ b/lua/custom/plugins/fidget.lua @@ -0,0 +1,16 @@ +return { + { + "j-hui/fidget.nvim", + event = { "BufEnter" }, + config = function() + -- Turn on LSP, formatting, and linting status and progress information + require("fidget").setup({ + progress = { + display = { + progress_icon = { "dots_negative" } + } + } + }) + end, + }, +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..f05427e8 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,50 @@ +return { + { + 'ThePrimeagen/harpoon', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + opts = { + global_settings = { + save_on_toggle = true, + enter_on_sendcmd = true, + }, + }, + config = function() + local harpoon_ui = require 'harpoon.ui' + local harpoon_mark = require 'harpoon.mark' + + -- Harpoon keybinds -- + -- Open harpoon ui + vim.keymap.set('n', '', function() + harpoon_ui.toggle_quick_menu() + end) + + -- Add current file to harpoon + vim.keymap.set('n', 'a', function() + harpoon_mark.add_file() + end) + + -- Quickly jump to harpooned files + vim.keymap.set('n', '1', function() + harpoon_ui.nav_file(1) + end) + + vim.keymap.set('n', '2', function() + harpoon_ui.nav_file(2) + end) + + vim.keymap.set('n', '3', function() + harpoon_ui.nav_file(3) + end) + + vim.keymap.set('n', '4', function() + harpoon_ui.nav_file(4) + end) + + vim.keymap.set('n', '5', function() + harpoon_ui.nav_file(5) + end) + end, + } +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index ccc2a8c1..be0eb9d8 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,325 +2,4 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return { - { - 'ThePrimeagen/harpoon', - dependencies = { - 'nvim-lua/plenary.nvim', - }, - opts = { - global_settings = { - save_on_toggle = true, - enter_on_sendcmd = true, - }, - }, - config = function() - local harpoon_ui = require 'harpoon.ui' - local harpoon_mark = require 'harpoon.mark' - - -- Harpoon keybinds -- - -- Open harpoon ui - vim.keymap.set('n', '', function() - harpoon_ui.toggle_quick_menu() - end) - - -- Add current file to harpoon - vim.keymap.set('n', 'a', function() - harpoon_mark.add_file() - end) - - -- Quickly jump to harpooned files - vim.keymap.set('n', '1', function() - harpoon_ui.nav_file(1) - end) - - vim.keymap.set('n', '2', function() - harpoon_ui.nav_file(2) - end) - - vim.keymap.set('n', '3', function() - harpoon_ui.nav_file(3) - end) - - vim.keymap.set('n', '4', function() - harpoon_ui.nav_file(4) - end) - - vim.keymap.set('n', '5', function() - harpoon_ui.nav_file(5) - end) - end, - }, - - { - 'stevearc/oil.nvim', - opts = {}, - dependencies = { 'nvim-tree/nvim-web-devicons' }, - config = function() - require('oil').setup { - default_file_explorer = true, - skip_confirm_for_simple_edits = true, - columns = { 'icon' }, - keymaps = { - [''] = false, - [''] = 'actions.select_split', - }, - view_options = { - show_hidden = true, - natural_order = true, - is_always_hidden = function(name, bufnr) - return name == '..' or name == '.git' - end, - }, - win_options = { - wrap = true, - }, - } - - -- Open parent directory in current window - vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) - - -- Open parent directory in floating window - vim.keymap.set('n', '-', require('oil').toggle_float) - end, - }, - - { - 'm4xshen/hardtime.nvim', - dependecies = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim' }, - opts = { - restriction_mode = 'hint', - }, - enabled = false, - }, - - { - 'echasnovski/mini.cursorword', - version = false, - lazy = true, - event = 'CursorMoved', - config = function() - require('mini.cursorword').setup() - end, - }, - - { - 'echasnovski/mini.indentscope', - version = false, - event = 'BufEnter', - opts = { - symbol = '│', - options = { try_as_border = true }, - draw = { - animation = function() - return 0 - end, - }, - }, - init = function() - -- local macchiato = require('catppuccin.palettes').get_palette 'macchiato' - vim.api.nvim_create_autocmd('FileType', { - pattern = { - 'help', - 'lazy', - 'mason', - 'notify', - 'oil', - 'Oil', - }, - callback = function() - vim.b.miniindentscope_disable = true - end, - }) - -- vim.api.nvim_set_hl(0, 'MiniIndentscopeSymbol', { fg = macchiato.mauve }) - end, - }, - - { - 'nvim-pack/nvim-spectre', - lazy = true, - cmd = { 'Spectre' }, - dependencies = { - 'nvim-lua/plenary.nvim', - 'catppuccin/nvim', - }, - keys = { - { - 'S', - function() - require('spectre').toggle() - end, - desc = 'Toggle Spectre', - }, - { - 'SW', - function() - require('spectre').open_visual { select_word = true } - end, - mode = 'n', - desc = 'Search current word', - }, - { - 'SW', - function() - require('spectre').open_visual() - end, - mode = 'v', - desc = 'Search current word', - }, - { - 'SP', - function() - require('spectre').open_file_search { select_word = true } - end, - desc = 'Search on current file', - }, - }, - config = function() - local theme = require('catppuccin.palettes').get_palette 'macchiato' - vim.api.nvim_set_hl(0, 'SpectreSearch', { bg = theme.red, fg = theme.base }) - vim.api.nvim_set_hl(0, 'SpectreReplace', { bg = theme.green, fg = theme.base }) - require('spectre').setup { - highlight = { - search = 'SpectreSearch', - replace = 'SpectreReplace', - }, - mapping = { - ['send_to_qf'] = { - map = '', - cmd = "lua require('spectre.actions').send_to_qf()", - desc = 'send all items to quickfix', - }, - }, - replace_engine = { - sed = { - cmd = 'sed', - args = { - '-i', - '', - '-E', - }, - }, - }, - } - end, - }, - - { - "pmizio/typescript-tools.nvim", - dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" }, - opts = {}, - }, - - { - "echasnovski/mini.files", - opts = { - windows = { - preview = true, - width_focus = 30, - width_preview = 30, - }, - options = { - -- Whether to use for editing directories - -- Disabled by default in LazyVim because neo-tree is used for that - use_as_default_explorer = false, - }, - }, - keys = { - { - "fm", - function() - require("mini.files").open(vim.api.nvim_buf_get_name(0), true) - end, - desc = "Open mini.files (Directory of Current File)", - }, - { - "fM", - function() - require("mini.files").open(vim.uv.cwd(), true) - end, - desc = "Open mini.files (cwd)", - }, - }, - config = function(_, opts) - require("mini.files").setup(opts) - - local show_dotfiles = true - local filter_show = function(fs_entry) - return true - end - local filter_hide = function(fs_entry) - return not vim.startswith(fs_entry.name, ".") - end - - local toggle_dotfiles = function() - show_dotfiles = not show_dotfiles - local new_filter = show_dotfiles and filter_show or filter_hide - require("mini.files").refresh({ content = { filter = new_filter } }) - end - - local map_split = function(buf_id, lhs, direction, close_on_file) - local rhs = function() - local new_target_window - local cur_target_window = require("mini.files").get_explorer_state().target_window - if cur_target_window ~= nil then - vim.api.nvim_win_call(cur_target_window, function() - vim.cmd("belowright " .. direction .. " split") - new_target_window = vim.api.nvim_get_current_win() - end) - - require("mini.files").set_target_window(new_target_window) - require("mini.files").go_in({ close_on_file = close_on_file }) - end - end - - local desc = "Open in " .. direction .. " split" - if close_on_file then - desc = desc .. " and close" - end - vim.keymap.set("n", lhs, rhs, { buffer = buf_id, desc = desc }) - end - - local files_set_cwd = function() - local cur_entry_path = MiniFiles.get_fs_entry().path - local cur_directory = vim.fs.dirname(cur_entry_path) - if cur_directory ~= nil then - vim.fn.chdir(cur_directory) - end - end - - vim.api.nvim_create_autocmd("User", { - pattern = "MiniFilesBufferCreate", - callback = function(args) - local buf_id = args.data.buf_id - - vim.keymap.set( - "n", - opts.mappings and opts.mappings.toggle_hidden or "g.", - toggle_dotfiles, - { buffer = buf_id, desc = "Toggle hidden files" } - ) - - vim.keymap.set( - "n", - opts.mappings and opts.mappings.change_cwd or "gc", - files_set_cwd, - { buffer = args.data.buf_id, desc = "Set cwd" } - ) - - map_split(buf_id, opts.mappings and opts.mappings.go_in_horizontal or "s", "horizontal", false) - map_split(buf_id, opts.mappings and opts.mappings.go_in_vertical or "v", "vertical", false) - map_split(buf_id, opts.mappings and opts.mappings.go_in_horizontal_plus or "S", "horizontal", true) - map_split(buf_id, opts.mappings and opts.mappings.go_in_vertical_plus or "V", "vertical", true) - end, - }) - - vim.api.nvim_create_autocmd("User", { - pattern = "MiniFilesActionRename", - callback = function(event) - Snacks.rename.on_rename_file(event.data.from, event.data.to) - end, - }) - end, - } -} +return {} diff --git a/lua/custom/plugins/mini.lua b/lua/custom/plugins/mini.lua new file mode 100644 index 00000000..a7f2cf7b --- /dev/null +++ b/lua/custom/plugins/mini.lua @@ -0,0 +1,155 @@ +return { + { + 'echasnovski/mini.cursorword', + version = false, + lazy = true, + event = 'CursorMoved', + config = function() + require('mini.cursorword').setup() + end, + }, + + { + 'echasnovski/mini.indentscope', + version = false, + event = 'BufEnter', + opts = { + symbol = '│', + options = { try_as_border = true }, + draw = { + animation = function() + return 0 + end, + }, + }, + init = function() + local macchiato = require('catppuccin.palettes').get_palette 'macchiato' + vim.api.nvim_create_autocmd('FileType', { + pattern = { + 'help', + 'lazy', + 'mason', + 'notify', + 'oil', + 'Oil', + }, + callback = function() + vim.b.miniindentscope_disable = true + end, + }) + vim.api.nvim_set_hl(0, 'MiniIndentscopeSymbol', { fg = macchiato.mauve }) + end, + }, + + { + "echasnovski/mini.files", + opts = { + windows = { + preview = true, + width_focus = 30, + width_preview = 30, + }, + options = { + -- Whether to use for editing directories + -- Disabled by default in LazyVim because neo-tree is used for that + use_as_default_explorer = false, + }, + }, + keys = { + { + "fm", + function() + require("mini.files").open(vim.api.nvim_buf_get_name(0), true) + end, + desc = "Open mini.files (Directory of Current File)", + }, + { + "fM", + function() + require("mini.files").open(vim.uv.cwd(), true) + end, + desc = "Open mini.files (cwd)", + }, + }, + config = function(_, opts) + require("mini.files").setup(opts) + + local show_dotfiles = true + local filter_show = function(fs_entry) + return true + end + local filter_hide = function(fs_entry) + return not vim.startswith(fs_entry.name, ".") + end + + local toggle_dotfiles = function() + show_dotfiles = not show_dotfiles + local new_filter = show_dotfiles and filter_show or filter_hide + require("mini.files").refresh({ content = { filter = new_filter } }) + end + + local map_split = function(buf_id, lhs, direction, close_on_file) + local rhs = function() + local new_target_window + local cur_target_window = require("mini.files").get_explorer_state().target_window + if cur_target_window ~= nil then + vim.api.nvim_win_call(cur_target_window, function() + vim.cmd("belowright " .. direction .. " split") + new_target_window = vim.api.nvim_get_current_win() + end) + + require("mini.files").set_target_window(new_target_window) + require("mini.files").go_in({ close_on_file = close_on_file }) + end + end + + local desc = "Open in " .. direction .. " split" + if close_on_file then + desc = desc .. " and close" + end + vim.keymap.set("n", lhs, rhs, { buffer = buf_id, desc = desc }) + end + + local files_set_cwd = function() + local cur_entry_path = MiniFiles.get_fs_entry().path + local cur_directory = vim.fs.dirname(cur_entry_path) + if cur_directory ~= nil then + vim.fn.chdir(cur_directory) + end + end + + vim.api.nvim_create_autocmd("User", { + pattern = "MiniFilesBufferCreate", + callback = function(args) + local buf_id = args.data.buf_id + + vim.keymap.set( + "n", + opts.mappings and opts.mappings.toggle_hidden or "g.", + toggle_dotfiles, + { buffer = buf_id, desc = "Toggle hidden files" } + ) + + vim.keymap.set( + "n", + opts.mappings and opts.mappings.change_cwd or "gc", + files_set_cwd, + { buffer = args.data.buf_id, desc = "Set cwd" } + ) + + map_split(buf_id, opts.mappings and opts.mappings.go_in_horizontal or "s", "horizontal", false) + map_split(buf_id, opts.mappings and opts.mappings.go_in_vertical or "v", "vertical", false) + map_split(buf_id, opts.mappings and opts.mappings.go_in_horizontal_plus or "S", "horizontal", true) + map_split(buf_id, opts.mappings and opts.mappings.go_in_vertical_plus or "V", "vertical", true) + end, + }) + + vim.api.nvim_create_autocmd("User", { + pattern = "MiniFilesActionRename", + callback = function(event) + Snacks.rename.on_rename_file(event.data.from, event.data.to) + end, + }) + end, + }, +} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua new file mode 100644 index 00000000..aa9f55f1 --- /dev/null +++ b/lua/custom/plugins/noice.lua @@ -0,0 +1,18 @@ +return { + { + "folke/noice.nvim", + enabled = false, + opts = { + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = false, -- position the cmdline and popupmenu together + long_message_to_split = false, -- 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 + }, + cmdline = { + view = "cmdline", + }, + }, + }, +} diff --git a/lua/custom/plugins/nvim-ufo.lua b/lua/custom/plugins/nvim-ufo.lua new file mode 100644 index 00000000..56ea3e1c --- /dev/null +++ b/lua/custom/plugins/nvim-ufo.lua @@ -0,0 +1,36 @@ +return { + { + "kevinhwang91/nvim-ufo", + dependencies = { "kevinhwang91/promise-async" }, + event = "BufEnter", + config = function() + -- Fold options + vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] + vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + require("ufo").setup() + end, + opts = { + preview = { + win_config = { + border = { "", "─", "", "", "", "─", "", "" }, + winhighlight = "Normal:Folded", + winblend = 0, + }, + mappings = { + scrollB = "", + scrollF = "", + scrollU = "", + scrollD = "", + jumpTop = "[", + jumpBot = "]", + }, + }, + provider_selector = function(_, filetype, buftype) + return (filetype == "" or buftype == "nofile") and "indent" -- only use indent until a file is opened + or { "treesitter", "indent" } -- if file opened, try to use treesitter if available + end, + }, + }, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000..04438ad9 --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,34 @@ +return { + { + 'stevearc/oil.nvim', + opts = {}, + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('oil').setup { + default_file_explorer = true, + skip_confirm_for_simple_edits = true, + columns = { 'icon' }, + keymaps = { + [''] = false, + [''] = 'actions.select_split', + }, + view_options = { + show_hidden = true, + natural_order = true, + is_always_hidden = function(name, bufnr) + return name == '..' or name == '.git' + end, + }, + win_options = { + wrap = true, + }, + } + + -- Open parent directory in current window + vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) + + -- Open parent directory in floating window + vim.keymap.set('n', '-', require('oil').toggle_float) + end, + } +} diff --git a/lua/custom/plugins/spectre.lua b/lua/custom/plugins/spectre.lua new file mode 100644 index 00000000..70566fe9 --- /dev/null +++ b/lua/custom/plugins/spectre.lua @@ -0,0 +1,71 @@ +return { + { + 'nvim-pack/nvim-spectre', + lazy = true, + cmd = { 'Spectre' }, + dependencies = { + 'nvim-lua/plenary.nvim', + 'catppuccin/nvim', + }, + keys = { + { + 'S', + function() + require('spectre').toggle() + end, + desc = 'Toggle Spectre', + }, + { + 'SW', + function() + require('spectre').open_visual { select_word = true } + end, + mode = 'n', + desc = 'Search current word', + }, + { + 'SW', + function() + require('spectre').open_visual() + end, + mode = 'v', + desc = 'Search current word', + }, + { + 'SP', + function() + require('spectre').open_file_search { select_word = true } + end, + desc = 'Search on current file', + }, + }, + config = function() + local theme = require('catppuccin.palettes').get_palette 'macchiato' + vim.api.nvim_set_hl(0, 'SpectreSearch', { bg = theme.red, fg = theme.base }) + vim.api.nvim_set_hl(0, 'SpectreReplace', { bg = theme.green, fg = theme.base }) + require('spectre').setup { + highlight = { + search = 'SpectreSearch', + replace = 'SpectreReplace', + }, + mapping = { + ['send_to_qf'] = { + map = '', + cmd = "lua require('spectre.actions').send_to_qf()", + desc = 'send all items to quickfix', + }, + }, + replace_engine = { + sed = { + cmd = 'sed', + args = { + '-i', + '', + '-E', + }, + }, + }, + } + end, + } +} diff --git a/lua/custom/plugins/tmux-navigator.lua b/lua/custom/plugins/tmux-navigator.lua new file mode 100644 index 00000000..4421fed9 --- /dev/null +++ b/lua/custom/plugins/tmux-navigator.lua @@ -0,0 +1,17 @@ +return { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + }, + keys = { + { "", "TmuxNavigateLeft" }, + { "", "TmuxNavigateDown" }, + { "", "TmuxNavigateUp" }, + { "", "TmuxNavigateRight" }, + { "", "TmuxNavigatePrevious" }, + }, +} diff --git a/lua/custom/plugins/typescrit-tools.lua b/lua/custom/plugins/typescrit-tools.lua new file mode 100644 index 00000000..94034b8b --- /dev/null +++ b/lua/custom/plugins/typescrit-tools.lua @@ -0,0 +1,7 @@ +return { + { + "pmizio/typescript-tools.nvim", + dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" }, + opts = {}, + }, +} diff --git a/lua/custom/plugins/wilder.lua b/lua/custom/plugins/wilder.lua new file mode 100644 index 00000000..3571d346 --- /dev/null +++ b/lua/custom/plugins/wilder.lua @@ -0,0 +1,58 @@ +return { + { + "gelguy/wilder.nvim", + keys = { + ":", + "/", + "?", + }, + dependencies = { + "catppuccin/nvim", + }, + build = function() vim.fn["UpdateRemotePlugins"]() end, + config = function() + local wilder = require("wilder") + local macchiato = require("catppuccin.palettes").get_palette("macchiato") + + -- Create a highlight group for the popup menu + local text_highlight = + wilder.make_hl("WilderText", { { a = 1 }, { a = 1 }, { foreground = macchiato.text } }) + local mauve_highlight = + wilder.make_hl("WilderMauve", { { a = 1 }, { a = 1 }, { foreground = macchiato.mauve } }) + + -- Enable wilder when pressing :, / or ? + wilder.setup({ modes = { ":", "/", "?" } }) + + -- Enable fuzzy matching for commands and buffers + wilder.set_option("pipeline", { + wilder.branch( + wilder.cmdline_pipeline({ + fuzzy = 1, + }), + wilder.vim_search_pipeline({ + fuzzy = 1, + }) + ), + }) + + wilder.set_option( + "renderer", + wilder.popupmenu_renderer(wilder.popupmenu_border_theme({ + highlighter = wilder.basic_highlighter(), + highlights = { + default = text_highlight, + border = mauve_highlight, + accent = mauve_highlight, + }, + pumblend = 5, + min_width = "100%", + min_height = "25%", + max_height = "25%", + border = "rounded", + left = { " ", wilder.popupmenu_devicons() }, + right = { " ", wilder.popupmenu_scrollbar() }, + })) + ) + end, + }, +}