From 2db2f4c15b79e53fee2d852b83f71c7a8b4f5957 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Thu, 13 Jan 2022 22:52:56 +0100 Subject: Move spectre mapping to whichkey --- lua/config/spectre.lua | 48 ------------------------------------------------ lua/config/whichkey.lua | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 48 deletions(-) diff --git a/lua/config/spectre.lua b/lua/config/spectre.lua index f535210..b9d3e57 100644 --- a/lua/config/spectre.lua +++ b/lua/config/spectre.lua @@ -11,54 +11,6 @@ spectre.setup({ search = "DiffChange", replace = "DiffDelete", }, - mapping = { - ["toggle_line"] = { - map = "t", - cmd = "lua require('spectre').toggle_line()", - desc = "toggle current item", - }, - ["enter_file"] = { - map = "", - cmd = "lua require('spectre.actions').select_entry()", - desc = "goto current file", - }, - ["send_to_qf"] = { - map = "Q", - cmd = "lua require('spectre.actions').send_to_qf()", - desc = "send all item to quickfix", - }, - ["replace_cmd"] = { - map = "c", - cmd = "lua require('spectre.actions').replace_cmd()", - desc = "input replace vim command", - }, - ["show_option_menu"] = { - map = "o", - cmd = "lua require('spectre').show_options()", - desc = "show option", - }, - ["run_replace"] = { - map = "R", - cmd = "lua require('spectre.actions').run_replace()", - desc = "replace all", - }, - ["change_view_mode"] = { - map = "m", - cmd = "lua require('spectre').change_view()", - desc = "change result view mode", - }, - ["toggle_ignore_case"] = { - map = "I", - cmd = "lua require('spectre').change_options('ignore-case')", - desc = "toggle ignore case", - }, - ["toggle_ignore_hidden"] = { - map = "H", - cmd = "lua require('spectre').change_options('hidden')", - desc = "toggle search hidden", - }, - -- you can put your mapping here it only use normal mode - }, find_engine = { -- rg is map with finder_cmd ["rg"] = { diff --git a/lua/config/whichkey.lua b/lua/config/whichkey.lua index 85ef65d..d045f05 100644 --- a/lua/config/whichkey.lua +++ b/lua/config/whichkey.lua @@ -184,6 +184,46 @@ local mappings = { -- h = { "ToggleTerm size=10 direction=horizontal", "Horizontal" }, -- v = { "ToggleTerm size=80 direction=vertical", "Vertical" }, -- }, + r = { + t = { + "lua require('spectre').toggle_line()", + "toggle current item", + }, + -- ["enter_file"] = { + -- map = "", + -- cmd = "lua require('spectre.actions').select_entry()", + -- desc = "goto current file", + -- }, + Q = { + "lua require('spectre.actions').send_to_qf()", + "send all item to quickfix", + }, + c = { + "lua require('spectre.actions').replace_cmd()", + "input replace vim command", + }, + o = { + "lua require('spectre').show_options()", + "show option", + }, + R = { + cmd = "lua require('spectre.actions').run_replace()", + desc = "replace all", + }, + m = { + "lua require('spectre').change_view()", + "change result view mode", + }, + I = { + "lua require('spectre').change_options('ignore-case')", + "toggle ignore case", + }, + H = { + "lua require('spectre').change_options('hidden')", + "toggle search hidden", + }, + -- you can put your mapping here it only use normal mode + }, } local vopts = { -- cgit v1.2.3-70-g09d2