Open jalanb opened 11 years ago
Ah yes. I'm using ZSH and the method of getting history is different. I should note that in the Readme.
Nice work.
So I'm running ZSH in iTerm2, and by default last_command() wasn't working as expected. I used the follwing:
function last_command() {
echo $(history | tail -n 1 | cut -d ' ' -f 2-20 | realiaser)
}
Here is the expected output.
~ ls -l 1440 [ABRIDGED] ~ history | tail -n 1 ll (1390) 37247 ls -l ~
~ history | tail -n 1 | cut -d ' ' -f 2-20 ll (1342) ls -l
I've found that part of the configuration to be very system dependent. I'm using ZSH / OSX. Newest version afaik.
On my machine the given method to extract the last command does not work:
Even if I were to work around that, the cut command is too simplistic, because it does not consider $HISTTIMEFORMAT:
OK, let's turn that off
Now I wonder about the cut command starting at field 3:
Those extra spaces before the command number (981) do seem to make the third field less than helpful. I need the 5th instead:
And that leaves the whole function as
Which works for me, but YMMV as you may be on Linux or Solaris or ... some other variety of Unix