Fish history command not working as intended due to config file

Hello,

I wasn’t sure what the best place for this was, but figured Feedback was okay.

I wanted to utilize the Fish history utilities like search, delete, etc, but was struggling to get it working. I figured out that the history command had been overwritten in the config file, inadvertently disabling most of the functionality.

To restore the default functionality, just open the .config/fish/config.fish file comment out these lines

function history
builtin history --show-time='%F %T ’
end

So anyway just wanted to leave this here in case someone else runs into the same issue. Hope this helps!

2 Likes

Yep, there is a lot of stuff in the default Fish config. Aliases and functions and all kinds of neat stuff. Probably it is fine for most folks to just use it as-is and never think about it, but for anyone who spends some time in the terminal it’s worth browsing through the file to see what goodies are in there.

Personally I also remove the history function, and actually I remove a lot of other stuff in there as well.


Bonus tip:

The functions don’t actually have to be in the proper Fish config; you can create a file in ~/.config/fish/functions and give it a .fish extension, and Fish will read it. For example:

micro ~/.config/fish/functions/history.fish
# Fish command history
function history
    builtin history --show-time='%F %T '
end

Putting it in that directory is all I need to do for Fish to honor the function, and I can call it directly from the command line immediately after adding it.

image

It’s an easy way to de-clutter the Fish config, especially if you end up making lengthy functions or just have a lot of them.

5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.