How to use arguments from previous command?

前端 未结 11 1802
一个人的身影
一个人的身影 2020-12-04 04:35

I know that Esc + . gives you the last argument of the last command.

But I\'m interested in first argument of the last command. Is there a key

11条回答
  •  孤街浪徒
    2020-12-04 04:53

    The method described at the end of the accepted answer also works with the zeroth argument for me. I have these lines in my ~/.inputrc:

    "\en": "\e0\e."
    "\em": "\e1\e."
    "\e,": "\e2\e."
    

    \e2\e. has the advantage over \e2\e\C-y that it cycles through previous commands if it is pressed repeatedly instead of inserting the second argument of the previous command multiple times.

    To insert the whole previous command, you can type !!\e^. \e^ is history-expand-line.

提交回复
热议问题