2020-05-09 06:15:26 +00:00
|
|
|
/*
|
|
|
|
Vi is stateful, so you have to track the modes yourself. Otherwise motion is awful (bell, bell, bell)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include QMK_KEYBOARD_H
|
|
|
|
|
|
|
|
#ifdef USE_BABBLEPASTE
|
|
|
|
# include "babblePaste.h"
|
|
|
|
|
|
|
|
# ifdef BABL_VI
|
|
|
|
|
|
|
|
bool babblePaste_vi(uint16_t keycode) {
|
|
|
|
# ifdef BABL_MOVE
|
|
|
|
BABLM(BABL_GO_LEFT_1C, "h");
|
|
|
|
BABLM(BABL_GO_RIGHT_1C, "l");
|
|
|
|
BABLM(BABL_GO_LEFT_WORD, "b");
|
|
|
|
BABLM(BABL_GO_RIGHT_WORD, "w");
|
|
|
|
BABLM(BABL_GO_START_LINE, IMSFT(X_6));
|
|
|
|
BABLM(BABL_GO_END_LINE, IMSFT(X_4));
|
|
|
|
BABLM(BABL_GO_START_DOC, "gg");
|
|
|
|
BABLM(BABL_GO_END_DOC, IMSFT(X_G));
|
|
|
|
BABLM(BABL_GO_NEXT_LINE, "j");
|
|
|
|
BABLM(BABL_GO_PREV_LINE, "k");
|
2022-10-17 12:45:23 +00:00
|
|
|
BABLM(BABL_GO_PARA_START, IMSFT(X_LEFT_BRACKET));
|
|
|
|
BABLM(BABL_GO_PARA_END, IMSFT(X_RIGHT_BRACKET));
|
|
|
|
BABLM(BABL_PGDN, SS_LCTL("f"));
|
|
|
|
BABLM(BABL_PGUP, SS_LCTL("b"));
|
2020-05-09 06:15:26 +00:00
|
|
|
BABLM(BABL_DEL_RIGHT_1C, "x");
|
|
|
|
BABLM(BABL_DEL_LEFT_WORD, "dge");
|
|
|
|
BABLM(BABL_DEL_RIGHT_WORD, "dw");
|
|
|
|
BABLM(BABL_DEL_TO_LINE_END, "d" IMSFT(X_4));
|
|
|
|
BABLM(BABL_DEL_TO_LINE_START, "d" IMSFT(X_6));
|
|
|
|
BABLM(BABL_MODE, "Vi ");
|
|
|
|
# endif
|
|
|
|
# ifdef BABL_OSKEYS
|
|
|
|
BABLM(BABL_UNDO, "h");
|
2022-10-17 12:45:23 +00:00
|
|
|
BABLM(BABL_REDO, SS_LCTL("r"));
|
2020-05-09 06:15:26 +00:00
|
|
|
BABLM(BABL_CUT, "x");
|
|
|
|
BABLM(BABL_COPY, "y");
|
|
|
|
BABLM(BABL_PASTE, "p");
|
2022-10-17 12:45:23 +00:00
|
|
|
BABLM(BABL_SELECT_ALL, IMSFT(X_SEMICOLON) SS_TAP(X_5) "y"); // wrong but helpful?
|
2020-05-09 06:15:26 +00:00
|
|
|
BABLM(BABL_FIND, SS_TAP(X_SLASH));
|
|
|
|
BABLM(BABL_FIND_NEXT, "n");
|
|
|
|
BABLM(BABL_FIND_PREV, IMSFT(X_N));
|
|
|
|
BABLM(BABL_FIND_REPLACE, OMALT(IMSFT(X_5)));
|
|
|
|
BABLM(BABL_RUNAPP, ":split"); // requires VIM, is vsplit better?
|
|
|
|
BABLM(BABL_SWITCH_APP_NEXT, IMCTL(X_DOWN)); // Or Right?
|
|
|
|
BABLM(BABL_SWITCH_APP_NEXT, IMCTL(X_UP)); // or Left?
|
2022-10-17 12:45:23 +00:00
|
|
|
BABLM(BABL_CLOSE_APP, IMCTL(X_SEMICOLON) "q");
|
|
|
|
BABLM(BABL_HELP, SS_LSFT(SS_TAP(X_SEMICOLON)) "h"); // start search in help
|
2020-05-09 06:15:26 +00:00
|
|
|
// BABLM( BABL_LOCK, () ); Perhaps VI is not an OS?
|
|
|
|
// BABLM( BABL_SCREENCAPTURE, () ); // capture a buffer?
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifdef BABL_BROWSER
|
|
|
|
/* what _is_ the VI browser now that vimpirator is dead?*/
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifdef BABL_APP
|
|
|
|
BABLM(BABL_APP_SAVE, SS_TAP(X_ESCAPE) ":w");
|
2021-03-14 19:23:30 +00:00
|
|
|
BABLM(BABL_APP_SET_MARK, SS_TAP(X_ESCAPE) "ma"); // real vi people probably want multiple marks,not just a
|
2020-05-09 06:15:26 +00:00
|
|
|
# ifdef BABL_APP_WINDOWSPLITTING
|
|
|
|
BABLM(BABL_SPLIT_FRAME_VERT, SS_TAP(X_ESCAPE) ":vsplit");
|
|
|
|
BABLM(BABL_UNSPLIT_FRAME_VERT, SS_TAP(X_ESCAPE) ":hide"); // debatable.
|
|
|
|
BABLM(BABL_SPLIT_FRAME_HORIZONTAL, SS_TAP(X_ESCAPE) ":vsplit");
|
|
|
|
BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, SS_TAP(X_ESCAPE) ":hide");
|
2022-10-17 12:45:23 +00:00
|
|
|
BABLM(BABL_NEXT_FRAME, SS_LCTL("w") "w");
|
|
|
|
BABLM(BABL_PREV_FRAME, SS_LCTL("w") SS_LSFT("w"));
|
2020-05-09 06:15:26 +00:00
|
|
|
# endif
|
|
|
|
# endif // app
|
|
|
|
// Todo, ring bell, flash light, show user this isn't supported
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
# endif // VI
|
|
|
|
#endif // Babblepaste
|