Author Topic: Command Palette  (Read 1722 times)


  • Community Member
  • Posts: 31
  • Hero Points: 0
Command Palette
« on: February 11, 2021, 08:33:37 PM »
have searched the forums and found this thread,16646.msg64213.html asking after this feature in SlickEdit.

the advice given on key bindings is great but it does not have the ease of access command palettes seen in Visual studio Code and Sublime Text have. in the two mentioned applications, Ctrl+Shift+P opens up the palette, in SlickEdit i cannot see anyway to open up the key bindings page directly.

could the developers possibly add a feature combining the ease of access of a command palette with the power of the key bindings page ?  i especially like seeing the descriptions of the various commands and that you can search for commands or sequence of commands in the key bindings page.

bringing a command palette into SlickEdit and merging it with the key bindings page functionality could be a match made in Heaven.


  • Senior Community Member
  • Posts: 2801
  • Hero Points: 347
Re: Command Palette
« Reply #1 on: February 12, 2021, 03:49:22 AM »
As I mentioned in that other thread, you can open the keybindings dialog using the command gui-keybindings  - which you can assign a shortcut key to.  However, the keybindings dialog isn't all that useful for executing commands because usually you will want the focus to be in an edit window when you execute a command, rather than in the keybindings dialog.  I could probably change the code I posted in that other thread, to give an edit window the focus  - but it might pick the wrong edit window.  You might be better to build your own command menu  - example below - from xxutils.e here.

Add the code to vusrmac.e in your configuration folder and load it using the load module command in the macro menu if you want to try it.  You can bind a key to the command show-xmenu4.

Code: [Select]
#include ""

_menu xmenu4 {
   "Set diff region", "xset_diff_region", "","","";
   "Compare diff region", "xcompare_diff_region", "","","";
   "Beautify project", "xbeautify_project", "","","";
   "Diff last two buffers", "diff_last_two_buffers", "","","";

   "&New temporary file", "xtemp_new_temporary_file", "","","";
   submenu "More","","","" {
      "Search", "search_cpp_ref", "", "", "";
      "Search devdocs", "search_devdocs_cpp", "", "", "";
      "New temporary file no keep", "xtemp_new_temporary_file_no_keep", "","","";
      "Start xtemp file handler","start_xtemp_files_handler","","","";
      "Stop xtemp file handler","stop_xtemp_files_handler","","","";
      "xnotepad cur line","xnotepad","","","";
      "xnotepad cur word","xnotepad_word","","","";
   "Transpose chars","transpose-chars","","","";
   "Transpose words","transpose-words","","","";
   "Transpose lines","transpose-lines","","","";
   "Append word to clipboard", "xappend_word_to_clipboard","","","";
   submenu "Copy names ","","","" {
      "Copy cur buffer name to clipboard","xcurbuf-name-to-clip","","","";
      "Copy cur buffer path+name to clipboard","xcurbuf-path-to-clip","","","";
      "Copy active project name to clipboard","xproject_name_to_clip","","","";
   submenu "Key bindings ","","","" {
      "Show key family","xkey_binding_trainer","","","";
      "Show all key family","xkey_bindings_show","","","";
      "Find source code for command","find_key_binding","","","";
      "Key bindings dialog","gui_keybindings","","","";
   "Alternate last 2 buffers","alternate_buffers","","","";
   "Float &1","xfloat1","","","";
   "Float &2","xfloat2","","","";
   "Float &3","xfloat3","","","";
   submenu "Set float","","","" {
      "Float &1","xset_float1","","","";
      "Float &2","xset_float2","","","";
      "Float &3","xset_float3","","","";
   "Save app layout","xsave_named_toolwindow_layout","","","";
   "Restore app layout","xload_named_toolwindow_layout","","","";
   "Save session","save_named_state","","","";
   "Restore session","load_named_state","","","";

   submenu "&Bookmarks","","","" {
      "&Save bookmarks","xsave_bookmarks","","","";
      "&Restore bookmarks","xrestore_bookmarks","","","";
      "Save bookmarks and clear","xsave_and_clear_bookmarks","","","";
      "Clear and restore bookmarks","xclear_and_restore_bookmarks","","","";

   submenu "Com&plete","","","" {

   submenu "&Select / Hide","","","" {
      "select code block","select_code_block","","","";
      "select paren","select_paren_block","","","";
      "select procedure", "select_proc", "","","";
      "hide code block","hide_code_block","","","";
      "hide selection","hide_selection","","","";
      "hide comments","hide_all_comments","","","";
      "show all","show-all","","","";

   submenu "&Open / E&xplore","","open-file or explore folder","" {
      "Open from here","xopen_from_here","","","open from current buffer path";
      "Open from config","xopen_from_config","","","open file from configuration folder";
      "Open vsstack error file","xopvss","","","Open Slick C error file";
      "Explore current buffer","explore_cur_buffer","","","explore folder of current buffer";
      "Explore config folder","explore_config","","","";
      "Explore installation folder", "explore_vslick","","","";
      "Explore docs","explore_docs","","","";
      "Explore project","explore_vpj","","","";

   submenu "&Case conversion","","","" {
      "&Lowcase selection","lowcase-selection","","","";
      "&Upcase selection","upcase-selection","","","";
      "Lowcase word","lowcase-word","","","";
      "Upcase word","upcase-word","","","";
      "Upcase &char","xupcase-char","","","";
      "Lowcase &char","xlowcase-char","","","";
      "Cap &selection","cap-selection", "","","";


_command show_xmenu4() name_info(',')


  • Community Member
  • Posts: 31
  • Hero Points: 0
Re: Command Palette
« Reply #2 on: February 12, 2021, 10:23:22 AM »
Thank you Graeme for your reply and the tips.

i'm embarrassed to say i completely missed the part you mentioned that the key bindings page can be assigned a shortcut key, apologies.

having tried the shortcut key to the key bindings page and xmenu(appreciate the share) i must say that they are not as clean as a command palette. please do not take my comments as taking your solution for granted, it is nice to have something like it in SlickEdit and i see it being useful for me going forward, but the downside of it is:

- it is not out of the box, therefore a new user has to configure this functionality when they install SlickEdit
- it is not exhaustive, in that not all commands in SlickEdit are in xmenu. a user would have to add them manually.
- it is mouse driven. with a command palette commands can be accomplished without turning to the mouse. call up the command palette, type in command, hit enter.
- finally as you mentioned it is a bit finicky in that it might pick up the wrong edit window.

with official implementation of a command palette, all of SlickEdit's power would be available to a user out of the box with just a few keystrokes and minimal effort on their part. as it is currently, you have to be a SlickEdit power user to implement, on your own, functionality that approaches that of a command palette.

i appreciate your input on this feature and hope you have not taken offense to my remarks or taken them to mean that i do not value xmenu.


  • Senior Community Member
  • Posts: 2801
  • Hero Points: 347
Re: Command Palette
« Reply #3 on: February 12, 2021, 10:44:49 AM »
Sure, no problem.  It's a good suggestion.  The visual studio code command palette is quite nice.  I suspect it would be fairly easy for slick-team to add something similar.  As well as "recently used" I think I'd want a favourites option as well.