monaqa / dial.nvim

enhanced increment/decrement plugin for Neovim.
MIT License
794 stars 12 forks source link

default to normal <c-a> #78

Open barrett-ruth opened 1 year ago

barrett-ruth commented 1 year ago

I love this plugin but this missing (and easy to implement feature) has really been bugging me.

If I open up a new file a.txt:

1

I can increment the 1 normally with <c-a>. However, that doesn't work with dial because dial doesn't have any groups associated with a random text file.

How can I configure dial to default to the builtin mapping if dial doesn't do anything? Should this be a default?

Thanks for the awesome plugin.

monaqa commented 1 year ago

Sorry, I don't understand, please elaborate a bit more. dial.nvim uses an augend group named "default" when not configured with on_filetype() function. Is there any problem with this usage?

barrett-ruth commented 1 year ago

not default i guess.

What I meant was "fallback". So fallback to and make it behave like vanilla vim if dial.nvim doesn't do anyhing. Do you understand the example I gave in the original post?

monaqa commented 1 year ago

dial.nvim supports all the features provided built-in <C-a>/<C-x>, so no fallback function is provided at this time. If requested, I would consider adding a function like require("dial.status").manipulatable(). This function would allow fallback to the default if there is no manipulatable augend:

vim.keymap.set("n", "<C-a>", function()
    if require("dial.inspect").manipulatable() then
        -- use dial.nvim's <C-a>
        return "<Plug>(dial-increment)"
    else
        -- fallback to built-in
        return "<C-a>"
    end
end, { expr = true })
gegoune commented 12 months ago

@monaqa That would actually be quite nice to have. I believe I found myself in similar situation as reported by OP.

fitrh commented 10 months ago

Sorry @gegoune, but I can't reproduce what OP said, could you provide the reproduction steps? For me, it just works as expected when opening a.txt

gegoune commented 10 months ago

For simple case such 1 it does work, as @monaqa states in their comment. I can't think of/remember situation I mean in my previous comment, so perhaps it is not relevant or factual at all.