2

I'm absolutely new in C and Vim (now learning), started from Python, but now turned to C for educational reasons, along with which I had to learn the Vim (the point is, it wasn't my choice). The system is Windows 10. Here is the problem:

  1. I installed Vim (32-bit) from here (https://github.com/vim/vim-win32-installer/releases), adjusted it (added to path, edited enviromental variables and so on as in tutorials), found a proper _vimrc file. Vim started working successfully (at least, it opened without errors, showed all the functionality and let me edit the _vimrc file (I mean, before looking for a proper one in the web)).

  2. The next step was to install a Vundle. As in tutorial, I've made in C:\Program Files\Vim a "vimfiles" directory with "bundle" folder and followed the instruction to insert in CMD "git clone https://github.com/VundleVim/Vundle.vim.git C:\Program Files\Vim\vimfiles\bundle". Common CMD told me GTFO, but Git CMD reacted to the command, though again refusing to satisfy me, as there were "too many arguments".

  3. Okay, I googled for it more and found another tutorial with CMD instruction, which advised to insert a "git clone https://github.com/VundleVim/Vundle.vim.git ~/vimfiles/bundle/Vundle.vim" command. It actually worked (I thought), black plate of CMD got filled with multiple white letters indicating the downloading process. After the process was finished, I've checked the vimfiles\bundle folder, it appeared to be empty, but never mind, I did as I was told to.

  4. The next step instructed to edit the _vimrc file, to add some strings about Vundle into it. And as soon as I've tried to open _vimrc via Vim (or gVim), it showed a warning with Error E1187: failed to source defaults.vim. The Vim window opened without any functionality, empty, with only two lines on the bottom containing, I guess, the file size info.

  5. I've cried a bit, but then gathered myself and decided to delete the whole "vimfiles" folder in hope to make it back to the previous step. It didn't work. I thought that it might be the second repository, which led me to the mistake, so I recreated vimfiles\bundle folder, but for this time I used the first repository with shortening my directory as in the second repository command (~/vimfiles/bundle/Vundle.vim). The answer was: "this directory is not empty etc."

  6. After another session of crying I accepted the challenge and deleted (de-installed) Vim, downloaded it as from the very beginning, repeated all the aforementioned actions. But once again, the installation of Vundle informed me that "vimfiles\bundle" folder was not empty, so "suck, my dear". Again, the reinstalled Vim didn't work properly because of the same error 1187; although it showed the contains of _vimrc file, but for reading only.

  7. Then I've surrendered and went here to seak for a help/advice/mercy. Please help, because I'm going to foam from my mouth soon with this Vim.

romainl
  • 186,200
  • 21
  • 280
  • 313
TiimeIrre
  • 81
  • 2
  • 11

4 Answers4

1

I got this error running vi under Cygwin. This thread was the most promising result from a Google search, so I'll add my solution. I'd just brown away away Cygwin and reinstalled from scratch - I was trying to resolve problems with some Python scripts which worked months ago but now wouldn't.

I've been using vi on and off since I learned it 35 years ago so just expected it to be there like it is in most distros. But when I went back to the Cygwin Install Packages page I found vim wasn't installed. Nor was Perl or Python, which I put right.

Anyone else with this problem under Cygwin, I'd recommend going through Category view in select Packages and checking what you want is installed. It might be getting a non-Cygwin version from somewhere such as c:/Program Files.

And if you're still having problems, check $PATH that all directories starting with /cygdrive/ came after all directories without. (Since previously running my Python scripts I'd reinstalled Windows Python, which may have messed up cygwin's $PATH.)

And if you're not using Cygwin, check your $PATH anyway, and/or use the type command to check what executable you're actually being given.

pleriche
  • 61
  • 5
  • Thank you for your answer! Actually, I've already given up both on C and Vim (not speaking about Vundle) :D – TiimeIrre Sep 17 '22 at 22:48
  • I came here for the same reason: vi not working in cygwin. Another thing to try: vi was installed by default as "vim minimal". I ran the cygwin installer and installed the "vim" package and the error went away – deccles Jun 12 '23 at 23:06
1

Here's the short answer:

  1. make a file %userprofile%\vimfiles\vimrc
  2. try starting gVim again, and see if the error goes away

Note that in more modern PowerShell syntax, the environment variable punctuation is a little different. Here's how it looks on my machine:

cat $env:userprofile\vimfiles\vimrc

" this is a vimrc file with nothing but a comment in it
MarkHu
  • 1,694
  • 16
  • 29
0
  1. You are not supposed to "find" a _vimrc. The only "proper" _vimrc is the one you build yourself, as your needs and knowledge evolve.

  2. C:\Program Files\Vim is off-limits. You literally have no business doing anything there. The right place for customisation is in your %userprofile%, which is Window's equivalent of the $HOME or ~ you may find in tutorials):

    %userprofile%\vimfiles\       <-- this is YOUR runtime directory, where
                                      all your Vim customisation should happen
    %userprofile%\vimfiles\vimrc  <-- this is YOUR vimrc
    

    That is where you are supposed to install plugins.

  3. The repo's README.md points to this document specifically targeted at Windows users and to a general FAQ. You are expected to read those documents carefully and follow them. If you did and you are still lost, then use the plugin's issue tracker.

  4. This is either a sign that you messed up Vim's runtime or that the installation didn't work as it should. A thorough wipeout followed by a clean install may help. If it does, stay away from C:\Program Files\Vim.

  5. Again, C:\Program Files\Vim is off-limits. You don't delete stuff. You don't add stuff. You don't change stuff. You leave it be.

  6. Isn't it Albert Einstein who had something to say about doing the same thing over and over and expecting a different result?

  7. You are wasting your time. You should a) give up on Vim, b) get a regular text editor or IDE so that you can focus on learning C.


(the point is, it wasn't my choice)

If someone told you to install Vim as a prerequisite for learning some programming language, then that someone should help you install, configure, and learn it.

Your failure is on them.

romainl
  • 186,200
  • 21
  • 280
  • 313
  • Thanks a lot :DDD 1) Well, I'm a newbie, so I have to apply to someone's else knowledge. For later it's true enough. 2) Do you mean I should delete C:\Program Files\Vim, or it must exist and I shouldn't touch it, working with userprofile directory instead? 3) Got you, I will read it. 4) I will try to delete it once again and then reinstall as you've said; btw, do I need to keep the same points in Path and environmental variables, or I should set them again from the very beginning? 5) Got you :) – TiimeIrre Jan 24 '22 at 19:50
  • 6) "...doing the exact same f***ing thing over and over again, expecting the sh*t to change. That is crazy" (c) Vaas, Far Cry 3)) 7) That's a branch of 42 franchise in Russia, it demands to learn C with Vim or some editor alike, as it gives a proper insight for newbies. Otherwise I wouldn't even have started to learn C, not even mention the Vim. And as it is a peer-to-peer system, there is a not very big hope to get an advice from the guys with the same experience as me. Thank you once again, though. – TiimeIrre Jan 24 '22 at 19:50
  • Vim is one of the weirdest and deepest editors out there. Even if one is a very good learner, it can take months to feel comfortable with it so it is bound to cause huge amounts of frictions on the road to your actual goal. Forcing you to use it without some kind of tutoring is rigging you up for failure. Plain and simple. C is enough of a topic in and of itself. – romainl Jan 25 '22 at 11:05
  • 1
    Stumbled on this looking for something else and even a year later, still have to come in and say how much your tone absolutely sucks, even though you're right, and displays the kind of off-putting energy that gatekeeps people from programming and makes the whole field seem inaccessible and unwelcoming. Show some empathy instead of approaching your response as a way to show off how smart you are. – sitrick2 Jan 09 '23 at 00:52
  • Keeping people like OP out of a field they obviously have no predisposition for is as good for them as it is for those of us who do and for the field itself as a whole. Neither programming nor Vim are for everyone, get over it. – romainl Jan 09 '23 at 06:15
  • No romainl: sitrick2 is right. Your tone sucks and you have a lot of nerve proclaiming OP unfit to code because he asked for help. He said he was new to the language: everyone is new at one time. You could help him without making him feel like crap – deccles Jun 12 '23 at 23:01
0

I had this issue after building from source. I created .vimrc file in my ~ directory and the issue was resolved.

Pauls Bebris
  • 399
  • 4
  • 6