how to reset Vim & TMUX dotfiles

472 views Asked by At

Let say I have messed up my vim & tmux configuration. Is it possible to delete or reset them without losing any configuration changes such as PATH etc? If so, then how?

1

There are 1 answers

0
W. B. Reed On

At this point? There probably is no way to get those files back. But, as a preventative measure in the future, keep config files like those in some sort of version-control system (like git or mercurial).

However, if this is too tedious or you don't want to for whatever reason, you can also add the following lines to your .vimrc:

set undofile
set undodir=~/.vim/undodir

Don't forget to mkdir ~/.vim/undodir.

This configuration enables persistent undo history in vim (I assume you're using vim to edit these files). With this feature, even after you close the file, and reopen it, you can still undo changes you made in the previous editing session. So if you'd had this set, your problem would be solved simply by hitting u until the files were in a good state. See :help undofile for more info.

Also, check out the great plugin vim-mundo. It provides a visual "undo tree" and makes browsing vim's complicated undo history very easy. Plus it's compatible with neovim.