Change keyboard shortcuts

The popular SciTE-based AutoHotkey Script Editor
carsonma
Posts: 8
Joined: 21 Oct 2017, 15:27

Change keyboard shortcuts

03 Mar 2024, 15:26

Apologies if this has been answered before. (I assume that it has, but I couldn't find anything with search.)

Is it possible to change the keyboard shortcuts?

Specifically, I want to change the toggle comment shortcut. I like to make them all the same across all my editors/IDES. e.g., Ctrl + Q toggles comments in SciTE4AutoHotkey, but in R Studio it closes the software; you can probably imagine the problem here.
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: Change keyboard shortcuts

03 Mar 2024, 16:20

I don't have SciTE4AutoHotkey installed anymore, so I can't check myself, but are its keyboard shortcuts available to be changed in the SciTEUser.properties file as described here?
carsonma
Posts: 8
Joined: 21 Oct 2017, 15:27

Re: Change keyboard shortcuts

05 Mar 2024, 15:12

It might be possible, but I'm not sure what the available options are since there aren't any already in the file. This is all that's in it now.

Code: Select all

# User initialization file for SciTE4AutoHotkey
#
# You are encouraged to edit this file!
#

# Import the platform-specific settings
import _platform

# Import the settings that can be edited by the bundled properties editor
import _config

# Add here your own settings
carsonma
Posts: 8
Joined: 21 Oct 2017, 15:27

Re: Change keyboard shortcuts

05 Mar 2024, 15:20

I found this:

Code: Select all

IDM_BLOCK_COMMENT	Block Comment or Uncomment
IDM_BOX_COMMENT	Box Comment
here: https://www.scintilla.org/CommandValues.html

But still not sure how to assign a keyboard shortcut to it *and* if it masks the default keyboard shortcut.

(Sorry for multiple posts; I couldn't figure out how to edit the previous one.
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: Change keyboard shortcuts

05 Mar 2024, 16:02

Ctrl+q seems to be a built-in SciTE hotkey. It can surely be changed somewhere, but a context-sensitive hotkey in a general hotkey script (which you might run already) should be able to block it:

Code: Select all

#Requires AutoHotkey v2.0 
#HotIf WinActive("ahk_class SciTEWindow")
^q::return	; block Ctrl and q
#HotIf
(or the AHK v1 equivalent with #If, if you like)


In my SciTE4AHK, NumpadSub still toggles block comments, though.

If you want to choose a different key (combo), you can add this section from SciTEGlobal.properties to your SciTEuser.properties file:

Code: Select all

# User defined key commands
user.shortcuts=\
Ctrl+Shift+V|IDM_PASTEANDDOWN|\
Ctrl+PageUp|IDM_PREVFILE|\
Ctrl+PageDown|IDM_NEXTFILE|\
KeypadPlus|IDM_EXPAND|\
KeypadMinus|IDM_BLOCK_COMMENT|\
Ctrl+F1|IDM_HELP_SCITE|
and change the line

Code: Select all

KeypadMinus|IDM_BLOCK_COMMENT|\
to something you prefer, if you don't want to use KeypadMinus (aka NumpadSub in AHK) which currenty would toggle block comments. You can see the used syntax in the other shortcuts. You might have to google for some keynames as they might differ from the AHK nomenclature, like Keypadminus showed. If you like, change other shortcuts as well.

I found these "user definitions" in SciTEGlobal.properties and I highly doubt that I put them there (probably it was the SciTE4AHK maintainer). Saving the changed SciTEuser.properties file will overwrite the settings in the global properties file (so don't edit that file) - after a restart of SciTE4AHK.
carsonma
Posts: 8
Joined: 21 Oct 2017, 15:27

Re: Change keyboard shortcuts

26 Mar 2024, 22:14

Sorry for the late reply to this; it's been a difficult few weeks.

I tried it out, and it works perfectly! Thanks for the help.

Apropos of nothing, I also was able to find out how to add Alt+Up/Alt+Down to move selected lines up and down. I had to share because I was so excited haha.

Apparently this does it:
Alt+Up|2620|\
Alt+Down|2621|

Return to “SciTE4AutoHotkey”

Who is online

Users browsing this forum: No registered users and 32 guests