News for hackers. Stuff that matters.
Re:iTerm2 has a new drawing engine that uses Metal 2 by hellofunk on Saturday July 28, 2018 @05:09PM (#17635069)
One thing I've never been able to get iTerm to do that every other iTerm user seems to have setup almost automatically is how it ghosts the full completion of a command you are typing (faded behind your live typing), presumably from your history, and then you can just tab to complete the whole thing. So many commands are repeated often and I've never been able to get mine to do this very basic feature.
Re:iTerm2 has a new drawing engine that uses Metal 2 by pd0wm on Saturday July 28, 2018 @05:15PM (#17635097)
You are probably referring to fish shell which has this feature (https://fishshell.com/).

However, I find that zsh + ohmyzsh works just as well. After typing the beginning of a command you can use the arrow keys to cycle through all commands in the history with the same beginning.

A third method for efficient history search is ctrl+r. Just press ctr+r and start typing part of the command. Then you press enter to execute or ctr+r to cycle through the history.

Re:iTerm2 has a new drawing engine that uses Metal 2 by gtm1260 on Saturday July 28, 2018 @05:48PM (#17635232)
fish is nice but I've ran into too many issues where some weird shell command / script I find online is expecting to be in bash and I have to switch out of fish, so its hard for me to switch.
Re:iTerm2 has a new drawing engine that uses Metal 2 by dagmx on Saturday July 28, 2018 @06:39PM (#17635426)
As long as they don't need to be sourced, you can just add a shebang for bash at the top of the scripts and run them via bash.
Re:iTerm2 has a new drawing engine that uses Metal 2 by Macha on Saturday July 28, 2018 @06:49PM (#17635460)
If they do need to be sourced, you can use bass: https://github.com/edc/bass
Re:iTerm2 has a new drawing engine that uses Metal 2 by breatheoften on Saturday July 28, 2018 @07:07PM (#17635523)
Wow this is neat — I’m gonna try this out. Does it really work?
Re:iTerm2 has a new drawing engine that uses Metal 2 by Macha on Saturday July 28, 2018 @07:09PM (#17635528)
It works at least for nvm (caveat: Installed from nvm directly, not homebrew), and my company's ssh setup script, which are the two reasons I've had cause to use it.
Re:iTerm2 has a new drawing engine that uses Metal 2 by h1d on Saturday July 28, 2018 @07:54PM (#17635688)
Just run it with bash then. The syntax is too different to run bash script on fish.
Re:iTerm2 has a new drawing engine that uses Metal 2 by ufo on Saturday July 28, 2018 @06:18PM (#17635362)
You can usually drop to a bash subshell for those
Re:iTerm2 has a new drawing engine that uses Metal 2 by ComputerGuru on Sunday July 29, 2018 @02:58AM (#17636905)
Fish 3 will fix a lot of that. Try the nightly builds.
Re:iTerm2 has a new drawing engine that uses Metal 2 by canhascodez on Saturday July 28, 2018 @07:25PM (#17635586)
oh-my-zsh is effectively unmaintained. That is not the worst thing in the world, but one may wish to consider prezto as an alternative:

https://github.com/sorin-ionescu/prezto

Re:iTerm2 has a new drawing engine that uses Metal 2 by iends on Saturday July 28, 2018 @07:57PM (#17635701)
I see like 6 commits to oh-my-zsh in the past week. Why do you say its not maintained?
Re:iTerm2 has a new drawing engine that uses Metal 2 by canhascodez on Saturday July 28, 2018 @11:03PM (#17636289)
688 open pull requests, the existence of a half-dozen competing projects, and Robby's blog post suggesting that he doesn't take the project seriously.
Re:iTerm2 has a new drawing engine that uses Metal 2 by h1d on Saturday July 28, 2018 @07:53PM (#17635683)
Or zplug which allows you to load oh-my-zsh scripts as well.
Re:iTerm2 has a new drawing engine that uses Metal 2 by hellofunk on Saturday July 28, 2018 @05:16PM (#17635101)
ctr+r is a great tip!
Re:iTerm2 has a new drawing engine that uses Metal 2 by patrec on Saturday July 28, 2018 @05:29PM (#17635160)
It's worth getting used to your new discovery a bit first (C-r is isearch-backward), partly because it's useful in other places, too – for example ipython or any decent programming language shell has emacs-derived keybindings including isearch via readline or a clone.

But after that, I'd suggest giving fzf (https://github.com/junegunn/fzf) a try.

Re:iTerm2 has a new drawing engine that uses Metal 2 by h1d on Saturday July 28, 2018 @07:52PM (#17635680)
Using integrated fzf is so much better than cycling through one by one.
Re:iTerm2 has a new drawing engine that uses Metal 2 by jasonm23 on Saturday July 28, 2018 @09:49PM (#17636052)
Zsh also has history completion of words.

M-/ (opt/alt + /)

Re:iTerm2 has a new drawing engine that uses Metal 2 by Exuma on Saturday July 28, 2018 @05:50PM (#17635238)
You're talking about autosuggestion, one of my ABSOLUTE FAVORITE features. I tell everyone about this:

If you're nervous about running shell commands here they're the same as the installation on the site if you care to check:

    sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
    git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
Then edit your ~/.zshrc plugins

    # Plugins
    plugins=(zsh-autosuggestions)
Then restart and type some commands. re-type a command you did and push control+e to complete it. I recommend re-binding your caps lock key to control for vim and also tons of hotkey ease of use. then you can just use caps+e for instant fast typing.

Combine this with using control+p to cycle through previous commands means you can be a wizard at commands quickly

Re:iTerm2 has a new drawing engine that uses Metal 2 by baliex on Saturday July 28, 2018 @05:12PM (#17635086)
I thought that was a zsh thing rather than an iTerm2 thing. You can use zsh in iTerm2 though.
Re:iTerm2 has a new drawing engine that uses Metal 2 by hellofunk on Saturday July 28, 2018 @05:15PM (#17635098)
Hm, that must mean everyone I know is using zsh and I didn't realize that... that strongly suggests I should use it too!
Re:iTerm2 has a new drawing engine that uses Metal 2 by AsyncAwait on Saturday July 28, 2018 @07:14PM (#17635542)
Specifically, most people use oh-my-zsh, which is a preconfigured set of zsh plugins and various other settings[1] with the autosuggestions[2] plugin.

1 - https://github.com/robbyrussell/oh-my-zsh

2 - https://github.com/zsh-users/zsh-autosuggestions

Re:iTerm2 has a new drawing engine that uses Metal 2 by canhascodez on Saturday July 28, 2018 @07:32PM (#17635615)
oh-my-zsh has more than six hundred open pull requests, and can be considered unmaintained. It is perfectly usable in most respects, and I would not expect that to change in the near future. However, some competing projects have started because of that, and may be worth consideration.

https://github.com/sorin-ionescu/prezto https://github.com/zsh-users/antigen See also: https://github.com/unixorn/awesome-zsh-plugins

Re:iTerm2 has a new drawing engine that uses Metal 2 by s3m4j on Saturday July 28, 2018 @05:29PM (#17635163)
Zsh and fish are, imo, much better environments than bash. And bash, once tamed, due to its ubiquity, is a better choice for scripting.
Re:iTerm2 has a new drawing engine that uses Metal 2 by h1d on Saturday July 28, 2018 @07:58PM (#17635707)
People should realize terminal and scripting don't need to be done using same shell.

I use fish for scripting but run zsh for terminal. (fish had couple weirdness in day to day terminal use and zsh could do pretty much all fish could do with zplug.)

Re:iTerm2 has a new drawing engine that uses Metal 2 by minusf on Saturday July 28, 2018 @05:40PM (#17635211)
not my choice. certainly less people suffer bash in the BSD world.

while bashims may give additional features, readability and portability suffers. I much prefer scripts using a posixish #!/bin/sh and a strict subset of shell syntax. something like pdfx.

Re:iTerm2 has a new drawing engine that uses Metal 2 by s3m4j on Saturday July 28, 2018 @05:44PM (#17635223)
That's why I emphasized "choice", using sh for scripting is a valid choice.
Re:iTerm2 has a new drawing engine that uses Metal 2 by nikivi on Saturday July 28, 2018 @05:15PM (#17635094)
Re:iTerm2 has a new drawing engine that uses Metal 2 by tny on Saturday July 28, 2018 @05:18PM (#17635113)
You can get that if you are using fish shell. For zsh, there is an auto suggestion package that you have to install.