How can I replace each occurrance of a sequence with another? #12082
Replies: 3 comments 1 reply
-
I think the trick here is to use the |
Beta Was this translation helpful? Give feedback.
-
You can press |
Beta Was this translation helpful? Give feedback.
-
If you are on Linux, you could pipe to |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In this case, I have a text file with tab characters for indentation that I want to replace with four spaces. I can use
indent-style 4
, but then there's no command (as far as I'm aware) to fix the indentation because there's no formatter for a text file.What I could do with vim, is use substitution to substitute every tab character with four spaces:
:%s/\t/ /g
. Generally, I'd use something like%s
in helix, but if I do%s\t
, that will indeed select all tab characters, but pressingc
to change that and put my four spaces will put one cursor per group of tabs, not one per tab. So in the lines where I have two tabs, there will only be four spaces, not eight.But this isn't just related to indenting, anytime I have two selections made with
s
that touch, thenc
will only put one insert cursor. For instance, if I have()()()
and I select the whole thing, then presss\(\)
, andc[]
, I'd expect this to replace all occurrences of()
with[]
, but in reality, it inserts exactly one[]
.How can I achieve this?
Beta Was this translation helpful? Give feedback.
All reactions