how to reset vim's settings (including plugins, .vimrc file) without close vim?

青春壹個敷衍的年華 提交于 2019-12-10 08:59:09

问题


I have been using vim for two years, and I use "pathogen" for plugins manage. I am seeking a way to reset all vim's settings (including plugins, .vimrc file) without close vim. Is there any idea?

PS: In some cases, reload vimrc doesnot work exactly the same as reopen vim, so I want to reload the whole state exactly like reopen vim.


回答1:


From :h set

:se[t] all&             Set all options, except terminal options, to their
                            default value.  The values of 'term', 'lines' and
                            'columns' are not changed. {not in Vi}



回答2:


It is not clear why would you avoid restarting Vim.

If the problem is to lose the current state of tabpages, windows and buffers it would be preferable to create a session to save what matters and the reload everything else.

Building on Peter Rincker suggestion on the comments, there is a great plugin called session.vim, which makes managing sessions very easy. It also creates the Restart command:

This command saves your current editing session, restarts Vim and restores your editing session. This can come in handy when you’re debugging Vim scripts which can’t be easily/safely reloaded using a more lightweight approach.

The :Restart command worked very well here, so I've never tested the other plugin for the "lightweight approach". But you could try it if completely restarting Vim is not an option.



来源:https://stackoverflow.com/questions/22162858/how-to-reset-vims-settings-including-plugins-vimrc-file-without-close-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!