From f9c6c8f1bd9f007796a6042d31b48aa237958bfa Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Thu, 13 Jan 2022 22:58:20 +0100 Subject: Update whichkey and spectre --- lua/config/spectre.lua | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- lua/config/whichkey.lua | 40 ---------------------------------------- 2 files changed, 48 insertions(+), 41 deletions(-) diff --git a/lua/config/spectre.lua b/lua/config/spectre.lua index b9d3e57..fe8eb6b 100644 --- a/lua/config/spectre.lua +++ b/lua/config/spectre.lua @@ -2,7 +2,6 @@ local status_ok, spectre = pcall(require, "spectre") if not status_ok then return end - spectre.setup({ color_devicons = true, @@ -11,6 +10,54 @@ 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 d045f05..85ef65d 100644 --- a/lua/config/whichkey.lua +++ b/lua/config/whichkey.lua @@ -184,46 +184,6 @@ 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