4 ms·
-- A survey which will likely be of interest to the zsh and/or iTerm and/or Git users -- I used zsh for almost 3 years exclusively before moving over to Fish.
by iheartmemcache 11y ago
-- A survey which will likely be of interest to the zsh and/or iTerm and/or Git users --
I used zsh for almost 3 years exclusively before moving over to Fish. Oh-my-fish doesn't leave me lacking for any features that Oh-my-zsh has, and it's easier for me to extend as well.
Anyways, yeah. Fish rules. The package manager that comes with oh-my-fish is nice, but you have options like 'fundle'. And being able to see what each function does/edit it out of the box with 'funced' is great.
This is a good cheat-sheet to start with fish and omf.[2] Followed by a setup that's pretty standard for zsh converts especially if you're on OS X[3]. Bobby's theme is good out of the box and git-friendly. Read the guide to see the out-of-the-box omf plugin functionality[4]. It really is that easy. Some iTermer's like Agnoster[5], and the github page has previews for dozens of themes.
-- Modifications that might be of interestif you're an autojump/z/j user [Skip to the citations 2-5 if you just want to try Fish out] --
Directory navigation/auto-complete/globbing is probably the #1 'issue' I've had with shells, and I'd imagine others as well because of the numerous 'j','z','autojump', etc solutions that are out there. My problem with all of those is that it uses heuristics rather than giving you a deterministic solution as to 'ok, you will end up here'.
After ~15 years I finally wrote my own solution extended fish with SQLite. After every cmd, it makes an atomic append to the directory history log table with:
a timestamp,
the working directory,
the command invoked (naive), e.g. if you're already in /etc/httpd/ 'emacs foo.conf' will be the column entry,
and the full-path command, e.g. 'emacs /etc/httpd/foo.conf'.
There are also 'bookmarks' I can set and view in another table.
And finally I have a dirh stack (using the cmd_history table with just a naive SELECT DISTINCT cwd FROM tbl GROUP BY cwd ORDER BY timestamp DESC limit 10 -- or something, it's been a while since I've looked at it) which is visually printed to show the most recent first, making different 'context switches' real easy in a deterministic fashion due to how fish renders it's auto-complete paging.
I invoke my command with ;<Tab> and it shows 3 columns -each with a prefix and an easily accessible home-row association char {a,s,d,f,e,h,j,k,i,l}[10]:
my bookmarks, my dirh stack, and my most frequently visited dirs.
It sounds complicated but ;bs substitutes in 'cd ~/' much like a snippet-- so I can type ;bs[<key>s in my case expands to cd /home/andrew/]foo<Enter> and I'm in /home/andrew/foo/. This also works for expanding with other commands (not just cd) and written so your leader key can be anything[1]
It's way faster than cd ~/foo/ (~30% speed increase). With fish I can actually timestamp from when the command-prompt renders to when enter is hit, then compare the difference between the two. I suspect its because I'm so homerow oriented that the action of pivoting on my wrists to hit Left-shift then extending my middle-forefinger to hit ~.
The most convenient thing is I know for a fact where I'm going to be, because the fish-pager generates an overlay (something like this: http://www.screenage.de/blog/uploads/fish11.png http://www.screenage.de/blog/uploads/fish11.png ) with those 3 previous columns previously mentioned generated upon the ;<Tab> sequence, I can look at the table (if I need to, common directories are muscle memoried), complete my command, and the uninstrusive autocomplete disappears.
----
[1](I just chose ; since no shell I've ever used, whether it was ksh on SunOS or scsh-guile, ever had a grammar where ; was a character that began an expression).
[2] http://ricostacruz.com/cheatsheets/fish-shell.html http://ricostacruz.com/cheatsheets/fish-shell.html
[3] http://bleibinha.us/blog/2014/08/my-command-line-setup-with-fish http://bleibinha.us/blog/2014/08/my-command-line-setup-with-...
[4] https://github.com/oh-my-fish/oh-my-fish https://github.com/oh-my-fish/oh-my-fish
[5] https://github.com/oh-my-fish/oh-my-fish/blob/master/docs/Themes.md#agnoster https://github.com/oh-my-fish/oh-my-fish/blob/master/docs/Th...
- StavrosK 11y agoIs oh-my-fish usable if you've already got a bunch of customizations? I don't want to install it if it means half my stuff is going to break. I have things versioned in a git repo, but still...
- athenot 11y agoThat history idea is fantastic! I was using global history when I was on zsh, which was convenient when looking for something I did recently, and annoying for all the other cases. I need to set up something like that too, thanks for the idea!