From 8d09f4a4d64855ac50176acaf3f49be2f9dee0a5 Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 9 Sep 2024 21:56:18 +0800 Subject: [PATCH] add plugins --- .editorconfig | 3 +- init.lua | 1 + lua/rua/core/init.lua | 1 + lua/rua/core/keymaps.lua | 14 ++++ lua/rua/core/options.lua | 4 +- lua/rua/plugins/alpha.lua | 35 ++++++++ lua/rua/plugins/bufferline.lua | 10 +++ lua/rua/plugins/colorscheme.lua | 57 +++++++++++++ lua/rua/plugins/formatting.lua | 134 ++++++++++++++++++++++++++++++ lua/rua/plugins/lsp/lspconfig.lua | 107 ++++++++++++++++++++++++ lua/rua/plugins/lsp/mason.lua | 68 +++++++++++++++ lua/rua/plugins/lualine.lua | 27 ++++++ lua/rua/plugins/nvim-cmp.lua | 63 ++++++++++++++ lua/rua/plugins/nvim-tree.lua | 57 +++++++++++++ lua/rua/plugins/telescope.lua | 50 +++++++++++ lua/rua/plugins/trouble.lua | 40 +++++++++ lua/rua/plugins/which-key.lua | 13 +++ 17 files changed, 681 insertions(+), 3 deletions(-) create mode 100644 lua/rua/core/keymaps.lua create mode 100644 lua/rua/plugins/alpha.lua create mode 100644 lua/rua/plugins/bufferline.lua create mode 100644 lua/rua/plugins/colorscheme.lua create mode 100644 lua/rua/plugins/formatting.lua create mode 100644 lua/rua/plugins/lsp/lspconfig.lua create mode 100644 lua/rua/plugins/lsp/mason.lua create mode 100644 lua/rua/plugins/lualine.lua create mode 100644 lua/rua/plugins/nvim-cmp.lua create mode 100644 lua/rua/plugins/nvim-tree.lua create mode 100644 lua/rua/plugins/telescope.lua create mode 100644 lua/rua/plugins/trouble.lua create mode 100644 lua/rua/plugins/which-key.lua diff --git a/.editorconfig b/.editorconfig index 453d361..26f9ebc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,4 +6,5 @@ charset = utf-8 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true -indent_style = tab +indent_style = space +indent_size = 2 diff --git a/init.lua b/init.lua index ff46eb4..d64399d 100644 --- a/init.lua +++ b/init.lua @@ -1 +1,2 @@ require("rua.core") +require("rua.lazy") diff --git a/lua/rua/core/init.lua b/lua/rua/core/init.lua index 7b5d4b1..757707e 100644 --- a/lua/rua/core/init.lua +++ b/lua/rua/core/init.lua @@ -1 +1,2 @@ require("rua.core.options") +require("rua.core.keymaps") diff --git a/lua/rua/core/keymaps.lua b/lua/rua/core/keymaps.lua new file mode 100644 index 0000000..d0c2481 --- /dev/null +++ b/lua/rua/core/keymaps.lua @@ -0,0 +1,14 @@ +vim.g.mapleader = " " + +local keymap = vim.keymap -- for conciseness + +keymap.set("n", "", ":nohl", { desc = "Clear search highlights" }) + +-- increment/decrement numbers +keymap.set("n", "+", "", { desc = "Increment number" }) -- increment +keymap.set("n", "-", "", { desc = "Decrement number" }) -- decrement + +-- window management +keymap.set("n", "|", "v", { desc = "Split window vertically" }) -- split window vertically +keymap.set("n", "_", "s", { desc = "Split window horizontally" }) -- split window horizontally +keymap.set("n", "se", "=", { desc = "Make splits equal size" }) -- make split windows equal width & height diff --git a/lua/rua/core/options.lua b/lua/rua/core/options.lua index c504bb8..f946fd8 100644 --- a/lua/rua/core/options.lua +++ b/lua/rua/core/options.lua @@ -13,8 +13,8 @@ opt.clipboard:append({ "unnamedplus" }) opt.termguicolors = true -- True color support opt.autoindent = true --- Good auto indent opt.scrolloff = 3 -opt.encoding = utf8 -opt.fileencoding = utf8 +opt.encoding = "utf8" +opt.fileencoding = "utf8" opt.cursorline = true opt.relativenumber = true opt.number = true diff --git a/lua/rua/plugins/alpha.lua b/lua/rua/plugins/alpha.lua new file mode 100644 index 0000000..bfff216 --- /dev/null +++ b/lua/rua/plugins/alpha.lua @@ -0,0 +1,35 @@ +return { + "goolord/alpha-nvim", + event = "VimEnter", + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.dashboard") + + -- Set header + dashboard.section.header.val = { + " ", + " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ", + " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ", + " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ", + " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ", + " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ", + " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ", + " ", + } + + -- Set menu + dashboard.section.buttons.val = { + dashboard.button("SPC e", " > Toggle file explorer", "NvimTreeToggle"), + dashboard.button("SPC ff", "󰱼 > Find File", "Telescope find_files"), + dashboard.button("SPC fw", " > Find Word", "Telescope live_grep"), + dashboard.button("SPC wr", "󰁯 > Restore Session For Current Directory", "SessionRestore"), + dashboard.button("q", " > Quit NVIM", "qa"), + } + + -- Send config to alpha + alpha.setup(dashboard.opts) + + -- Disable folding on alpha buffer + vim.cmd([[autocmd FileType alpha setlocal nofoldenable]]) + end, +} diff --git a/lua/rua/plugins/bufferline.lua b/lua/rua/plugins/bufferline.lua new file mode 100644 index 0000000..7e1a826 --- /dev/null +++ b/lua/rua/plugins/bufferline.lua @@ -0,0 +1,10 @@ +return { + "akinsho/bufferline.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + version = "*", + opts = { + options = { + mode = "tabs", + }, + }, +} diff --git a/lua/rua/plugins/colorscheme.lua b/lua/rua/plugins/colorscheme.lua new file mode 100644 index 0000000..d53a28a --- /dev/null +++ b/lua/rua/plugins/colorscheme.lua @@ -0,0 +1,57 @@ +return { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + config = function() + require("catppuccin").setup({ + flavour = "auto", -- latte, frappe, macchiato, mocha + background = { -- :h background + light = "latte", + dark = "mocha", + }, + transparent_background = true, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = false, -- dims the background color of inactive window + shade = "dark", + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { "italic" }, -- Change the style of comments + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + -- miscs = {}, -- Uncomment to turn off hard-coded styles + }, + color_overrides = {}, + custom_highlights = {}, + default_integrations = true, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = false, + mini = { + enabled = true, + indentscope_color = "", + }, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, + }) + + vim.cmd("colorscheme catppuccin") + end, +} diff --git a/lua/rua/plugins/formatting.lua b/lua/rua/plugins/formatting.lua new file mode 100644 index 0000000..7798c2b --- /dev/null +++ b/lua/rua/plugins/formatting.lua @@ -0,0 +1,134 @@ +return { + "stevearc/conform.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local conform = require("conform") + + conform.setup({ + formatters_by_ft = { + sql = { "sqlfluff" }, + lua = { "stylua" }, + go = { + "goimports", + "goimports-reviser", + "golines", + "gopls", + }, + sh = { "shfmt" }, + javascript = { "prettier" }, + typescript = { "prettier" }, + javascriptreact = { "prettier" }, + typescriptreact = { "prettier" }, + svelte = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + yaml = { "prettier" }, + markdown = { "prettier" }, + graphql = { "prettier" }, + python = { "isort", "black" }, + php = { "intelephense" }, + c = { "clang-format" }, + -- Use the "*" filetype to run formatters on all filetypes. + ["*"] = { "codespell" }, + -- Use the "_" filetype to run formatters on filetypes that don't + -- have other formatters configured. + ["_"] = { "trim_whitespace" }, + }, + format_on_save = { + lsp_fallback = true, + -- async = false, + timeout_ms = 1000, + }, + notify_on_error = true, + formatters = { + injected = { + options = { + ignore_errors = true, + lang_to_formatters = { + sql = { "sqlfluff" }, + }, + lang_to_ext = { + sql = "sql", + }, + }, + }, + lang_to_ext = { + bash = "sh", + sql = "sql", + c_sharp = "cs", + elixir = "exs", + latex = "tex", + markdown = "md", + python = "py", + ruby = "rb", + teal = "tl", + }, + sqlfluff = { + command = "sqlfluff", + args = { + "fix", + "--dialect", + "sqlite", + "--disable-progress-bar", + "-f", + "-n", + "-", + }, + stdin = true, + }, + rustfmt = { + options = { + -- The default edition of Rust to use when no Cargo.toml file is found + default_edition = "2021", + }, + }, + options = { + -- Use a specific prettier parser for a filetype + -- Otherwise, prettier will try to infer the parser from the file name + ft_parsers = { + -- javascript = "babel", + -- javascriptreact = "babel", + -- typescript = "typescript", + -- typescriptreact = "typescript", + -- vue = "vue", + -- css = "css", + -- scss = "scss", + -- less = "less", + -- html = "html", + -- json = "json", + -- jsonc = "json", + -- yaml = "yaml", + -- markdown = "markdown", + -- ["markdown.mdx"] = "mdx", + -- graphql = "graphql", + -- handlebars = "glimmer", + }, + -- Use a specific prettier parser for a file extension + ext_parsers = { + -- qmd = "markdown", + }, + }, + -- # Example of using dprint only when a dprint.json file is present + -- dprint = { + -- condition = function(ctx) + -- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1] + -- end, + -- }, + -- + -- # Example of using shfmt with extra args + -- shfmt = { + -- prepend_args = { "-i", "2", "-ci" }, + -- }, + }, + }) + + vim.keymap.set({ "n", "v" }, "fm", function() + conform.format({ + lsp_fallback = true, + async = false, + timeout_ms = 1000, + }) + end, { desc = "Format file or range (in visual mode)" }) + end, +} diff --git a/lua/rua/plugins/lsp/lspconfig.lua b/lua/rua/plugins/lsp/lspconfig.lua new file mode 100644 index 0000000..cab9b89 --- /dev/null +++ b/lua/rua/plugins/lsp/lspconfig.lua @@ -0,0 +1,107 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + { "antosha417/nvim-lsp-file-operations", config = true }, + { "folke/neodev.nvim", opts = {} }, + }, + config = function() + -- import lspconfig plugin + local lspconfig = require("lspconfig") + + -- import mason_lspconfig plugin + local mason_lspconfig = require("mason-lspconfig") + + -- import cmp-nvim-lsp plugin + local cmp_nvim_lsp = require("cmp_nvim_lsp") + + local keymap = vim.keymap -- for conciseness + + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf, silent = true } + + -- set keybinds + opts.desc = "Show LSP references" + keymap.set("n", "gR", "Telescope lsp_references", opts) -- show definition, references + + opts.desc = "Go to declaration" + keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration + + opts.desc = "Show LSP definitions" + keymap.set("n", "gd", "Telescope lsp_definitions", opts) -- show lsp definitions + + opts.desc = "Show LSP implementations" + keymap.set("n", "gi", "Telescope lsp_implementations", opts) -- show lsp implementations + + opts.desc = "Show LSP type definitions" + keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) -- show lsp type definitions + + opts.desc = "See available code actions" + keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection + + opts.desc = "Smart rename" + keymap.set("n", "rn", vim.lsp.buf.rename, opts) -- smart rename + + opts.desc = "Show buffer diagnostics" + keymap.set("n", "D", "Telescope diagnostics bufnr=0", opts) -- show diagnostics for file + + opts.desc = "Show line diagnostics" + keymap.set("n", "d", vim.diagnostic.open_float, opts) -- show diagnostics for line + + opts.desc = "Go to previous diagnostic" + keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer + + opts.desc = "Go to next diagnostic" + keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer + + opts.desc = "Show documentation for what is under cursor" + keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor + + opts.desc = "Restart LSP" + keymap.set("n", "rs", ":LspRestart", opts) -- mapping to restart lsp if necessary + end, + }) + + -- used to enable autocompletion (assign to every lsp server config) + local capabilities = cmp_nvim_lsp.default_capabilities() + + -- Change the Diagnostic symbols in the sign column (gutter) + -- (not in youtube nvim video) + local signs = { Error = " ", Warn = " ", Hint = "󰠠 ", Info = " " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + + mason_lspconfig.setup_handlers({ + -- default handler for installed servers + function(server_name) + lspconfig[server_name].setup({ + capabilities = capabilities, + }) + end, + ["lua_ls"] = function() + -- configure lua server (with special settings) + lspconfig["lua_ls"].setup({ + capabilities = capabilities, + settings = { + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { "vim" }, + }, + completion = { + callSnippet = "Replace", + }, + }, + }, + }) + end, + }) + end, +} diff --git a/lua/rua/plugins/lsp/mason.lua b/lua/rua/plugins/lsp/mason.lua new file mode 100644 index 0000000..d114431 --- /dev/null +++ b/lua/rua/plugins/lsp/mason.lua @@ -0,0 +1,68 @@ +return { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + }, + config = function() + -- import mason + local mason = require("mason") + + -- import mason-lspconfig + local mason_lspconfig = require("mason-lspconfig") + + local mason_tool_installer = require("mason-tool-installer") + + -- enable mason and configure icons + mason.setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }) + + mason_lspconfig.setup({ + -- list of servers for mason to install + ensure_installed = { + "gopls", + "lua_ls", + "rust_analyzer", + "html", + "volar", + "vtsls", + "tailwindcss", + "eslint", + "cssls", + "cssmodules_ls", + "jsonls", + "yamlls", + "docker_compose_language_service", + "dockerls", + "bashls", + "clangd", + "lemminx", + }, + }) + + mason_tool_installer.setup({ + ensure_installed = { + "prettier", -- prettier formatter + "stylua", -- lua formatter + "isort", -- python formatter + "black", -- python formatter + "pylint", + "eslint_d", + "stylua", + "shellharden", + "shfmt", + "goimports", + "goimports-reviser", + "golines", + "taplo", + }, + }) + end, +} diff --git a/lua/rua/plugins/lualine.lua b/lua/rua/plugins/lualine.lua new file mode 100644 index 0000000..0b13cb6 --- /dev/null +++ b/lua/rua/plugins/lualine.lua @@ -0,0 +1,27 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local lualine = require("lualine") + local lazy_status = require("lazy.status") -- to configure lazy pending updates count + + -- configure lualine with modified theme + lualine.setup({ + options = { + theme = "catppuccin", + }, + sections = { + lualine_x = { + { + lazy_status.updates, + cond = lazy_status.has_updates, + color = { fg = "#ff9e64" }, + }, + { "encoding" }, + { "fileformat" }, + { "filetype" }, + }, + }, + }) + end, +} diff --git a/lua/rua/plugins/nvim-cmp.lua b/lua/rua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..e4da97c --- /dev/null +++ b/lua/rua/plugins/nvim-cmp.lua @@ -0,0 +1,63 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", -- source for text in buffer + "hrsh7th/cmp-path", -- source for file system paths + { + "L3MON4D3/LuaSnip", + -- follow latest release. + version = "v2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp", + }, + "saadparwaiz1/cmp_luasnip", -- for autocompletion + "rafamadriz/friendly-snippets", -- useful snippets + "onsails/lspkind.nvim", -- vs-code like pictograms + }, + config = function() + local cmp = require("cmp") + + local luasnip = require("luasnip") + + local lspkind = require("lspkind") + + -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + completion = { + completeopt = "menu,menuone,preview,noselect", + }, + snippet = { -- configure how nvim-cmp interacts with snippet engine + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), -- previous suggestion + [""] = cmp.mapping.select_next_item(), -- next suggestion + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), -- show completion suggestions + [""] = cmp.mapping.abort(), -- close completion window + [""] = cmp.mapping.confirm({ select = false }), + }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- snippets + { name = "buffer" }, -- text within current buffer + { name = "path" }, -- file system paths + }), + + -- configure lspkind for vs-code like pictograms in completion menu + formatting = { + format = lspkind.cmp_format({ + maxwidth = 50, + ellipsis_char = "...", + }), + }, + }) + end, +} diff --git a/lua/rua/plugins/nvim-tree.lua b/lua/rua/plugins/nvim-tree.lua new file mode 100644 index 0000000..93f8224 --- /dev/null +++ b/lua/rua/plugins/nvim-tree.lua @@ -0,0 +1,57 @@ +return { + "nvim-tree/nvim-tree.lua", + dependencies = "nvim-tree/nvim-web-devicons", + config = function() + local nvimtree = require("nvim-tree") + + -- recommended settings from nvim-tree documentation + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + nvimtree.setup({ + view = { + width = 35, + relativenumber = false, + number = false, + }, + -- change folder arrow icons + renderer = { + indent_markers = { + enable = true, + }, + icons = { + glyphs = { + folder = { + -- arrow_closed = "", -- arrow when folder is closed + -- arrow_open = "", -- arrow when folder is open + }, + }, + }, + }, + -- disable window_picker for + -- explorer to work well with + -- window splits + actions = { + open_file = { + window_picker = { + enable = false, + }, + }, + }, + -- filters = { + -- custom = { ".DS_Store" }, + -- }, + git = { + ignore = false, + }, + }) + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + -- keymap.set("n", "e", "NvimTreeToggle", { desc = "Toggle file explorer" }) -- toggle file explorer + keymap.set("n", "e", "NvimTreeFindFileToggle", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file + -- keymap.set("n", "ec", "NvimTreeCollapse", { desc = "Collapse file explorer" }) -- collapse file explorer + -- keymap.set("n", "er", "NvimTreeRefresh", { desc = "Refresh file explorer" }) -- refresh file explorer + end, +} diff --git a/lua/rua/plugins/telescope.lua b/lua/rua/plugins/telescope.lua new file mode 100644 index 0000000..b7f229e --- /dev/null +++ b/lua/rua/plugins/telescope.lua @@ -0,0 +1,50 @@ +return { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + dependencies = { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + "nvim-tree/nvim-web-devicons", + "folke/todo-comments.nvim", + }, + config = function() + local telescope = require("telescope") + local actions = require("telescope.actions") + local transform_mod = require("telescope.actions.mt").transform_mod + + local trouble = require("trouble") + local trouble_telescope = require("trouble.sources.telescope") + + -- or create your custom action + local custom_actions = transform_mod({ + open_trouble_qflist = function(prompt_bufnr) + trouble.toggle("quickfix") + end, + }) + + telescope.setup({ + defaults = { + path_display = { "smart" }, + mappings = { + i = { + [""] = actions.move_selection_previous, -- move to prev result + [""] = actions.move_selection_next, -- move to next result + [""] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist, + [""] = trouble_telescope.open, + }, + }, + }, + }) + + telescope.load_extension("fzf") + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "ff", "Telescope find_files", { desc = "Fuzzy find files in cwd" }) + keymap.set("n", "fo", "Telescope oldfiles", { desc = "Fuzzy find recent files" }) + keymap.set("n", "fw", "Telescope live_grep", { desc = "Find string in cwd" }) + keymap.set("n", "fc", "Telescope grep_string", { desc = "Find string under cursor in cwd" }) + keymap.set("n", "ft", "TodoTelescope", { desc = "Find todos" }) + end, +} diff --git a/lua/rua/plugins/trouble.lua b/lua/rua/plugins/trouble.lua new file mode 100644 index 0000000..03c006e --- /dev/null +++ b/lua/rua/plugins/trouble.lua @@ -0,0 +1,40 @@ +return { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim" }, + opts = { + focus = true, + }, + cmd = "Trouble", + keys = { + { + "tX", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "tx", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "ts", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "tl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "tL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "tQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, +} diff --git a/lua/rua/plugins/which-key.lua b/lua/rua/plugins/which-key.lua new file mode 100644 index 0000000..d004051 --- /dev/null +++ b/lua/rua/plugins/which-key.lua @@ -0,0 +1,13 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 500 + end, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, +}