From 2bb6cbecc438d6420a13ea2806b73f5523e1d5e3 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Thu, 2 Mar 2017 20:02:16 -0500 Subject: [PATCH] added shortcuts to create new line before or after the current line --- xedit.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/xedit.c b/xedit.c index b012d51..aeaff7b 100644 --- a/xedit.c +++ b/xedit.c @@ -391,6 +391,21 @@ static void new_win(void) { cmd_exec("!edit"); } +static void newline(void) { + View* view = win_view(FOCUSED); + if (x11_keymodsset(ModShift)) { + view_byline(view, UP, false); + view_bol(view, false); + if (view->selection.end == 0) { + view_insert(view, true, '\n'); + view->selection = (Sel){0,0,0}; + } + } else { + view_eol(view, false); + view_insert(view, true, '\n'); + } +} + /* Main Routine *****************************************************************************/ static Tag Builtins[] = { @@ -454,6 +469,8 @@ static KeyBinding Bindings[] = { { ModCtrl, 'p', pick_ctag }, { ModCtrl, 'g', goto_ctag }, { ModCtrl, 'n', new_win }, + { ModCtrl, '\n', newline }, + { ModCtrl|ModShift, '\n', newline }, { 0, 0, 0 } }; -- 2.49.0