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

Add extras for filetype workflow #53

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

leiserfg
Copy link
Contributor

  • Automate tests
  • Add extras for filetype workflow

@leiserfg
Copy link
Contributor Author

This PR includes the other one in order to add the tests.
The indented usage is to import group_from_ft and then:

      vim.keymap.set("n", "<C-A>", dm.inc_normal(group_from_ft), { noremap = true })

It's a bit hacky but does not require internal changes, actually, it's the same I'm already doing locally.

@monaqa monaqa mentioned this pull request Jan 16, 2023
@leiserfg
Copy link
Contributor Author

I had to remove the <Plug> maps we can try to bring them back (do we actually nee them?) and probably some cleanup needs to be done, but I don't wanna proceed without your opinion.

Copy link
Owner

@monaqa monaqa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me check one thing. Is the dot repeat functionality preserved?

In my environment, dot repeat does not seem to work.

@monaqa
Copy link
Owner

monaqa commented Jan 18, 2023

I had to remove the <Plug> maps we can try to bring them back (do we actually nee them?)

<Plug> mapping is provided for those who want to easily configure dial.nvim with Vim script. Limiting it to a Lua-based interface is a reasonable choice, as dial.nvim is a Neovim-only plugin.

Note that removing the <Plug> mapping is a breaking change. We would like to have a certain period of time to publish a deprecation warning before merging.

Copy link
Owner

@monaqa monaqa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Dot repeating feature is still not working.
    For example, suppose you have a buffer consisting of two lines and you want to increment two numbers in each line:

    ten: 10
    one hundred: 100
    

    When you increment 10 at line 1 by <C-a> and then increment 100 at line 2 by dot repeat, you should get an error.
    This is because the text object for operator is not being handled properly and the range is not being updated.

    For detailed behavior, please read :h dial-dot-repeating and follow it.

  • Please clarify why the code around lua/dial/map.lua needs to be modified.
    In particular, does it worthwhile to use nvim_feedkeys function?
    The nvim_feedkeys function is difficult to predict the behavior, making debugging and maintenance hard.
    If you are more familiar with the function-based I/F than key-map-string-based I/F, you can use the normal command, like:

    vim.keymap.set("n", "<C-a>", function()
        local cmd = vim.api.nvim_replace_termcodes(require("dial.map").inc_normal(), true, true, true)
        vim.cmd.normal { cmd }
    end, { noremap = true })

@leiserfg
Copy link
Contributor Author

  • Please clarify why the code around lua/dial/map.lua needs to be modified.

I will prefer not to have to change the map function, but the issue is that there you are composing a string to be used in the mapping but within a string you can't encode a lua closure. So I'm trying to replicate the behavior in pure lua.

  • The nvim_feedkeys function is difficult to predict the behavior, making debugging and maintenance hard.

Yes, but the . register is read-only, so I can't do setreg('.', "g@"), I think the issue with the . in visual mode is the fact that I'm passing a feeding a motion. I will try doing it only in normal mode 🤔 and see if that fixes it.
I'm sorry I forgot to test that use case.

@leiserfg
Copy link
Contributor Author

The issue is not the motion, but anyway should not the dial#operator#* family of operators use the position as passed by g@ ?

@monaqa
Copy link
Owner

monaqa commented Jan 25, 2023

Now that I understand a little more what you want to achieve, I have created another PR, #56.
It is implemented using the :normal command as shown above. As far as I have tried at hand, dot repeat works well, but the count feature does not work.
The implementation is still in progress, but I think this approach is easier to achieve the function-based I/F.

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

Successfully merging this pull request may close these issues.

None yet

2 participants