Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Sublime 4 Autohotkey [Updated 13/11]


  • Please log in to reply
74 replies to this topic
A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

A v i
 
May be it will be interesting for you. There is opensource analog for Sublime text editor https://github.com/limetext/lime . It is not yet ready for use but it is actively developed.

Very cool. I will look at it later . 


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


Binocular222
  • Members
  • 99 posts
  • Last active: Jul 25 2014 04:28 AM
  • Joined: 26 Feb 2012

Should add a plugin to wrap selected text in % => convenient to write variables.

Code:

import sublime, sublime_plugin

class wrap_selection(sublime_plugin.TextCommand):
	def run(self, edit, char):
		begin = self.view.sel()[0].begin()
		end = self.view.sel()[0].end()
		if begin == end:
			self.view.insert(edit, end, char)
		else:
			self.view.insert(edit, end, char)
			self.view.insert(edit, begin, char)

Then add a Default (Windows).sublime-keymap:

[
  { "keys": ["%"], "command": "wrap_selection", "args": {"char": "%"} },
]
 
 
P.S: I tried
if self.view.sel()[0].end() == self.view.sel()[0].begin():
    self.view.window().run_command("move", {"by": "characters", "forward": "false"})
but not work?! Don't know why


Binocular222
  • Members
  • 99 posts
  • Last active: Jul 25 2014 04:28 AM
  • Joined: 26 Feb 2012

Another improvement would be: Instead of popup help, you can open the related help page in Autohotkey.chm:

Step 1: contextual_help.py (remember to change the path to Autohotkey.chm accordingly)

import sublime, sublime_plugin, subprocess

class contextual_help(sublime_plugin.TextCommand):
	def run(self, edit):
		CursorLocation = self.view.sel()[0]
		ScopeName = self.view.scope_name(CursorLocation.a)
		ScopeText = self.view.substr(self.view.extract_scope(CursorLocation.a)).replace("*", "")
		if "keyword.command" in ScopeName:
			ScopeText = ScopeText.replace("#", "_")
			arg = "E:\\7Utilities\\Launcher\\AutoHotkey\\AutoHotkey.chm::/docs/commands/" + ScopeText + ".htm"
			subprocess.Popen(["hh.exe", arg])
		else:
			window.run_command("move_to", {"to": "hardeol"})        # Add new line
			window.run_command("insert", {"characters": "\n"})      # Add new line 

Step 2: Amend Autohotkey.tmlanguage - line69 from

<string>(\b|^)(?i)(allowsamelinecomments|clipboardtimeout|...

to

<string>(\b|^)(?i)#?(allowsamelinecomments|clipboardtimeout|...

 

Step 3: Default (Windows).sublime-keymap

[
  {"keys": ["ctrl+enter"], "command": "contextual_help"},
]

Now, place your cursor on each function and press ctrl+enter will open the help page



A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Thanks @Binocular222 for these plugins. I have only started learning Python so don't understand all of your code. I will test these and report.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


Binocular222
  • Members
  • 99 posts
  • Last active: Jul 25 2014 04:28 AM
  • Joined: 26 Feb 2012

Forget the warp plugin. I found an easier way to do it: just a .sublime-keymap is enough:

	{ "keys": ["%"], "command": "insert_snippet", "args": {"contents": "%$0%"}, "context":
	[
		{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
		{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
		{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|;|\\}|$)", "match_all": true },
		{ "key": "selector", "operator": "equal", "operand": "source.ahk"}
	]
	},


Arcanist
  • Members
  • 27 posts
  • Last active: Jan 27 2018 08:46 AM
  • Joined: 10 Mar 2014

Did you update the files properly for 2.5 because when I copy and paste the update for 2.5 and Upgrade Package in package control, it still says I have 2.4 installed and wants me to upgrade. Is this a mistake by me or you?



A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Did you update the files properly for 2.5 because when I copy and paste the update for 2.5 and Upgrade Package in package control, it still says I have 2.4 installed and wants me to upgrade. Is this a mistake by me or you?

You are talking about the 'AutoHotkey' package that resides in packages/AutoHotkey . Su4Ahk is a different thing, not update-able from Package Control and it's in v2.5.

 

Edit - Interestingly, there is a bug in sublime4autohotkey.ahk too. It also is v2.4 but the real version of su4ahk is 2.5 .. I am working on a newer version, so this will be fixed soon.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

v2.6

  • Better GoTo with search
  • Fixed bug with Context-Sensitive F1 help not working correctly if a previous windows was active

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


adabo
  • Members
  • 385 posts
  • Last active: Jul 30 2015 07:52 PM
  • Joined: 13 May 2010

@A v i, Is your package related to this one: https://github.com/robertcollier4/AutoHotkey ? I read that you were helping each other and so I just want to know which package to install.

Currently I'm using robertcollier4's package on ST3. I just want to know which one I should be using.

 

I'm having an issue that when I press enter when the autocomplete list pops up, it automatically changes what I was writing. For example, if I write

return

and press return on the keyboard, then it will change it to:

Return

How can I change it so that only tab will autocomplete what I'm typing and not return?



A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

@A v i, Is your package related to this one: https://github.com/robertcollier4/AutoHotkey ? I read that you were helping each other and so I just want to know which package to install.

Currently I'm using robertcollier4's package on ST3. I just want to know which one I should be using.

 

I'm having an issue that when I press enter when the autocomplete list pops up, it automatically changes what I was writing. For example, if I write

return

and press return on the keyboard, then it will change it to:

Return

How can I change it so that only tab will autocomplete what I'm typing and not return?

There's AutoHotkey.sublime-completions files in Data/Package/AutoHotkey . You will have to change that . 

 

As Robert's package is registered with the name "AutoHotkey" on package control, I plan to merge my package with his. I will soon send him a PR reflecting the updates if any.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


JusFiddlin
  • Members
  • 2 posts
  • Last active: Feb 02 2018 06:09 AM
  • Joined: 31 Oct 2015

Hi,

 

Thanks for your work.

 

- Was yours eventually merged with Robert's and available through Package Control?

 

- Was Debugging realized?

 

TIA



A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Hi,

 

Thanks for your work.

 

- Was yours eventually merged with Robert's and available through Package Control?

 

- Was Debugging realized?

 

TIA

Yes it was merged with Robert's package and is available in Package control as "sublimeautotohotkey" ... ( https://github.com/a...blimeAutoHotkey) If you ask about Su4ahk, some of the features like the tooltip help can still be added to the autohotkey package as sublime plugins...

 

I don't think there is support for debugging but I haven't been following autohotkey for some time so maybe I am wrong.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

If you ask about Su4ahk, some of the features like the tooltip help can still be added to the autohotkey package as sublime plugins...

 
I will add the Tooltip Help support to the SublimeAutoHotkey package soon.  https://github.com/a...otkey/issues/26


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


JusFiddlin
  • Members
  • 2 posts
  • Last active: Feb 02 2018 06:09 AM
  • Joined: 31 Oct 2015

Thanks for you replies. As the help on Github doesn't mention Debugging, I assume it's not in it - too bad, else I'd consider using it.



A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Thanks for you replies. As the help on Github doesn't mention Debugging, I assume it's not in it - too bad, else I'd consider using it.

I have never tried to understand the concept/need of (formal) debugging. :(   I just use msgbox or tooltips to find bugs and breakpoints and it has worked fine for me.... Maybe someday I will realize its importance.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan