diff --git a/README.asciidoc b/README.asciidoc index 801aeea9..53c9d917 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -127,6 +127,10 @@ Changes * _>_: indent selected lines * _<_: deindent selected lines + * _alt->_: indent selected lines, including empty lines + * _<_: deindent selected lines + * _alt-<_: deindent selected lines, do not remove incomplete + indent (3 leading spaces when indent is 4) * _|_: pipe each selections through the given external filter program and replace with it's output. diff --git a/src/normal.cc b/src/normal.cc index b837a0f5..fe3476af 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -580,6 +580,7 @@ void indent(Context& context, int) editor.insert(indent, InsertMode::Insert); } +template void deindent(Context& context, int) { CharCount tabstop = context.options()["tabstop"].get(); @@ -605,7 +606,11 @@ void deindent(Context& context, int) else if (c == ' ') ++width; else + { + if (deindent_incomplete and width != 0) + res.emplace_back(line, BufferCoord{line, column-1}); break; + } if (width == indent_width) { res.emplace_back(line, BufferCoord{line, column}); @@ -1027,6 +1032,7 @@ KeyMap keymap = { '<', deindent }, { '>', indent }, { alt('>'), indent }, + { alt('<'), deindent }, { ctrl('i'), jump }, { ctrl('o'), jump },