vim: Surround in visual mode (#13347)
Adds support for surrounding text in visual/visual-line/visual-block mode by re-using the `AddSurrounds` operator. There is no default binding though so the user must follow the instructions to enable it. Note that the behaviour varies slightly for the visual-line and visual-block modes. In visual-line mode the surrounds are placed on separate lines (the vim-surround extension also indents the contents but I opted not to as that behaviour is less important with the use of code formatters). In visual-block mode each of the selected regions is surrounded and the cursor returns to the beginning of the selection after the action is complete. Release Notes: - Added action to surround text in visual mode (no default binding). Fixes #13122
This commit is contained in:
parent
5a8c2a4a88
commit
77b2da2b42
4 changed files with 167 additions and 9 deletions
|
@ -287,7 +287,10 @@ impl EditorState {
|
|||
.unwrap_or_else(|| "none"),
|
||||
);
|
||||
|
||||
if self.mode == Mode::Replace {
|
||||
if self.mode == Mode::Replace
|
||||
|| (matches!(active_operator, Some(Operator::AddSurrounds { .. }))
|
||||
&& self.mode.is_visual())
|
||||
{
|
||||
context.add("VimWaiting");
|
||||
}
|
||||
context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue