skywind3000 / quickmenu.vim

A nice customizable popup menu for vim
MIT License
278 stars 12 forks source link

Choose the shortcut key #5

Open CharlesGueunet opened 7 years ago

CharlesGueunet commented 7 years ago

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

Best regards, Charles

skywind3000 commented 7 years ago

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 commented 7 years ago

I am trying to use Quickmenu to help the user learn the shortcuts of my configuration the way SpaceVim works with their mnemonic panel. But doing so require to be able to change the default access key of each element. This indeed imply that the configuration should be done carefully, but should not be an issue for the user. I can try to improve the code to check for duplicate in the configuration if you want, to display a warning if the configuration is not conform and to avoid the hint to bind conflicting keys.

Charles

On 2 August 2017 at 21:47, Linwei notifications@github.com wrote:

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.

So, I removed that parameter.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/skywind3000/quickmenu.vim/pull/5#issuecomment-319778442, or mute the thread https://github.com/notifications/unsubscribe-auth/AFKW42XYa6Wm8j_0MPy1idwRtajXXVquks5sUNJtgaJpZM4Orhco .

-- Ph.D Student Sorbonne Universités, UPMC Univ Paris 06, CNRS, LIP6 UMR 7606

CharlesGueunet commented 7 years ago

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.

CharlesGueunet commented 7 years ago

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

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 commented 6 years ago

@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 commented 6 years ago

@vxid You are totally right! The commit 075227118d507d1061bbca5aaeba98b680f50fcc 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

skywind3000 commented 4 years ago

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.