55Setup TextTransform options and merge them with user provided ones.
66
77
8+ ==============================================================================
9+ ------------------------------------------------------------------------------
10+ *TextTransform.init_commands()*
11+ `TextTransform.init_commands` ()
12+ Initializes user commands
13+ @private
14+
15+
816==============================================================================
917------------------------------------------------------------------------------
1018 *TextTransform.options*
@@ -16,21 +24,33 @@ Default values:
1624 TextTransform.options = {
1725 -- Prints useful logs about what event are triggered, and reasons actions are executed.
1826 debug = false,
19- -- Keymap to trigger the transform.
27+ -- Keymap configurations
2028 keymap = {
21- -- Normal mode keymap.
22- ["n"] = "<Leader>~",
23- -- Visual mode keymap.
24- ["v"] = "<Leader>~",
29+ -- Keymap to open the telescope popup. Set to `false` or `nil` to disable keymapping
30+ -- You can always customize your own keymapping manually.
31+ telescope_popup = {
32+ -- Opens the popup in normal mode
33+ ["n"] = "<Leader>~",
34+ -- Opens the popup in visual/visual block modes
35+ ["v"] = "<Leader>~",
36+ },
2537 },
2638 }
2739
2840 local function init()
2941 local o = TextTransform.options
3042 D.log("config", "Initializing TextTransform with %s", utils.dump(o))
31-
32- vim.keymap.set("n", o.keymap.n, telescope_popup, { silent = true })
33- vim.keymap.set("v", o.keymap.v, telescope_popup, { silent = true })
43+ commands.init_commands()
44+
45+ if o.keymap.telescope_popup then
46+ local keys = o.keymap.telescope_popup
47+ if keys.n then
48+ vim.keymap.set("n", keys.n, telescope_popup, { silent = true })
49+ end
50+ if keys.v then
51+ vim.keymap.set("v", keys.v, telescope_popup, { silent = true })
52+ end
53+ end
3454 end
3555
3656<
0 commit comments