From c3c39434324b9aa2739ef03c412e157d3a883947 Mon Sep 17 00:00:00 2001
From: Keith Long <kjlong14@gmail.com>
Date: Fri, 10 Apr 2020 14:53:13 -0700
Subject: [PATCH] =?UTF-8?q?[Keymap]=20added=20vim=20compatibility,=20backs?=
 =?UTF-8?q?pace=20above=20enter,=20and=20general=20macOS=20opt=E2=80=A6=20?=
 =?UTF-8?q?(#8080)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* added vim compatibility, backspace above enter, and general macOS optimizations on top of default layout

* add space65 macOS keymap for vim users with an optimized bottom row

* Update keyboards/projectkb/alice/keymaps/keithlo/keymap.c
---
 .../space65/keymaps/keithlo/keymap.c          |  63 +++++++++++
 .../space65/keymaps/keithlo/readme.md         | 107 ++++++++++++++++++
 .../projectkb/alice/keymaps/keithlo/keymap.c  |  43 +++++++
 3 files changed, 213 insertions(+)
 create mode 100644 keyboards/gray_studio/space65/keymaps/keithlo/keymap.c
 create mode 100644 keyboards/gray_studio/space65/keymaps/keithlo/readme.md
 create mode 100644 keyboards/projectkb/alice/keymaps/keithlo/keymap.c

diff --git a/keyboards/gray_studio/space65/keymaps/keithlo/keymap.c b/keyboards/gray_studio/space65/keymaps/keithlo/keymap.c
new file mode 100644
index 0000000000..9efc3fd84a
--- /dev/null
+++ b/keyboards/gray_studio/space65/keymaps/keithlo/keymap.c
@@ -0,0 +1,63 @@
+/* Copyright 2019 MechMerlin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+  /* Qwerty
+   * ,------------------------------------------------------------------------------------------------.
+   * | ESC |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  |  -  |  =  |   BSPC    | DEL  |
+   * |------------------------------------------------------------------------------------------------+
+   * |  TAB  |  Q  |  W  |  E  |  R  |  T  |  Y  |  U  |  I  |  O  |  P  |  [  |  ]  |    \    | INS  |
+   * |------------------------------------------------------------------------------------------------+
+   * |   CAPS  |  A  |  S  |  D  |  F  |  G  |  H  |  J  |  K  |  L  |  ;  |  '  |    Enter    | PGUP |
+   * |------------------------------------------------------------------------------------------------+
+   * |   Shift   |  Z  |  X  |  C  |  V  |  B  |  N  |  M  |  ,  |  .  | ?/ |   Shift   |  Up  | PGDN |
+   * |------------------------------------------------------------------------------------------------+
+   * | Ctrl |  Alt  |  Cmd |    Space   |  Fn  |      Cmd     |  Alt |  Fn  |    | Left | Down |Right |
+   * `----------------------------------------------------------------------'    '--------------------'
+   */
+
+[0] = LAYOUT( \
+      KC_ESC,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC, KC_BSPC, KC_DEL,  \
+      KC_TAB,           KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC, KC_RBRC, KC_BSLS, KC_INS,  \
+      KC_CAPS,          KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_ENT,           KC_PGUP, \
+      KC_LSFT, KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT,          KC_UP,   KC_PGDN, \
+      KC_LCTL, KC_LALT, KC_LGUI,                 KC_SPC,   MO(1),          KC_RGUI,            KC_RALT,    MO(1),          KC_LEFT, KC_DOWN, KC_RGHT  \
+    ),
+
+  /* Fn Layer
+   * ,------------------------------------------------------------------------------------------------.
+   * |     |  F1 |  F2 |  F3 |  F4 |  F5 |  F6 |  F7 |  F8 |  F9 | F10 | Vol- | Vol+ |  Mute   | Mute |
+   * |------------------------------------------------------------------------------------------------+
+   * |        |RGB T|RGB M| Hue-| Hue+| Sat-| Sat+| Val-| Val+|      |      |    |      |      |      |
+   * |------------------------------------------------------------------------------------------------+
+   * |         | RGBP | RGPG | RGPK |    |     | Left| Down| Up |Right|     |    |  Play/Pause |      |
+   * |------------------------------------------------------------------------------------------------+
+   * |           |     |     |     |     |     |     |     |    | Scr- | Scr+ |         | PgUp |      |
+   * |------------------------------------------------------------------------------------------------+
+   * |      |       |      |            |      |              |     |      |     | Home | PgDn |  End |
+   * `---------------------------------------------------------------------'     '--------------------'
+   */
+
+[1] = LAYOUT( \
+      KC_TRNS, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_VOLD, KC_VOLU, KC_MUTE, KC_MUTE,  KC_MUTE, \
+			KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, RGB_SPD,  RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,          \
+			KC_TRNS, RGB_M_P, RGB_M_G, RGB_M_K, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP,   KC_RIGHT, KC_TRNS, KC_TRNS, KC_MPLY, KC_TRNS,                   \
+			KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BRID,  KC_BRIU, KC_TRNS, KC_TRNS, KC_PGUP, KC_TRNS,          \
+			KC_TRNS, KC_TRNS, KC_TRNS,                   KC_TRNS, KC_TRNS, KC_TRNS,          KC_TRNS,  KC_TRNS,          KC_HOME, KC_PGDN, KC_END            \
+    ),
+};
diff --git a/keyboards/gray_studio/space65/keymaps/keithlo/readme.md b/keyboards/gray_studio/space65/keymaps/keithlo/readme.md
new file mode 100644
index 0000000000..d8673643ef
--- /dev/null
+++ b/keyboards/gray_studio/space65/keymaps/keithlo/readme.md
@@ -0,0 +1,107 @@
+## Space65 layout (with split space row -- no pun intended)
+
+This layout is optimized for vim users on MacOS.
+The split space row == least travel possible (I've found). Coming from an Alice this is the only way I can find myself going back to a non-ergonomic 6X% board
+
+###### Settings:
+
+* The `ALT` and `CMD` keys are swapped to replicate the Mac layout
+* vim-style arrow key bindings H J K L in Fn layer
+
+###### Flashing:
+
+* v1 PCB: in order to toggle BootLoader from a factory PCB you must hold down ESC + Modifier MO(1) before you plug the board in
+* otherwise you just hold ESC before you plug the board in
+* Next, to make the .hex file and subsequently flash the board run:
+
+```$ make gray_studio/space65:keithlo:flash # be in the qmk_firmware directory to do this ```
+* more info at the bottom if you're getting errors 
+
+
+### Qwerty
+```
+,------------------------------------------------------------------------------------------------.
+| ESC |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  |  -  |  =  |   BSPC    | DEL  |
+|------------------------------------------------------------------------------------------------+
+|  TAB  |  Q  |  W  |  E  |  R  |  T  |  Y  |  U  |  I  |  O  |  P  |  [  |  ]  |    \    | INS  |
+|------------------------------------------------------------------------------------------------+
+|   CAPS  |  A  |  S  |  D  |  F  |  G  |  H  |  J  |  K  |  L  |  ;  |  '  |    Enter    | PGUP |
+|------------------------------------------------------------------------------------------------+
+|   Shift   |  Z  |  X  |  C  |  V  |  B  |  N  |  M  |  ,  |  .  | ?/ |   Shift   |  Up  | PGDN |
+|------------------------------------------------------------------------------------------------+
+| Ctrl |  Alt  |  Cmd |    Space   |  Fn  |      Cmd     |  Alt |  Fn  |    | Left | Down |Right |
+`----------------------------------------------------------------------'    '--------------------'
+```
+
+### Fn Layer
+```
+,------------------------------------------------------------------------------------------------.
+|     |  F1 |  F2 |  F3 |  F4 |  F5 |  F6 |  F7 |  F8 |  F9 | F10 | Vol- | Vol+ |  Mute   | Mute |
+|------------------------------------------------------------------------------------------------+
+|        |RGB T|RGB M| Hue-| Hue+| Sat-| Sat+| Val-| Val+|      |      |    |      |      |      |
+|------------------------------------------------------------------------------------------------+
+|         | RGBP | RGPG | RGPK |    |     | Left| Down| Up |Right|     |    |  Play/Pause |      |
+|------------------------------------------------------------------------------------------------+
+|           |     |     |     |     |     |     |     |    | Scr- | Scr+ |         | PgUp |      |
+|------------------------------------------------------------------------------------------------+
+|      |       |      |            |      |              |     |      |     | Home | PgDn |  End |
+`---------------------------------------------------------------------'     '--------------------'
+
+
+Fn Layer Mapping   chars -> RGB commands
+|------------------------------------------------------------------------------------------------+
+|        |RGB T|RGB M| Hue-| Hue+| Sat-| Sat+| Val-| Val+|      |     |     |      |      |      |
+|------------------------------------------------------------------------------------------------+
+|        |  Q  |  W  |  E  |  R  |  T  |  Y  |  U  |  I  |      |     |     |      |      |      |
+|------------------------------------------------------------------------------------------------+
+
+|------------------------------------------------------------------------------------------------+
+|         | RGBP | RGPG | RGPK |    |     | Left| Down| Up |Right|     |    |  Play/Pause |      |
+|------------------------------------------------------------------------------------------------+
+|         |  A   |   S  |   D  |    |     |  H  |  J  | K  |  L  |     |    |    Enter    |      |
+|------------------------------------------------------------------------------------------------+
+```
+
+
+###### Flashing (debugging)
+* Make sure you are holding ESC + MO(1) when you plug board in
+* Release ESC + MO(1) if you are stuck in the ```dfu-programmer: no device present.
+ERROR: Bootloader not found. Trying again in 5s.``` loop seen below
+
+* You should see a screen like this when you make and flash 
+```
+qmk_firmware git:(master)$ make gray_studio/space65:keithlo:flash
+QMK Firmware 0.8.107
+Making gray_studio/space65 with keymap keithlo and target flash
+
+avr-gcc (GCC) 8.3.0
+Copyright (C) 2018 Free Software Foundation, Inc.
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+Size before:
+   text	   data	    bss	    dec	    hex	filename
+      0	  21836	      0	  21836	   554c	.build/gray_studio_space65_keithlo.hex
+
+Copying gray_studio_space65_keithlo.hex to qmk_firmware folder                                      [OK]
+Checking file size of gray_studio_space65_keithlo.hex                                               [OK]
+ * The firmware size is fine - 21836/28672 (76%, 6836 bytes free)
+dfu-programmer: no device present.
+ERROR: Bootloader not found. Trying again in 5s.
+dfu-programmer: no device present.
+ERROR: Bootloader not found. Trying again in 5s.
+Bootloader Version: 0x00 (0)
+Erasing flash...  Success
+Checking memory from 0x0 to 0x6FFF...  Empty.
+Checking memory from 0x0 to 0x557F...  Empty.
+0%                            100%  Programming 0x5580 bytes...
+[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]  Success
+0%                            100%  Reading 0x7000 bytes...
+[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]  Success
+Validating...  Success
+0x5580 bytes written into 0x7000 bytes memory (76.34%).
+qmk_firmware git:(master)$
+```
+
+
+shoutout @billiams for the base ascii art template
diff --git a/keyboards/projectkb/alice/keymaps/keithlo/keymap.c b/keyboards/projectkb/alice/keymaps/keithlo/keymap.c
new file mode 100644
index 0000000000..c6801308aa
--- /dev/null
+++ b/keyboards/projectkb/alice/keymaps/keithlo/keymap.c
@@ -0,0 +1,43 @@
+/*
+Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include QMK_KEYBOARD_H
+
+
+// Each layer gets a name for readability, which is then used in the keymap matrix below.
+// The underscores don't mean anything - you can have a layer called STUFF or any other name.
+// Layer names don't all need to be of the same length, obviously, and you can also skip them
+// entirely and just use numbers.
+#define _BASE 0
+#define _FN1 1
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+  [_BASE] = LAYOUT_default(
+    KC_ESC,  KC_TILD, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,   KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSLS, KC_DEL,
+    KC_PGUP, KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,             KC_Y,   KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC, KC_RBRC, KC_BSPC,
+    KC_PGDN, KC_CAPS, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,             KC_H,   KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,          KC_ENT,
+             KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,             KC_B,   KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT, KC_RGUI,
+             KC_LCTL,          KC_LCMD, KC_SPC,  MO(_FN1),                          KC_RCMD,           KC_RALT,          KC_RCTL
+  ),
+
+  [_FN1] = LAYOUT_default(
+    RGB_TOG,  _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_VOLD, KC_VOLU, _______, KC_MUTE,
+    RGB_MOD,  _______,  _______, KC_UP,  _______, _______, _______,          RGB_SAI, RGB_HUI, RGB_VAI, _______, KC_F11,  KC_F12, _______, _______,
+    RGB_RMOD, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______,          KC_LEFT, KC_DOWN, KC_UP  , KC_RIGHT, _______, _______,          _______,
+              _______, BL_INC,  BL_DEC,  BL_TOGG, BL_BRTG, _______,          RGB_SAD, RGB_HUD, RGB_VAD, _______, _______, _______, _______, _______,
+              _______,          _______, _______, _______,                            _______,          _______,          RESET
+  )
+};