Skip to content

Conversation

CharlesGueunet
Copy link

Hi,
This pull request add the ability to choose which key to use for a new entry on the panel.

Best regards,
Charles

We can now precise the key we want to use in the configuration
@skywind3000
Copy link
Owner

skywind3000 commented Aug 2, 2017

It seems that the tradition key allocation may assign a duplicate key and conflict with keys choosed by user.

I had indeed implemented a parameter in quickmenu#append to indicate the hot key for each item. But after a short time, I found I was too lazy to think what key should I use, it is very hard to make a choice when I have about 20+ items. I always confused which key to choose for a new item.

So, I removed that parameter.

@CharlesGueunet
Copy link
Author

CharlesGueunet commented Aug 3, 2017 via email

@CharlesGueunet
Copy link
Author

Hi, I have updated this pull request.
A Warning is displayed if the configuration contains invalid key (duplicate binding, or conflict with an useful key). It helps building a valid configuration file.
Their is one minor limitation for now, the system is not aware of the file type and will display the warning on non-overlapping keys of two separate file type like:

call g:quickmenu#append("menu1" , 'cmd1' , 'help1', 'cpp', 0, 'f')
call g:quickmenu#append("menu2" , 'cmd2' , 'help2', 'vim', 0, 'f')

will trigger the warning.

Also: can deal with multiple panel now
@CharlesGueunet
Copy link
Author

Hi,
I have used these changes in my configuration for several days with no bugs.
Feat:

  • append can receive an optional custom key to uses to access this element instead of the hint
  • no conflict with the hint
  • works with any number of panel
  • warn the user if he has created a duplicate key binding
  • by default, warn the user if he has a custom binding on a move key ("j","k",...)
    • can be disabled using let g:quickmenu_special_key = 0

Moreover these changes are compliant with the last version of the quickmenu using functor.
For an example of the uses of this change: my conf uses the quickpanel to help users learn the shortcuts I have created. So I need to precise the binding key for each entry. (Gallery second image).

Hope these changes will be taken into account,
Charles

@mtreca
Copy link

mtreca commented Aug 8, 2018

@CharlesGueunet I don't know if this PR is going to be merged but just a heads up:

The duplicate binding warning should occur after s:select_by_ft() is run so that filetype-specific bindings do not clash.

@CharlesGueunet
Copy link
Author

@Vxid You are totally right!
The commit 0752271 changed this behavior.
Now, there is no more warning at startup, but duplicate mapping are automatically remapped (with a background message raised). This behavior avoid all annoying duplicate mappings.

Charles

This commit fix @Vixyd comment,
There is no more warning for duplicate during startup,
Duplicates found at runtime are reported on the message section
(background).

The only counter intuitive case would be if user-defined and automatic
key maps are mixed (unlikely). In this case, if a user-defined key map
is already in use by a previous automatically assigned item, the
user-defined key map is ignored (and a warning is raised).
This would be costly to check and is now documented.
@skywind3000
Copy link
Owner

skywind3000 commented Jan 7, 2020

Sorry for replying late,as vim 8.2 and neovim 0.4 released, it is possible to create something cool.

and I bring your ideas to a new plugin: vim-quickui.

the successor of quickmenu.

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.

3 participants