improve history parsing

A few improvements have been introduced:

 - Improve file parsing by really reading a new line each time instead
   of just shifting to the next byte.

 - Exclude duplicates as it is not handled by fish history.

 - Strip double backslashes (this could introduce some bugs).

 - Exclude commands shorter than 3 chars.