Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default to normal <c-a> #78

Open
barrett-ruth opened this issue Oct 3, 2023 · 6 comments
Open

default to normal <c-a> #78

barrett-ruth opened this issue Oct 3, 2023 · 6 comments

Comments

@barrett-ruth
Copy link

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
Copy link
Owner

monaqa commented Oct 5, 2023

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
Copy link
Author

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
Copy link
Owner

monaqa commented Oct 5, 2023

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
Copy link
Contributor

gegoune commented Oct 11, 2023

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

@monaqa monaqa reopened this Oct 14, 2023
@fitrh
Copy link

fitrh commented Nov 24, 2023

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
Copy link
Contributor

gegoune commented Nov 24, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants