{ config, lib, ... }: { plugins.refactoring = { enable = true; enableTelescope = true; }; keymaps = lib.mkIf config.plugins.refactoring.enable ( [ { key = "ri"; action = "Refactor inline_var"; mode = "n"; } { key = "re"; action = "Refactor extract"; mode = "x"; } { key = "ri"; action = "Refactor inline_var"; mode = "x"; } { key = "rv"; action = "Refactor extract_var"; mode = "x"; } ] ++ lib.optionals (config.plugins.refactoring.enable && config.plugins.refactoring.enableTelescope) [ { mode = "n"; key = "rR"; action.__raw = '' function() require('telescope').extensions.refactoring.refactors() end ''; options.silent = true; } ] ); }