Define tap dance for parens/braces

The keys labeled as Tab and Enter are now all the brackets.

Tap tapped once is `(`, tapped twice is `[`, tapped thrice is `{`.
Enter tapped once is `)`, tapped twice is `]`, tapped thrice is `}`.
This commit is contained in:
Gergely Polonkai 2022-06-16 12:52:43 +02:00
parent 86ca9bdcad
commit 091c29ed2e
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
3 changed files with 46 additions and 2 deletions

View File

@ -44,6 +44,8 @@
#include "Kaleidoscope-TapDance.h"
#include "TapDance.h"
enum {
MACRO_VERSION_INFO,
MACRO_ANY,
@ -94,14 +96,14 @@ enum {
KEYMAPS(
[PRIMARY] = KEYMAP_STACKED
(___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
RALT(Key_7), LSHIFT(Key_6), Key_Comma, Key_Period, Key_P, Key_Z, ___,
RALT(Key_7), LSHIFT(Key_6), Key_Comma, Key_Period, Key_P, Key_Z, TD(0),
___, Key_A, Key_O, Key_E, Key_U, Key_I,
___, RALT(Key_Comma), Key_Q, Key_J, Key_K, Key_X, Key_Tab,
Key_LeftControl, Key_Backspace, OSL(SHIFTED), Key_Escape,
OSL(FUNCTION),
M(1), Key_6, Key_7, Key_8, Key_9, Key_Backtick, MoveToLayer(HUN),
___, Key_F, Key_G, Key_C, Key_R, Key_L, LSHIFT(Key_7),
TD(1), Key_F, Key_G, Key_C, Key_R, Key_L, LSHIFT(Key_7),
Key_D, Key_H, Key_T, Key_N, Key_S, LSHIFT(Key_1),
Key_Enter, Key_B, Key_M, Key_W, Key_V, Key_Y, Key_Slash,
Key_LeftGui, Key_Enter, Key_Spacebar, OSM(LeftAlt),

25
TapDance.cpp Normal file
View File

@ -0,0 +1,25 @@
#include <Kaleidoscope.h>
#include "TapDance.h"
namespace gpolonkai {
namespace TapDance {
bool cancelOneShot = false;
}
}
void
tapDanceAction(
uint8_t tap_dance_index,
KeyAddr key_addr,
uint8_t tap_count,
kaleidoscope::plugin::TapDance::ActionType tap_dance_action
)
{
switch (tap_dance_index) {
case LEFT_PARENS:
return tapDanceActionKeys(tap_count, tap_dance_action, LSHIFT(Key_8), RALT(Key_F), RALT(Key_B));
case RIGHT_PARENS:
return tapDanceActionKeys(tap_count, tap_dance_action, LSHIFT(Key_9), RALT(Key_G), RALT(Key_N));
}
}

17
TapDance.h Normal file
View File

@ -0,0 +1,17 @@
#pragma once
#include <Kaleidoscope-TapDance.h>
enum {
LEFT_PARENS,
RIGHT_PARENS,
};
extern void
tapDanceAction(uint8_t tapDanceIndex, KeyAddr key_addr, uint8_t tapCount, kaleidoscope::plugin::TapDance::ActionType tapDanceAction);
namespace gpolonkai {
namespace TapDance {
extern bool cancelOneShot;
}
}