Lanh Hoang
Lanh Hoang

Reputation: 11

How to reset vim and neovim when sourcing wrong file .zshrc instead of init.vim

I'm using macOS Catalina which has built in Vim 8.1. I'm also using iTerm with zsh and oh-my-zsh. I installed neovim for my personal use and when I setting it up, I accidentally enter source .zshrc in Command mode instead of source init.vim. From then, when I open neovim or built in vim, it does not source init.vim anymore and shows error message like below:

Error detected while processing VIMINIT:
E33: No previous substitute regular expression
Press ENTER or type command to continue

There is a line in my .zshrc that exports VIMINIT variable

export VIMINIT="~/.config/nvim/init.vim"

How can I undo this or is there any other way to reset vim to original setting? Thank you so much

Upvotes: 0

Views: 4447

Answers (2)

SergioAraujo
SergioAraujo

Reputation: 11830

To load a clean neovim:

nvim -u NONE -U NONE -N -i NONE

Actually I have an alias for that

alias vinone='nvim -u NONE -U NONE -N -i NONE'

This way you can type vinone and use your default neovim

Upvotes: 0

Lanh Hoang
Lanh Hoang

Reputation: 11

I tried @Niloct solution, unset VIMINIT and vim/neovim is backed to normal. After that, I reopen the iTerm and it showed error message again. Therefore I removed the export line from .zshrc and the problem has been solved.

Upvotes: 1

Related Questions