Autohotkey Control + Capslock issue - keyboard

I am using Autohotkey to make it so that you have to hit Shift + CapsLock in order to activate capslock. Then just pressing capslock gets you out of capslock. I love this script, however, when I switch tabs in chrome using Control + Tab, I sometimes end up hitting Contorl + Capslock, which activates capslock. Here is my code:
; Only allow capslock if it's shift-capslock
$SC03a::
GetKeyState,caps,CapsLock,T
if caps = D
SetCapsLockState,Off
return
I don't know how to get around this. Any ideas?

Only allow capslock if it's shift-capslock:
CapsLock::SetCapslockState AlwaysOFF
+CapsLock::SetCapslockState AlwaysON

Related

How to remap keys after Alt+Tab/Ctrl+Tab while Alt/Ctrl is currently being held?

I am trying to use VIM a lot in my day to day life, and I prefer not to move my hands away from the home row. That being said I do alt tab/ctrl tab a lot, but its tedious to keep pressing TAB to cycle applications. When you press Alt+tab and keep alt pressed down, i would like to remap hjkl to the arrow keys only when ALT is currently held down AFTER pressing ALT+Tab. Is it possible to do this in AutoHotKey?
Yes, it is possible. I'd suggest doing some research about hotkeys within hotkeys and come back with a script we can help you tweak.
when you press Alt+Tab you enter a new framework called the MultitaskingViewFrame
so you need to work from within this context.
try this:
#IfWinActive ahk_class MultitaskingViewFrame
i::up
j::left
k::down
l::right
#IfWinActive

How to generate a try catch code block automatic in Android Studio by shortcut?

In Eclipse, when I enter code Thread.sleep(100), the code will be wrappered by try catch after entering keys: ctrl+1 and enter. In Android studio what can I do for wrapper it by try catch easily? Is there a shortcut?
Highlight the code you want to surround with try/catch
For Windows it is:
Press Ctrl + Alt + t
For Mac it is:
Press cmd + Alt + t
Select the item you want (#7 for try / catch)
There is no need to "type" try first however, highlighting your code works better.
Highlight the necessary code you need to surround with, and press one of the key combinations depending upon your Operating System.
Windows:
Ctrl + Alt + T
Linux(Ubuntu):
Ctrl + Windows + Alt + T
Mac:
Cmd + Alt + T
A list of Surround With options would pop (like in the below image). You can select the appropriate item of your choice either by pressing the respective number of the item on keyboard or manually via mouse click.
Type "try",
then press alt + ctrl + t,
then select "try / catch".
In Ubuntu Gnome, Ctrl + Alt + T has been taken already by "Launch terminal", run command gnome-control-center keyboard to check:
Either you disable it by press Back Space OR use Ctrl + Alt + Win + T as alternative.
Keep in mind that if "try / catch" option doesn't shows up, it might caused by warning such as "unexpected token" in your code. You need to fix it first.
Try this
Write 'try'
select this word(try)
press Ctrl-Alt-T
Select appropriate one
On Mac it's: cmd + alt + T. Also for most used shortcuts in Android Studio I'd recommend this link http://www.developerphil.com/android-studio-tips-of-the-day-roundup-2/
Select the code you want to surround with try/catch and press Alt + Shift + Z, this will bring up try/catch along with any other applicable templates like this:
To generate a try/catch block type 'try' and press ctrl + space.
The Ctrl + Shift + T shortcut launches the terminal in the eclipse version I am using - 2019-03.
Short Cut of Generating predefined/custom templates
Press Ctrl + Alt + T
Short Cut of Generating predefined/custom templates
Press Ctrl + Alt + T
Surround with many blocks like
try/catch
try/catch/finally
if
if/else
{}
< Edit fold > Commits

Remapping Alt+` to ESC

My Esc key is broken on my keyboard, and I would like to remap it to Alt+` (that's Alt and ` grave accent, same button as the ~ tilde). However:
!`::Esc
will trigger Alt+Esc when pressed (!Esc) because the Alt key is held down. How do I remap Alt+` so that, when pressed, it will trigger Esc rather than Alt+Esc?
EDIT: I am not opposed to using an entirely different program to remap my keys. I just want to remap ALT+` to
the Esc key in all of my Windows.
Use SendPlay:
!`::sendplay {Esc}
SendPlay [...] buffers any physical keyboard or mouse activity during the send, which prevents the user's keystrokes from being interspersed with those being sent.
I found two possible ways to achieve this.
Use BlockInput
Disables or enables the user's ability to interact with the computer via keyboard and mouse.
!p::
BlockInput On
send {Esc}
BlockInput, Off
return
You might need to run the script as administrator and the alt and/or p may get stuck down, which led me to the second solution.
Use KeyWait
Waits for a key or mouse/joystick button to be released or pressed down.
!p::
KeyWait, Alt
send {Esc}
return
This should work:
!`::
SendInput, {Alt Up}{Esc}
Return

IntelliJ Column Selection using Cursor Keys

Is it possible to some how setup IntelliJ IDEA so that I can column select with the cursor keys similarly to how I might in Notepad++, Visual Studio, or FlashDevelop.
For instance when I'm typing code I almost always do my navigation solely through use of the keyboard. In the IDEs mentioned previously I can quickly select blocks of code by holding Shift + Alt then tapping ↑ to extend my cursor across the lines above. I can then hold Shift + Alt + Ctrl and tap ← or → to quickly jump across words and select the chunk of text I want.
In IntelliJ IDEA I have to constantly enable and disable Column Selection Mode using the Shift + Alt + Insert and even then it doesn't quite function as it does in the other IDEs or Text Editors.
Any ideas?
You can do column editing using the Edit | Column Selection Mode.
The shortcut to turn it on/off is Alt+Shift+Insert. You navigate with arrow keys to select blocks of text.
Multiline Caret (without mouse)
Windows/Linux: CTRL + CTRL(Hold) + ↑ / ↓
Mac: ⌘ + ⌘(Hold) + ↑ / ↓
ESC will end multiline mode.
Change Multi-caret Hotkey
To add a custom Keymap, CTRL+SHIFT+A, type keymap and click on the one with Settings as subtext. Search for Clone Caret Above and Clone Caret Below.
I mapped mine to ALT+SHIFT+↑ / ↓.
Bonus
Try holding combinations of CTRL, SHIFT, and arrows for improved selection power.
It is also possible to select holding middle mouse key.
Go to the Settings | Keymap and set a shortcut for Clone Caret Above and for Clone Caret Below
Most convenient way is to:
MAC: Hold Option+Shift and click with mouse.
Windows: Hold Alt and click with mouse.
On a mac, to toggle block select on/off:
shift command 8
⇧⌘8
For me on Mac:
Press once 'option' key, release it, and press and hold it again.
Now navigate with cursor to select desired code.
Press 'Esc' to exit column mode! :)
I think #Meo's answer is the most correct, but if your hand happens to be on the mouse, you can also accomplish this with Ctrl+Alt+Shift+Left Mouse Button Click. Or look for the Add Rectangular Selection on Mouse Drag in the keymap settings.
In Windows or Linux I press two times Ctrl
For Mac cmd+shift+* didn't work for me. I changed the keymap to something else and now it works seamlessly.

How do I type CTRL + ] on a QWERTZ keyboard (in order to jump to a tag with Vim)?

In Vim, the usual way to jump to the definition of the keyword under the cursor is to type CTRL-] (as claimed by :he CTRL-\]).
But when you have a QWERTZ keyboard (see below, Strg is Ctrl), you're in some trouble: there is no separate ] key on the keyboard; you'll have to press ALT GR-9 to type the ]. So, to jump to a tag, it`s neccessary to hit CTRL-ALT GR-9 which doesn't work (and is also not feasible because you'll break your fingers if you happen to use that often).
So, how could I jump to a tag using my QWERTZ keyboard?
In addition, I'd also be glad if someone could explain why pressing CTRL-ALT GR-9 does not work.
Edit:
I'm not interested in the obvious answers "remap to something else" or "press the mouse button".
Duplicate on Vi/Vim: https://vi.stackexchange.com/questions/5732/tag-navigation-using-ctrl-does-not-work-with-non-english-keyboard-on-windows
As weird as it reads, on AZERTY keyboards (french layout specifically) $ is at the same spot as ] on QWERTY keyboards so I must hit <C-$> to jump to definition.
See if <C-+> does the trick.
On an AZERTY keyboard press:
ctrl shift 8 to go to List item
ctrl shift 7 to go from
The same in excel as
ctrl [
ctrl ]
On a QWERTZ mac keyboard Ctrl+option+6 worked for me. And jumping back worked as expected with Ctrl+T or Ctrl+O.

Resources