Comments (23)
Thank you for the report!
- 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.
- 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. - 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.
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.
Your 3. should also work as expected now
from which-key.nvim.
Just checked. thank you for the quick update!
2 works perfectly for any length!
Stuff that does not work:
-
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.
-
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.
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.
@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.
@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.
@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
^ they are exactly the same actually, except for CSurround
from which-key.nvim.
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.
Can you check if it works if WhichKey is loaded and setup before commentary?
Checked. I don't see any difference.
- g -> wait for the popup -> c -> c (not preset in the list of options) does not work
- gcc (quickly typed) -> nothing
- gc (quickly typed) -> opens +Comments popup
from which-key.nvim.
ok, I'll install commentary to see what's happening here.
from which-key.nvim.
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.
Just pushed a fix. Let know if it work now. 🤞
from which-key.nvim.
@folke works perfectly now! (at least cases I typically use)
from which-key.nvim.
@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.
@ranjithshegde awesome, thanks!
from which-key.nvim.
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.
@ranjithshegde great to hear! Thanks again for taking the time to help testing all of this
from which-key.nvim.
no problem. Maybe in future I also contribute in the means of PRs.
Cheers
from which-key.nvim.
@ranjithshegde fyi: just fixed #10 as well
from which-key.nvim.
@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.
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
IDK if I'm doing something wrong or if it's a nvim-comment
issue.
Thanks!
from which-key.nvim.
@folke my bad. I just removed cmd = "CommentToggle",
from my config and got it working. Thanks.
from which-key.nvim.
Related Issues (20)
- bug: visual mode keymap `<CR>` not shown in which-key HOT 1
- feature: Excluding a mapped key HOT 3
- bug: Bindings not honoring mode
- bug: Mappings using multiple backslashes cause :WhichKey to crash
- feature: override trigger of register action
- bug: WhichKey breaks flash.nvim with OSC-52 clipboard enabled in Neovim nightly HOT 1
- bug: Mapping a function, concatenates the compile commandd with the result.
- feature: Disable which-key UI HOT 2
- feature: Configuration option to override the usage of timeoutlen
- feature: Group descriptions
- bug: Command mode prompt doesn't show until user types, when mapping opens command mode HOT 2
- feature: Add keymap statistic.
- bug: which-key errors out when pressing wrong key combo in Command Line buffer mode HOT 4
- bug: module 'which-key' not found (Lazy.nvim) after registering maps
- feature: Peek buffers like registers
- feature: Make menu items clickable
- bug: vim.on_key binded function always receive <80><fd>* characters when which-key setup.
- bug: can't disable plugins.presets.z
- feature: Manual trigger of which-key HOT 2
- bug: Mapping vim.cmd functions with arguments will run the function when nvim starts HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from which-key.nvim.