SL5_AHK_Refactor_engine - a Source Code Refactoring Engines for Autohotkey

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
Contact:

SL5_AHK_Refactor_engine - a Source Code Refactoring Engines for Autohotkey

07 Jul 2015, 16:18

hi :wave: i created a Source Code Refactoring Engines for Autohotkey . Hope you enjoy :thumbup:

SL5_AHK_Refactor_engine
developer productivity engine for ahk developers with scite4ahk
SL5_AHK_Refactor_engine is free for personal and commercial use.


Tested with Autohotkey Version 1.1.19.03(http://www.autohotkey.com/)
, SciTE4AutoHotkey 3.0.06.01 (portable Version recommended for easier TillaGoto configuration) (http://fincs.ahk4.net/scite4ahk/)
, Thanks to TheGood for TillaGoto (thread: http://www.autohotkey.com/forum/viewtopic.php?t=41575
, Thanks to Autohotkey community (http://www.autohotkey.com/board/)
, Thanks to Czarek Tomczak for PHP Desktop (https://code.google.com/p/phpdesktop/, http://i.imgur.com/4uVvU8n.gif?1)

Usage

start
-- SL5_AHK_Refactor_engine_v0.5.ahk
-- SciTE4AutoHotkey
eventually disable or add return before first line in
TillaGoto (...\SciTE_beta4\tools\TillaGoto.ahk)
or set tillagoto.enable=0 (...\SciTE_beta4\tillagoto.properties)
read manual for shortcuts SL5_AHK_Refactor_engine keyboard shortcuts (in this document: [documentation]: https://github.com/sl5net/SL5_AHK_Refac ... ntation.md ) SciTE4AutoHotkey keyboard shortcuts here:
https://www.google.de/#q=SciTE4AutoHotk ... +shortcuts

Firs Demo Video:
[youtube]
https://youtu.be/uF-nodLZ-gM
[/youtube]
guest3456
Posts: 3453
Joined: 09 Oct 2013, 10:31

Re: SL5_AHK_Refactor_engine - a Source Code Refactoring Engines for Autohotkey

10 Jul 2015, 21:38

This is very cool, I can definitely appreciate it

However, it looks like you put in a LOT of work building these hotkey shortcuts simply for the s4ahk editor. If you ever plan to code in another language, you're bindings won't be available to you. Or even if you are typing some plaintext notes into another editor, you won't have these shortcuts. Thats a problem

Thats why its perferable to use a more powerful text editor. I use VIM. Many of the things you are trying to do can be done in pure vanilla VIM, and if not, you can easily find a plugin that does it, or create your own shortcut. Of course, VIM has a large learning curve, but you will have a learning curve putting all of these shortcuts into muscle memory already.

I've created a demo in vim, showing some of the same features that you show

Here it is:

https://www.youtube.com/watch?v=23ziB3d6e0E

In case you've never heard of vim, in Normal mode all of the letter keys are commands shortcuts and operations. So you will see me moving around with h, j, k, l, which correspond to left, down, up, right. And then when you are in Insert mode, you can type and edit text like you would in a normal editor, where each letter actually inputs into the text on the screen. The idea is that, when you are programming, most of the time you are EDITING text, not WRITING it. You are fixing bugs, moving stuff around, etc. Only rarely are you freely writing new code. So when you are jumping around fixing things, its very slow moving your hands back and forth from mouse to keyboard. the micro mouse movements also cause RSI

Heres what i do in the video:

1. I create a mapping (hotkey) for Ctrl + Shift + up/down to move lines up and down, just like your example. This is done with the :move command in vim, but vim allows you to create your own shortcuts for whatever you want, so thats what I do

2. Then i show how vim can auto fix indenting, over a range of lines that i highlight with vim's Visual mode. I simply needed to end each line with a ; because i couldn't be bothered to read the manual to change the default C-language for this quick demo. I type in a snippet, copy it with the y key, paste it twice with the p key. Then i highlight the range and re-indent with the = key

3. I show how to delete a line, which is very common, with the dd command. iI also show how to "delete a word" with dw and "delete 2 words" with d2w. Also "delete inside parens" and "change inside parens" with di( and ci(

4. Then i demo the surround plugin (one of the most popular), which allows you to surround stuff with whatever you want. ysiw" translates into something like "you surround inner word with quotes". I also show cs"' which is "change surrounding double qutoes with single quote". etc. similarly ds" for "delete surrounding quotes".

5. Finally i show how you can jump to the last edited line with the `. command.

These are just a micro handful of commands that you can do. Vim is like learning another programming language just to operate on your text. Its extremely powerful and takes a while to get going but not only do i find it rewarding but its also just fun

User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
Contact:

Re: SL5_AHK_Refactor_engine - a Source Code Refactoring Engines for Autohotkey

23 Jul 2015, 10:34

guest3456 wrote:This is very cool, I can definitely appreciate it
... https://www.youtube.com/watch?v=23ziB3d6e0E
... learning curve, but you will have a learning curve putting all of these shortcuts into muscle memory already. ...
I have watched your video. Impressive. Yes my version works currently really only with scite4ahk, but can be converted (for example, as a Lite-Version Web page: http://sl5.it/SL5_preg_contentFinder/ex ... e_code.php ). If someone wants to create itself a variant:

Code: Select all

$actual_content = reformat_AutoHotKey($file_content, $arguments);
https://github.com/sl5net/SL5_AHK_Refac ... ce.php#L71

Since I work a lot with IDEs Jetbrain, it was to me particularly important to use the same shortcuts.

Probably it's not worth it for me to date to switch to your VIM.

Thanks for your video :) Thanks for your intersting posting.
guest3456
Posts: 3453
Joined: 09 Oct 2013, 10:31

Re: SL5_AHK_Refactor_engine - a Source Code Refactoring Engines for Autohotkey

23 Jul 2015, 11:23

Thanks man, I thought you may like it, because your whole refactor engine is an attempt to make code editing easier. Its a great project that you've accomplished. I just wanted to show that many of these problems have already been solved in the past, notably by the more power editors from unix: vim and emacs. They definitel takes some time to learn, but you can always remap the shortcuts to whatever you prefer.

User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
Contact:

Re: SL5_AHK_Refactor_engine - a Source Code Refactoring Engines for Autohotkey

23 Jul 2015, 14:56

guest3456 wrote:... , but you can always remap the shortcuts to whatever you prefer.
yes thats totally right and i thougt last hours about it. remap our VIM. should be possible directly with your VIM or possible (indirectly) with Autohotkey for sure. but for that its now a little to late for me. what i also really is autocompletition (intelisen). scite4ahk got this. your VIM dont looks so (in your video).
guest3456
Posts: 3453
Joined: 09 Oct 2013, 10:31

Re: SL5_AHK_Refactor_engine - a Source Code Refactoring Engines for Autohotkey

23 Jul 2015, 15:17

yeah, to get autocomplete working in Vim, you have to add all the commands/functions like s4ahk has. its possible just requires some work


Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: TheNaviator and 83 guests