While working at the Bash shell prompt, you can access the very last argument of the preceding command using
$ vim foobar.txt $ vim $_
To get the effect of
$_ in Fish, press
Alt+Up. Fish will insert the last argument of the previous command for you right there at the shell prompt.
If you find this command is not working, please check if your terminal multiplexer (tmux or Byobu) or your GUI terminal or windowing environment has not already assigned that key for something else.