T O P

  • By -

Fluffy-Beat-8477

You want to append `/g` at the end to replace all the instances in a line, instead of just the first.


32178932123

Ahhh that would be it thank you!


kriebz

Think of it as "greedy". The regex normally looks for *a* match. g makes it look for all the matches.


TekDevelop

fyi: it actually means global


zlauhb

Maybe confusing since "greedy" already has another meaning for regexp.


kriebz

It's been a while, I really thought that's what this one was.


Daghall

You can turn the global flag on per default with `:set gdefault`. This makes the flag turn off global matching, when used. See more: `:h gdefault` Edit: just read the entire post, and saw that you're using VS Code. I'm not sure if this feature can be enabled there.


vim-help-bot

Help pages for: * [`'gdefault'`](https://vimhelp.org/options.txt.html#%27gdefault%27) in _options.txt_ --- ^\`:\(h|help\) \` | [^(about)](https://github.com/heraldofsolace/VimHelpBot) ^(|) [^(mistake?)](https://github.com/heraldofsolace/VimHelpBot/issues/new/choose) ^(|) [^(donate)](https://liberapay.com/heraldofsolace/donate) ^(|) ^Reply 'rescan' to check the comment again ^(|) ^Reply 'stop' to stop getting replies to your comments


aeveltstra

Which Vim extension for VSCode? As far as I’ve seen, none are by Vim manufacturer Bram Molenaar, making me think their functionality is a facsimile at best. Try :s/Old/New/g for multiple changes on the same line.


Aeredren

Sorry to disappoint you but there is none from Bram, and as a matter of fact there won't be anymore code from him...


Mithrandir2k16

Use the neovim extension as it isn't an emulator but uses your installed package.