# vim: Add \`gdefault\` setting to set \`/g\` as a default substitution flag \(\#47664\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/41ce23f896dbeaa801cca48b52168be328232dd7)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 41ce23f896dbeaa801cca48b52168be328232dd7

Requested commit: 41ce23f896dbeaa801cca48b52168be328232dd7

Commit: 41ce23f896dbeaa801cca48b52168be328232dd7

Tree: 0d0cff1979f408d80fe141f5c04f8b7822da2d04

Author: Ran Benita

Committer: GitHub

## Message

```
vim: Add `gdefault` setting to set `/g` as a default substitution flag (#47664)

Add support for Vim's `gdefault` option which makes the `:substitute`
command replace all matches in a line by default, instead of just the
first match. When enabled, the `/g` flag inverts this behavior.

- Add `vim.gdefault` setting
- Add `:set gdefault`, `:set nogdefault` (and short forms `:set gd`, `:set nogd`)
- Fix handling of multiple `/g` flags so that each one inverts the one before

Closes #36209

Release Notes:

- vim: Add `vim.gdefault` setting to make `/g` (replace all matches in a line) the default for substitutions, along with `:set gdefault` and `:set nogdefault` commands (short forms: `gd`, `nogd`)

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
```

## Parents

- [e77c528c1cf0ca59771a18ec7fe09c53bd272c0f](https://git.cafe/gitcafe/zed/commit/e77c528c1cf0ca59771a18ec7fe09c53bd272c0f?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/41ce23f896dbeaa801cca48b52168be328232dd7?format=markdown)
