AFAIK, in bash/zsh you have to do
export HISTCONTROL=ignoredups:ignorespace
in .bashrc or .bash_profile for the above trick to work.fish, OTOH, seems to do this by default.