Sublime / VSCode keyboard shortcuts

Discuss other useful utilities, general computing tips & tricks, Internet resources, etc.
meowzermylikers
Posts: 1
Joined: 29 Nov 2017, 09:09

Sublime / VSCode keyboard shortcuts

29 Nov 2017, 09:25

Hello all,


It's been a while since I dove into the AHK world, I've been playing in the JavaScript side of things recently. Since using Sublime Text and VSCode, I've gotten spoiled with their common shortcuts, mainly ctrl+d, ctrl+enter, alt+down(or up), and alt+shift+down(or up)... and I find myself trying to use them everywhere, inside emails, Word, etc... I've looked around a bit trying to find a method of incorporating these shortcuts globally, no luck.

Does anyone have any suggestions?

When thinking about how to accomplish this, it reminded me of playing around with AHK a few years ago. I'm tempted to take a crack at it, probably try WinGetText first, unless someone more knowledgeable has a suggestion?


Thanks in advance for any advice you can offer.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Sublime / VSCode keyboard shortcuts

29 Nov 2017, 11:48

These?
Keyboard Shortcuts - Windows/Linux — Sublime Text Unofficial Documentation
http://docs.sublimetext.info/en/latest/ ... s_win.html
Visual Studio Code Key Bindings
https://code.visualstudio.com/docs/gets ... eybindings

Generally I would use the Clipboard variable, ClipWait and Send/SendInput for things like this. EM_GETSEL can be useful if it's an Edit control. It would help if you could make a full list of all the shortcuts and what they do. Cheers.

One similar thing that I do is duplicate line:

Code: Select all

#IfWinActive, ahk_class IEFrame
^d:: ;internet explorer - duplicate line
ClipSaved := ClipboardAll
Clipboard := ""
SendInput, {Up}{Home}+{End}^c
ClipWait, 3
SendInput, {Down}{End}^v
Sleep, 200
Clipboard := ClipSaved
return
#IfWinActive

#IfWinActive, ahk_class Notepad
^d:: ;notepad - text functions - copy line above (duplicate line above)
WinGet, hWnd, ID, A
ControlGet, vCurrentLineNum, CurrentLine,, Edit1, % "ahk_id " hWnd
ControlGet, vText, Line, % vCurrentLineNum-1, Edit1, % "ahk_id " hWnd
Control, EditPaste, % vText, Edit1, % "ahk_id " hWnd
return
#IfWinActive
[EDIT:] Further links:
Visual Studio: duplicate line - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=35918
MS Word: duplicate line - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=40925
Last edited by jeeswg on 05 Dec 2017, 08:04, edited 2 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
davebrny
Posts: 85
Joined: 05 Dec 2016, 06:26

Re: Sublime / VSCode keyboard shortcuts

05 Dec 2017, 07:48

ive had the same problem ever since i started using sublime text. using the hotkeys in other programs but even worse is trying to use multiple cursors :headwall:

recently i put all the built in windows hotkeys into functions so they would read as plain english like: caret("select to start of word") instead of send ^+{left}
https://github.com/davebrny/caret

Code: Select all

caret("select line")
caret("insert line after")
caret("delete to end of line")
other commands that i have almost finished: duplicate, join line, split line, indent and unindent, expand selection to word.
then there are others like swap line up/down and expand selection to paragraph that sort of work but not in some situations so i might end up putting them into another branch instead

Return to “Other Utilities & Resources”

Who is online

Users browsing this forum: No registered users and 44 guests