From af15773179d029f09e948249a5a0fe394116d098 Mon Sep 17 00:00:00 2001 From: Kerem Bozdas Date: Tue, 17 Sep 2024 16:35:17 +0300 Subject: [PATCH] Fix deprecated options --- lua/config/plugins/gitsigns.lua | 6 - lua/config/plugins/lsp-zero.lua | 2 +- lua/config/plugins/which-key.lua | 371 ++++++++++++------------------- 3 files changed, 141 insertions(+), 238 deletions(-) diff --git a/lua/config/plugins/gitsigns.lua b/lua/config/plugins/gitsigns.lua index 0f8c307..749844e 100644 --- a/lua/config/plugins/gitsigns.lua +++ b/lua/config/plugins/gitsigns.lua @@ -33,9 +33,6 @@ function M.config() delay = 1000, ignore_whitespace = false, }, - current_line_blame_formatter_opts = { - relative_time = false, - }, sign_priority = 6, update_debounce = 100, status_formatter = nil, -- Use default @@ -48,9 +45,6 @@ function M.config() row = 0, col = 1, }, - yadm = { - enable = false, - }, }) end diff --git a/lua/config/plugins/lsp-zero.lua b/lua/config/plugins/lsp-zero.lua index a44b330..bb5d71d 100644 --- a/lua/config/plugins/lsp-zero.lua +++ b/lua/config/plugins/lsp-zero.lua @@ -69,7 +69,7 @@ function M.config() mason.setup({}) mason_settings.set({ ui = { border = "rounded" } }) mason_lspconfig.setup({ - ensure_installed = { "solargraph", "lua_ls", "tsserver" }, + ensure_installed = { "solargraph", "lua_ls", "ts_ls" }, handlers = { lsp_zero.default_setup, }, diff --git a/lua/config/plugins/which-key.lua b/lua/config/plugins/which-key.lua index ae9fec6..a446753 100644 --- a/lua/config/plugins/which-key.lua +++ b/lua/config/plugins/which-key.lua @@ -9,240 +9,149 @@ function M.config() return end - local setup = { - plugins = { - marks = false, -- shows a list of your marks on ' and ` - registers = false, -- shows your registers on " in NORMAL or in INSERT mode - spelling = { - enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions - suggestions = 20, -- how many suggestions should be shown in the list? - }, - -- the presets plugin, adds help for a bunch of default keybindings in Neovim - -- No actual key bindings are created - presets = { - operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion - motions = true, -- adds help for motions - text_objects = true, -- help for text objects triggered after entering an operator - windows = true, -- default bindings on - nav = false, -- misc bindings to work with windows - z = true, -- bindings for folds, spelling and others prefixed with z - g = true, -- bindings for prefixed with g - }, - }, - -- add operators that will trigger motion and text object completion - -- to enable all native operators, set the preset / operators plugin above - -- operators = { gc = "Comments" }, - key_labels = { - -- override the label used to display some keys. It doesn't effect WK in any other way. - -- For example: - -- [""] = "SPC", - -- [""] = "RET", - -- [""] = "TAB", - }, + which_key.setup({ + preset = "modern", + filter = function(mapping) + return mapping.desc and mapping.desc ~= "" + end, icons = { - breadcrumb = "»", -- symbol used in the command line area that shows your active key combo - separator = "➜", -- symbol used between a key and it's label - group = "+", -- symbol prepended to a group - }, - popup_mappings = { - scroll_down = "", -- binding to scroll down inside the popup - scroll_up = "", -- binding to scroll up inside the popup - }, - window = { - border = "rounded", -- none, single, double, shadow - position = "bottom", -- bottom, top - margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] - padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] - winblend = 0, - }, - layout = { - height = { min = 4, max = 25 }, -- min and max height of the columns - width = { min = 20, max = 50 }, -- min and max width of the columns - spacing = 3, -- spacing between columns - align = "left", -- align columns left, center or right - }, - ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label - hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate - show_help = true, -- show help message on the command line when the popup is visible - triggers = "auto", -- automatically setup triggers - -- triggers = {""}, -- or specify a list manually - triggers_blacklist = { - -- list of mode / prefixes that should never be hooked by WhichKey - -- this is mostly relevant for key maps that start with a native binding - -- most people should not need to change this - i = { "j", "k" }, - v = { "j", "k" }, - }, - } - - local opts = { - mode = "n", -- NORMAL mode - prefix = "", - buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings - silent = true, -- use `silent` when creating keymaps - noremap = true, -- use `noremap` when creating keymaps - nowait = true, -- use `nowait` when creating keymaps - } - - -- stylua: ignore - local mappings = { - ["a"] = { "lua require('neogen').generate({})", "Annotate" }, - ["w"] = { "w!", "Save" }, - ["q"] = { "q!", "Quit" }, - ["c"] = { "lua require('bufdelete').bufdelete(0, false)", "Close Buffer" }, - ["C"] = { "lua require('bufdelete').bufdelete(0, true)", "Close Unsaved Buffer" }, - ["h"] = { "set invhlsearch", "Toggle Highlight" }, - ["f"] = { "lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})", "Find File" }, - ["P"] = { "lua require('telescope').extensions.projects.projects()", "Projects" }, - ["r"] = { "Telescope frecency theme=dropdown previewer=false", "Recent Files" }, - ["u"] = { "lua require('undotree').toggle()", "Undotree" }, - ["z"] = { ":NoNeckPain", "No Neck Pain" }, - ["?"] = { "Cheatsheet", "Cheatsheet" }, - - b = { - name = "Buffers", - j = { "BufferLinePick", "Jump" }, - f = { "Neotree buffers position=float", "Find" }, - b = { "BufferLineCyclePrev", "Previous" }, - e = { "BufferLinePickClose", "Pick which buffer to close" }, - h = { "BufferLineCloseLeft", "Close all to the left" }, - l = { "BufferLineCloseRight", "Close all to the right" }, - D = { "BufferLineSortByDirectory", "Sort by directory" }, - L = { "BufferLineSortByExtension", "Sort by language" }, - }, - - d = { - name = "Debug", - t = { "lua require('dap').toggle_breakpoint()", "Toggle Breakpoint" }, - b = { "lua require('dap').step_back()", "Step Back" }, - c = { "lua require('dap').continue()", "Continue" }, - C = { "lua require('dap').run_to_cursor()", "Run To Cursor" }, - d = { "lua require('dap').disconnect()", "Disconnect" }, - g = { "lua require('dap').session()", "Get Session" }, - i = { "lua require('dap').step_into()", "Step Into" }, - o = { "lua require('dap').step_over()", "Step Over" }, - u = { "lua require('dap').step_out()", "Step Out" }, - p = { "lua require('dap').pause.toggle()", "Pause" }, - r = { "lua require('dap').repl.toggle()", "Toggle Repl" }, - s = { "lua require('dap').continue()", "Start" }, - q = { "lua require('dap').close(); require('dap.repl').close(); require('dapui').close()", "Quit" }, - }, - - p = { - name = "Lazy", - o = { "lua require('lazy').home()", "Home" }, - i = { "lua require('lazy').install()", "Install" }, - u = { "lua require('lazy').update()", "Update" }, - s = { "lua require('lazy').sync()", "Sync" }, - x = { "lua require('lazy').clean()", "Clean" }, - c = { "lua require('lazy').check()", "Check" }, - L = { "lua require('lazy').log()", "Log" }, - R = { "lua require('lazy').restore()", "Restore" }, - p = { "lua require('lazy').profile()", "Profile" }, - D = { "lua require('lazy').debug()", "Debug" }, - H = { "lua require('lazy').help()", "Help" }, - B = { "lua require('lazy').clear()", "Clear" }, - n = { "Telescope notify theme=ivy", "Notifications" }, - m = { "Mason", "Mason" }, - }, - - g = { - name = "Git", - g = { "lua require('neogit').open({ kind = 'split' })", "Neogit" }, - j = { "lua require('gitsigns').next_hunk()", "Next hunk" }, - k = { "lua require('gitsigns').prev_hunk()", "Prev hunk" }, - l = { "lua require('gitsigns').blame_line()", "Blame line" }, - p = { "lua require('gitsigns').preview_hunk()", "Preview hunk" }, - R = { "lua require('gitsigns').reset_buffer()", "Reset buffer" }, - r = { "lua require('gitsigns').reset_hunk()", "Reset hunk" }, - s = { "lua require('gitsigns').stage_hunk()", "Stage hunk" }, - u = { "lua require('gitsigns').undo_stage_hunk()", "Undo stage hunk" }, - o = { "Telescope git_status", "Open changed file" }, - b = { "Telescope git_branches", "Checkout branch" }, - c = { "Telescope git_commits", "Checkout commit" }, - d = { "Gitsigns diffthis HEAD", "Diff" }, - O = { "GitBlameOpenCommitURL", "Open in browser" }, - h = { "GitBlameCopySHA", "Copy hash" }, + mappings = false, }, - - l = { - name = "LSP", - a = { "lua vim.lsp.buf.code_action()", "Code Action" }, - A = { "lua vim.lsp.codelens.run()", "CodeLens Action" }, - d = { "Telescope diagnostics bufnr=0 theme=ivy", "Buffer Diagnostics" }, - D = { "Telescope diagnostics", "Diagnostics" }, - f = { "Format", "Format" }, - q = { "lua vim.diagnostic.setloclist()", "Quickfix" }, - r = { "lua vim.lsp.buf.rename()", "Rename" }, - s = { "Telescope lsp_document_symbols", "Document Symbols" }, - S = { "Telescope lsp_dynamic_workspace_symbols", "Workspace Symbols" }, + win = { + title = false, }, - - s = { - name = "Search", - f = { "Telescope find_files theme=dropdown previewer=false", "Find files" }, - g = { "Telescope live_grep theme=ivy", "Live Grep" }, - b = { "Telescope git_branches", "Checkout branch" }, - c = { "Cheatsheet", "Cheatsheet" }, - h = { "Telescope help_tags", "Help" }, - l = { "Telescope resume", "Last Search" }, - M = { "Telescope man_pages", "Man Pages" }, - R = { "Telescope registers", "Registers" }, - k = { "Telescope keymaps", "Keymaps" }, - C = { "Telescope commands", "Commands" }, - p = { "lua require('telescope').extensions.projects.projects()", "Projects" }, - y = { "Telescope yank_history", "Yank History" }, - G = { "GrepAppInput", "Web Grep" }, - }, - - t = { - name = "Tabs", - c = { "tabclose", "Close tab" }, - h = { "-tabmove", "Move tab left" }, - j = { "tabnext", "Next tab" }, - k = { "tabprevious", "Previous tab" }, - l = { "+tabmove", "Move tab right" }, - t = { "tab sb %", "Move buffer to a new tab" }, - }, - - n = { - name = "Neotest", - o = { "lua require('neotest').summary.toggle()", "Toggle summary" }, - n = { "lua require('neotest').run.run()", "Test nearest" }, - f = { "lua require('neotest').run.run(vim.fn.expand('%'))", "Test file" }, - l = { "lua require('neotest').run.run_last()", "Run last test" }, - s = { function() - local neotest = require("neotest") - for _, adapter_id in ipairs(neotest.state.adapter_ids()) do - neotest.run.run({ suite = true, adapter = adapter_id }) - end - end, "Test suite" }, - } - } - - local vopts = { - mode = "v", -- VISUAL mode - prefix = "", - buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings - silent = true, -- use `silent` when creating keymaps - noremap = true, -- use `noremap` when creating keymaps - nowait = true, -- use `nowait` when creating keymaps - } - - -- stylua: ignore - local vmappings = { - ["/"] = { "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", "Comment" }, - g = { - name = "Git", - o = { "lua require('gitlinker').get_buf_range_url('v', { action_callback = require('gitlinker.actions').open_in_browser })", "Open in browser" }, - c = { "lua require('gitlinker').get_buf_range_url('v', { action_callback = require('gitlinker.actions').copy_to_clipboard })", "Copy to clipboard" }, - }, - } - - -- Register which-key bindings - which_key.setup(setup) - which_key.register(mappings, opts) - which_key.register(vmappings, vopts) + }) + + -- stylua: ignore start + which_key.add({ + -- General mappings + { "a", "lua require('neogen').generate({})", desc = "Annotate" }, + { "w", "w!", desc = "Save" }, + { "q", "q!", desc = "Quit" }, + { "c", "lua require('bufdelete').bufdelete(0, false)", desc = "Close Buffer" }, + { "C", "lua require('bufdelete').bufdelete(0, true)", desc = "Close Unsaved Buffer" }, + { "h", "set invhlsearch", desc = "Toggle Highlight" }, + { "f", "lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})", desc = "Find File", }, + { "P", "lua require('telescope').extensions.projects.projects()", desc = "Projects" }, + { "r", "Telescope frecency theme=dropdown previewer=false", desc = "Recent Files" }, + { "u", "lua require('undotree').toggle()", desc = "Undotree" }, + { "z", ":NoNeckPain", desc = "No Neck Pain" }, + { "?", "Cheatsheet", desc = "Cheatsheet" }, + + -- Buffers + { "b", group = "Buffers" }, + { "bj", "BufferLinePick", desc = "Jump" }, + { "bf", "Neotree buffers position=float", desc = "Find" }, + { "bb", "BufferLineCyclePrev", desc = "Previous" }, + { "be", "BufferLinePickClose", desc = "Pick which buffer to close" }, + { "bh", "BufferLineCloseLeft", desc = "Close all to the left" }, + { "bl", "BufferLineCloseRight", desc = "Close all to the right" }, + { "bD", "BufferLineSortByDirectory", desc = "Sort by directory" }, + { "bL", "BufferLineSortByExtension", desc = "Sort by language" }, + + -- Debug + { "d", group = "Debug" }, + { "dt", "lua require('dap').toggle_breakpoint()", desc = "Toggle Breakpoint" }, + { "db", "lua require('dap').step_back()", desc = "Step Back" }, + { "dc", "lua require('dap').continue()", desc = "Continue" }, + { "dC", "lua require('dap').run_to_cursor()", desc = "Run To Cursor" }, + { "dd", "lua require('dap').disconnect()", desc = "Disconnect" }, + { "dg", "lua require('dap').session()", desc = "Get Session" }, + { "di", "lua require('dap').step_into()", desc = "Step Into" }, + { "do", "lua require('dap').step_over()", desc = "Step Over" }, + { "du", "lua require('dap').step_out()", desc = "Step Out" }, + { "dp", "lua require('dap').pause.toggle()", desc = "Pause" }, + { "dr", "lua require('dap').repl.toggle()", desc = "Toggle Repl" }, + { "ds", "lua require('dap').continue()", desc = "Start" }, + { "dq", "lua require('dap').close(); require('dap.repl').close(); require('dapui').close()", desc = "Quit", }, + + -- Lazy + { "p", group = "Lazy" }, + { "po", "lua require('lazy').home()", desc = "Home" }, + { "pi", "lua require('lazy').install()", desc = "Install" }, + { "pu", "lua require('lazy').update()", desc = "Update" }, + { "ps", "lua require('lazy').sync()", desc = "Sync" }, + { "px", "lua require('lazy').clean()", desc = "Clean" }, + { "pc", "lua require('lazy').check()", desc = "Check" }, + { "pL", "lua require('lazy').log()", desc = "Log" }, + { "pR", "lua require('lazy').restore()", desc = "Restore" }, + { "pp", "lua require('lazy').profile()", desc = "Profile" }, + { "pD", "lua require('lazy').debug()", desc = "Debug" }, + { "pH", "lua require('lazy').help()", desc = "Help" }, + { "pB", "lua require('lazy').clear()", desc = "Clear" }, + { "pn", "Telescope notify theme=ivy", desc = "Notifications" }, + { "pm", "Mason", desc = "Mason" }, + + -- Git + { "g", group = "Git" }, + { "gg", "lua require('neogit').open({ kind = 'split' })", desc = "Neogit" }, + { "gj", "lua require('gitsigns').next_hunk()", desc = "Next hunk" }, + { "gk", "lua require('gitsigns').prev_hunk()", desc = "Prev hunk" }, + { "gl", "lua require('gitsigns').blame_line()", desc = "Blame line" }, + { "gp", "lua require('gitsigns').preview_hunk()", desc = "Preview hunk" }, + { "gR", "lua require('gitsigns').reset_buffer()", desc = "Reset buffer" }, + { "gr", "lua require('gitsigns').reset_hunk()", desc = "Reset hunk" }, + { "gs", "lua require('gitsigns').stage_hunk()", desc = "Stage hunk" }, + { "gu", "lua require('gitsigns').undo_stage_hunk()", desc = "Undo stage hunk" }, + { "go", "Telescope git_status", desc = "Open changed file" }, + { "gb", "Telescope git_branches", desc = "Checkout branch" }, + { "gc", "Telescope git_commits", desc = "Checkout commit" }, + { "gd", "Gitsigns diffthis HEAD", desc = "Diff" }, + { "gO", "GitBlameOpenCommitURL", desc = "Open in browser" }, + { "gh", "GitBlameCopySHA", desc = "Copy hash" }, + + -- LSP + { "l", group = "LSP" }, + { "la", "lua vim.lsp.buf.code_action()", desc = "Code Action" }, + { "lA", "lua vim.lsp.codelens.run()", desc = "CodeLens Action" }, + { "ld", "Telescope diagnostics bufnr=0 theme=ivy", desc = "Buffer Diagnostics" }, + { "lD", "Telescope diagnostics", desc = "Diagnostics" }, + { "lf", "Format", desc = "Format" }, + { "lq", "lua vim.diagnostic.setloclist()", desc = "Quickfix" }, + { "lr", "lua vim.lsp.buf.rename()", desc = "Rename" }, + { "ls", "Telescope lsp_document_symbols", desc = "Document Symbols" }, + { "lS", "Telescope lsp_dynamic_workspace_symbols", desc = "Workspace Symbols" }, + + -- Search + { "s", group = "Search" }, + { "sf", "Telescope find_files theme=dropdown previewer=false", desc = "Find files" }, + { "sg", "Telescope live_grep theme=ivy", desc = "Live Grep" }, + { "sb", "Telescope git_branches", desc = "Checkout branch" }, + { "sc", "Cheatsheet", desc = "Cheatsheet" }, + { "sh", "Telescope help_tags", desc = "Help" }, + { "sl", "Telescope resume", desc = "Last Search" }, + { "sM", "Telescope man_pages", desc = "Man Pages" }, + { "sR", "Telescope registers", desc = "Registers" }, + { "sk", "Telescope keymaps", desc = "Keymaps" }, + { "sC", "Telescope commands", desc = "Commands" }, + { "sp", "lua require('telescope').extensions.projects.projects()", desc = "Projects" }, + { "sy", "Telescope yank_history", desc = "Yank History" }, + { "sG", "GrepAppInput", desc = "Web Grep" }, + + -- Tabs + { "t", group = "Tabs" }, + { "tc", "tabclose", desc = "Close tab" }, + { "th", "-tabmove", desc = "Move tab left" }, + { "tj", "tabnext", desc = "Next tab" }, + { "tk", "tabprevious", desc = "Previous tab" }, + { "tl", "+tabmove", desc = "Move tab right" }, + { "tt", "tab sb %", desc = "Move buffer to a new tab" }, + + -- Neotest + { "n", group = "Neotest" }, + { "no", "lua require('neotest').summary.toggle()", desc = "Toggle summary" }, + { "nn", "lua require('neotest').run.run()", desc = "Test nearest" }, + { "nf", "lua require('neotest').run.run(vim.fn.expand('%'))", desc = "Test file" }, + { "nl", "lua require('neotest').run.run_last()", desc = "Run last test" }, + { "ns", "lua require('neotest').run.run({ suite = true })", desc = "Test suite" }, + + -- Visual mode mappings + { "/", "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", desc = "Comment", mode = "v", }, + { "g", group = "Git", mode = "v" }, + { "go", "lua require('gitlinker').get_buf_range_url('v', { action_callback = require('gitlinker.actions').open_in_browser })", desc = "Open in browser", mode = "v", }, + { "gc", "lua require('gitlinker').get_buf_range_url('v', { action_callback = require('gitlinker.actions').copy_to_clipboard })", desc = "Copy to clipboard", mode = "v", }, + }) end +-- stylua: ignore end return M