Surrounds are another useful feature of Helix which allow you to perform common actions such as:
- Surround selection with character
- Replace surrounding character
- Delete surrounding character
You can use any character for a surround add, replace or delete operation -- such as x
.
Some surround characters are more advanced. For example, having a selection and surrounding it with (
will add (
at the beginning of the selection and )
at the end.
Surround selection with character
You can surround selections with specific characters with ms for make surrounding. For example, with the whole hello
word selected:
Pressing ms(, you surround the selection with (
:
Replace surrounding character
But what if we actually meant to surround it with {
instead? That's fine! We can make replace the surrounding character with mr
For instance, place your cursor anywhere in hello
. mr({ replaces the surrounding (
with a {
:
Delete surrounding character
If we wanted to delete the surrounding character, we could also use md for make delete. For example to delete the nearest surrounding pair of {
, use md{.
List of surrounds
Helix has support for the following pairs of surrounds:
{
and }
(
and )
[
and ]
<
and >
Use any character
You can also use any other character which will act on the literal characters. With cursor on the w
in world
: