Live data from Hacker News

SL(1): Cure your bad habit of mistyping

github.com

51–60 of 63 posts

Re: SL(1): Cure your bad habit of mistyping

#52

Or embrace it... I don't seem to mistype ls often enough to care, but my ~/.alias has a few things of this sort # some common typos alias grpe grep alias gpre grep alias mroe more alias mreo more alias rmeo more

zsh `setopt correct` is pretty helpful with these kinds of typos.

This sounded interesting but too magicky to me and I did a google search. Most of the top results are about how to disable or limit it. :)

I believe I experienced this kind of feature with fish and it was one of the reasons I didn't like it. (Most things cannot be user configured away in fish).

Re: SL(1): Cure your bad habit of mistyping

#53

Or embrace it... I don't seem to mistype ls often enough to care, but my ~/.alias has a few things of this sort # some common typos alias grpe grep alias gpre grep alias mroe more alias mreo more alias rmeo more

and: alias cd..="cd .." alias ..="cd .."

Fish and Zsh can automatically cd into a dir if you type a path in.

Re: SL(1): Cure your bad habit of mistyping

#54

I have this in my `.zshrc` on my personal machine. I get a kick out of it: ``` function command_not_found_handler() { figlet "lol, $1" } ``` (I think the bash equivalent is `command_not_found_handle`). This overrides the function that usually prints the `zsh: command not found: foo` message, and instead, mocks you, by printing "lol, foo" (but in big ol' figlet letters). SL is in a similar, but admittedly much more el…

I've been using prezto[0] for a long time so I'm not sure anymore if this is integrated in zsh, but at least using prezto I get this when I run a wrong command:

  > claer
  zsh: correct 'claer' to 'clear' [nyae]? n
  zsh: command not found: claer
I am guilty of not reading the docs, but I learnt by experience that n/y/a/e stands for no (run without correction)/yes (correct)/abort (don't run)/edit (manually/interactively)

[0] https://github.com/sorin-ionescu/prezto

Re: SL(1): Cure your bad habit of mistyping

#55

Earlier quoted context omitted.

I use that all the time as a shortcut to push new git branches without having to type the whole name.

`git push -u origin HEAD` pushes the current branch to `origin` with the same name you have locally. You could even add an alias for that.

Or set `push.default` to `current` to have plain `git push origin` push to the same remote name, ignoring the configured upstream (you might also want to set `remote.pushDefault` alongside that).

Re: SL(1): Cure your bad habit of mistyping

#57

I regularly mistype “myself” as “mysql” and vice versa. It’s like my brain registers the “mys”, figures my fingers have it covered, and checks out.

I do this for share and shader. I should symlink /usr/share to /usr/shader at this point.

Re: SL(1): Cure your bad habit of mistyping

#59
post #52

Earlier quoted context omitted.

zsh `setopt correct` is pretty helpful with these kinds of typos.

This sounded interesting but too magicky to me and I did a google search. Most of the top results are about how to disable or limit it. :) I believe I experienced this kind of feature with fish and it was one of the reasons I didn't like it. (Most things cannot be user configured away in fish).

It works fine for me. I do have `correct_all` unset, which makes it only apply to the command and not the arguments.

Re: SL(1): Cure your bad habit of mistyping

#60
post #40

SL(1): Learn the muscle-memory to send SIGQUIT all the time Part of this tool’s “charm” is that it traps SIGINT so you truly are forced to watch the animation as a punishment for bad typing, even if you try to send it SIGINT from your keyboard by typing control-C. Control-backslash sends SIGQUIT on the other hand. This signal cannot be trapped. Perhaps sl could launch a parent process and a child process, put the chi…

> Control-backslash sends SIGQUIT on the other hand. This signal cannot be trapped. Yes, it can.

Indeed. The only signals that cannot be caught (or blocked, or ignored) are SIGKILL and SIGSTOP.
Post reply on HN