vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 1830a98d60a27045b23c23af00e2a979627143d7 parent b1b8d5f0a0f3f963b9e6a647c6ca30689a7f8f32 Author: Richard Burke <rich.g.burke@gmail.com> Date: Sun, 8 May 2016 14:05:25 +0100 Fix autoindent when using O Diffstat:
| M | main.c | | | 6 | +++++- |
| M | vis.c | | | 5 | +++++ |
| M | vis.h | | | 3 | +++ |
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/main.c b/main.c @@ -1947,7 +1947,11 @@ static const char *openline(Vis *vis, const char *keys, const Arg *arg) { vis_motion(vis, VIS_MOVE_LINE_END); vis_keys_feed(vis, "<insert-newline>"); } else { - vis_motion(vis, VIS_MOVE_LINE_BEGIN); + if (vis_get_autoindent(vis)) { + vis_motion(vis, VIS_MOVE_LINE_START); + } else { + vis_motion(vis, VIS_MOVE_LINE_BEGIN); + } vis_keys_feed(vis, "<insert-newline><Up>"); } return keys; diff --git a/vis.c b/vis.c @@ -1363,3 +1363,7 @@ View *vis_view(Vis *vis) { Win *vis_window(Vis *vis) { return vis->win; } + +bool vis_get_autoindent(const Vis *vis) { + return vis->autoindent; +} +\ No newline at end of file diff --git a/vis.h b/vis.h @@ -449,4 +449,7 @@ Win *vis_window(Vis*); bool vis_theme_load(Vis*, const char *name); +/* Get value of autoindent */ +bool vis_get_autoindent(const Vis*); + #endif