From: Michael D. Lowis Date: Fri, 3 Mar 2017 01:02:16 +0000 (-0500) Subject: added shortcuts to create new line before or after the current line X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=2bb6cbecc438d6420a13ea2806b73f5523e1d5e3;p=projs%2Ftide.git added shortcuts to create new line before or after the current line --- 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 } };