diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2024-02-05 21:45:34 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2024-02-05 21:45:34 +0100 |
commit | 1ecc187021070b884d886bef0244cfa49692c879 (patch) | |
tree | 7c93fe9e8bc94e4440d3e627f58f2c6ddb9146f2 | |
parent | 7b26efa4d70866ff603468f89dc399f98632bf71 (diff) | |
download | vis-toggler-1ecc187021070b884d886bef0244cfa49692c879.tar.gz |
The upstream author got into an unfortunate habbit of squashing
whole repo to one commit, so I have to reconstruct his changes.
-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") |