Giter Club home page Giter Club logo

Comments (23)

folke avatar folke commented on May 18, 2024

Thank you for the report!

  1. I see the same with kommentary. It's because they define a operator pending mapping. It can probably already be supported by reading in those keymaps as well. Need to check this.
  2. probably related to 1, since initially you are in NORMAL mode and after pressing gc you're in operator pending mode. However, it does work in my case with kommentary.
  3. might also be related to the same thing.

It might be that gcc needs the timeoutlen. Will check if there's something I can do.

from which-key.nvim.

folke avatar folke commented on May 18, 2024

I just pushed a fix that should make NORMAL => OPERATOR PENDING mappings work.

Can you recheck if it does?

It should even work with timeoutlen = 0

from which-key.nvim.

folke avatar folke commented on May 18, 2024

Your 3. should also work as expected now

from which-key.nvim.

ranjithshegde avatar ranjithshegde commented on May 18, 2024

Just checked. thank you for the quick update!

2 works perfectly for any length!

Stuff that does not work:

  1. vim commentary (and vim-surround) still only shows first level prefix fully, lacking in second level prefix. For example after typing gc I get option c, not ap, ip, and so on. Not only do they not display, if timeout length is small then they wont work.

  2. Same issue still. treesitter-textobjects dont work for operator pending. mappings based on [,] or any other key work except for the ones based on g,y,d,c

from which-key.nvim.

ranjithshegde avatar ranjithshegde commented on May 18, 2024

I may have narrowed down the problem for .2 problem.

Treesitter-textobject mappings are defined this way

require'nvim-treesitter.configs'.setup {
  textobjects = {
    select = {
      enable = true,
      keymaps = {
        ["af"] = "@function.outer",
        ["if"] = "@function.inner",
        ["ac"] = "@class.outer",
        ["ic"] = "@class.inner",

So whichkey reads them as actual mappings inplace of appended mappings. Now I cant get into insert mode as i need to press 'i' and whichkey reads them as mappings for textobjects

from which-key.nvim.

folke avatar folke commented on May 18, 2024

@ranjithshegde damn, indeed.

I just disabled my earlier changes for operator pending stuff. Need to look into this in more depth.

from which-key.nvim.

folke avatar folke commented on May 18, 2024

@ranjithshegde I just pushed a bunch of changes, which should solve these issues.

Treesitter text objects work as they should now, but I'm working on #10 to also get them to show up in the text objects list.

from which-key.nvim.

konart avatar konart commented on May 18, 2024

@folke gcc (vim commentary ) is still broken. gc leads you to +Comments (which looks strangely similar to +Change to me, see the screenshot) but not further action actually adds comments. The timeout doesn't really matter

change

comments

^ they are exactly the same actually, except for CSurround

from which-key.nvim.

folke avatar folke commented on May 18, 2024

They would be similar since we show all motions and text objects for both comment and change. Under i/a, you should now also see the treesitter text objects.

For me it all seems to work with kommentary. Both plugins should be similar, but I will test with commentary just to be sure.

How it should work:

  • typing g and then waiting for the popup: anything should work
  • typing the command quickly without popup: gcip should all work
  • typing gc: no popup will be displayed, since you're then in operator pending mode handled by commentary, but again commenting should work

Can you check if it works if WhichKey is loaded and setup before commentary?

I lazy load kommentary, so that might make a difference

from which-key.nvim.

konart avatar konart commented on May 18, 2024

Can you check if it works if WhichKey is loaded and setup before commentary?

Checked. I don't see any difference.

  1. g -> wait for the popup -> c -> c (not preset in the list of options) does not work
  2. gcc (quickly typed) -> nothing
  3. gc (quickly typed) -> opens +Comments popup

from which-key.nvim.

folke avatar folke commented on May 18, 2024

ok, I'll install commentary to see what's happening here.

from which-key.nvim.

folke avatar folke commented on May 18, 2024

Commentary doesn't seem to create key mappings: https://github.com/tpope/vim-commentary/blob/349340debb34f6302931f0eb7139b2c11dfdf427/plugin/commentary.vim#L108

I don't really get why not. Even if I load WK after it, they're still missing.

Pretty sure the problem is not that we are replacing them, since the keymap for gcc is also missing.

Will look into it further

from which-key.nvim.

folke avatar folke commented on May 18, 2024

Just pushed a fix. Let know if it work now. 🤞

from which-key.nvim.

konart avatar konart commented on May 18, 2024

@folke works perfectly now! (at least cases I typically use)

Popup has correct info too:
Снимок экрана 2021-04-29 в 17 30 41

from which-key.nvim.

ranjithshegde avatar ranjithshegde commented on May 18, 2024

@konart thank you for further verification. After #10 fix I wanted to write about gcc problem. But that seems to be resoved with the previous PR.
@folke
From what I can tell, it works for all my needs. I will verify once more with all my TS mappings along with some camcelCasePlugins and respond this evening.
Thanks again for such quick implementations!

from which-key.nvim.

folke avatar folke commented on May 18, 2024

@ranjithshegde awesome, thanks!

from which-key.nvim.

ranjithshegde avatar ranjithshegde commented on May 18, 2024

All my TS keymaps, whether they were defined within TSconfig block or implicitly as keymaps, all plugin defined motions such as commentary or unimpaired, they work perfectly. Even with 0 timeout.
Also except for numbers mappings related #11, I see all bindings show up in the popup area. Zero problems for my setup!
This is incredible work. Thank you so much

from which-key.nvim.

folke avatar folke commented on May 18, 2024

@ranjithshegde great to hear! Thanks again for taking the time to help testing all of this

from which-key.nvim.

ranjithshegde avatar ranjithshegde commented on May 18, 2024

no problem. Maybe in future I also contribute in the means of PRs.
Cheers

from which-key.nvim.

folke avatar folke commented on May 18, 2024

@ranjithshegde fyi: just fixed #10 as well

from which-key.nvim.

ranjithshegde avatar ranjithshegde commented on May 18, 2024

@folke Just saw it! Fantastic. This is such an upgrade over regular whichkey. I used to have a host of rempas for z, g and ] internals to get them to show up in the old whichkey! this is perfect

from which-key.nvim.

ricbermo avatar ricbermo commented on May 18, 2024

Hello @folke how u doing? First that all, thanks for this amazing plugin.

I'd like to report something. I'm using terrortylor/nvim-comment which just a lua version of TPope's Commentary but it doesn't seem to be working.

use {
  "terrortylor/nvim-comment",
  cmd = "CommentToggle",
  config = function() require('config.comments') end
}
 -- the config
local nvim_comment = prequire("nvim_comment")
if not (nvim_comment) then return end

nvim_comment.setup()

Just to be clear, the CommentToggle command is working. When I press g this is what I get
image

IDK if I'm doing something wrong or if it's a nvim-comment issue.

Thanks!

from which-key.nvim.

ricbermo avatar ricbermo commented on May 18, 2024

@folke my bad. I just removed cmd = "CommentToggle", from my config and got it working. Thanks.

from which-key.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.