Fish now supports timestamps in the builtin history command if you execute it with the
(You must be using at least fish version 2.4 which was released Oct 2016)
As per your original example, you can specify the format as so:
$> history --show-time='%h/%d - %H:%M:%S '
or save that into a function (not using an alias here because 1. recursive and 2. long):
builtin history --show-time='%h/%d - %H:%M:%S ' | tail -r
I add the additional pipe to tail-reverse so that it reads top-down like bash
Add that to your fish functions and it should be enough for you.
There does not appear to be a way to print the "history index" (which "line number" a given command corresponds to). For comparison, here's my preferred bash history format:
228 01/05/17 14:47:53 $> history
229 01/05/17 14:48:11 $> vim .bash_profile
230 01/05/17 14:48:42 $> source .bash_profile
231 01/05/17 14:48:45 $> history
232 01/05/17 15:15:29 $> ls
233 01/05/17 15:15:30 $> clear
234 01/05/17 15:15:32 $> history
and the corresponding fish history for the time I was writing this post:
01/05/17 15:05:53 $> vim history.fish
01/05/17 15:10:01 $> man history
01/05/17 15:14:50 $> history | tail -r | less
01/05/17 15:15:01 $> history | tail -r
01/05/17 15:15:11 $> ls
01/05/17 15:15:14 $> vim history.fish
01/05/17 15:15:41 $> history
Frankly, it's close enough to be honest.
UPDATE: after some thought, you can keep piping the result in order to get those line numbers. It won't be perfect (multi-line commands will be counted as a new "line" for each line entered) but it gives you pretty much everything you would want out of a bash-like history for fish. Here's my final
builtin history --show-time='%m/%d/% %T $> ' | tail -r | less -N +G
less -N gives line numbers, and
less +G starts the file at the bottom (so you are automatically looking at most recent entries).
tail -r is only compatible on FreeBSD-based systems (which includes Mac OS X) but you can use similar alternatives like tac (and gtac if you're using GNU coreutils).