Recent file history in Vim?

后端 未结 14 1401
悲&欢浪女
悲&欢浪女 2021-01-29 18:44

I would like to access recent files that I had opened and then closed in GVim. I open and close GVim frequently. I would like to access recent files from previous sessions as we

相关标签:
14条回答
  • 2021-01-29 19:23

    You might be able to access the list from the command line with:

    grep '^>' ~/.viminfo|cut -c3-|sed 's,~,'"$HOME"','
    

    Explanation:

    grep '^>' ~/.viminfo  #find the list of recent files
    cut -c3-              #remove the first 2 characters
    sed 's,~,'"$HOME"','  #replace ~ with absolute path
    

    You could have a bash alias if you use this regularly

    alias vim_mru="grep '^>' ~/.viminfo|cut -c3-|sed 's,~,'\"$HOME\"','"
    
    0 讨论(0)
  • 2021-01-29 19:24

    :ls to list recent files with buffer number on left-hand column.

    Then do :b{buffer-number} to jump there.

    Example: :ls shows list of files. I want to jump to third-last file I visited. :b3 will take me there.

    For faster searching, map :ls to something, e.g. <Leader>. in your .vimrc file.

    0 讨论(0)
提交回复
热议问题