Skip to content

Disable spellcheck in zsh and bash#280

Merged
arran4 merged 2 commits intomainfrom
disable-shell-spellcheck-3406645714609527023
Apr 14, 2026
Merged

Disable spellcheck in zsh and bash#280
arran4 merged 2 commits intomainfrom
disable-shell-spellcheck-3406645714609527023

Conversation

@arran4
Copy link
Copy Markdown
Owner

@arran4 arran4 commented Apr 14, 2026

Disables spellcheck and auto-correction features across Zsh and Bash environments. This resolves the user's issue with shell spellcheck features.


PR created automatically by Jules for task 3406645714609527023 started by @arran4

- In Zsh: removed `_correct` and `_approximate` from `zstyle ':completion:*' completer`, added `unsetopt correct` and `unsetopt correct_all`, and removed the `SPROMPT` variable export from `prompt.tmpl`.
- In Bash: added `shopt -u cdspell` and `shopt -u dirspell` to disable directory spellcheck auto-corrections in `dot_bash_profile.tmpl`.

Co-authored-by: arran4 <111667+arran4@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request disables spelling correction and completion features across Bash and Zsh configurations. It removes the Zsh spelling prompt and completion correction styles, while explicitly disabling 'cdspell' and 'dirspell' in Bash. A suggestion was provided to handle potential errors when setting 'dirspell' on older Bash versions, such as those found on macOS, by redirecting error output to /dev/null.

Comment thread dot_bash_profile.tmpl
Comment on lines +57 to +58
shopt -u cdspell
shopt -u dirspell
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dirspell option was introduced in Bash 4.0. On systems with older versions of Bash (such as the default Bash 3.2 on macOS), running shopt -u dirspell will result in an error message like shopt: dirspell: invalid shell option name every time a new shell is opened. To avoid this, you can silence the error output.

Suggested change
shopt -u cdspell
shopt -u dirspell
shopt -u cdspell dirspell 2>/dev/null

fi

{{ if eq $shell "zsh" }}
export SPROMPT="Potential spelling error %R , could be %r"
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jules this is the correct removal, can we make it conditional if we find "spellcheck" which it seems to be erroring on.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the spellcheck boolean to .chezmoi.toml.tmpl and made the SPROMPT block conditional on it.

Comment thread dot_bash_profile.tmpl
shopt -s checkwinsize

# Disable spell check
shopt -u cdspell
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jules this is not necessary atm but we could make it conditional on it's dependencies if there are any

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've wrapped the shopt -u cdspell and shopt -u dirspell disablements in a check for the spellcheck property.

Comment thread dot_zshrc.tmpl
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jules not necessary but make conditional

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made the addition of _correct and _approximate to the completion styling conditional, and disabled setting unsetopt correct and unsetopt correct_all to also respect the condition.

Adds a `spellcheck` boolean prompt to `.chezmoi.toml.tmpl` and dynamically adapts Bash and Zsh shell spellcheck/auto-correction features based on this value:
- `dot_bash_profile.tmpl`: Conditionally apply `shopt -u cdspell` and `shopt -u dirspell`.
- `dot_zshrc.tmpl`: Conditionally enable `_correct` and `_approximate` completers, and apply `unsetopt correct` and `unsetopt correct_all`.
- `.chezmoitemplates/prompt.tmpl`: Conditionally export `SPROMPT` based on the config.

Co-authored-by: arran4 <111667+arran4@users.noreply.github.com>
@arran4 arran4 merged commit da08392 into main Apr 14, 2026
9 checks passed
@arran4 arran4 deleted the disable-shell-spellcheck-3406645714609527023 branch April 14, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant