get bash history to vi

前端 未结 5 985
故里飘歌
故里飘歌 2021-02-19 04:57

When I try to read bash history into vim, I get nothing.

:r !history

If I just execute the command, i.e.

:!history
5条回答
  •  暖寄归人
    2021-02-19 05:59

    You may pre-write the history of current session:
    history -w
    Then in editor you can get last, say, 20 commands of history:
    :r ! tail -20 ~/.bash_history

提交回复
热议问题