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

Plugin isn't working but keybindings have been mapped #115

Closed
hpb0412 opened this issue Feb 8, 2022 · 8 comments
Closed

Plugin isn't working but keybindings have been mapped #115

hpb0412 opened this issue Feb 8, 2022 · 8 comments
Labels
invalid This doesn't seem right question Question related to integration and other stuff

Comments

@hpb0412
Copy link

hpb0412 commented Feb 8, 2022

I am following the Neovim from Scratch tutorial but all features don't work.

My specs:

  • Mac M1 (Monterey: 12.1)

  • iterm2

  • Neovim info:

    NVIM v0.6.1
    Build type: Release
    LuaJIT 2.1.0-beta3
    Compiled by [email protected]
    
    Features: +acl +iconv +tui
    See ":help feature-compile"
    
       system vimrc file: "$VIM/sysinit.vim"
       fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.6.1/share/nvim"
  • My setup:

    -- comment.lua
    local status_ok, comment = pcall(require, "Comment")
    if not status_ok then
      vim.notify("Comment not found!")
      return
    end
    comment.setup()
    
    -- plugins.lua
    -- ...other stuffs
    use "numToStr/Comment.nvim"
    -- ...
    
    -- init.lua
    require "path.to.plugins"
    require "path.to.comment"

    I also try the instruction from the README.md of this repo

    use {
      'numToStr/Comment.nvim',
      config = function()
          require('Comment').setup()
      end
    }
  • I check the :map and found all keymaps have been mapped
    Screen Shot 2022-02-08 at 12 16 18 PM

  • Issue: using the gcc and/or other actions doesn't work at all.
    Ex: after typing the gcc the cursor converted to underline and no commenting out

Screen.Recording.2022-02-08.at.12.09.29.PM.mov
  • What i did:
    • Try to set mapping.basic to true (at the setup function call)
    • Try different languages: lua, html, css, js, jsx, ts => all doesn't work
    • Try 2 ways of configuration (mentioned above)
    • The only way that works:
      • mimic the mapping with neovim command line
      :lua require("Comment.api").call("toggle_current_linewise_op")
      • then type enter to confirm the command
      • then g@$
@numToStr
Copy link
Owner

numToStr commented Feb 8, 2022

Hmmm, this is interesting but I can't do much by myself as I don't use iTerm.


Ok, so if all the mappings are set then running :normal gcc should work. Can you try running the command?

@hpb0412
Copy link
Author

hpb0412 commented Feb 8, 2022

Hi @numToStr,
No worries, I totally understand of the device-dependent issue.

FYI, the :normal gcc works 👍
Hope it can give you some ideas about the issue.

Thanks 🙇

@numToStr
Copy link
Owner

numToStr commented Feb 8, 2022

FYI, the :normal gcc works +1 Hope it can give you some ideas about the issue.

Then I can only say that something is wrong with your config or setup. This plugin doesn't contain OS specific things, so I would doubt that this is related to this plugin. I would recommend asking other people (on neovim matrix or reddit) with a similar setup.

@hpb0412
Copy link
Author

hpb0412 commented Feb 8, 2022

I found the cause.

I guessed it is because of some kind of key typing timeout.
I went to configuration and found that my timeoutlen of neovim is 100 while default it should be 1000.
Therefore I switch back to 1000 and the plugin works very well.

Thank you 🙇

@hpb0412 hpb0412 closed this as completed Feb 8, 2022
@numToStr numToStr added the invalid This doesn't seem right label Feb 8, 2022
@numToStr numToStr added the question Question related to integration and other stuff label Feb 21, 2022
@numToStr numToStr pinned this issue Feb 21, 2022
@numToStr numToStr changed the title The plugin doesn't work on iterm2 / Mac OS Plugin isn't working but keybindings have been mapped Feb 21, 2022
@kohane27
Copy link

kohane27 commented Apr 7, 2022

@hpb0412 I had the same issue as well. Turned out I copied some config from Chris@machine and he set the following:

set timeoutlen=100 " time to wait for a mapped sequence to complete

I assume the reason he did this was because we use Which-key. Setting it to 1000 means that the Which-key window would pop up only after a second, which is too long. Changing it to 500 seems to be a good middle ground.

@caamittiwari
Copy link

 set timeoutlen=100 " time to wait for a mapped sequence to complete 

this totally depends upon how fast u type the key and your system configuration if type fast u may decrease it and if not increase it
plugin is working fine and very great plugin to use

@Vaisakhkm2625
Copy link

@hpb0412 I had the same issue as well. Turned out I copied some config from Chris@machine and he set the following:

set timeoutlen=100 " time to wait for a mapped sequence to complete

I assume the reason he did this was because we use Which-key. Setting it to 1000 means that the Which-key window would pop up only after a second, which is too long. Changing it to 500 seems to be a good middle ground.

Thanks.. for me gcc itself wasn' working, and i was copied many things from Chris@machine.. :) now everything is working... thanks

keith-rollin added a commit to keith-rollin/dotfiles that referenced this issue Jan 18, 2024
Comment.nvim seems to have some nice features (like full motion support
and things like gco, gcO, and gcA) and works with treesitter for more
accurate results.

Note that I had to tweak which-key's timeout value in order to get gcO
and gcA to work. The issue seems to be related to:

numToStr/Comment.nvim#115 (comment)
@gyaaniguy
Copy link

I had the same issue when using vscode neovim extension + kickstart.nvim
It had reduced the time to 300ms in init.lua . I changed it to 1000 and all is good now !
vim.opt.timeoutlen = 1000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right question Question related to integration and other stuff
Projects
None yet
Development

No branches or pull requests

6 participants