copy-earlier-word, you could bind it to your favorite keybinding before using it with appending these lines to
autoload -Uz copy-earlier-word
zle -N copy-earlier-word
bindkey "^[," copy-earlier-word
So, you could use like this in the command line:
% ln a_file_with_a_long_filename.pdf ~/path/to/a/new/hardlink/<Esc-,><Esc-,>
(The first keypress of Esc-,(or Alt+,) yields "~/path/to/new/hardlink/" like
copy-prev-shell-word, and the second time it replaces that newly inserted word with "a_file_with_a_long_filename.pdf").
Here is a copy of
copy-earlier-word document for a reference.
This widget works like a combination of
copy-prev-shell-word. Repeated invocations of the widget retrieve earlier words on the relevant history line. With a numeric argument N, insert the N th word from the history line; N may be negative to count from the end of the line.
insert-last-word has been used to retrieve the last word on a previous history line, repeated invocations will replace that word with earlier words from the same line.
Otherwise, the widget applies to words on the line currently being edited. The widget style can be set to the name of another widget that should be called to retrieve words. This widget must accept the same three arguments as
copy-earlier-word ZLE Function, widgets, zshcontrib(1)