[HN Gopher] New Features in the Fish Shell
       ___________________________________________________________________
        
       New Features in the Fish Shell
        
       Author : chmaynard
       Score  : 190 points
       Date   : 2020-09-29 18:14 UTC (4 hours ago)
        
 (HTM) web link (lwn.net)
 (TXT) w3m dump (lwn.net)
        
       | NuSkooler wrote:
       | I've been almost exclusively using Fish on all my installations
       | for a few years now.
       | 
       | Every once in a while I have to sub to Bash, but it's very rare.
        
       | lucaspauker wrote:
       | I remember not switching over due to having spent years
       | incrementally building up a bashrc. Is there a way to port it
       | over?
        
         | ilaksh wrote:
         | What I do is run bash as default and then fish on top of it
        
       | thenewwazoo wrote:
       | I tried to use fish for a while and ended up giving up and going
       | back to bash, mostly for one (somewhat irrational) reason: fish
       | kept recognizing bash-isms and yelling at me about it.
       | 
       | Clearly there's a code path to recognize the thing, so why not
       | just _do_ it? It already knows what I want, why post a message
       | instead? Either interpret it, or don 't.
        
         | tempay wrote:
         | In the latest major version they've actually changed most of
         | these so it's worth another try if you're so inclined.
        
         | [deleted]
        
         | daveidol wrote:
         | I get the sentiment, but not sure I agree with the "either
         | interpret it, or don't" part - it sounds like you are
         | essentially saying the scripting should either match Bash
         | completely (and thus lose out on the more modern syntax) or not
         | offer any kind of helpful error to users. Or perhaps support
         | both types of syntax?
         | 
         | Personally I think it's fine to help guide new users to the new
         | syntax without directly supporting it - this keeps Fish scripts
         | from all devolving into the (subjectively ugly) bash format.
         | It's like a graceful deprecation warning.
         | 
         | Edit: although I do think ceding on the logical operators (&&,
         | ||) was a good move since that one is so fundamental
        
       | djstein wrote:
       | thanks fish contributors. just upgraded and even simple ls -la is
       | snapper. so excited to have normal environment variable usage
        
       | lvh wrote:
       | I've used fish in the past but went back to zsh. IIRC fish broke
       | a bunch of times between versions and the maintainer feedback
       | wasn't great. The maintainers of course don't owe me any of their
       | time, so I'm not _mad_ about it, I just don 't use it anymore
       | because I need my shell to work reliably every time I open a
       | terminal. (I don't remember the precise problem but I'm sure I
       | could go find it.)
       | 
       | I now use zsh with zgen and a smattering of modules. It works
       | fine, doesn't have the issue that you have to first translate
       | every snippet you find to your new shell, and it's still easy for
       | the newer shell users in your life to use.
        
       | nikisweeting wrote:
       | As a long-time power user of fish for 6+ years, I cannot live
       | without it. It's easily in my top 5 most game-changing upgrades
       | to my dev environment. (up there with a clipboard history manager
       | and TabNine for code autocompletion)
       | 
       | Over the years I've amassed hundreds of fish functions for common
       | tasks on my machines, https://github.com/pirate/fish-functions. I
       | loved it so much I started using it to write devops/deployment
       | scripts instead of bash. That was a mistake.
       | 
       | It has some serious limitations as a scripting language, namely
       | lack of proper subshell support and background process control.
       | The relevant issues have been open for years with no clear
       | resolution in sight. (which is fair, these are very hard problems
       | and it's an open-source project with finite resources)
       | 
       | That's fine though, it's still my favorite interactive shell for
       | use in a Terminal. I just make sure to write any script longer
       | than a few lines in Bash. https://github.com/pirate/bash-utils
        
         | kstrauser wrote:
         | Fish functions are just gorgeous, and what made me drop Zsh
         | like a hot potato. Suppose you want to make an automatically
         | loaded (that is, not defined in the shell's rc file) function
         | called foo. Here's how you do it:
         | 
         | - Make a file named ~/.config/fish/functions/foo.fish
         | 
         | - Inside it, define a function named "foo"
         | 
         | That's it. Now when you open a new shell and try to run the
         | command "foo", Fish will look for the file named foo.fish in
         | that directory, load and execute it, then call the foo function
         | from in it.
         | 
         | Now, create an autoloaded function in Zsh or Bash without
         | looking at a man page.
         | 
         | There are a million little niceties like that where I'd assumed
         | that a certain task had to be complicated because every shell
         | I'd used before had made it complicated, but then Fish came up
         | with a nice convention for making it simple. Want to make a
         | function to dynamically set your shell's prompt? Create a
         | function named "fish_prompt" in the file
         | ~/.config/fish/functions/fish_prompt.fish. Ta-da - turns out it
         | doesn't _have_ to be a pain in the neck to do that.
         | 
         | I completely agree about using it as a scripting language,
         | though. It's great for making functions for your interactive
         | shell, but stick with sh or bash (or Python) for writing more
         | sophisticated stuff.
        
           | moonchild wrote:
           | for fname in $(ls ~/.config/zsh/functions); do source $fname;
           | done
           | 
           | :)
        
             | skizziepop wrote:
             | for fname in ~/.config/zsh/functions/*; do source $fname;
             | done
             | 
             | will prevent issues with special chars and spaces in
             | filenames
        
           | tyingq wrote:
           | Curious if this is loaded if you run fish from cron, or if
           | there's a flag for that. That's a recurring irritation with
           | regular shells, you have to manually load config if you run
           | cmd line or cron.
        
         | mattgreenrocks wrote:
         | The best part about fish is you don't have to configure it much
         | to be productive in it. It is really nice that the fish
         | maintainers think hard about what should be configurable, and
         | what sane defaults should be. This is not as common as it
         | should be in OSS. Contrast with zsh, which has a billion knobs
         | to tweak, and the consensus is that everyone should install a
         | huge "community dotfile framework" (whatever that means)
         | consisting of tons of opaque aliases and settings, some of
         | which might make your shell startup lag.
         | 
         | More to a specific point: I haven't had much of an issue with
         | fish's subshell/backgrounding control. That doesn't mean that
         | there aren't issues, just that my interactive use doesn't trip
         | into them.
         | 
         | I will note that you can write an async git prompt using
         | nothing but fish itself, which I consider an advanced use case
         | for a shell. Check it out:
         | 
         | https://github.com/mattgreen/lucid.fish
        
           | nikisweeting wrote:
           | I ended up implementing my own background process management
           | for fish here, it uses bash to fork a subshell with fish
           | inside of it, which seems to solve all the problems I
           | encountered.
           | 
           | https://github.com/pirate/fish-
           | functions/blob/master/backgro...
           | 
           | https://github.com/pirate/fish-
           | functions/blob/master/progres...
           | 
           | https://github.com/pirate/fish-
           | functions/blob/master/signal....
           | 
           | https://github.com/pirate/fish-functions/blob/master/fork
           | 
           | Usage:                   background progress_await
           | compiling_task_finished              g++ ... some slow
           | command              signal compiling_task_finished
           | 
           | This allows the progress bar to truly run at the same time as
           | the g++ command and receive a signal from the fg process when
           | it's time to complete, something a simple & does not let you
           | do in fish.
           | 
           | I've collected more details on Fish's issues here for anyone
           | interested:
           | 
           | https://github.com/pirate/fish-functions#issues-with-fish
        
         | hnlmorg wrote:
         | > _It has some serious limitations as a scripting language,
         | namely lack of proper subshell support and background process
         | control. The relevant issues have been open for years with no
         | clear resolution in sight. (which is fair, these are very hard
         | problems and it 's an open-source project with finite
         | resources)_
         | 
         | You say that but I'd been writing a shell in my spare time and
         | I solved those problems over the course of a few weeks. For me
         | though, they were important problems to solve because few other
         | lesser mainstream / alternative shells addressed those problems
         | and thus they became all the more tantalising problems to
         | solve. In Fish's case, they might be lower priority jobs.
         | 
         | Unfortunately though, I also broke job control support again
         | earlier this year and haven't had the spare time during the
         | pandemic (my kids have been understandably more demanding of my
         | time now that I'm working from home) to fix it. So I can't demo
         | that particular feature as working. As an aside, this is also a
         | good lesson to everyone to write robust tests....
        
         | Osiris wrote:
         | I've been using fish for longer than I can remember, but I
         | almost never write fish functions. The out of the box
         | experience is already much better than bash/zsh (out of the
         | box, not including plugins/etc).
         | 
         | I also prefer the basic syntax for things like for and while
         | looks on the command line, the way they get formatted. With
         | bash I always had to look up the syntax because I didn't use it
         | much. Fish, I barely have to look up things because they are
         | pretty intuitive, for the most part.
         | 
         | Also, no adding `export X=Y` to your .bashrc because you can
         | just `set -U` and it automatically saves it between sessions.
        
         | OhSoHumble wrote:
         | The lack of associative arrays is what does it for me.
        
       | bitcharmer wrote:
       | This, especially the long-awaited introduction of logical
       | operators (&&, ||) is most welcome.
       | 
       | In the past I used bash then zsh then migrated to fish and not
       | looking back. If you work in a shell a lot I can't recommend it
       | enough; it will boost your productivity. Especially with tons of
       | cool extras like oh-my-fish.
       | 
       | Huge thanks to all the contributors; keep up the good work!
        
       | lorenzfx wrote:
       | One of the things that really bug me out about fish shell is how
       | it completes history. If you type the beginning of a command, you
       | can use the arrows to cycle through all matching history items.
       | All items BUT THE LAST ONE. That one you have to complete with
       | ctrl-f.
       | 
       | And the worst thing is, this behavior is completely intentionally
       | [0]. For some time I used a patched version of fish, but it was
       | just too inconvenient and I went back to zsh.
       | 
       | [0] https://github.com/fish-shell/fish-shell/issues/405
        
       | maximilianroos wrote:
       | To preface -- I love Fish -- "Finally, a command line shell for
       | the 90s" is an apt description. I use it every day.
       | 
       | But I haven't managed to recommend it to beginners. There are so
       | many bash instructions out there, and translating between bash
       | and fish isn't easy for a beginner.
       | 
       | That's a great shame and missed opportunity, because beginners
       | would in particular value a nice shell. The shell is often one of
       | the harder tools to learn -- e.g. I find beginners are more
       | comfortable in a Jupyter Notebook than they are the shell.
       | 
       | I'm not sure whether there's a way of combining fish's ease of
       | use with a notion of compatibility -- maybe a "bash mode" for
       | beginners, which accepts bash commands? Or error messages which
       | return translated commands?
       | 
       | (I recognize not all commands can be translated, but all of those
       | that would be run by a beginner can be)
        
         | alan_n wrote:
         | I wish someone had recommended fish to me as a beginner. When I
         | discovered it I was finally able to write some aliases and
         | scripts without copy/pasting, overdoing it by resorting to a
         | real programming language, or wasting an entire day trying then
         | giving up. Concerning bash instructions, it's not that hard to
         | translate them imo, or you can just use bass or just pop into
         | bash for a second.
        
         | markstos wrote:
         | Extra compatibility has been added lately, like && and ||. More
         | bash syntax Just Works now.
         | 
         | I think it's fair to say "If it doesn't work in fish, just type
         | `bash` to enter a bash shell and try again."
        
         | ilaksh wrote:
         | It actually doesn't come up that often. A lot of times you can
         | just either A) paste one line at a time or B) use double
         | quotes.
         | 
         | But what I do is I run fish manually on top of bash. If I have
         | an issue, I just type exit and then try to paste the commands
         | in again. Then when I am done I restart fish.
        
         | hinkley wrote:
         | It's a chronic problem on work projects that people write shell
         | scripts without a shebang operator at the top. Obscure error
         | messages are usually how I find out someone is using zsh, fish,
         | or some other shell.
         | 
         | I fix what I can, but it's like mopping up water during a
         | rainstorm. Yes it's better than doing nothing, but also there
         | will be more in twenty minutes so don't make any plans.
        
           | azernik wrote:
           | One way I force people (mostly myself) to include shebang
           | lines:
           | 
           | Have a scripts directory in my repo that mixes shell and
           | python scripts with no file extensions and executable bits
           | set. If I don't put a shebang, it just doesn't run.
           | 
           | Of course, this requires you to have firm control of code
           | style policies.
        
         | chubot wrote:
         | This is the point of Oil -- having a smooth upgrade from bash.
         | The interactive shell ended up being more work than I
         | anticipated. So I'm looking for people who want to run with it
         | either as a separate project or part of Oil.
         | 
         | http://www.oilshell.org/blog/2020/02/recap.html#fish-oil-is-...
         | 
         | Another option is to link Oil as a C++ library into another
         | shell, which is starting to become possible. Oil handles all
         | the difficult language and compatibility issues, and
         | encapsulates them, so it's a great complement to someone who
         | only wants to work on the interactive shell.
         | 
         | Even though it cleans up many legacy warts, Oil runs thousands
         | of lines of real bash programs:
         | https://github.com/oilshell/oil/wiki/Shell-Programs-That-Run...
         | 
         | Posts on the interactive shell:
         | https://www.oilshell.org/blog/tags.html?tag=interactive-shel...
        
         | zamadatix wrote:
         | Have you seen https://www.oilshell.org/
        
           | SAI_Peregrinus wrote:
           | Oil is more focused on making shell scripting nicer, Fish is
           | more focused on making shell interaction nicer. Both are cool
           | projects, just slightly different focus.
        
             | oblio wrote:
             | If Oil makes error checking and error messages nicer, it
             | will have provided an awesome service to the community.
        
         | jiehong wrote:
         | Usually, those commands can be run in bash from fish with a
         | bash -c, or from a file.
        
           | SAI_Peregrinus wrote:
           | Or via Bass[1], for things that modify the environment.
           | 
           | [1] https://github.com/edc/bass
        
         | duckerude wrote:
         | > Or error messages which return translated commands?
         | 
         | Fish does this in some cases:                 ~> echo $(true)
         | fish: $(...) is not supported. In fish, please use '(true)'.
         | echo $(true)            ^
         | 
         | > (I recognize not all commands can be translated, but all of
         | those that would be run by a beginner can be)
         | 
         | Not all of them, unfortunately.
         | 
         | Consider `while true; do something; done`. Fish interprets this
         | as an unclosed while loop, where `do` and `done` are ordinary
         | commands. So if you enter it you don't get a syntax error, fish
         | just waits for more input until you enter `end`. The same goes
         | for `if` and `for`.
        
         | Osiris wrote:
         | I found that adding the "&&" operator recently has fixed that
         | for a lot of common cases. I still prefer the "; and" syntax
         | though.
        
         | pjmlp wrote:
         | Actually it is more "Finally, a command line shell for the
         | 80s".
         | 
         | "Xerox Alto"
         | 
         | https://www.computerhistory.org/revolution/input-output/14/3...
         | 
         | Having grown through the UNIX adoption in the enterprise, it
         | kind of feels ironic that nowadays bash is kind of seen as the
         | UNIX shell, and in those days it was just one among many
         | possibilities to configure on /etc/passwd
        
           | mixmastamyk wrote:
           | I think it's referencing the color support that didn't really
           | hit until the 90s.
        
           | snazz wrote:
           | Bash is definitely seen as the "Linux shell", but most users
           | of non-Linux Unixes and Unix-likes don't use Bash. macOS, for
           | instance, now uses Zsh out of the box (although most Bash
           | one-liners still run unmodified in Zsh).
           | 
           | But Linux is the majority of the Unix-like market, so it (and
           | therefore Bash) dominates.
        
             | tssva wrote:
             | macOS just recently switched to zsh as the default and
             | doesn't change the shell for existing users so I imagine it
             | is likely the majority of macOS users are still using bash.
        
               | snazz wrote:
               | True, although it gives you a pretty prominent notice
               | that Zsh is now the preferred shell when you start
               | Terminal for the first time after updating to Catalina.
        
         | binaryanomaly wrote:
         | Just enter "bash" when you need bash and exit it once you're
         | done. Barely need this but sometimes it's useful.
         | 
         | Fish imho offers superb usability, wouldn't want to miss it.
        
           | lighthazard wrote:
           | You lose all the fish goodies when you do this, no?
        
             | Zardoz84 wrote:
             | you only need to paste a line or two of bash. it's what I
             | did when I have a problem with some online help that put a
             | line that only works on bash
        
               | riyadparvez wrote:
               | Some commands are compatible with bash, but not
               | compatible with zsh. I do the same thing when using zsh.
        
               | binaryanomaly wrote:
               | exactly.
        
       | dorianmariefr wrote:
       | happy user of fish with very few simple customizations:
       | set fish_greeting                  function fish_prompt
       | echo (set_color green)(prompt_pwd)(set_color normal)'> '
       | end
       | 
       | edit: also there is a change that didn't get mentioned: fish now
       | accepts `A=1 echo $A` for instance without using `env A=1 echo
       | $A` like at some point
        
         | haarts wrote:
         | Holy smokes! I've gotten used to the `env` prefix but this is
         | what kept going wrong for me. Thanks for the tip!
        
         | yborg wrote:
         | >not wanting to see fish being friendly every launch
         | 
         | The only thing I leave the default banner on is fish.
        
       | otoburb wrote:
       | Many of the comments in this thread refer to the sheer inertia of
       | millions of LOC of bash script in the wild. This seems to be the
       | main reason why Oil shell[1] aims to be "an upgrade path from
       | bash to a better language and runtime".[2]
       | 
       | I wish them luck.
       | 
       | [1] https://www.oilshell.org/
       | 
       | [2] https://www.oilshell.org/why.html
        
         | chubot wrote:
         | Thanks, that is indeed the purpose of Oil, and I also noticed
         | so many comments here pointing out the compatibility issue.
         | 
         | That is nearly "done" for Oil, as it runs thousands of lines of
         | real bash scripts.
         | 
         | There's a big list of known and mostly trivial differences
         | here: https://www.oilshell.org/release/0.8.1/doc/known-
         | differences...
         | 
         | If you're a bash user and you want your scripts to run under
         | Oil, I recommend testing it! If your script doesn't run, you'll
         | probably get a better error message than bash gives you.
         | 
         | Or you might motivate a change the OSH language (a cleaned-up
         | bash). It's easier to change now than later.
         | 
         | I'm still looking for help too:
         | 
         | http://www.oilshell.org/blog/2019/12/09.html#help-wanted
         | 
         | https://github.com/oilshell/oil/issues?q=is%3Aissue+is%3Aope...
         | 
         | https://github.com/oilshell/oil/issues?q=is%3Aissue+is%3Aope...
        
       | brightball wrote:
       | For somebody who hasn't tried it, what are the advantages over
       | something like Oh My Zsh?
        
         | lgunsch wrote:
         | I find it has two advantages. One, being quite a sophisticated
         | auto-complete system. I haven't seen anything nearly as
         | polished. The other advantage is it's easy to learn and
         | configure. You can read the short manual and you'll know about
         | every feature and keyboard shortcut that exists.
        
         | Macha wrote:
         | oh-my-zsh can be quite slow on very powerful machines for very
         | simple tasks. Also having a shell default to most of the
         | features you need makes docs simple compared to the million
         | flags of zsh
        
         | bobbylarrybobby wrote:
         | Oh my zsh always seemed to add several seconds to shell
         | startup. Fish starts up instantly
        
         | ufo wrote:
         | One thing I like about Fish is that it works great out of the
         | box, without needing to install plugins.
        
         | jdudek wrote:
         | It's a sane scripting language. It encouraged me to automate
         | simple tasks, create handy functions etc. I don't have to
         | google the for loop syntax every time I need it.
        
         | derencius wrote:
         | it's super fast (autocomplete, arrow up/down) and "looks cool"
         | without any extra configuration.
        
       | rubyist5eva wrote:
       | I think Fish is fantastic, but just can't use it because so many
       | things rely on either Bash or Zsh. I've settled for a modest ZSH
       | setup with Prezto and I'm pretty happy.
        
         | pkulak wrote:
         | Pretty easy to drop into bash for a second to copy paste
         | something from the internet and introduce God-knows-what onto
         | your system. ;)
         | 
         | You can also set Fish to start up after bashrc (or whatever),
         | so that you don't have to translate all your startup stuff.
        
         | lgunsch wrote:
         | In my years as a dev I haven't found many true dependencies on
         | Bash/Zsh. For Ruby, rbenv and other solutions worked. For
         | Python, there was virtualfish to make virtualenvs work
         | properly. Although now pyenv works out of the box with Fish.
         | Other than that, simply adding a shebang to scripts is
         | sufficient.
         | 
         | That being said, I don't go and convert the shell of all my AWS
         | instances to Fish. I just keep my local shell as Fish.
        
           | cuddlybacon wrote:
           | I've been using fish for years now and cannot remember the
           | last time something broke because it required bash but was
           | run by fish.
           | 
           | One thing I do differently than most is I don't make fish my
           | system-wide default shell. I leave that as whatever the
           | system default is. Instead I just make fish the default shell
           | within the terminal emulator I use.
           | 
           | Never had an issue with it, and it is much easier to setup as
           | well.
        
             | mattgreenrocks wrote:
             | Yeah, I think people miss that you don't have to `chsh`
             | your shell. Perfectly fine to make your terminal launch
             | `fish` instead of the default shell.
        
       | joseluisq wrote:
       | Fish shell is simple great. I use it for many years on my daily
       | development on Linux/Mac without regret it. The way how it speeds
       | up my software development process from the command line is
       | invaluable. However I still use Bash for writing production
       | scripts on my servers for different reasons like compatibility,
       | requirements, etc. But when I get my server via SSH, Fish rocks
       | also there.
        
       | rightbyte wrote:
       | "Finally, a command line shell for the 90s"
       | 
       | I laughed so hard when I read their motto some years ago that I
       | had to try it. I use it mainly for the nice autocomplete and
       | write scripts in bash ...
       | 
       | It is nice that they added "&&" for "and" etc. It was quite
       | annoying until I got used to it.
        
       | Jerry2 wrote:
       | I gave it a try a while back but it apparently needs IPv6 to be
       | enabled to use its web interface. Is this still the case?
        
       | mixmastamyk wrote:
       | I've been using fish for a long time from the 1.x branch, after a
       | long time using bash, and tcsh before that in the 90's. Before
       | that the primitive CMD and DOS.
       | 
       | I like much of what the new crew (who took it over) have done,
       | but after installing it on a new machine recently I realized I
       | didn't like their web configuration and some defaults. Which I
       | almost never use, but a newbie would.
       | 
       | First, terminals have much improved in the last three decades.
       | There's no obvious reason a curses-like app couldn't take the
       | place of the web app. Configuring the shell from the web is
       | rather gratuitous and weird IMHO.
       | 
       | A second, minor concern is the use of blue hues in their syntax
       | highlighting defaults. Blue on black is rather unreadable, hard
       | to see on its own, weakest of the colors due to eye sensitivity.
       | It's also bad at night-time. I'd like to see a more
       | neutral/warmer color palette for the default.
       | 
       | I have other nitpicks, such as their docs are not good enough on
       | how all the types of variables work, and why you pick one or the
       | other, for example. They moved away from the daemon, and
       | variables no longer get propagated across shells. That was a neat
       | feature but they removed it around the time they instituted the
       | web server. I don't really get those design choices, but there's
       | still no friendlier shell.
        
         | ridiculous_fish wrote:
         | fish-shell dev here. Sounds like you have been using it longer
         | than me!
         | 
         | We'd love to do a curses version of fish_config. I think you're
         | right the default colors could be warmer and still work on
         | light backgrounds (terminals don't publish their colors so the
         | defaults have to work on light and dark).
         | 
         | Variables are still instantly propagated, it just uses fifos
         | instead of a daemon!
        
         | mattgreenrocks wrote:
         | > They moved away from the daemon, and variables no longer get
         | propagated across shells.
         | 
         | Universal variable changes should be propagated across
         | different fish processes. However, it looks like the
         | maintainers are questioning whether they should live on.
        
           | mixmastamyk wrote:
           | I had just tried it and it didn't work. But looking at the
           | help, it needs a -U not a -u, thanks.
        
       | vesche wrote:
       | I've been using fish as my default shell for ~3 years now. The
       | faint gray history auto-complete / search that appears when
       | typing commands alone is a killer feature. urxvt + fish + ranger
       | + sauce code pro font = me loving my terminal experience a ton.
       | Thanks fish devs!
        
       | tjonsson wrote:
       | Fun story. Couple of years ago, a few colleague's and I were
       | casually chatting at our desk about fish shell. When suddenly we
       | hear someone a few desk away saying with a big smile: I wrote
       | that!
       | 
       | We were sitting next to Axel...
        
       | linsomniac wrote:
       | I gave fish a serious try last year, and really loved the
       | command-line completion, but the vi mode editing was a deal-
       | breaker. It's minimally usable, in particular it doesn't support
       | command combinations like dw, cw, f/ ct. etc... In the end I
       | found a history completion plugin for zsh that worked as well as
       | fish, and ended up going back to zsh.
       | 
       | The vi mode issue seems pretty hard to resolve, like have to
       | completely reimplement the editing hard. You can, as an
       | alternative, drop to a real editor if you need a real editor for
       | the command. Here's the issue related to it:
       | https://github.com/fish-shell/fish-shell/issues/4019
       | 
       | It's very interesting, but I'm pretty dead set on vi history
       | editing, so it wasn't for me.
        
         | Gaelan wrote:
         | I just tried dw, cw, f/, and df/, and they all worked just
         | fine.
        
       | devnonymous wrote:
       | For anyone who needs to/prefers to use bash:
       | 
       | > One nice feature for fish history is the ability to filter
       | through the history based on what is typed into the shell.
       | 
       | Add this to your .inputrc                 ## arrow up
       | "\e[A":history-search-backward       ## arrow down
       | "\e[B":history-search-forward
       | 
       | > Fish does not enter any command that begins with a space into
       | its history file, essentially treating it like an incognito
       | command.
       | 
       | Add "HISTCONTROL=ignorespace" to your .bashrc
       | 
       | > A new addition in fish 3.0 is the --private flag that can be
       | used to start fish in private mode; it stops all subsequent
       | commands from being logged in the history file.
       | 
       | run unset HISTFILE
        
         | NegativeLatency wrote:
         | The inputrc change is nice, but not quite the same as what fish
         | does.
         | 
         | If I type a part of a previous command in and then press the up
         | arrow in fish it will only cycle through history records that
         | contain that as a substring (which is really the killer part of
         | the feature).
         | 
         | (Yes I know you can do similar things in bash but you have to
         | press other keys to put it in the history search mode)
        
           | devnonymous wrote:
           | I agree, although otoh, the inputrc change is not specific to
           | bash. It is useful for any cli that uses readline (mysql,
           | python prompt, pgcli,...). Other useful inputrc settings I
           | have in mine :
           | 
           | # - when performing completion in the middle of a word, do
           | not insert characters # from the completion that match
           | characters after point in the word being # completed
           | set skip-completed-text on
           | 
           | # - displays possible completions using different colors
           | according to file type.                 set colored-stats on
           | 
           | # - show completed prefix in a different color
           | set colored-completion-prefix on
           | 
           | # - jump temporarily to matching open parenthesis
           | set blink-matching-paren on            set expand-tilde on
           | set history-size -1       set history-preserve-point on
        
       | szhu wrote:
       | Fish 3 was released almost two years ago in December 2018. It's a
       | little weird seeing these features being referred to as "new"!
        
       | miguelmota wrote:
       | Fish Shell has a lot of cool feature but lack of `ctrl-r`
       | functionality is preventing me from using it full time.
        
         | brinox wrote:
         | You can just type in anything you'd like as when using Ctrl+R
         | and then just press the up arrow key to perform a fuzzy match
         | in your history.
        
           | grimgrin wrote:
           | Does fish have its own inputrc ?
           | 
           | I'm sure it uses inputrc or similar, giving you a thing like:
           | $if mode=emacs       "\e[A": history-search-backward
           | "\e[B": history-search-forward       $endif
           | 
           | aka, type "fish" and press up arrow to only go through
           | history that starts with "fish"
           | 
           | also, how would you configure fish to use something that
           | doesn't lean on arrows? ^r has its own useful power that can
           | be separate from my use-case of arrows mentioned above, if
           | not just bc you don't have to move off the homerow ;)
        
             | snazz wrote:
             | You can press ^E to complete the current autocompletion, or
             | keep typing a little more to disambiguate if needed.
             | 
             | edit: this originally said ^D, which is EOF, not
             | autocomplete :)
        
         | triceratops wrote:
         | It lacks "ctrl+r" because it does history search even better
         | than bash. It shows auto-suggestions based on your history. I
         | find ctrl+r when I'm in bash kind of annoying, and not as good
         | at searching.
        
         | krisgenre wrote:
         | I am using fish along with fzf[1] and it makes `ctrl-r` even
         | better.
         | 
         | [1] https://github.com/junegunn/fzf
        
         | fimdomeio wrote:
         | Can't remember if it's something special I did with my fish
         | config but ctrl+r works for me and is actually better than
         | bash.
        
         | nikisweeting wrote:
         | The _default_ mode in fish is Ctrl-R mode, the shortcut is
         | redundant.
        
       ___________________________________________________________________
       (page generated 2020-09-29 23:00 UTC)