Sublime Text Resources - [plugins, lang files, etc.]

Discuss features, issues, about Editors for AHK
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
GitHub: cocobelgica

Sublime Text Resources - [plugins, lang files, etc.]

02 Oct 2013, 08:17

This thread is for users of Sublime Text (2|3) who wants to share their AutoHotkey configuration/setup for the said text editor. To start with, below is a link to my custom sublime plugin that enables the user to run/build AHK scripts (saved or unsaved). By passing some special parameter(s) to the command, the user can:
  1. open AutoHotkey CHM Documentation
  2. run Window Spy
  3. run dynamic code
  4. run a script

The command can be used for custom sublime menus, bound to hotkey, added to the command palette, called from the Sublime Text console, etc.
USAGE/EXAMPLE:
First save the Python script as ahk.py and put it in your AutoHotkey package folder.

Calling it from the Sublime Text Console: (type the following in the console):

Code: [Select all] [Download] GeSHi © Codebox Plus

view.run_command("ahk", {"cmd":"$help"}) # opens documentation
OR
view.run_command("ahk", {"cmd":"$win_spy"}) # runs Window Spy
OR
view.run_command("ahk", {"cmd":None}) # runs code from active Sublime Text view
OR
view.run_command("ahk", {"cmd":"C:\\Users\\MyUser\\Documents\\AutoHotkey\\some_ahk_script.ahk"}) # run script in HD
OR
view.run_command("ahk", {"cmd":"MsgBox, Hello World\nreturn"}) # run dynamic AHK code

As key binding: (pressing F5 will run code in active Sublime Text view)

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


**Tip/trick: Bind the command to a hotkey, type any AHK code in the Sublime Text console(use "\n" to indicate new lines = e.g.[do not include quotes]: "MsgBox, Hello Word\nreturn") , press the hotkey - the code is ran dynamically.

Here is the link to the Python script: ahk.py

UPDATE:

Code: [Select all] [Download] (Script.ahk)GeSHi © Codebox Plus

CHANGELOG(topmost-recent):
10/20/13 - Added ability to pass arguments to script via 'args' parameter - 'args' should be a sequence/list/array of script arguments. For temp/unsaved script(s): if 'include_print' parameter is set to 'True'(default is True), a 'print(str)' function will be appended to the code. Calling this function from AHK will write 'str' to stdout, in this case, captured by Sublime Text's console - useful for debugging. Renamed 'param' parameter to 'cmd'.

10/09/13 - AHK scripts (whether from file or string) is now launched with the "/ErrorStdOut" switch. Runtime error(s) and #Warn warnings(if 'WarningMode' parameter is set to 'StdOut') are now displayed in Sublime Text's console.


NOTE: For now, the provided script is for Sublime Text 3 [beta] which uses Python 3.x. I will be posting a Sublime Text 2 compatible script.
Last edited by Coco on 19 Oct 2013, 14:57, edited 3 times in total.
User avatar
budRich
Posts: 81
Joined: 29 Sep 2013, 16:52
Location: Wermland
Contact:

Re: Sublime Text Resources - [plugins, lang files, etc.]

02 Oct 2013, 18:13

Great!
Here's my contribution, GoToTilla . It's a ahk script so i posted it in scripts & functions. Maybe someday, I'll make a python version of it, but not today.
User avatar
budRich
Posts: 81
Joined: 29 Sep 2013, 16:52
Location: Wermland
Contact:

Re: Sublime Text Resources - [plugins, lang files, etc.]

02 Oct 2013, 18:31

I've also made a color theme called HatOfGod, (also included in SciTE4AutoHotkey).
User avatar
Avi
Posts: 193
Joined: 30 Sep 2013, 09:51
Facebook: avi.aryan.ap
Google: +AviAryan
GitHub: aviaryan
Location: India
Contact:

Re: Sublime Text Resources - [plugins, lang files, etc.]

03 Oct 2013, 02:50

AutoHotkey Patch for Sublime Text (Sublime 4 AutoHotkey)
Github - https://github.com/avi-aryan/Sublime4Autohotkey
Old ahk Topic - http://www.autohotkey.com/board/topic/9 ... autohotkey

AutoHotkey Language Files for Sublime Text
Github - https://github.com/avi-aryan/AutoHotkey
Clipjump Clipboard Manager : More Scripts

Image
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
GitHub: cocobelgica

Re: Sublime Text Resources - [plugins, lang files, etc.]

09 Oct 2013, 14:51

Update on AHK Python plugin - see OP:
AHK scripts (whether from file or string) is now launched with the "/ErrorStdOut" switch. Runtime error(s) and #Warn warnings(if 'WarningMode' parameter is set to 'StdOut') are now displayed in Sublime Text's console.
tmplinshi
Posts: 1100
Joined: 01 Oct 2013, 14:57

Re: Sublime Text Resources - [plugins, lang files, etc.]

12 Oct 2013, 04:53

Plugins:

1. Alignment
Dead-simple alignment of multi-line selections and multiple selections for Sublime Text 2.

Screenshot:
Spoiler

2. HighlightWords
A Sublime Text 2 & 3 plugin for highlighting mutiple words in different colors

Screenshot:
Spoiler

3. JumpTo
Sublime Text 2 plugin to move the cursor

4. MultiFill
A sublime text plugin for multi-fill text.

Screenshot:
Spoiler

5. ColorPicker

Screenshot:
Spoiler
Last edited by tmplinshi on 30 Jun 2014, 05:23, edited 1 time in total.
tmplinshi
Posts: 1100
Joined: 01 Oct 2013, 14:57

Re: Sublime Text Resources - [plugins, lang files, etc.]

28 Jan 2014, 09:20

Lookup keywords in chm file

ahk_help.py:
Spoiler

Install
  • Save above code to \Data\Packages\User\ahk_help.py
  • Open ahk_help.py, and modify D:\\Program Files\\AutoHotkey\\AutoHotkey.chm to your chm file path.
  • Add a hotkey to Preferences > Key Bindings - User

    Code: [Select all] [Download] GeSHi © Codebox Plus

    { "keys": ["alt+f1"], "command": "customhelp" }

Usage
Select a word or just place the cursor at the word , then press Alt+F1

Screenshot ( CustomHelp and StrokeIt )
Spoiler
Last edited by tmplinshi on 19 Mar 2014, 09:35, edited 2 times in total.
User avatar
jNizM
Posts: 2303
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: Sublime Text Resources - [plugins, lang files, etc.]

19 Mar 2014, 01:57

GutterColor
Gutter Color is a Sublime Text plugin which displays a colored icon for all lines which contain a color.
Image
[AHK] 1.1.27.02 x64 Unicode | [WIN] 10 Pro (Version 1709) x64 | [GitHub] Profile
Donations are appreciated if I could help you
ryunp
Posts: 6
Joined: 14 Jan 2014, 02:01

Re: Sublime Text Resources - [plugins, lang files, etc.]

30 Jul 2015, 17:49

While modifying the color theme for the github ST3 package I ended up customizing the tmLanguage syntax rules a bit.
Among a few changes, I wanted the text after Msgbox to appear the same as String color, but only when no % symbol was present. I nearly got it, but there is some overriding happening :/.

Image

If anyone is interested, here is the additions I made:
Inside AutoHotkey.tmLanguage

Code: [Select all] [Expand] [Download] (AutoHotkey.tmLanguage)GeSHi © Codebox Plus



Inside YourThemeFile.tmTheme

Code: [Select all] [Expand] [Download] (XYZ.tmTheme)GeSHi © Codebox Plus

ryunp
Posts: 6
Joined: 14 Jan 2014, 02:01

Re: Sublime Text Resources - [plugins, lang files, etc.]

30 Jul 2015, 19:14

Also, CHM Lookup is awesome.

For anyone looking to implement tmplinshi's CHM Lookup on ST3 with Python3 for Windows there are a few adjustments. For those less inclined to mess with the updating...
ST3 Path Change:
Pathing doesn't contain 'Data'; 'C:\Users\<user>\AppData\Roaming\Data\Sublime Text 3\Packages\User'

Update Python code to v3:
Unicode changes. You can remove my commented lines, but for brevity's sake I'll just outline the changes in-place.
tmplinshi wrote:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

20170201225639
Posts: 23
Joined: 01 Feb 2017, 22:57

Re: Sublime Text Resources - [plugins, lang files, etc.]

22 Apr 2017, 07:11

very minor thing:

there's a small bug in the Sublime4Autohotkey autuhotkey syntax file that's never been fixed, i.e. it wouldn't recognize variable names with #, @, and $ in them as legit.
as a result these names wouldn't get properly highlighted and indexed (for e.g. showing up in autocomplete)
if you use these symbols, here's how to fix this:

Image

after doing this you may also want to edit the config file to make these symbols not "word separators" (so you can doubleclick on a variable containing $ and select the whole name)


another problem with the syntax file is that function declarations with opening brace on a new line ('cuddled' brace style) doesn't get recognized as legit. still trying to figure out how to fix this ...
User avatar
Cerberus
Posts: 63
Joined: 12 Jan 2016, 15:46

Re: Sublime Text Resources - [plugins, lang files, etc.]

28 Jan 2018, 13:26

Thank you, everyone, for these great tips! I've added a couple to my Sublime Text.

As to properly highlighting function definitions where the curly brace comes on the next line, it cannot be done in Sublime Text, it's hardcoded that way. The problem is that a regex cannot look beyond the end of the current line, for reasons of performance. This will not change.

The only thing you could do is add a comment after the function definition, on the same line:

Code: [Select all] [Download] GeSHi © Codebox Plus

MyFunction()          ;{
{

That the regex can recognise (though it's hardly a solution: I myself will just put the real brace on the same line as the function name, which works fine in Autohotkey). Then you can edit the regex in the tmlanguage file for the 'functionline.ahk' class such that it looks for this:

Code: [Select all] [Download] GeSHi © Codebox Plus

^\s*(\w+)(\()(.*)(\))\s*({|\s(?=;{))\s*(;?.*)$


Does anyone have any new tips or ideas? Or are people not using Sublime Text any more?

Return to “Editors”

Who is online

Users browsing this forum: No registered users and 1 guest