how to reset vim's settings (including plugins

2019-05-10 04:27发布

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.

标签: editor vim
2条回答
Summer. ? 凉城
2楼-- · 2019-05-10 04:59

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}
查看更多
啃猪蹄的小仙女
3楼-- · 2019-05-10 05:15

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.

查看更多
登录 后发表回答