Sergio Tapia
Sergio Tapia

Reputation: 41158

Emacs/VIM vs. Compiler

Since Emacs and VIM are just text editors, does that mean I have to copy paste the code into an IDE so it can be compiled?

Upvotes: 0

Views: 1883

Answers (11)

Jason
Jason

Reputation: 2741

For Visual Studio integration, I highly recommend ViEmu.

It basically turns the editor in VS into Vim. I use it every day at work, and it is very stable. I can't imagine working without it!


(source: viemu.com)

Upvotes: -4

Cheeso
Cheeso

Reputation: 192517

No, you don't need an IDE to compile code that you write in emacs.

I use emacs very extensively for building .NET code in C#.

The .NET runtime includes compilers. I downloaded the .NET SDK, which includes other tools, like nmake, msbuild, XML tools, debuggers and so on.

I grabbed csharp-mode.el, which teaches emacs how to highlight and indent C# modules.

C-x C-e , for me, runs the command compile. I type in msbuild there, and emacs runs the build, using the .NET SDK tools.

I do something similar with C code, and with Java code, and with Javascript.

The same idea will work with other languages as well.

Upvotes: 0

Matt Curtis
Matt Curtis

Reputation: 23624

Many IDEs can detect if the source file is changed by an external program, and prompt you to reload. I know this is the case with MS Visual Studio and CodeWarrior.

This is useful if your project is already managed by the IDE and you don't want to move it to something like Make, for example if you're on a team who mostly use the IDE, but you want to use a different editor. Simply edit and save the file in vim or emacs, switch back to your editor and hit Compile.

Upvotes: 0

Gregory Pakosz
Gregory Pakosz

Reputation: 70204

Well you edit your files in emacs or vim. Then you save them and then you invoke the target language compiler.

Typically, C projects would use Makefiles that are meant to track down the files needed to be compiled into a program, and their dependencies. Then you typically type make in the command line and make reads the Makefile you authored and takes care of invoking the compiler on the files etc...

For Java, people often use Ant or Maven to build their software.

...I know that my answer is vague, the list of languages and build tools is long, you should narrow down your question.

Very often, under Linux, when I don't need a massive IDE, I'm using Pida. It brings me a list view of the different Vim buffers, a convenient treeview of the filesystem and a shell: see screenshot.

See:

Upvotes: 16

tungd
tungd

Reputation: 14897

So far: IDE = a poor editor + compiler + debugger + other_unnecessary_stuffs Go get a compiler and a debugger and you do not need an IDE anymore

Upvotes: 0

Kornel Kisielewicz
Kornel Kisielewicz

Reputation: 57555

Apart from what already has been said, take a few tutorials to learn how to code/compile with vim and Emacs:

Upvotes: 3

Tobu
Tobu

Reputation: 25426

In vim, you type :make. In emacs, you type a M-x compile-frobnicate style command which I'm sure someone will provide.

Upvotes: 4

Noufal Ibrahim
Noufal Ibrahim

Reputation: 72765

You don't need an IDE to compile a program. You just need a compiler. Emacs/Vim are text editors that allow you to write your program. You then call the compiler and it will do the compilation.

Also, Emacs and Vim are scriptable and have routines that allow you to call a compiler directly on the file you're editing.

Upvotes: 6

Asklepius M.D.
Asklepius M.D.

Reputation: 283

It depends on your compiler, platform, and program. Most, like gcc, can be called from the command line (or from within either of those editors) although you may have to first write a makefile for the linker. Other compilers are integrated into IDEs (or are difficult to control externally), although even these won't require copy/pasting. Simply save your program and open it from within the IDE.

Upvotes: 1

DrewM
DrewM

Reputation: 1906

In VIM (with no extensions installed) something like

! /path/to/make (C/C++ world)
or
! /path/to/ant build (Java world)

Upvotes: 1

John Weldon
John Weldon

Reputation: 40769

Text editors just edit files.

Compilers just compile files.

IDE's just bring files and the compiler together in a convenient way.

So... No, you don't need to copy/paste the code into an IDE, however you do have to make sure your compiler (IDE in your case) knows where to find the file you want to compile.

Upvotes: 14

Related Questions