Sublime Text plugin development: modifying the Quick Panel to add a custom text title or label? - sublimetext3

I'm developing a Sublime Text 3 plugin which uses the quick panel a.k.a. the command palette.
I would like to add a textual title/label at the top of the quick panel when the user opens my plugin's quick panel menu, because my plugin runs in various modes and I want to make it clear which mode is currently running (Test, Pre-Live, Live, etc.)
Is this possible, and how?
This a mockup of what I want to achieve:

This is not possible in a quick panel, no. The only thing you can provide to the quick panel display-wise is the list of items that you want the user to choose from. Each item in the list can contain multiple lines of data however (with the restriction that every row has to contain the same number of lines):
Something like that could potentially be used to provide context on the items in the list that allows the user to know what mode you're in.
The Command Palette and the quick panel aren't the same thing (although they are visually similar); the command palette only displays commands that you can choose. By using an input handler, you can customize the display somewhat:
In this sample, View Package File is the selected command, but the command has control over what that text says (it's just the command name by default). You also have the power to provide a "preview" (basically any extra information that you want) about the currently selected item:
So given that, depending on your use case your command could present its interface in the command palette to give this kind of contextual clue.

Related

Is there any shortcut-key in sublime text 3 to change language?

Actually there is an easy way to change language in Sublime Text 3, that's on the bottom right corner. But I need the fast way to change while my hands are on the keyboard. Is there any shortcut-key to change language in Sublime Text 3?
Thank you.
All of the non-hidden syntaxes in Sublime are automatically added to the View > Syntax main menu, which is the same menu that appears when you click on the file type in the bottom of the window. Additionally all syntaxes are added to the Command Palette as commands that start with Set Syntax:.
So the easiest and fastest non-mouse way to swap the syntax on a file is to open the command palette an enter just enough filter text to find and select the command that will swap to your desired syntax, such as in the image below to switch to HTML.
Sublime remembers what command you select for any given command palette input, so for extra speed you can use filter text like sh and manually select the Set Syntax: HTML command that appears to tell Sublime that's the command you want. Now whenever you enter sh it will automatically select that command for you by default.
The set_setting command can be used to set any setting, including the syntax setting, so you could also bind a key to that command to switch easily to an often used syntax. However that requires that you know the full package resource name of the syntax in question and it will not properly set up the syntax specific settings (that requires a plugin that uses view.assign_syntax()).
There may be a package available on package control that provides such a command already, but I'm not aware of any offhand.

Moving between text and input and textarea areas without using mouse and closing panels

In the majority of programs and sites it is possible to switch between input and textarea fields by means of combinations of the Tab and Shift+Tab keys.
But in Sublime Text Tab — tabulation.
For example, for me open Goto Line Panel and console.
May I move between entry fields and my text also as in the majority of programs becomes by means of keyboard combinations of Tab and Shift+Tab? I know, what the Tab and Shift+Tab keys is needed for tabulation, but any combination of keys can be used to move between input and textarea fields.
Thanks.
TAB will not work but this can be achieved by series of shortcuts:
Opening line selector: Ctrl+G
Opening search: Ctrl+F
Going from search to founded string: Alt+Enter
Shortcuts above are available on Linux version. They may be different on Windows but they are there and can be found in online documentation.
With Sublime Text you can personalize your shortcut!
I found this guide on the official website and this "different but useful" question about it.
So you can create your own sort of switch with comfortable combination. Example:
alt+1 to go to search
alt+2 to go to the text
alt+3 to go to the bottom
...
this is also faster then the "tag way" because it is not cyclic!
i haven't tried it but as mentioned by Draco the commands to move exist so you can just make them more comfortable.

Bash and dialog UI, how to change color dynamically

I have a simple bash script, which I use to maintain some log etc files on a server, and most of the time the tools works in "normal mode". For UI I use the dialog tool.
However, sometimes I have some condition that requires more careful attention, and I would like at those times to change the background color of dialog, to draw more attention to the issue.
I know that by changing the screen_color attribute in .dialogrc, I can define custom colors for the dialogs, but that affects all windows, and is not what I want.
Is there some way to dynamically set this variable so that only specific dialogs would have different colors, and everything else unaffected?
For a given dialog process, you can select a specific configuration file using the environment variable DIALOGRC (see manual).

Can menus in Vim be made "dynamic"?

i.e. to show a value (let's say, for the purpose of this example, set tabstop? ... 8), but when that value changes to show the changed value?
I'm playing with Vim to see if I could setup a menu which would display some of my more used settings to save up on set setting? ... any ideas?
I also find it a little bit unusual to put settings values into the menu (a menu item usually is associated with an action that is triggered by selecting it), and would also recommend using either the 'statusline' (for settings that you want to see in parallel for each open buffer) or 'titlestring' (for settings that you only need for the current buffer).
You can use the :menu and :unmenu command to dynamically create and update menu items. Unlike the above mentioned mechanisms, however, Vim will not automatically trigger the updates; you have to do this with :autocmds on the appropriate events (e.g. CursorHold) yourself.

Button-Triggered Insert File Only Works If Portal Contains Edit Box for Container Field

I'm working with a FileMaker Pro 11 database that contains a portal. I've added an "attach file" button to the portal which triggers a simple "Insert File[portal_table::attachment_field]" script. When I click on the button, I would expect an insert file dialog box to appear. Instead, nothing happens.
If I add a text box to the portal, setting the text box's field to portal_table::attachment_field, the attach button starts working.
Why am I required to add this text box to the portal in order for my button-triggered script to work? Is there a way I can modify my script so that it works without requiring the text box's presence?
Thank you,
Ben
Generally speaking FileMaker's "Insert..." commands behave as if a user has done an action manually (activating script triggers, selecting the field, etc.) including the requirement that the field actually be displayed on the screen.
Unfortunately, as far as I am aware, there is not a way to use "Set Field" to specify a file to be added to a container field. One possible work-around is the following:
Freeze Window
Set Variable [$RecordIndex to RelatedTable::Index]
Go to Layout [A Layout of RelatedTable specifically for inserting files]
Enter Find Mode
Set Field [Index to $RecordIndex]
Perform Find
Insert File
Go to Layout [Original Layout]
Alternately, it may be easier to just include the field on the layout at a very small size (1 pixel x 1 pixel).

Resources