Vim on Windows stupid questions thread

Hello everyone. I am trying to learn Vim on WIndows 10 with the GVim8.2 program.

What has me confused so far are commands. I can select a compiler but how on earth do I compile?

Also if someone can explain to me how to install plugins that would be great.

I have googled a lot of these things but a lot of the instructions don’t work.

All these commands within the program keep coming up as unrecognized commands

In :help 30.1, it says use the :make command. Set the makeprg option to the command for compiling.

Correct but when I do that it doesn’t work, I’m obviously doing something wrong and I don’t know what.

Something to keep in mind - Vim is primarily a text editor, not an IDE. You can definitely configure it to work like an IDE, but it’ll take time, plugins, and a lot of tinkering and experimentation.

Caveats - I haven’t used Vim on windows before and have moved over to using NeoVim (lua > vim script, imo).

I’d focus primarily on learning the editor itself - ie - the modes and movements. If you haven’t gone through vimtutor, do it (it should be included??).

As far as compiling goes, I still typically have another terminal open I can browse. However, you can setup language specific plugins, along side a language-server-protocol (LSP) and get your linting and compiling done for you in the background. I suggest this route, since LSPs are awesome.

As suggested by @jlittle, the :make command will compile your program, but you’ll need to verify that your current working directory is what you want it to be and that you have the correct :makeprg (if not using make itself), the :compiler is set appropriately, etc. Once you figure out all the pieces, it’ll work nicely.

If you want to play with plugins, which you probably do, I recommend Vim-Plug - it’s simple, works well, and has windows instructions.

Otherwise, I can try to help with specific issues - what language are you working with?

My goal is to learn C.

Gotcha! What compiler are you using on windows and can you compile your program outside of vim?

1 Like

I am still figuring all this stuff out. Previously I was just using Visual Studio and Visual Studio Code so whatever they use.

Is it just me or is none of this this stuff explained very clearly in documentation or online. A lot of stuff I find online is rather old.

I found a website last night that hadn’t been updated in nearly 15 years.

The thing I am really noticing is this weird unintentional vibe everyone gives off where they leave too much to interpretation and sort of forget that beginners don’t know anything hence why they are trying to learn.

I love science and I can understand physics and scientific studies easier than I can learn all this stuff as I have never gone down this hole before it is all new to me even with decades of computer experience.

Visual Studio bundles their own compiler and it’s probably not in your path. Once found, you can add it to your path / build script and utilize it in your make file (or set the vim makeprg?)

I haven’t done any real C development since college, but many C programs I compile now a days use ninja to for their build system (rather than straight up make). I’d suggest going that route and getting that setup in your system - as it’ll probably narrow down your searches to something a bit more recent.

This looks like an OK windows high level guide, though c++ specific → Setting up Ninja for CMake on Windows – Fredrik Linde

It looks like there’s a special “developers” cmd prompt in windows that has things setup for you w/ cl being the compiler? I’m curious what’ll happen if you run Vim inside that.

hey thanks Ill look into that.

I guess my frustrations are in the fact that there too many ways to do things. Where I like to find and learn the “factory” way and then customize as I grow proficient.

What I mean by that is learn a standardized way to get a foundation. Than modify with advancement of proficiency.

Welding for example. If I am teaching someone I am not going to teach them a bunch of tricks or whatever at the start. I am going to go straight to the absolute basics. As they grow in skill you can start to add the tricks.

I completely understand!

Not to bash windows or anything, but I think it’s tailored for development using Visual Studio. Most people I know use VS for everything programming related - it is a great IDE afterall!

Looks like the windows way of compiling C with the command line is to use their developer version - Walkthrough: Compile a C program on the command line | Microsoft Docs, which might be what you’re looking for.

Connecting it to Vim might be hard, but assuming you figure where everything lives and setup the makeprg option to point to the correct compiler, you should be successful after some trial and error.

Thanks for you help. I must say one language that really sparked my interest and ill look at in the future is AWK. I love the fact that it is all about doing more with less. Being able to do something in one line of code versus 5 or more is great in my mind.

I noticed my fascination with minimizing code when I was looking into JavaScript, I noticed code that did a function using 5 lines of code but I was able to shrink that to 1-2 lines and perform the same output.

I come from mechanical engineering background as I work in the machining industry and in that world it is all about minimizing processes, produce something to the desired quality but in the fewest amount of steps.

I was mildly horrified to hear that there is such a thing as being paid per line of code which to me is the absolutely stupidest requirement anyone could ever come up with.

If you want to play with AWK and learn Vim then I’d say just setup a Linux virtual machine and work in the environment they’re designed for to start. Then just use gcc as your compiler and go from there. That’s how I started learning programming, Vim and C, which incidentally led to me switching to Linux full time.

The thing with all of these things is there is no “factory” way aside from the default Vim keybinds. Personally, if I’m working in a terminal then I will use tmux and edit code in one pane and then compile it in another just using the shell and running make or whatever.
True Vim cultists enthusiasts will properly set up their environment with a menagerie of plugins and vimscript to make their own IDE but I’ve never gone that far.

To be fair wouldn’t an authentic factory experience be an original Unix system haha.

1 Like

Awk is great and all, really good for match a pattern and do something with the line, and a well used tool in my toolbox, but for a newcomer to coding, Python and a few idioms might be a better first choice, because you can run a very long way with it.

I have a question about Python. I know it is incredibly popular, but is it true that it is useless at multithreading? If so that seems like a severe waste of resources.

VIM on Windows is a niche application at best. It does not surprise me that the documentation probably assumes some of your knowledge and what not.

Usually, if you are not going to use the MS standard bundle, MingW is the usual go to for native MS Window and or cross-compilation. Cygwin being a little antiquated now.

This. If you want to learn how to use them and as close to the “factory” way, then I would highly suggest using the tools in their native environment. Inherently, when you learn these tools somewhere where they are not a first class citizen, your are going to learn bad habits, or you may get a bad taste in your mouth which may be issues with the transplanted environment more so than the applications themselves.

It can be done, but remember that Python was created as a [prototyping] scripting language first. great strides have happen to correct a lot of short-comings in Python 3, but there are still quite a few inherent faults there. Scripting languages are really there to get work done and get something up and running. They are not necessarily pretty. If you want to make something that lasts then [IMO] you really would need something that is strongly typed and also is more low level. Well I say that as having made a brief living off of Java.