diff --git a/lua/lsp/attach.lua b/lua/lsp/attach.lua index 589b638..fa68929 100644 --- a/lua/lsp/attach.lua +++ b/lua/lsp/attach.lua @@ -1,6 +1,6 @@ -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer -local on_attach = function(_, bufnr) +local on_attach = function(client, bufnr) -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions local bufopts = { noremap = true, silent = true, buffer = bufnr } @@ -19,5 +19,9 @@ local on_attach = function(_, bufnr) vim.keymap.set("n", "rn", vim.lsp.buf.rename, bufopts) vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) vim.keymap.set("n", "i", require "lsp.formatting", bufopts) + if client.server_capabilities.documentSymbolProvider then + require("nvim-navic").attach(client, bufnr) + require("nvim-navbuddy").attach(client, bufnr) + end end return on_attach diff --git a/lua/plugins/alpha.lua b/lua/plugins/alpha.lua new file mode 100644 index 0000000..4de8e5b --- /dev/null +++ b/lua/plugins/alpha.lua @@ -0,0 +1,58 @@ +return { + "goolord/alpha-nvim", + event = "VimEnter", + opts = function() + local dashboard = require "alpha.themes.dashboard" + local logo = [[ + ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z + ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z + ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z + ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z + ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + dashboard.section.header.val = vim.split(logo, "\n") + dashboard.section.buttons.val = { + dashboard.button("f", " " .. " Find file", ":Telescope find_files "), + dashboard.button("e", " " .. " Edit new file", ":ene startinsert "), + dashboard.button("r", " " .. " Recent files", ":Telescope oldfiles "), + dashboard.button("n", "󱏒 " .. " Neotree", ":Neotree left "), + dashboard.button("g", "󰊢 " .. " Git status", ":Neogit "), + dashboard.button("c", " " .. " Config", ":e $MYVIMRC "), + dashboard.button("l", "󰒲 " .. " Lazy", ":Lazy"), + dashboard.button("q", " " .. " Quit", ":qa"), + } + for _, button in ipairs(dashboard.section.buttons.val) do + button.opts.hl = "AlphaButtons" + button.opts.hl_shortcut = "AlphaShortcut" + end + dashboard.section.header.opts.hl = "AlphaHeader" + dashboard.section.buttons.opts.hl = "AlphaButtons" + dashboard.section.footer.opts.hl = "AlphaFooter" + dashboard.opts.layout[1].val = 8 + return dashboard + end, + config = function(_, dashboard) + -- close Lazy and re-open when the dashboard is ready + if vim.o.filetype == "lazy" then + vim.cmd.close() + vim.api.nvim_create_autocmd("User", { + pattern = "AlphaReady", + callback = function() require("lazy").show() end, + }) + end + + require("alpha").setup(dashboard.opts) + + vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimStarted", + callback = function() + local stats = require("lazy").stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + dashboard.section.footer.val = "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" + pcall(vim.cmd.AlphaRedraw) + end, + }) + end, +} diff --git a/lua/plugins/catppuccin.lua b/lua/plugins/catppuccin.lua index 03e74a4..e6c1ab8 100644 --- a/lua/plugins/catppuccin.lua +++ b/lua/plugins/catppuccin.lua @@ -1,3 +1,37 @@ +local config = { + flavour = "macchiato", + term_colors = true, + transparent_background = true, + integrations = { + alpha = true, + gitsigns = true, + hop = true, + indent_blankline = { + enabled = true, + colored_indent_levels = true, + }, + cmp = true, + markdown = true, + mini = true, + native_lsp = { + enabled = true, + }, + neogit = true, + neotree = true, + noice = true, + notify = true, + navic = { + enabled = true, + custom_bg = "NONE", + }, + treesitter = true, + treesitter_context = true, + telescope = true, + lsp_trouble = true, + which_key = true, + }, +} + return { "catppuccin/nvim", name = "catppuccin", @@ -8,7 +42,7 @@ return { require "ui.fillchars" end, config = function() - require("catppuccin").setup(require "config.catppuccin") + require("catppuccin").setup(config) vim.cmd.colorscheme "catppuccin" end, } diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua new file mode 100644 index 0000000..babc58b --- /dev/null +++ b/lua/plugins/comment.lua @@ -0,0 +1,7 @@ +return { + "numToStr/Comment.nvim", + keys = { "gcc", "gcb" }, + event = { "BufReadPre" }, + config = true, + opts = { ignore = "^$" }, +} diff --git a/lua/plugins/diffview.lua b/lua/plugins/diffview.lua index 98d7182..7e9ea04 100644 --- a/lua/plugins/diffview.lua +++ b/lua/plugins/diffview.lua @@ -5,5 +5,11 @@ return { "DiffviewFileHistory", "DiffviewOpen", }, - config = function() require("diffview").setup(require "config.diffview") end, + config = true, + opts = { + enhanced_diff_hl = true, + file_panel = { + listing_style = "list", + }, + }, } diff --git a/lua/plugins/dressing.lua b/lua/plugins/dressing.lua index 0bb9abb..d19febd 100644 --- a/lua/plugins/dressing.lua +++ b/lua/plugins/dressing.lua @@ -1 +1 @@ -return { "stevearc/dressing.nvim" } +return { "stevearc/dressing.nvim", event = "VeryLazy" } diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index 9230535..e25d158 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -1,5 +1,50 @@ return { "lewis6991/gitsigns.nvim", event = { "BufReadPre", "BufNewFile" }, - config = function() require("gitsigns").setup(require "config.gitsigns") end, + config = true, + opts = { + signcolumn = true, + numhl = true, + linehl = false, + current_line_blame = true, + word_diff = false, + 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", "]c", function() + if vim.wo.diff then return "]c" end + vim.schedule(function() gs.next_hunk() end) + return "" + end, { expr = true }) + + map("n", "[c", function() + if vim.wo.diff then return "[c" end + vim.schedule(function() gs.prev_hunk() end) + return "" + end, { expr = true }) + + -- Actions + map({ "n", "v" }, "hs", ":Gitsigns stage_hunk") + map({ "n", "v" }, "hr", ":Gitsigns reset_hunk") + map("n", "hS", gs.stage_buffer) + map("n", "hu", gs.undo_stage_hunk) + map("n", "hR", gs.reset_buffer) + map("n", "hp", gs.preview_hunk) + map("n", "hb", function() gs.blame_line { full = true } end) + map("n", "tb", gs.toggle_current_line_blame) + map("n", "hd", gs.diffthis) + map("n", "hD", function() gs.diffthis "~" end) + map("n", "td", gs.toggle_deleted) + + -- Text object + map({ "o", "x" }, "ih", ":Gitsigns select_hunk") + end, + }, } diff --git a/lua/plugins/hop.lua b/lua/plugins/hop.lua index eb6c1b7..daf9491 100644 --- a/lua/plugins/hop.lua +++ b/lua/plugins/hop.lua @@ -1,5 +1,9 @@ return { - 'phaazon/hop.nvim', - cmd = {"HopWord", "HopLine"}, + "phaazon/hop.nvim", + cmd = { "HopWord", "HopLine" }, + init = function() + vim.keymap.set("n", "hw", "HopWord") + vim.keymap.set("n", "hl", "HopLine") + end, config = true, } diff --git a/lua/plugins/indent_blankline.lua b/lua/plugins/indent_blankline.lua index b0ee0a9..943c4ed 100644 --- a/lua/plugins/indent_blankline.lua +++ b/lua/plugins/indent_blankline.lua @@ -1,5 +1,9 @@ return { "lukas-reineke/indent-blankline.nvim", event = { "BufReadPre", "BufNewFile" }, - config = function() require("indent_blankline").setup(require "config.indent_blankline") end, + config = true, + opts = { + show_current_context = true, + show_current_context_start = false, + }, } diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index ce9b98a..656c112 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -1,41 +1,25 @@ return { - { - "neovim/nvim-lspconfig", - event = { "BufReadPre", "BufNewFile" }, - cmd = { - "LspLog", - "LspStop", - "LspStart", - "LspRestart", - "LspInfo", - }, - dependencies = { - { "hrsh7th/nvim-cmp" }, - { "rafamadriz/friendly-snippets" }, - { "windwp/nvim-autopairs" }, - }, - config = function() - require "lsp.config" - require "lsp.cmp" - end, + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile", "BufEnter" }, + cmd = { + "LspLog", + "LspStop", + "LspStart", + "LspRestart", + "LspInfo", }, - { - "hrsh7th/nvim-cmp", - dependencies = { - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/cmp-path" }, - { "hrsh7th/cmp-cmdline" }, - { "f3fora/cmp-spell" }, - { "petertriho/cmp-git" }, - { "Dosx001/cmp-commit" }, - { "kdheepak/cmp-latex-symbols" }, - { "L3MON4D3/LuaSnip" }, - { "saadparwaiz1/cmp_luasnip" }, - }, - cmd = "CmpStatus", + dependencies = { + { "hrsh7th/nvim-cmp" }, + { "rafamadriz/friendly-snippets" }, + { "windwp/nvim-autopairs" }, + { "jose-elias-alvarez/null-ls.nvim", lazy = true }, + { "mfussenegger/nvim-dap", lazy = true }, + { "folke/neodev.nvim", dependencies = { "hrsh7th/nvim-cmp" }, lazy = true }, + { "SmiteshP/nvim-navic" }, + { "SmiteshP/nvim-navbuddy" }, }, - { "jose-elias-alvarez/null-ls.nvim", dependencies = { "neovim/nvim-lspconfig" }, lazy = true }, - { "mfussenegger/nvim-dap", dependencies = { "neovim/nvim-lspconfig" }, lazy = true }, - { "folke/neodev.nvim", dependencies = { "neovim/nvim-lspconfig", "hrsh7th/nvim-cmp" }, lazy = true }, + config = function() + require "lsp.config" + require "lsp.cmp" + end, } diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..4c06b24 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,32 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", "SmiteshP/nvim-navic", "folke/noice.nvim" }, + event = { "BufEnter" }, + config = true, + opts = { + options = { + theme = "catppuccin", + component_separators = "|", + section_separators = { left = "", right = "" }, + globalstatus = true, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "filename", { "branch", icon = "󰊢" }, "diff" }, + lualine_c = { "diagnostics", "require('noice').api.status.lsp.get_hl()" }, + lualine_x = { "filetype", "fileformat", "encoding" }, + lualine_y = { "progress" }, + lualine_z = { "selectioncount", "location" }, + }, + tabline = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "require('nvim-navic').get_location()" }, + lualine_x = { "windows" }, + lualine_y = {}, + lualine_z = {}, + }, + winbar = {}, + extensions = { "aerial", "fzf", "lazy", "neo-tree", "toggleterm", "trouble" }, + }, +} diff --git a/lua/plugins/navigator.lua b/lua/plugins/navigator.lua index 3dc499f..b50ea4f 100644 --- a/lua/plugins/navigator.lua +++ b/lua/plugins/navigator.lua @@ -7,5 +7,12 @@ return { "NavigatorRight", "NavigatorPrevious", }, - config = function() require("Navigator").setup() end, + init = function() + vim.keymap.set({ "n", "t" }, "", "NavigatorLeft") + vim.keymap.set({ "n", "t" }, "", "NavigatorRight") + vim.keymap.set({ "n", "t" }, "", "NavigatorUp") + vim.keymap.set({ "n", "t" }, "", "NavigatorDown") + vim.keymap.set({ "n", "t" }, "", "NavigatorPrevious") + end, + config = true, } diff --git a/lua/plugins/neogit.lua b/lua/plugins/neogit.lua index f3cc6b1..257bbb8 100644 --- a/lua/plugins/neogit.lua +++ b/lua/plugins/neogit.lua @@ -1,9 +1,24 @@ return { "TimUntersberger/neogit", - config = function() require("neogit").setup(require "config.neogit") end, - cmd = "Neogit", dependencies = { "nvim-lua/plenary.nvim", "sindrets/diffview.nvim", }, + cmd = "Neogit", + init = function() + vim.keymap.set("n", "gg", "Neogit") + vim.keymap.set("n", "cc", "Neogit commit") + vim.keymap.set("n", "gp", "Neogit pull") + vim.keymap.set("n", "gP", "Neogit push") + end, + config = true, + opts = { + disable_commit_confirmation = true, + disable_builtin_notifications = true, + -- kind = "floating", + -- commit_popup = { kind = "floating" }, + -- preview_buffer = { kind = "floating" }, + -- popup = { kind = "floating" }, + integrations = { diffview = true }, + }, } diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua index 38e19f4..3ddd8f6 100644 --- a/lua/plugins/neotree.lua +++ b/lua/plugins/neotree.lua @@ -12,6 +12,37 @@ return { vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 vim.g.neo_tree_remove_legacy_commands = 1 + vim.keymap.set("n", "nn", "Neotree left reveal reveal_force_cwd") + vim.keymap.set("n", "nb", "Neotree toggle show buffers right") end, - config = function() require("neo-tree").setup(require "config.neotree") end, + config = true, + opts = { + close_if_last_window = true, + use_popups_for_input = false, + filesystem = { + window = { + mappings = { + ["Z"] = "expand_all_nodes", + [""] = "toggle_node", + }, + }, + filtered_items = { + hide_dotfiles = false, + }, + group_empty_dirs = true, + hijack_netrw_behavior = "open_current", + }, + buffers = { + bind_to_cwd = true, + follow_current_file = true, + group_empty_dirs = true, + }, + git_status = { + group_empty_dirs = true, + }, + source_selector = { + winbar = true, + statusline = false, + }, + }, } diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua new file mode 100644 index 0000000..28dbfc6 --- /dev/null +++ b/lua/plugins/noice.lua @@ -0,0 +1,44 @@ +return { + "folke/noice.nvim", + dependencies = { + "MunifTanjim/nui.nvim", + "rcarriga/nvim-notify", + }, + config = true, + opts = { + lsp = { + progress = { + enabled = true, + format = { + "({data.progress.percentage}%) ", + { "{spinner} ", hl_group = "NoiceLspProgressSpinner" }, + { "{data.progress.title} ", hl_group = "NoiceLspProgressTitle" }, + { "{data.progress.client} ", hl_group = "NoiceLspProgressClient" }, + }, + }, + -- 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, + }, + }, + views = { + mini = { + position = { row = -2 }, + border = { style = "rounded" }, + win_options = { winblend = 0 }, + }, + }, + status = { lsp = { event = "lsp", kind = "progress" } }, + routes = { { view = "mini", filter = { event = "lsp", kind = "progress" }, opts = { skip = true } } }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = false, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = false, -- long messages will be sent to a splitnoice + inc_rename = true, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = true, -- add a border to hover docs and signature help + }, + }, +} diff --git a/lua/plugins/notify.lua b/lua/plugins/notify.lua index 5d63ecd..30d5822 100644 --- a/lua/plugins/notify.lua +++ b/lua/plugins/notify.lua @@ -1,7 +1,9 @@ return { "rcarriga/nvim-notify", - config = function() - require("notify").setup(require "config.notify") - vim.notify = require "notify" - end, + config = true, + opts = { + background_colour = "#000000", + fps = 60, + render = "default", -- "minimal", "simple" + }, } diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..7c7e20e --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,15 @@ +return { + "hrsh7th/nvim-cmp", + dependencies = { + { "hrsh7th/cmp-nvim-lsp" }, + { "hrsh7th/cmp-buffer" }, + { "hrsh7th/cmp-path" }, + { "hrsh7th/cmp-cmdline" }, + { "f3fora/cmp-spell" }, + { "petertriho/cmp-git" }, + { "Dosx001/cmp-commit" }, + { "kdheepak/cmp-latex-symbols" }, + { "L3MON4D3/LuaSnip" }, + { "saadparwaiz1/cmp_luasnip" }, + }, +} diff --git a/lua/plugins/nvim_autopairs.lua b/lua/plugins/nvim_autopairs.lua index b8a1b3c..88626dc 100644 --- a/lua/plugins/nvim_autopairs.lua +++ b/lua/plugins/nvim_autopairs.lua @@ -5,5 +5,10 @@ return { "nvim-treesitter/nvim-treesitter", "hrsh7th/nvim-cmp", }, - config = function() require("nvim-autopairs").setup(require "config.nvim-autopairs") end, + config = true, + opts = { + disable_in_macro = true, + disable_in_visualblock = true, + check_ts = true, + }, } diff --git a/lua/plugins/nvim_navbuddy.lua b/lua/plugins/nvim_navbuddy.lua new file mode 100644 index 0000000..8efa757 --- /dev/null +++ b/lua/plugins/nvim_navbuddy.lua @@ -0,0 +1,27 @@ +return { + "SmiteshP/nvim-navbuddy", + dependencies = { "SmiteshP/nvim-navic", "MunifTanjim/nui.nvim" }, + cmd = { "Navbuddy" }, + init = function() vim.keymap.set("n", "na", "Navbuddy") end, + config = true, + opts = { + icons = require "ui.navic_icons", + window = { + border = "none", + size = "80%", + sections = { + left = { border = "rounded" }, + mid = { border = "rounded" }, + right = { border = "rounded", preview = "leaf" }, + }, + }, + node_markers = { + enabled = true, + icons = { + leaf = " ", + leaf_selected = " → ", + branch = " ", + }, + }, + }, +} diff --git a/lua/plugins/nvim_navic.lua b/lua/plugins/nvim_navic.lua index d53de2f..80e8226 100644 --- a/lua/plugins/nvim_navic.lua +++ b/lua/plugins/nvim_navic.lua @@ -2,5 +2,10 @@ return { "SmiteshP/nvim-navic", dependencies = "neovim/nvim-lspconfig", lazy = true, - opts = require "config.nvim-navic", + config = true, + opts = { + safe_output = true, + click = true, + icons = require "ui.navic_icons", + }, } diff --git a/lua/plugins/nvim_test.lua b/lua/plugins/nvim_test.lua index 539b165..c54b3ea 100644 --- a/lua/plugins/nvim_test.lua +++ b/lua/plugins/nvim_test.lua @@ -9,5 +9,20 @@ return { "TestInfo", "TestSuite", }, - config = function() require("nvim-test").setup(require "config.nvim_test") end, + init = function() + vim.keymap.set("n", "ts", "TestSuite") + vim.keymap.set("n", "tf", "TestFile") + vim.keymap.set("n", "te", "TestEdit") + vim.keymap.set("n", "tn", "TestNearest") + vim.keymap.set("n", "tl", "TestLast") + vim.keymap.set("n", "tv", "TestVisit") + vim.keymap.set("n", "ti", "TestInfo") + end, + config = true, + otps = { + termOpts = { + direction = "horizontal", + keep_one = true, + }, + }, } diff --git a/lua/plugins/project.lua b/lua/plugins/project.lua index e97cf62..6e127ba 100644 --- a/lua/plugins/project.lua +++ b/lua/plugins/project.lua @@ -1,5 +1,11 @@ return { "ahmedkhalf/project.nvim", - event = { "BufReadPre", "BufNewFile" }, - config = function() require("project_nvim").setup(require "config.project") end, + name = "project_nvim", + event = { "BufEnter" }, + config = true, + opts = { + ignore_lsp = { "efm", "null-ls" }, + show_hidden = true, + silent_chdir = true, + }, } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 6fb34c2..f9b78b4 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -1,11 +1,56 @@ return { "nvim-telescope/telescope.nvim", branch = "0.1.x", + dependencies = { + { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + { "tsakirist/telescope-lazy.nvim", dependencies = { "folke/lazy.nvim" } }, + "folke/noice.nvim", + { "benfowler/telescope-luasnip.nvim", dependencies = { "L3MON4D3/LuaSnip" } }, + { + "paopaol/telescope-git-diffs.nvim", + dependencies = { "nvim-lua/plenary.nvim", "sindrets/diffview.nvim" }, + }, + "FeiyouG/command_center.nvim", + { "barrett-ruth/telescope-http.nvim", dependencies = { "savq/paq-nvim" } }, + "aaronhallaert/advanced-git-search.nvim", + }, + }, cmd = "Telescope", + init = function() + vim.keymap.set("n", ";", "Telescope builtin") + vim.keymap.set("n", "ff", "Telescope find_files") + vim.keymap.set("n", "fr", "Telescope oldfiles") + vim.keymap.set("n", "fg", "Telescope live_grep") + vim.keymap.set("n", "fb", "Telescope buffers") + vim.keymap.set("n", "fs", "Telescope lsp_document_symbols") + vim.keymap.set("n", "fe", "Telescope diagnostics") + vim.keymap.set("n", "ft", "Telescope treesitter") + vim.keymap.set("n", "fz", "Telescope current_buffer_fuzzy_find") + end, config = function() - require("telescope").setup(require "config.telescope") + local trouble = require "trouble.providers.telescope" + require("telescope").setup { + defaults = { + layout_strategy = "flex", + mappings = { + i = { [""] = trouble.open_with_trouble }, + n = { [""] = trouble.open_with_trouble }, + }, + winblend = vim.o.winblend, + }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + }, + }, + } require("telescope").load_extension "fzf" require("telescope").load_extension "lazy" + require("telescope").load_extension "noice" require("telescope").load_extension "luasnip" require("telescope").load_extension "git_diffs" require("telescope").load_extension "command_center" @@ -13,34 +58,4 @@ return { require("telescope").load_extension "advanced_git_search" require("telescope").load_extension "projects" end, - dependencies = { - { - "nvim-lua/plenary.nvim", - { - "nvim-telescope/telescope-fzf-native.nvim", - build = "make", - }, - { - "tsakirist/telescope-lazy.nvim", - dependencies = { "folke/lazy.nvim" }, - }, - { - "benfowler/telescope-luasnip.nvim", - dependencies = { "L3MON4D3/LuaSnip" }, - }, - { - "paopaol/telescope-git-diffs.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "sindrets/diffview.nvim", - }, - }, - "FeiyouG/command_center.nvim", - { - "barrett-ruth/telescope-http.nvim", - dependencies = { "savq/paq-nvim" }, - }, - "aaronhallaert/advanced-git-search.nvim", - }, - }, } diff --git a/lua/plugins/toggleterm.lua b/lua/plugins/toggleterm.lua index 51ed98e..c2b8bcc 100644 --- a/lua/plugins/toggleterm.lua +++ b/lua/plugins/toggleterm.lua @@ -1,6 +1,7 @@ return { "akinsho/toggleterm.nvim", version = "*", - config = true, cmd = { "ToggleTerm" }, + init = function() vim.keymap.set("n", "tt", "ToggleTerm direction=horizontal") end, + config = true, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index bdabfdc..e1fa4dc 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,16 +1,51 @@ return { "nvim-treesitter/nvim-treesitter", event = { "BufReadPre", "BufNewFile" }, - cmd = { - "TSToggle", - "TSBufEnable", - "TSBufToggle", - "TSInstall", - "TSUpdate", - "TSEnable", - }, - config = function() require("nvim-treesitter.configs").setup(require "config.treesitter") end, - dependencies = { - "nvim-treesitter/nvim-treesitter-refactor", + dependencies = { "nvim-treesitter/nvim-treesitter-refactor" }, + config = function(_, opts) + if type(opts.ensure_installed) == "table" then + -- @type table + local added = {} + opts.ensure_installed = vim.tbl_filter(function(lang) + if added[lang] then return false end + added[lang] = true + return true + end, opts.ensure_installed) + end + require("nvim-treesitter.configs").setup(opts) + end, + opts = { + ensure_installed = "all", + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "gnr", + scope_incremental = "gnc", + node_decremental = "gnm", + }, + }, + indent = { + enable = true, + }, + refactor = { + smart_rename = { + enable = true, + keymaps = { + smart_rename = "grr", + }, + }, + navigation = { + enable = true, + keymaps = { + goto_definition_lsp_fallback = "gnd", + }, + }, + }, }, } diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua index 1db5241..46cc808 100644 --- a/lua/plugins/trouble.lua +++ b/lua/plugins/trouble.lua @@ -2,5 +2,19 @@ return { "folke/trouble.nvim", dependencies = "nvim-tree/nvim-web-devicons", cmd = "TroubleToggle", - config = function() require("trouble").setup(require "config.trouble") end, + init = function() + vim.keymap.set("n", "xx", "TroubleToggle") + vim.keymap.set("n", "xw", "TroubleToggle workspace_diagnostics") + vim.keymap.set("n", "xd", "TroubleToggle document_diagnostics") + vim.keymap.set("n", "xq", "TroubleToggle quickfix") + vim.keymap.set("n", "xl", "TroubleToggle loclist") + end, + config = true, + opts = { + mode = "workspace_diagnostics", + auto_open = false, + auto_close = false, + auto_preview = true, + auto_jump = { "lsp_definitions", "lsp_references", "lsp_implementations" }, + }, } diff --git a/lua/plugins/twilight.lua b/lua/plugins/twilight.lua new file mode 100644 index 0000000..2b31774 --- /dev/null +++ b/lua/plugins/twilight.lua @@ -0,0 +1,7 @@ +return { + "folke/twilight.nvim", + dependencies = { "nvim-treesitter" }, + cmd = "Twilight", + config = true, + opts = { context = 10, treesitter = true }, +} diff --git a/lua/plugins/zen_mode.lua b/lua/plugins/zen_mode.lua index 4dcabd2..f661d66 100644 --- a/lua/plugins/zen_mode.lua +++ b/lua/plugins/zen_mode.lua @@ -1,13 +1,30 @@ return { "folke/zen-mode.nvim", - cmd = "ZenMode", - config = function() require("zen-mode").setup(require "config.zen_mode") end, - dependencies = { - "folke/twilight.nvim", - cmd = "Twilight", - config = function() require("twilight").setup(require "config.twilight") end, - dependencies = { - "nvim-treesitter", + dependencies = { "folke/twilight.nvim" }, + cmd = { "ZenMode" }, + init = function() vim.keymap.set("n", "z", "ZenMode") end, + config = true, + opts = { + window = { + options = { + signcolumn = "no", -- disable signcolumn + number = false, -- disable number column + relativenumber = false, -- disable relative numbers + cursorline = false, -- disable cursorline + cursorcolumn = false, -- disable cursor column + foldcolumn = "0", -- disable fold column + list = false, -- disable whitespace characters + }, }, + plugins = { + options = { + enabled = true, + }, + twilight = { enabled = true }, + gitsigns = { enabled = true }, + tmux = { enabled = true }, + }, + on_open = function(win) vim.wo.scrolloff = 999 end, + on_close = function(win) vim.wo.scrolloff = 0 end, }, } diff --git a/lua/ui/navic_icons.lua b/lua/ui/navic_icons.lua new file mode 100644 index 0000000..cfb4908 --- /dev/null +++ b/lua/ui/navic_icons.lua @@ -0,0 +1,28 @@ +return { + File = " ", + Module = " ", + Namespace = " ", + Package = " ", + Class = " ", + Method = " ", + Property = " ", + Field = " ", + Constructor = " ", + Enum = " ", + Interface = " ", + Function = " ", + Variable = " ", + Constant = " ", + String = " ", + Number = " ", + Boolean = " ", + Array = " ", + Object = " ", + Key = " ", + Null = " ", + EnumMember = " ", + Struct = " ", + Event = " ", + Operator = " ", + TypeParameter = " ", +}