junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
34.22k stars 1.93k forks source link

E492 Not and Editor command on Windows #1282

Closed dado-ca closed 5 months ago

dado-ca commented 5 months ago

Hello everyone, so I am trying to figure this out for three days now, but it just wont work.

I Installed vim for windows, version 9.1. Vim installation folder C:\Program Files\vim\vim91

  1. I installed vim-plug for Windows via the provided Powershell command, and got the following structure in my home directory:

1  VIM-PLUG

With autoload containing the plug.vim file.

  1. My _vimrc, is located in C:\Program Files\vim

2  VIM-PLUG

And it looks like this:

Vim with all enhancements source $VIMRUNTIME/vimrc_example.vim

" Use the internal diff if available. " Otherwise use the special 'diffexpr' for Windows. if &diffopt !~# 'internal' set diffexpr=MyDiff() endif function MyDiff() let opt = '-a --binary ' if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif let arg1 = v:fname_in if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif let arg1 = substitute(arg1, '!', '!', 'g') let arg2 = v:fname_new if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif let arg2 = substitute(arg2, '!', '!', 'g') let arg3 = v:fname_out if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif let arg3 = substitute(arg3, '!', '!', 'g') if $VIMRUNTIME =~ ' ' if &sh =~ '\<cmd' if empty(&shellxquote) let l:shxq_sav = '' set shellxquote& endif let cmd = '"' . $VIMRUNTIME . '\diff"' else let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"' endif else let cmd = $VIMRUNTIME . '\diff' endif let cmd = substitute(cmd, '!', '!', 'g') silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 if exists('l:shxq_sav') let &shellxquote=l:shxq_sav endif endfunction

set number all

plug#begin('C:\Program Files\Vim\vimfiles\autoload\plug.vim')

" List your plugins here Plug 'tpope/vim-sensible'

call plug#end()

I've tried to put the plug.vim file in the following locations (Absolute paths allways):

  1. C:\users\dado\vimfiles\autoload\plug.vim
  2. C:\Program Files\vim\vimfiles\autoload\plug.vim
  3. C:\Program Files\vim\vim91\vimfiles\autoload\plug.vim

Of course, I replaced the paths in plug#begin(...) block, inside the _vimrc file, every time I changed the location of plug.vim file. I even I copied plug.vim file to all autoload folders.

But allways with the same results, when i issue :scriptnames command inside vim, I can see that the plug.vim file is loaded:

3  VIM-PLUG

When I make changes to the _vimrc config file, I allways reload the terminal, tried with rebooting the laptop, without luck.

Also, I have Git installed, as some people mentiot it can be an issue, vim-plug uses git to download plugins.

Also, tried running it with cmd, powersell and Windoes termnal, as a regular user and Administrator.

junegunn commented 5 months ago
 plug#begin('C:\Program Files\Vim\vimfiles\autoload\plug.vim')

This is incorrect.

  1. No call
  2. The argument to plug#begin is the directory to install plugins, not the location of plug.vim file. You can just omit it so vim-plug will choose the default directory.

Change it to

call plug#begin()

and see how it works.

dado-ca commented 5 months ago

4  VIM-PLUG

Shame on me for not reading through.