5

This isn't exactly a duplicate, as I want correct_all still active. I do mess up arguments from time to time and ZSH is happy to help me. The rub happens when I am in my home directory and I want to manage sshd with something like systemctl reload ssh or service ssh start it always asks me if I want to correct to .ssh. I usually perform my work in $HOME so this gets rather annoying. I have already tried alias ssh='nocorrect ssh' and alias ssh='nocorrectall ssh' (which I don't think does anything). Any ideas on how to solve this?

2
  • do you need correction on systemctl? if not try instead alias systemctl='nocorrect systemctl'; the ssh command is unrelated here
    – thrig
    Feb 7, 2018 at 3:57
  • No, systemctl is not the problem in my i have setopt CORRECTALL set in my .zshrc, so no matter where ssh is in my command if I am in my home directory (where .ssh lives) it askes me if that is what I mean. Even touch ssh just asked me: zsh: correct 'ssh' to '.ssh' [nyae]?
    – user52470
    Feb 7, 2018 at 4:12

1 Answer 1

10

Set CORRECT_IGNORE_FILE. For example to ignore corrections on all dot files:

$ cd
$ PS1='%% ' zsh -f
% setopt CORRECT_ALL
% touch ssh
zsh: correct 'ssh' to '.ssh' [nyae]? a
% CORRECT_IGNORE_FILE='.*'
% touch ssh
% rm ssh

This is documented in zshall(1)

   CORRECT_IGNORE_FILE
          If set, is treated as a pattern during  spelling  correction  of
          file  names.   Any  file  name that matches the pattern is never
          offered as a correction.  For example, if the value is `.*' then
          dot  file  names  will never be offered as spelling corrections.
          This is useful with the CORRECT_ALL option.

this requires a somewhat recent version of zsh (one more recent than ships with Centos 7). If you're stuck on an old version of zsh you'll need to either disable CORRECT_ALL or use nocorrect to turn the corrections off for each problematical command (which is probably why CORRECT_IGNORE_FILE was added).

2
  • Thank you. I missed zshall I've read the manpage for zsh and the user guide, but it looks like I have a ton more reading to do!
    – user52470
    Feb 7, 2018 at 6:30
  • @user52470 zshall contains the whole manual in a single file. The manual is also available as separate pages. zsh is merely the front matter. The OVERVIEW section at the top lists the available pages. zshall is huge but has the advantage that you can easily search through the whole thing. Feb 7, 2018 at 7:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .