search

Home  >  Q&A  >  body text

How can VIM be opened in the same state as the last time it was closed?

Like Sublime and Webstorm, when you open it, it will be in the same state as when you last closed it?
I think this is quite practical, because basically I open the same project every time.

过去多啦不再A梦过去多啦不再A梦2775 days ago747

reply all(6)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 16:43:03

    :mksession will save a Session.vim in the current directory. Just vim -S Session.vim next time will be fine

    reply
    0
  • 迷茫

    迷茫2017-05-16 16:43:03

    "记住最后一次编辑的位置
    autocmd BufReadPost *
      \ if line("'\"") > 1 && line("'\"") <= line("$") |
      \   exe "normal! g`\"" |
      \ endif
    
    
    

    reply
    0
  • 天蓬老师

    天蓬老师2017-05-16 16:43:03

    Okay, I found an easier way:
    https://github.com/xolox/vim-session

    Update: I found that the above method is still not easy to use,
    Finally, I found the artifact,
    https://github.com/tmuxinator/tmuxinator

    reply
    0
  • PHPz

    PHPz2017-05-16 16:43:03

    Just fucking google it :)

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 16:43:03

    Isn’t that the way it is?

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-16 16:43:03

    vim fileName, save after editing, the next time you open the editing position will keep the position when you last closed it

    reply
    0
  • Cancelreply