Hello,
I wrote a kind of vi mode with the leader plugin to notably do the movement like
number + movement with selection and after you can apply a command like delete (delete), cut (Ctrl+X), copy (Ctrl+C) in a classical text editor.
It is useful if you want for instance cut the next 15 lines like 15dd in vi.
Exemple of code with leader plugin :
static void moveNLinesAfter(uint8_t seq_index, int n) {
Macros.play(MACRO(D(LeftShift)));
for (int i = 0; i < n; i++) {
Macros.play(MACRO(T(DownArrow)));
}
}
static void move1LinesAfter(uint8_t seq_index) { moveNLinesAfter(seq_index, 1);}
static void move2LinesAfter(uint8_t seq_index) { moveNLinesAfter(seq_index, 2);}
static void move3LinesAfter(uint8_t seq_index) { moveNLinesAfter(seq_index, 3);}
static void move4LinesAfter(uint8_t seq_index) { moveNLinesAfter(seq_index, 4);}
static void move5LinesAfter(uint8_t seq_index) { moveNLinesAfter(seq_index, 5);}
static void move6LinesAfter(uint8_t seq_index) { moveNLinesAfter(seq_index, 6);}
static void move7LinesAfter(uint8_t seq_index) { moveNLinesAfter(seq_index, 7);}
static void move8LinesAfter(uint8_t seq_index) { moveNLinesAfter(seq_index, 8);}
static void move9LinesAfter(uint8_t seq_index) { moveNLinesAfter(seq_index, 9);}
static void move10LinesAfter(uint8_t seq_index) { moveNLinesAfter(seq_index, 10);}
…
// moveNLinesAfter
{ LEADER_SEQ(LEAD(0), Key_K, Key_Semicolon), move1LinesAfter},
{ LEADER_SEQ(LEAD(0), Key_A, Key_K), move1LinesAfter},
{ LEADER_SEQ(LEAD(0), Key_S, Key_K), move2LinesAfter},
{ LEADER_SEQ(LEAD(0), Key_D, Key_K), move3LinesAfter},
{ LEADER_SEQ(LEAD(0), Key_F, Key_K), move4LinesAfter},
{ LEADER_SEQ(LEAD(0), Key_G, Key_K), move5LinesAfter},
{ LEADER_SEQ(LEAD(0), Key_H, Key_K), move6LinesAfter},
{ LEADER_SEQ(LEAD(0), Key_J, Key_K), move7LinesAfter},
{ LEADER_SEQ(LEAD(0), Key_K, Key_K), move8LinesAfter},
{ LEADER_SEQ(LEAD(0), Key_L, Key_K), move9LinesAfter},
It works but I need to create a lot of code configuration (not a problem) for leader plugin but it has as consequence to generate a lot of memory used in the eeprom.
I can’t manage more than 100 key sequences in leader plugin without having a full eeprom.
But if I use the same method in the configuration of leader (not correct functionally speaking), the size taken in the memory is clearly less.
So, my question, is possible in leader plugin to pass argument (in addition of uint8_t seq_index) in the configuration, something like
{ LEADER_SEQ(LEAD(0), Key_K, Key_Semicolon), moveNLinesAfter(1)},
{ LEADER_SEQ(LEAD(0), Key_A, Key_K), moveNLinesAfter(1)},
{ LEADER_SEQ(LEAD(0), Key_S, Key_K), moveNLinesAfter(2)},
{ LEADER_SEQ(LEAD(0), Key_D, Key_K), moveNLinesAfter(3)},
{ LEADER_SEQ(LEAD(0), Key_F, Key_K), moveNLinesAfter(4)},
{ LEADER_SEQ(LEAD(0), Key_G, Key_K), moveNLinesAfter(5)},
{ LEADER_SEQ(LEAD(0), Key_H, Key_K), moveNLinesAfter(6)},
{ LEADER_SEQ(LEAD(0), Key_J, Key_K), moveNLinesAfter(7)},
{ LEADER_SEQ(LEAD(0), Key_K, Key_K), moveNLinesAfter(8)},
{ LEADER_SEQ(LEAD(0), Key_L, Key_K), moveNLinesAfter(9)},
or something can permit to manage a lot of key sequences in leader plugin.
Thanks in advance,
PS : my customized firmware https://github.com/alexandrenavarro/Model01-Firmware/blob/master/Model01-Firmware.ino with vi mode around 525 lines of code if some people are interested.