ohne-accidents.nvim icon indicating copy to clipboard operation
ohne-accidents.nvim copied to clipboard

Option to use `vim.notify()` API instead of echo

Open nikbrunner opened this issue 1 year ago • 3 comments

Thank you for this plugin! I use and like it, but I would be great to have an setup option display the message(s) via vim.notify() (:h vim.notify) instead of echo. I have some things that happen on startup and the echo message get hidden very quickly.

I wanted to try to contribute myself, by adding a method = "echo" | "notify" setup config option, but I was stopped, since there was no .editorconfig or stylua.toml in the root of your project so my Formater ran with the default options and reformats the whole file when I try to edit the file. I could also disable the auto format, but this is also not a good option I think.

Also I have no experience with testing Lua files. 😁

Thank you again.

nikbrunner avatar Apr 01 '24 08:04 nikbrunner

I just added an .editorconfig to the project. Let me know if you need anything else to make your suggestion happen.

blumaa avatar Apr 17 '24 07:04 blumaa

Hey thank you for your reply. :)

With the .editorconfig in place i will create an PR with an attempt to realize this. I will ping you for the tests if i need help.

nikbrunner avatar Apr 18 '24 06:04 nikbrunner

Super!

blumaa avatar Apr 18 '24 11:04 blumaa

@nikbrunner Sorry I missed your MR! It is merged now. Thanks for running the editorconfig. :)

blumaa avatar May 26 '24 09:05 blumaa

Thank you for merging #5. :) I setup an PR to bring these features into this project: #6

nikbrunner avatar May 26 '24 12:05 nikbrunner

@nikbrunner I merged your branch into a separate branch, (sorry, I didn't know how to test your MR/branch locally because it was from a fork) here: chore/add-option-to-use-notify-api-instead-of-echo

But I was unable to get things running locally, and the tests are failing. I can have a look this weekend and try to fix things.

Anyways, overall it looks good. Sorry Ive been so slow on this. For some reason github is not notifying me when you write a comment or make an MR.

blumaa avatar May 31 '24 13:05 blumaa

No problem. :) Did I do something wrong while submitting the Pull Request? Thank you for the merge. I have updated my configuration to use the mentioned branch and will test things that way.

---@type LazyPluginSpec
M.spec = {
    "blumaa/ohne-accidents.nvim",
    branch = "chore/add-option-to-use-notify-api-instead-of-echo",
    event = "UIEnter",
    keys = {
        {
            "<leader>vc",
            ":OhneAccidents<CR>",
            desc = "Time since last config change",
        },
    },
    ---@type OhneAccidentsConfig
    opts = {
        api = "notify",
        multiLine = false,
        useLastCommit = true,
    },
}

nikbrunner avatar May 31 '24 13:05 nikbrunner

No I think your MR was okay! I think it's my lack of dev experience. I couldn't figure out how to switch branches to your forked branch to test it.

EDIT: Okay what the heck. I must be tired today. :) I just switched to your branch now. I think the problem is I was using your name as a prefix. It works!

hold on a sec and let me test a thing and then I think we're good to go.

blumaa avatar May 31 '24 14:05 blumaa

I also didn't know you could just add the branch to the lazy config like that. Makes it a lot easier than trying to config the directories locally.

blumaa avatar May 31 '24 14:05 blumaa

I got the tests working. You can run them with busted.

@nikbrunner Merged, published, released. 🎉

Nice work man! And thanks for teaching me things.

blumaa avatar May 31 '24 14:05 blumaa

Merged, published, released.

blumaa avatar May 31 '24 14:05 blumaa

Very nice 😊 🤝

nikbrunner avatar May 31 '24 14:05 nikbrunner