Is it possible to create a Sublime Text snippet with a trigger that doesn't use the tab key?
For example, if I want a comment block, could I type: /comblock and then hit Enter instead of tab?
Related
The MarkupsCore extension automatically creates a text area when you click that you enter text into. Now, I automatically insert text into this text area, but cannot find out how to close it programatically. After going through the source a little bit, it seemed like the text area was a little bit custom as I saw there were some custom implementations of the backspace button, etc. So, I assumed there was a different event.
It seems to happen when you focus out of the element, but that event didn't seem to do it either. In version 3 (or maybe it was earlier, I can't remember), you used to press the enter key. Now you just focus out.
So, what event needs to be fired in order to tell the extension to close the text area and create the markup?
Try the following...
Using the 'markupscore' object, send a 'mouse down' event with 'target:null' like this...
markupscoreExt = viewer.getExtension("Autodesk.Viewing.MarkupsCore")
markupscoreExt.onMouseDown({target:null})
As you are in the middle of typing some text, you can trigger the mouse down event to complete the text.
Let me know if that helps.
Cheers
Michael
For an example after I go to the Project tab with Alt+1 shortcut and open specific file with pressing Enter I then want to go and edit content with single shortcut. Is there any way to do it?
There is couple of things that I can use, but neither does exactly what I want:
Ctrl+Tab - that opens the switcher and selects next file in switcher instead of allowing me to edit file with single Ctrl+Tab
Ctrl+E or Ctrl+Shift+E do different things but basically the result is simmilar as above
What I want is to simply edit the file after opening it with keyboard from Projects tab (without using mouse).
How can I move focus from any other tool window to text editor in PhpStorm?
Just press Esc key.
Works in every tool window. For built-in Terminal though you can (may have to) configure different shortcut for such action (as Esc can be needed there).
For an example after I go to the Project tab with Alt+1 shortcut and open specific file with pressing Enter I then want to go and edit content with single shortcut. Is there any way to do it?
Use F4 for that (action is available in context menu and called Jump to Source).
Ctrl+Tab - that opens the switcher and selects next file in switcher instead of allowing me to edit file with single Ctrl+Tab
Just press and release it quickly: it works just like Alt + Tab on Windows. If you keep modifier key pressed (Ctrl in this particular case) it will keep the Switcher window opened.
I wanted to bind hotkey in Sublime Text 2 like this:
[
{"keys": ["ctrl+alt+m"], "command": "toggle_menu"}
]
After I tried to use it, but nothing happend. Later I realised that I don't have 'toggle_menu' option at all. In ctrl+shift+p menu there is no view: Toggle Menu and in the View tab either.
enter image description here
Tell me how to add the 'toggle_menu' action, please help!
Sublime Text 2 has no ability to hide and show the menu, so there is no menu entry, command palette entry or command to toggle the state of the menu. This is also something that's outside the purview of any plugin. The page that told you about that particular command was mentioning Sublime 3 functionality.
As a result, if you want to add the toggle_menu command, you need to be using Sublime Text 3 and not Sublime Text 2. Sublime 3 includes this ability using that exact command, so what you've tried to do will work just fine there.
How to delete a line in sublime text the same way it is deleted in intellij ?
Which is : line is deleted, and cursor is back to previous position on the newly displayed line.
Ctrl+Shift+K is the default shortcut to delete a line in Sublime Text. However, I'm not sure it will replicate the behavior you are looking for.
No, Ctrl+Shift+K sent the cursor back to the beginning of the line, which is most of the time not the required behaviour. I want the cursor not to move back but to stay as close as possible to where it was before (horizontally speaking).
The solution was to record a macro, where you toggle a bookmark, delete line above, go back to bookmark, and delete bookmark. Then bind the macro to a shortcut.
Let's say I have an onFocus event for a text box. That event triggers when the user tabs into that box, as expected. But it also seems like the event triggers when the box is selected, and then the window is covered and then uncovered, by switching tabs, opening then closing another application, etc. Is there a way to make it so that the event triggers only by tabbing (or mouse-clicking) the text box, and NOT by covering then uncovering the window?
You can use an onClick event. This will only trigger the event on the click though, not tabbing.
You could also use onKeyDown which would trigger on any key press, but would also trigger when the user tabbed away from the textbox.
http://jsfiddle.net/kBzAu/2/
when one goes away from page, you may use window.document.onblur=function(){disable all onFocus};
and re activate them with window.document.onfocus=function(){enable all onFocus};