How can I remap broken arrow key via hidutil? - macos

I have the arrow keys of the keyboard broken so I though to use the combination Ctrl + "asdw" instead. As an example, if we want to change the down arrow key, my question is: how can I remap it to Ctrl + s. Through KeyCode I got that Ctrl + s is:
Also,
How can I add it to hidutil code knowing that the down arrow code is 0x700000051?
Thanks,

At the end, since I want to replace the arrowkeys for Ctrl + "asdw", I decided to employ a specific third-party app which I read in the comments of a post: BetterTouchTool. Since the remap is done easily, at the end I replaced all the arrows with Fn + "asdw", as well as any combination of Opt/Ctr/Cmd + arrow with Opt/Ctr/Cmd + Fn + "asdw". It is not the best solution but it works nicely fine!

Related

How to make a multiline cursor without using a mouse in Sublime text 3?

The only way to make a multiline cursor in Sublime text 3 is Ctrl+Shift+RC+Drag. Is there any way to do this without using a mouse?
Yes, there is. Using Shift↓ or Shift↑, select the lines you want multiple cursors on. Next, hit CtrlShiftL (CommandShiftL on macOS) to split the selection into lines. Finally, hitting ← will put the cursors at the beginning of the lines, while → will put them at the end.
Edit
There is also another, quicker way (thanks to minitech) - CtrlAlt↑/↓ will create multiple cursors without having to do selections first, and you can place the cursors anywhere in the line you wish. However, on Windows these key combos may be mapped to changing the screen orientation. To change this, hit CtrlAltF12 to open the Intel control panel, click Options, and either remap the screen orientation hotkeys, or click Off on the left side to disable all of them.
You can use Middle mouse button for this as well.
Click & Hold Middle mouse button and drag up and down
Standard key bindings not work for me(Ubuntu 16.4 and Win 10), but after redefining works good! To redefine default key bindings use (Preferences->Key Bindings)
{ "keys": ["alt+shift+down"], "command": "select_lines", "args":{"forward": true} } will add cursor below, { "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} } will add cursor above.
MAC: ctrl ( ^ ) + Shift + up / down arrow
ctrlShiftup arrow
ctrlShiftdown arrow
What works for me on a window 10 Surface Pro is
Ctrl + Alt + up/down
Because Ctrl + Alt + up/down already works for me, there is no need to do another key binding. I have it set up the same way for VS Code as well: Ctrl + Alt + up/down.
Or you can also map it as Yaroslav says (which I voted up), which works as well.
In Ubuntu, the accepted answer works. Also, you can do:
Shift + Alt + Key up/down
It was much simpler for me than any other answers above: Just hold ctrl and click on your mouse placing it where you want to have the second or third cursor.

Shorten code automatically in Xcode

I was wondering if it was possible to shorten code automatically in the last version of xcode. You know, when you press on the side of a void method for example and the (...) appear, and you have a shorter page. Is there a command to do it?
Click on the Editor>Code Folding menu and you'll see all your options for this, along with the keyboard shortcuts.
The shortcut is cmnd + shift + option + left arrow key. This will collapse all functions.
You can press command + alt + left cursor key on your keyboard to fold your codes or press command + alt + right cursor key to unfold. Make sure your pointer is inside of the curly brackets.

Why does pressing the arrow keys while something is running in bash produce "^[[A^[[C^[[B^[[D"?

Let's say you run the command
find . -iname bob
While it is running, pressing various letters on your keyboard inserts it before the standard output of the next line produced by "find". However, pressing the up arrow produces "^[[A". Is this some keyboard shortcut for the arrow keys?
I am currently imagining it is something like CTRL + ? + A since CTRL + C produces "^C".
Is this some keyboard shortcut for the arrow keys?
Correct. The terminal generates these character sequences when extended keys are pressed, and it is up to the software (e.g. readline) to interpret these sequences appropriately.
I am currently imagining it is something like CTRL + ? + A since CTRL + C produces "^C".
Also correct. It is Ctrl[, just as shown.

How to uncomment multiple lines of code in Visual Studio

I did a ctrl K + ctrl C (adds // to a line) on a lot of lines of code that I need uncommented. What is the quick key method to uncomment code in Visual studio?
Ctrl+K, Ctrl+U removes the // comments
I believe it is Ctrl + K, Ctrl + U.
Ctrl + K, Ctrl + U.
There is also a button for it on the Standard toolbar.
ctrl + /
can be used for adding and removing comments.
Try + U or click the little icon on the toolbar.
If you're using Resharper, there is a much nicer alternative:
just right Alt + / for both
By using this single shortcut, you can simply toggle between commenting/uncommenting code, without having to remember/switch between two shortcuts for each.
Ctrl + K + C (to comment) and Ctrl + k + U (to uncomment the code)
Or
or use Ctrl + / (for the same)
Qwerty: Ctrl + /
Azerty: Ctrl + :
Just wanted to add, that in the latest version of VS, ctrl + u makes it caps. They instead made it a toggle command, so it is actually just ctrl + k again to make it uncommented.
I have the german keyboardlayout.
VSCode-x64-1.52.1
To leave a comment:
You have to highlight the code, then push
Ctrl + #
or
Ctrl+K, stay at Ctrl and push C
to commen out:
Ctrl + #, it toggles on/off the comment
or
Ctrl + K, stay at Ctrl and push U
Mine was a bit different. It is ctrl-shift-C to comment and ctrl-shift-alt-C to uncomment.
I am using Visual Studio Community 2017.
Ctrl + Q alternates between comment and uncomment.
Unfortunately Ctrl K Ctrl U does not work in few environments, rather it adds instead of removing. My case on windows, using composer file I faced Ctrl K Ctrl U not working.
I m using VS Code, ver 1.36.1
links to all keys short cuts: https://code.visualstudio.com/docs/getstarted/keybindings
In Visual C++ 2019 Ctrl + Shift + / both comments and uncomments.

Visual Studio 2010 Keyboard Shortcut Chords

I started out with VB6 default shortcuts where Ctrl + R brings up the Solution Explorer window.
Now when I hit Ctrl + R I see a status message saying that VS is waiting for me to hit the next sequence in the chord, suggesting to me that I have shortcuts that begin with Ctrl + R but require another keystroke.
This suggests to me that having one or more shortcut sequences that begin with Ctrl + Rinvalidates the Ctrl + R shortcut, which I can understand, but the question is, how do I find what those command are so I can assign a different sequence to them?
Also, shouldn't VS warn me when assigning the first chord shorcut that begins with Ctrl + R that this will invalidate my Ctrl + R shortcut or, it should clear it out so Ctrl + R is no longer a shortcut for the Solution Explorer window.
Anyway, I guess the question is how do I locate the commands that begin with Ctrl + R so I can change them so they dont collide with my Solution Explorer shortcut Ctrl + R?
In VS 2010, Tools | Options | Environment | Keyboard gets you to the right place. Now, put the cursor in Press shortcut keys, and press the keys you are interested in (so Ctrl + R). The Shortcut currently used by dropdown will then show you all the shortcuts that currently involve the keys you have pressed.
I agree it would be a 'nice to have' for VS to warn about overlapping shortcuts, but note that different shortcuts can have different scopes of effect (in the Use new shortcut in dropdown), so this might not be as easy as it sounds.
The keybindings poster from MSDN might be helpful. It looks Ctrl + R behaves differently depending on if you are debugging or not.
Have a look at IntelliCommand Plugin. This helped me out a lot in learning and remembering the chrod combinations.
Also Learn the shortcut Plugin is pretty cool too.

Resources