Both are horribly slow, seriously, try iTerm2 for a week then try Terminal - you'll then notice how much latency iTerm2 adds to basic key presses.
oh-my-zsh is also horribly slow out of box, spend some time manually configuring zsh and observe your terminals open in fractional seconds instead of multiple seconds.
My terminals stay open inbetween computer re-boots, so not really a problem? I imagine most dev-types keep terminals open all the time on their local dev machines.
iTerm2 with the new metal renderer (only added to the stable releases recently) is as fast as Terminal. But if you want to see what a truly fast terminal can be, give Kitty a try: https://sw.kovidgoyal.net/kitty/
As for OMZ, yep, it includes a lot of functionality out of the box which makes it a little slow. I personally use prezto because it's quicker. Give that a try.
I don’t know about color (never needed anything fancy that way) but Terminal has supported ligatures for at least the past macOS release or two. I use Fira Code with mine and it works exactly as expected.
iTerm2 is nice but for my usage it does too much. If there were a lite version that cut a lot of the more niche features and focused solely on speed and responsiveness I might consider it.
I use iTerm2 all the term and I can honestly say I've never given a second thought to responsiveness. What are you noticing specifically? Are you typing super fast?
To each his own: I find Terminal.app to be one of the best terminal out there, all platforms combined. Speed and latency are awesome, colors are exact. Line marks (both manual and with automatic prompt detection) navigated with cmd+up/down is a godsend. Escape sequences to update tab and window titles with directory and document paths are great too. The only thing I miss is having different settings for alt and meta on the left and right alt keys. The days of Terminal.app being crap (up till Leopard) are long gone since Snow Leopard where it had a major update, and was constantly improved upon on each subsequent release.
I know this is territory that gets rehashed every time someone says "hey, I like tool X..." but I still get a kick out of browsing these threads to see what tools people are using.
If you want one persistent window to always popup with a hotkey:
Preferences => Profiles => (Choose or make from scratch[1]) => Keys => Configure Hotkey Window
I think that works with the Control-Command-Space binding mentioned above. I use caps lock to toggle my terminal, which required some remapping via Karabiner[2]
[1] I have a profile called "Hotkey Profile" I don't remember if I set this up myself or if iTerm did it for me. I have it configured to appear on whichever monitor my mouse is on when I open it, and to have its window fill the bottom 1/3 or so of my screen
Exactly! The title is inaccurate and misleading. Readline works across all terminal emulators and is supported by a lot of applications, Bash being just one of them.
The problem with fish is that it's not POSIX-compliant, and it doesn't try to be (it's a design non-goal), and it's not backwards-compatible with the literally billions of POSIX-compliant scripts and tools already out there.
It doesn't even support `!!` since the maintainers don't seem to like it[0].
The literally billions of POSIX-compliant scripts and tools already out there will run just fine under fish with a hashbang/shebang (a first line that defines what the file executed should be opened with, e.g. `/usr/bin/env sh`) :) . And it's not as if adding a hashbang was painful, not having one is super bad anyway as it leads to uncertainty of whether the script is bash / sh / etc, and can lead to tricky corner cases.
I was a wary zsh user too, until I moved my zsh aliases to scripts with a proper hashbang, then migration to fish was painless, and the benefits are real: I get all the features I expected from my long-tuned zsh, with none of the maintenance/performance pains.
Actually, even for one-time personal scripts I still default to writing (ba)sh, because 1. habit/competence, 2. shellcheck, 3. what you say: examples and resources are everywhere.
Tangentially, upcoming fish will support POSIX && and || (in addition to maybe-even-weirder `; and` / `; or`), and already does if you build from sources now.
So long as you don't need to "source" any of these POSIX-compliant scripts into your environment... A shebang'd script cannot affect the environment of the parent process
Lucky for you. I have really come to love zsh's sh and ksh emulation features for this very reason. I have worked in various work environments where setting up a build environment or a testing environment required sourcing ksh scripts that sourced even more ksh scripts. The majority of the engineers on these teams would "deal with" ksh for this reason but a few of the "geekier" engineers would set up zsh with ksh emulation in order to work in a more usable shell.
what i have yet to figure out is how i can make the commands that i build work with auto-completion. i have never been able to find a good guide. anyone have a good resource/library (in Go) that can help me with this?
My approach is to copy, paste, & tailor the programmable completion for a command that has similar interface to my mine. Can try browsing /usr/local/share/bash-completions/completions or `set` & search for _FOO. Hopefully the special variables like COMPREPLY will be self-explanatory. Also `help compgen`. I'm assuming bash, by the way.
I just added bash completion to a few internal tools that work with kafka, basically just autocompleting topics. It was a little harder than I would have liked (who wants to write all that bash), and I had to fix a bug in Cobra, but overall it wasn't that bad.
I'm actually at Gophercon right now, if anyone wants to hack on Cobra at the community day on Thursday to make this easier, shoot me an email (@gmail).
But if you don't do this, you can still use <tab> - and if there are more than one option it'll list the possibilities. With this you just have to tab through all the options to see what is there.
So basically it switches the behaviour to what CMD does on Windows. IMO this is extremely annoying and I wish I could disable it on Windows.
If you have 3 options starting with the same prefix, it's fine, but if there's hundreds (e.g. a directory with a lot of libraries starting with lib<something>), it becomes highly annoying and it's better to just give the list so I can type the next letter
For PowerShell, there is PSReadLine, and that has an option to make completion more bash-like in that it completes common prefixes, then lists all options afterwards.
(Say you have a directory with two subdirectories "fooabc" and "foo123". You are in the directory and you type "cd f" and then hit tab. This will complete to "cd foo", and if you hit tab again, then it will show the two options, and then you have to enter "a" or "1" to disambiguate.)
Yes, I'm very confused -- I don't have to do anything to "turn on" autocomplete, it's already turned on! The things they talk about change the behavior.
If any of you find Oh-My-ZSH bloated and slow and ZPrezto being abandonware then check out ZIM framework that's ZPrezto fork with goal of being maintained, workable and making ZSH great again ;)
The bash that comes with macOS is very old due to Apple sticking to GPLv2 I believe. So I did "brew install bash" and switched my login shell from /bin/bash to /usr/local/bin/bash and now I can use new bash things.
56 comments
[ 4.8 ms ] story [ 117 ms ] threadoh-my-zsh is also horribly slow out of box, spend some time manually configuring zsh and observe your terminals open in fractional seconds instead of multiple seconds.
I'm familiar enough with the terminal that I generally type by rote, I don't even need to look at the terminal while typing for most common tasks.
As for OMZ, yep, it includes a lot of functionality out of the box which makes it a little slow. I personally use prezto because it's quicker. Give that a try.
It's basically exactly what I had before except I can't click on links in my terminal.
iTerm2 is nice but for my usage it does too much. If there were a lite version that cut a lot of the more niche features and focused solely on speed and responsiveness I might consider it.
I also like FZF a lot for fast history search: https://github.com/junegunn/fzf
On that front, I've been using ZIM: https://github.com/zimfw/zimfw
I also recently added sandboxd so certain things are not run during shell init (rbenv/pyenv/asdf/etc): https://github.com/benvan/sandboxd
I have a keybinding set to CTRL+CMD+SPACEBAR for show/hiding item2. This is fairly close to activating the spotlight shortcut (CMD+SPACEBAR)
This makes it easy for me to seamlessly swap between my IDE and 2-3 terminals. Without having to use desktop swapping, etc.
Preferences => Profiles => (Choose or make from scratch[1]) => Keys => Configure Hotkey Window
I think that works with the Control-Command-Space binding mentioned above. I use caps lock to toggle my terminal, which required some remapping via Karabiner[2]
[1] I have a profile called "Hotkey Profile" I don't remember if I set this up myself or if iTerm did it for me. I have it configured to appear on whichever monitor my mouse is on when I open it, and to have its window fill the bottom 1/3 or so of my screen
[2] https://pqrs.org/osx/karabiner/
It doesn't even support `!!` since the maintainers don't seem to like it[0].
I get the occasional hiccup, but most scripts have a proper shebang line, so they work with fish anyway.
I was a wary zsh user too, until I moved my zsh aliases to scripts with a proper hashbang, then migration to fish was painless, and the benefits are real: I get all the features I expected from my long-tuned zsh, with none of the maintenance/performance pains.
Actually, even for one-time personal scripts I still default to writing (ba)sh, because 1. habit/competence, 2. shellcheck, 3. what you say: examples and resources are everywhere.
Tangentially, upcoming fish will support POSIX && and || (in addition to maybe-even-weirder `; and` / `; or`), and already does if you build from sources now.
I'm still of the opinion that fish is little more than a novelty and won't see widespread adoption in the long run.
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
Now, whenever you run `go install filename.go`, you'll automatically be able to run it anywhere on your machine.
I just added bash completion to a few internal tools that work with kafka, basically just autocompleting topics. It was a little harder than I would have liked (who wants to write all that bash), and I had to fix a bug in Cobra, but overall it wasn't that bad.
I'm actually at Gophercon right now, if anyone wants to hack on Cobra at the community day on Thursday to make this easier, shoot me an email (@gmail).
If you have 3 options starting with the same prefix, it's fine, but if there's hundreds (e.g. a directory with a lot of libraries starting with lib<something>), it becomes highly annoying and it's better to just give the list so I can type the next letter
(Say you have a directory with two subdirectories "fooabc" and "foo123". You are in the directory and you type "cd f" and then hit tab. This will complete to "cd foo", and if you hit tab again, then it will show the two options, and then you have to enter "a" or "1" to disambiguate.)
complete -f -d -W "$(grep '[Hh]ost ' ~/.ssh/config | grep -v '*' | awk '{print $2}')" ssh scp
If you don't use '~/.ssh/config' but have a '~/.ssh/known_hosts' file, add this instead:
complete -f -d -W "$(cut -d',' -f1 ~/.ssh/known_hosts | awk '{print $1}')" ssh scp
Similarly, you can use the 'complete' command in '~/.bash_profile' to tweak everything. Some other ways I use it are:
1. Make 'cd' and 'ls' only autocomplete for directories: complete -d cd ls
2. Make 'foo' autocomplete with 'bar0' and 'bar1': complete -W 'bar0 bar1' foo
I got omz + zgen down to sub 60ms but I had to trade some functionality to get there.
I tried zplug but my pruned omz worked out slower than zgen.
Just a thought.