From 1ecc187021070b884d886bef0244cfa49692c879 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 5 Feb 2024 21:45:34 +0100 Subject: Includes changes in the commit e2c92c58a8e1cdd16044bad7d583fa13e03e69e7. The upstream author got into an unfortunate habbit of squashing whole repo to one commit, so I have to reconstruct his changes. --- init.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 9b04533..b810bd9 100644 --- a/init.lua +++ b/init.lua @@ -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("", toggle(increment), ord_next, nil, "Toggle/increment word or number", true) - operator_new("", 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("", increment, ord_next, nil, "Toggle/increment word or number", true) + operator_new("", 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") -- cgit