5 ms·
Sweet Shell: With Oh-My-Zsh, SpaceVim, Starship, True Color, and Demo Mode
- nathias 4y agooh-my-zsh is too slow, too bloated, just install the plugins you need with antibody that 'compiles' them
- StreamBright 4y agoI just started to use fish which seems like most of the things oh-my-zsh does but without the hassle. On the down side it has few quirks (loops, wildcards for example).
- kstrauser 4y agoI switched to fish a couple of years ago and I'd never go back now. Want to customize your prompt? Write a function called "fish_prompt" that calls git, echo, or whatever else you want and make them write to stdout. There, done. Want to add a second prompt column to the right side of your shell? My "fish_right_prompt" function looks like set_color 666666 date +'%Y-%m-%d %H:%M:%S' set_color normal and it puts the date at the end of each command prompt. Have spaces in filenames? Watch this: $ touch a "b c" d $ for i in *; echo "<$i>"; end <a> <b c> <d> Of course it handles that for you automatically. The downsides are that it's not POSIX-compatible, that command lines you find online may or may not work in it, and it's not going to be installed on every machine you touch. However, 1) you can still use bash or zsh if you occasionally need to, and 2) why make your life harder if you're using a machine you can install software on 99% of the time? I mean, I still write Python, even though it's not installed everywhere by default.
- eddyg 4y agoFWIW, zsh can do that stuff (and more!); e.g. set RPROMPT for a "right prompt". It also handles files with spaces just fine: $ touch a "b c" d $ for i in *; { echo "<$i>" } <a> <b c> <d> Once I added 'zsh-syntax-highlighting' and 'zsh-autosuggestions' I didn't see a reason to deal with all the eccentricities of a non-standard shell like fish. (If anybody is looking for a terrific "turn-key" zsh config that is fast, check out https://github.com/romkatv/zsh4humans/tree/v4 https://github.com/romkatv/zsh4humans/tree/v4 ... there are instructions for trying it out in Docker so it won't mess with your existing shell config.)
- kstrauser 4y agoYes, but here's what zsh's prompt setting looks like: https://zsh.sourceforge.io/Intro/intro_14.html https://zsh.sourceforge.io/Intro/intro_14.html In fish, it's literally just a function that runs normal commands. There's no special syntax or anything. And in any event, that's just an example. Fish feels like it was built to be ergonomic and convenient. It's also lightning fast because all of the nice things are built-in and don't have to be accreted around it.
- soraminazuki 4y agoIn other words, zsh uses format strings. You don't need to use the format specifiers, it's just there for convenience so that you won't need to spawn a bunch of processes to do trivial stuff. Here's one example that is very much ergonomic and convenient as the fish way: setopt prompt_subst PROMPT='$(whoami)@$(hostname): $(pwd) \$ ' Things don't have to be "accreted around" in zsh either. It has a powerful completion system, convenience commands and keybindings built into it. It can do pretty much what people want from fish sans the syntax. It's just that there are an abundance of plugins and frameworks around zsh because it was designed to be extensible from the ground up. Some of those frameworks do slow down the shell, but that's a problem with that particular framework, not inherent to how zsh works.
- kstrauser 4y agoI highly recommend installing Fish and experimenting with it for a couple of days, if only to see what a different approach to shell design looks like. Don’t try to make it into a Zsh clone, but use it as itself and see what you think. If you do that, I suspect you won’t find that prompt_subst is a good replacement for being able to write full-blown functions that allow complex flow logic like “if logged in as root…” or “if this is a Git directory…” or “if the last command succeeded…”. Yes, you can do all of those in Zsh in the sense that both shells are Turing complete, but wow, it’s nice when the shell makes it easy and fun to do these things.
- soraminazuki 4y ago
- Calzifer 4y agoSpaces in filenames is more a Bash problem. Zsh does far less automatic word splitting. > Note in particular the fact that words of unquoted parameters are not automatically split on whitespace unless the option SH_WORD_SPLIT is set; see references to this option below for more details. This is an important difference from other shells. https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parameter-Expansion https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parame... The example works the same in Zsh. (of cause with the slightly different for loop syntax) for i in *; do echo "<$i>"; done
- StreamBright 4y agoYes, this is exactly it. Btw. POSIX is grossly overrated. There are many things that could have done better.
- foobarian 4y agoThing to definitely consider: eternal, session-keyed command history
- samesense 4y agoIs this a tool, plugin or philosophy?
- foobarian 4y agoA thing to do with your environment setup, so a tool I suppose? There are probably different plugins out there for it. In my case it's a few lines in .bashrc that override the history processing to never delete old history, and add tags indicating which session wrote the command. This way I can reboot a computer, restart all 30 screen sessions, and have each access backward searchable history to the start of time (2013 for me). I'm guessing newer shells may have better support for this kind of thing instead of running shell commands to wrangle text files on every prompt.
- djaouen 4y agoI am not sure of the utility of SpaceVim. Why wouldn’t I just find and install the plugins myself?
- timothylaurent 4y agomostly because you can spend an arbitrary amount of time tweaking your vim to get it the way you want it. This Vim distros, like SpaceVim and AstroNvim, are a great foundation working on an IDE-like vim setup. For example, in AstroNvim - the path completion dropdown shows icons and all paths accessible, when focusing on a file, it shows the head of the file. It's a really smart UX integration. It would likely have taken me weeks to months of playing with my config to have a small subset of what is available in the distro. They're also very configurable, so you can override any key-binding you want, add or disable plugins. I guess it depends on how you want to spend your time :shrug
- linsomniac 4y agoI used LunarVim, switched about 6 months ago because I was tired of maintaining my virc settings that I'd been carrying around for decades and a bunch of plugins. SpaceVim has a really slick install and gives me all the LSP and a nice collection of plugins. And someone else is maintaining it!
- timothylaurent 4y agoI've tried lots of these tools. I'm currently doing pan-OS ohmyzsh - mostly for the git aliases :D starship - contextual prompt AstroNvim - this replaced SpaceVim for me - a delightful- batteries included vim direnv - directory-based environments - I have custom layouts that install python with pyenv, and a virtualenv with pyenv-virtualenv, and activates the VE based on the .python-version RipGrep - replaces ag for search k9s - for managing kubernetes hishtory - command history search lsd - colorful ls replacement in rust bat - colorful cat replacement in rust brew - so much fresher than apt packages on linux OSx Warp - next gen terminal - replaced iterm for me Linux Wezterm - really snappy terminal emulator
- gillesjacobs 4y agoOMZ is slow, been using zinit since it came out because OMZ and antigen were so slow to start up. Recently I found zsh4humans [1] which benchmarks much better than any other solution, is portable, and has everything I need with sane configs. 1. https://github.com/romkatv/zsh4humans https://github.com/romkatv/zsh4humans
- aliqot 4y agoYep, I just want it to do my prompt and leave the rest alone. What would be ideal, to me, is a tool that does this: 0. Does `source ~/.config/.prompt` exist in .zshrc? if not, make it so. 1. If `~/.config/.prompt` is empty, give me a cool default prompt 2. print a link to the gallery of things I can put in `~/.config/.prompt` to make my prompt look different. don't do any "hey lets do our biweekly upgrade" don't do anything fancy, I don't care about the rest. just give me a predictable prompt with a name I can remember, and let people submit theirs.
- timothylaurent 4y agoJust use starship.rs , then.
- jmcphers 4y agoAlso don't like OMZ because of feature and performance bloat. I've been using prezto -- it's very modular and fast. https://github.com/sorin-ionescu/prezto https://github.com/sorin-ionescu/prezto
- ifaxmycodetok8s 4y agoI use powerlevel10k to speed up my omz start time. Been great. https://github.com/romkatv/powerlevel10k https://github.com/romkatv/powerlevel10k
- alophawen 4y agoSince author is showcasing cross-os setups, I think it is appropriate to mention WezTerm. The cross-os terminal emulator with multiplexing and is instant startup on windows as compared to seconds for Windows Terminal or iTerm2. It allows for a consistent terminal setup across Windows, macOS and Linux. https://wezfurlong.org/wezterm/ https://wezfurlong.org/wezterm/
- timothylaurent 4y agoAgree - Wezterm is great! It's my goto on linux now, and I even installed in on my Mac where I'm daily driving Warp.
- bennine 4y agoAny differences over Alacritty? Seems like this has same exact main selling point.
- throwaway12223 4y agoglyph rendering
- eddyg 4y agoOut of curiosity, does WezTerm allow you to "Select output of last command" (Shift-Cmd-A) and jump backwards/forwards through your scrollback command-by-command with Shift-Cmd-Up/Down? (And other features that Shell Integration[0] brings along?) (Thing like that are what set iTerm apart for me, and why I keep going back to it...) [0] https://iterm2.com/documentation-shell-integration.html https://iterm2.com/documentation-shell-integration.html
- linsomniac 4y agoBeen using wezterm for a few months now and love it. On Linux I run a bunch of windows under Sway, on my Mac I run it in "mosh+tmux mode" to connect to a session on the Linux box, a "thin terminal".
- _8j50 4y agoI can't seem to get myself to like zsh more than bash. I eish there was a bashifier profile script. Small annoyances. A small example would be '!' To execute the last matching command, I use that all the time but zsh requires an extra enter to get it to actually run. I use it when it is a default, sometimes I use bash when it annoys too much and I would not pick it on purpose. I just don't get what is so much better about it.
- cjbprime 4y ago> execute the last matching command set +o histverify
- _8j50 4y agoThanks
- soraminazuki 4y agoAutocompletion is one thing zsh does better, and that alone is worth it IMO. It can autocomplete things other than filenames and even gives you a short description for each of the subcommands or CLI options in the completion candidates. For the most common commands, this works without even having to install third party completion scripts. Bash, in comparison, has limited completion. Most of the time, it only completes filenames even after installing third party completion scripts. It's a major source of frustration when I find myself in a bash shell. Syntax highlighting is useful as well, though that requires the use of a third party plugin. You can detect quoting errors, unmatched braces, missing commands, incorrect filepaths before hitting enter. It's indispensable in an interactive shell because that's where you write convoluted one-off one-liners. ZLE, the zsh equivalent of readline, is also a major selling point. It allows you to create your own keybinding widget, a shell function bound to a key that can manipulate the current command line buffer. It's what enables the syntax highlighting plugin. With readline, you can only assign predefined functions. In general, zsh is extensible and offers more capabilities than bash. But to feel the difference, you need to configure it and enable the nice features.
- 4y ago
- nnoitra 4y ago
- brendanfalk 4y agoWe built the Shell Plugin Store into Fig[https://fig.io https://fig.io] to solve a lot of the problems mentioned in this thread. Namely: * Plugins are hard to install/uninstall * Plugins are hard to customise once installed * Plugins add bloat and/or degrade performance in shell load time * It's hard to find plugins in the first place (there is not centralised directory) * It's hard to sync plugins and configurations across devices In Fig, adding a plugin is easy as clicking a button. And if you have issues with it, you can uninstall in a click too
- rgoulter 4y agoStarship is an excellent prompt, and requires very little effort to set up. I appreciate the details about the current environment it puts in the prompt. e.g. the current git branch, which AWS profile / region is active, etc.
- superb-owl 4y agoDisagree. I have spent countless hours tweaking my starship setup! But I do agree that it's excellent.
- timothylaurent 4y agoThe only thing I do is enable the kubernetes plugin which for some reason isn't the default.
- capitalsigma 4y agoWhy would I want to replace ls of all things? What if I need to use another machine, ever?
- yewenjie 4y agoThere was absolutely no reason to switch from Starship, but I hopped (shell-promt-hopped?) to oh-my-posh and am pleasantly happy with it. https://ohmyposh.dev/ https://ohmyposh.dev/
- twblalock 4y agoAs someone who does software for a living, I need to be able to SSH onto a box/container/pod and do things. This is ridiculous. Don't turn your shell into unicorns and rainbows. They won't be there when you need them. Turn yourself into someone who can be productive with the basic Bash defaults because those are the only things that will definitely be there on every system you use.
- cageface 4y agoI used to believe this but in fact I spend a vanishingly tiny fraction of my time shelled into random machines running individual commands by hand. I'd rather optimize for the 99% of my time I spend in an environment I can configure to be maximally productive and enjoyable.
- fileeditview 4y agoWe all have different needs.. not everybody is an "SRE" or similar. Some people just use the terminal/shell mainly on their own machine and want to tune it. I am one of them. I can still use a vi without plugins on a remote machine instead of my tweaked and heavily customized vim. It is not an argument to keep the environment I work in all the time dumb.
- thomasqbrady 4y agoWhat’s the “Demo Mode” part of the headline refer to?
- bryanlarsen 4y agoAre there any good, broadly available color themes where the background is actually black? OLED screens are incredible, but for screen maintenance and because it looks incredible you want your background color to be actual black rather than almost black. Most apps make it easy to tweak themes, but it'd be nice to not have to do so.