2

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?

  • do you need correction on systemctl? if not try instead alias systemctl='nocorrect systemctl'; the ssh command is unrelated here – thrig Feb 7 '18 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 '18 at 4:12
5

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).

  • 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 '18 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. – Gilles Feb 7 '18 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.