Friday, February 18, 2022

[SOLVED] How to run VirtualEnvActivate from inside .vimrc

Issue

I am able to run it inside vim from the colon prompt.

When I put the same inside .vimrc, I get:

E492: Not an editor command: VirtualEnvActivate black


Solution

Plugins are loaded after .vimrc (:help startup). Use autocmd VimEnter * in .vimrc to set up commands to run later (:help :autocmd, :help :augroup, :help VimEnter):

augroup SetUpVirtualEnv
  au!
  au VimEnter * VirtualEnvActivate black
augroup END


Answered By - Amadan
Answer Checked By - Mary Flores (WPSolving Volunteer)