Sublime Forum

Few Questions about command_palette & sublime-commands

#1

Hi guys. So, i created a small collection of files i edit often using .sublime-commands. You can see the file here:
github.com/iamntz/sublimentz/bl … e-commands

After this file was created, i also created a shortcut:

,{ "keys": "f8"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "> "} }

Everything works peachy, but I encountered few issues:

  1. The most annoying thing is: how the hell do i order the items? I prefixed everything with a number, but no dice.
  2. How do i use system variables here? On windows, home folder is set as a variable: %home% (which should pointing to /C/Users/Ionut Staicu/), but using it will cause editor freeze

So, any ideas? Thanks!

I didn’t used favorite files plugin because is quite complex to get to my files (i have to follow like three steps or so).

0 Likes

#2

I believe they are all ordered at start, but as soon as you start typing, the fuzzy matching begins; therefore, order will go out the window. And commands that have been used more often will bubble up to the top of the list as well.

Favorite Files doesn’t have to be so complicated, instead of having to launch the command palette and select open Favorite files command to get a list of your files and then select the file to open, you can just bind the Favorite Files Open command to a shortcut allowing you to go straight to your favorites menu. Bind it to the context menu if you find that preferable.

Or if you are just really against Favorite Files, you could create your own simple command that allows you bring up an ordered list of just your file open commands by populating a quick panel…(but this is no different than what Favorite Files does; minus Favorite Files management of the entries).

If you have suggestions for Favorite Files, you can also throw those my way as well…but whatever you choose, maybe something I have thrown out can be helpful.

0 Likes

#3

Right now, favorites will require:

  1. ctrl+shift+p
  2. type fav (ok, these to steps can be mixed together with a shortcut)
  3. select Group:my group (this may be tweaked a little: if there is only one group, show files dirrectly)
  4. select file

My config works like this:

  1. ctrl+shift+p
  2. type > (or press f8 to show the pre-populated command palette)
    2.1) bonus, i can assign numbers for each entry and quickly access it; something like f8 + 2 will edit httpd.conf. Beat that! :mrgreen:
  3. select file

Besides that, my commands also restarts apache & autohotkey :stuck_out_tongue:

Anywho, i understand what’s the thing with the order; any ideas about system vars like %home% & co?

Thanks!

0 Likes

#4

[quote=“iamntz”]My config works like this:

  1. ctrl+shift+p
  2. type > (or press f8 to show the pre-populated command palette)
    2.1) bonus, i can assign numbers for each entry and quickly access it; something like f8 + 2 will edit httpd.conf. Beat that!
  3. select file

Besides that, my commands also restarts apache & autohotkey [/quote]

That is a bit more specialized and out of the scope of Favorites. I understand better what you are doing now :smile:.

As for systems variables, i believe you are going to have to filter your arguments through another command that processes your paths, and then sends those args through the “open_file” cmd etc. that you want to do.

You can use things like tilde and os.path.expanduser “~/Desktop” for something simple like your home folder (this works on windows as well), but if you want to access more than that, then this might help you stackoverflow.com/questions/1318 … -in-python. I believe this will translate into a way to use any system variable…but I have never actually used this.

0 Likes

#5

Right now i’m pretty biased and i’m not sure either is a good or bad idea to dig deeper on this matter.

Thanks for the idea!

0 Likes

#6

[quote=“iamntz”]Right now i’m pretty biased and i’m not sure either is a good or bad idea to dig deeper on this matter.

Thanks for the idea![/quote]

It is really only a benefit if you want to hide your User path or something like that. Since what you are doing is copying the path once and forgetting about it, it offers you no convenience factor either way. The only benefit would be obscuring the path. I have never really cared whether by User path is obscured, so I have never used such a thing.

0 Likes