Last active
December 18, 2023 14:24
-
-
Save mshannaq/fc63b98337a01ea4a05fb871229c4f4d to your computer and use it in GitHub Desktop.
define 'Home' and 'End' on MacOS (uses Microsoft Keyboard) to be like Microsoft Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As you know in Microsoft Windows there is a button 'Home' which go to the begning of line and and button 'End' goes to the end of line. | |
In MacOS if you use Keyboard others that Mac Keyboard you cannot use 'Home' and 'End' button because it is not defined. | |
buu sure you can customize it and use it exactly as you use on Microsoft Keyboard | |
to do that open terminal and goto folder `~/Library/KeyBindings/` by running the command | |
```bash | |
cd ~/Library/KeyBindings/ | |
``` | |
if the folder `KeyBindings` does not exists you can make it by running the command | |
``` | |
cd cd ~/Library | |
mkdir KeyBindings | |
``` | |
then goto the folder `KeyBindings` and create a new file names `DefaultKeyBinding.dict` using | |
``` | |
cd ~/Library/KeyBindings/ | |
nano DefaultKeyBinding.dict | |
``` | |
and Add the following code to the file and save it | |
``` | |
{ | |
"\UF729" = moveToBeginningOfLine:; // home | |
"\UF72B" = moveToEndOfLine:; // end | |
"$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift-home | |
"$\UF72B" = moveToEndOfLineAndModifySelection:; // shift-end | |
} | |
``` | |
this will define the `home` button. to goto begning of line and define the end button to go to the end of line. | |
Applying changes requires reopening applications. | |
DefaultKeyBinding.dict is ignored by some old versions of Xcode (works with latest version 6.3.1), Terminal, and many cross-platform applications. | |
this was tested on MacOS 14.2 (Sonoma) | |
also you can take a look into this https://gist.github.com/trusktr/1e5e516df4e8032cbc3d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment