5 ms·
I'm a VIM-only dev, spend all my day in a Tmux session, and I use the command-line probably a lot more than average. The single best improvement to my command-
by emilecantin 5y ago
I'm a VIM-only dev, spend all my day in a Tmux session, and I use the command-line probably a lot more than average.
The single best improvement to my command-line workflow I've done in the last few years has been switching shells. First I moved from Bash to ZSH, but about 2 years ago I switched again to Fish.
Why I love it:
- history completion searches by default, so I can just type part of a command, hit arrow-up and look through only the relevant results (ZSH also did this, but Fish is better)
- tab completions are shown to you in advance (in light gray in front of your cursor)
- Basic configuration (which is good enough, honestly) can be done via a web browser. Just run "fish_config", and it starts a web server, pops open your browser and any changes you make there are saved to your actual config files. No more looking up syntax.
- aliases (which are called abbreviations) are actually expanded after typing, so the full command appears in your history. You can also edit the full command before running it, if you need.
- fullwaza 5y ago+1 for fish shell, it really is great. Powerline prompt with it is also super useful.
- a_conservative 5y agodo you have any trouble running shell scripts? I would suppose that the #! line at the top of the script would save you from problems in most cases. What about bash one liners? I had a bad experience with Ubuntu's (Debian's) dash shell many years ago and I've (lazily) just stuck with bash since then.
- ronjouch 5y agoNot OP, but happy fish user too. For me, yes I still write my scripts in hashbanged (ba)sh scripts; the only fish I write is my config.fish. Fish might be an objectively better language, I don't want to learn it and prefer keeping writing (ba)sh, as 1. (ba)sh is an evil I know... 2. ... that I must know anyway to work on servers (while fish's "utility" is low as used nowhere but around the fish shell)... 3. ... and shellcheck makes it (a bit) less of a footgun. When I do need to write a bash one-liner, I just run it in bash :) . But it's a once-in-a-blue-moon occurrence, since pipes are the same, and fish added syntax for && and || a few years ago (before that, they didn't exist and you had to use and; and or;), and added support a few months ago for `FOO=bar ...` direct env.var setting (before that you had to `env FOO bar ...`). So, your typical `thing --blah | grep stuff | awk stuff | whatever && something` generally works in fish.
- cuddlybacon 5y agoI use fish. My biggest pro-tip is don't chsh to set your shell to fish. Instead configure your terminal program to launch fish. * do you have any trouble running shell scripts? Nope. fish will run bash for most shebangs. * What about bash one liners? You will have to translate these.
- emilecantin 5y agoEasy: instead of "./the-script.sh", I run "bash the-script.sh". You can still type "bash" to get bash.
- kvnhn 5y agoCan't agree more with this. I too am a (neo)vim + tmux dev, and I made the same progression in shells. Fish just works out of the box. I actually stopped using autojump (see Better CD in the article) because Fish's context-aware auto-completion is that good.
- avindroth 5y agoOn a similar note, zsh-history-substring-search has become something I look for everywhere. https://github.com/zsh-users/zsh-history-substring-search https://github.com/zsh-users/zsh-history-substring-search
- mikevin 5y agoQuick note: aliases and abbreviations are seperate things in Fish, using the 'alias' function will create a wrapper function that does not expand after typing.