diff options
-rw-r--r-- | init.lua | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -1,11 +1,11 @@ --- Author: Georgi Kirilov --- --- You can contact me via email to the posteo.net domain. --- The local-part is the Z code for "Place a competent operator on this circuit." +-- SPDX-License-Identifier: GPL-3.0-or-later +-- © 2020 Georgi Kirilov require("vis") -local l = require("lpeg") +require("lpeg") +local l = lpeg + local C, Cc, Ct, Cmt, Cp, Cg, P, R, S, V = l.C, l.Cc, l.Ct, l.Cmt, l.Cp, l.Cg, l.P, l.R, l.S, l.V local progname = ... @@ -106,7 +106,7 @@ local function h(msg) end local function operator_new(key, handler, object, motion, help, novisual) - local id = vis:operator_register(handler) + local id = vis:operator_register(toggle(handler, motion)) if id < 0 then return false end @@ -149,12 +149,12 @@ end vis.events.subscribe(vis.events.INIT, function() local ord_next = vis:textobject_register(ordinal) - operator_new("<C-a>", toggle(increment), ord_next, nil, "Toggle/increment word or number", true) - operator_new("<C-x>", toggle(decrement), ord_next, nil, "Toggle/decrement word or number", true) - operator_new("~", toggle(case, true), nil, VIS_MOVE_CHAR_NEXT, "Toggle case of character or selection") - operator_new("g~", toggle(case), nil, nil, "Toggle-case operator") - operator_new("gu", toggle(string.lower), nil, nil, "Lower-case operator") - operator_new("gU", toggle(string.upper), nil, nil, "Upper-case operator") + operator_new("<C-a>", increment, ord_next, nil, "Toggle/increment word or number", true) + operator_new("<C-x>", decrement, ord_next, nil, "Toggle/decrement word or number", true) + operator_new("~", case, nil, VIS_MOVE_CHAR_NEXT, "Toggle case of character or selection") + operator_new("g~", case, nil, nil, "Toggle-case operator") + operator_new("gu", string.lower, nil, nil, "Lower-case operator") + operator_new("gU", string.upper, nil, nil, "Upper-case operator") lookup, ordinal_words = preprocess(M.config) vis:map(vis.modes.NORMAL, "g~~", "g~il") vis:map(vis.modes.NORMAL, "guu", "guil") |