Skip to content

Made Overwrite-Mode-Indicator Plugin #20

@dase78

Description

@dase78

As already mentioned, I still don't have and don't plan to have a repo of my own, so I'm putting this plugin here. If someone wants to use or adopt it, feel free again.

The plugin was initially inspired by the replace plugin from jabbalaci which I liked very much. However, over time I realized it disrupted my workflow slightly because I had to press the Esc key too often: the consequences were issues with resetting selections and clearing command-line messages.

Since I am not a coder myself, I have written the following plugin with the help of AI again, here comes the ~/.config/micro/plug/mindicator/mindicator.lua:

-- mindicator - mode indicator for micro

-- In ~/.config/micro/bindings.json:
-- "Insert": "lua:mindicator.ToggleIndicator,ToggleOverwriteMode",

-- E.g. in ~/.config/micro/settings.json:
-- "statusformatr": "$(mindicator.getOvrStatus)",

local micro = import("micro")
local config = import("micro/config")

IsOverwriteMode = false

function getOvrStatus()
    if IsOverwriteMode then
        return " OVR! "
    end
    return ""
end

function ToggleIndicator(bp)
    IsOverwriteMode = not IsOverwriteMode
end

function init()
    config.MakeCommand("ToggleIndicator", ToggleIndicator, config.NoComplete)
    micro.SetStatusInfoFn("mindicator.getOvrStatus")
end

Nothing fancy or to be proud of. Glad if it helps someone out, feel free.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions