tags:

views:

504

answers:

13

I recently started picking up vi, going through some tutorials and trying to get used to it. But I still have some questions about it.

It seems to be nice for small one file changes, but as soon as I start to try doing bigger things it seems to be lacking. For example I'm used to have code formatting, import organizing, simple overview over all packages and other things that an IDE gives me. I saw some tutorials on how to use vi as an IDE, but it felt awkward at best.

Now I'm just wondering, what are the typical use cases for vi? Is it typically used to edit small files, or can it be used for larger projects? And if you use it in larger projects, how do you make it work? Or would it be a lot easier to use an IDE with vi keybindings?

+5  A: 

I've used VI(M) and Emacs as my primary editors for years... I've tried switching to IDEs but find they can't get out of my way enough. I always end up back in VI(M) or Emacs after a while. One major reason is that I find my hands need to leave the keyboard too much in IDEs as they require the mouse too often... And I'm too lazy to setup my own shortcuts for everything.

beggs
+3  A: 

Here's why I use it.

  1. it's fast to start up
  2. it's available across multiple platforms and is on all Unix machines
  3. it's fast to use (keystrokes for common operations, operations based around words/paragraphs etc.)

However, I use IDEs for large scale development work, since I can't believe they can be beaten for productivity, given their code-awareness and refactoring capability. I use Eclipse, but I plug a VI editor emulator into it. See this answer for more details.

Brian Agnew
Audioillity
A: 

As usuall: Choose your tool depending on the work you have to do! ;-) I'm using Vim and Visual Studio. You don't have to choose only one.

  • If you need an IDE, use an IDE. Vim is made for text manipulation.
  • It supports any languages. Try to edit a Ruby script with Visual Studio.
  • Performance on large files is much better than for most IDEs. Try to analyze a logfile having 100k lines and more using your IDE.
  • It runs on many plattforms and you can use it via a remote console, if you have to edit files on a server.
  • ...

IDEs are specialized tools, which are good for problems they are made for. Vim is an incredible flexible and powerfull generall purpose tool.

Achim
+10  A: 

Why, oh WHY, do those #?@! nutheads use vi?

Pawka
rather than vim? no idea
rampion
It doesn't matter.
Pawka
Downvotes for what? Read article at 1st!
Pawka
+6  A: 
Al
Netbeans can do that by simply dragging the tab and laying it wherever you want it, you can even customize where you want each window by simply moving it.
That's interesting, thanks razass: I'd not come across any editors that could show multiple views of the same file before.
Al
Dan
+2  A: 

I saw some tutorials on how to use VI as an IDE, but it felt awkward at best.

There's one thing to do at the very beginning: throw your sense of aesthetics overboard. You will never get the same kind of graphical experience in VIM as you do in a decent IDE.

That said, VIM actually does offer many of the features of a full-blown IDE and has a lot of advantages besides. I use VIM for almost all of my developing work and all of my text documents (using Vim-LaTeX) – even though I've actually paid money for Apple’s office suite, iWorks.

There's one point that's still nagging me, though: I can't get IntelliSense to work. For me, that's a huge problem, especially when using languages such as VB, C# or Java, for which excellent IDE support exists.

So, the learning curve for VIM is steep but once you've passed a certain point it's everything but awkward. In fact, compared to VIM's editing experience, you will find that it's the IDEs that suddenly feel awkward because while they're good at bookkeeping stuff, they suck at editing.

Konrad Rudolph
You do know about ViEmu right? Then you get Vim *and* intellisense.
Brian Rasmussen
@Brian: haven’t tried it, and I don’t use Windows any more. It’s also not the same since VIM thrives on the integration into the terminal, something that’s completely lost here. I like working with makefiles and bash scripts.
Konrad Rudolph
+18  A: 

People use non-IDE editors like Vi(m) for coding due to the following reasons,

  1. They are non-distractive, allows you to concentrate on the job.
  2. They do not clutter you screen area, offers you more code space
  3. They are faster
  4. They have better/faster/cooler text manipulation at the stroke of the finger
  5. You happen to move your hands out of the keyboard less to hold the mouse, drag it here and there and click.
  6. They also have the flexibility to support other tools like debugger, document viewer, etc.
  7. They also have ways to get things like code folding, etc.

For a normal programmer whose ideal work cycle is sit, write code, test, debug, more code, test debug.. Vi offers a simplistic yet powerful environment to get the work done faster and more efficiently.

For someone who had years of using some IDE, it might be like using some prehistoric tool, but once they have been through the initial days, then there is no looking back. They'd feel like there is no better thing.

Technofreak
+1 Very good points. Notably the 4th.
LB
Vim *is* an IDE without the mouse nonsense
Pestilence
So people...1) are too easy distracted2) should get a bigger screen3) should get a faster machine4) are too lazy to learn shortcuts of a real ide5) once again - are too lazy to learn shortcuts of a real ide6) don't know how to install plugins to a real ide7) want to enter cryptic settings commands to enable features they get for free with a real ideJust kidding - I like vi for small tasks and remote editing, but I wouldn't use it for real software development.
FRotthowe
+1  A: 

I frequently work on a remote system, programming for a cluster, or editing config files on a headless box. All of these could be done with a file transfer, a regular IDE, and another file transfer, but it is so much faster to just use VIM through SSH.

Karl
+3  A: 

Though not always as pretty, (g)vim can be configured to do everything that an IDE can do... and some more. You just need to find the right plugins.

After a period of getting used to, other ide's and text editors will fell clumsy and inefficient in comparison.

vim is addictive.

Alterlife
A: 

Vim is not very good at code awareness. What it is good at is text manipulation. It provides you with the tools for you to edit text, not to edit for you. If you just do "small" edits and don't read up on the occasional "vim commands you wish you knew" you'll never understand the power provided.

code formatting

Formatting is done with =. You can also point equalprg to an external program to do the formatting for you.

import organizing

Vim won't be able to remove unused imports but if you select the import lines

:'<,'>sort

simple overview over all packages

:vs .

This will open a vertical window containing the current working directory :)

In conclusion, vim can't replace your IDE but it will let you edit your text.

he_the_great
+1  A: 

You can find it (or easily install it) almost anywhere - Runs on all systems that can implement the standard C library, including UNIX, Linux, DOS, Windows, Mac, BeOS, and POSIX-compliant systems.

The ability to log into a remote server and confidently edit a config file is priceless.

Ken
A: 

This is obviously a hot topic so I'm going to give a list of reasons why I prefer IDE editor for coding. 1) I prefer to be able to fold sections of my code (I don't know whether Vi(m) can) without having to remember the command to do so or type it.

2) I prefer one click compile button/command as opposed to having to remember my compile command and it's library of options

3) I prefer the easier highlight copy paste operations without having to........ aah sod it!!

Well by now you get the picture. I'm not knocking Vi(m) I just think having your the elements and functionality of your coding environment visually represented makes for a clearer head and encourages exploration of options you may not know exists.

Dark Star1
The last paragraph would have been better presented as less categorical statements, describing what you do. Editors are a hot button for many people, and any statement about what you think a particular editor will do for everybody has the potential to start a flame war.
David Thornley
A: 

I much prefer vim over vi and prefer not to lump them together. Vim provides some features that are really handy and not always immediately obvious. Already mentioned was screen splitting. Also you may want to checkout ctags or exctags. These allow you to jump around the code base from within vim. I can place the cursor over a called method, jump to the definition, jump to a definition within that method, etc. Very powerful for tracing down bugs. Cscope is another similar program.

Vim will also allow you to run arbitrary shell commands within the environment and has powerful search and replacement features.

So an IDE will provide most of those, what will vim provide over a traditional GUI based IDE? That's easy, it runs on the CLI.

This allows me to login to my dev box, run screen (definitely something to checkout for the unfamiliar: http://www.gnu.org/software/screen/) and run multiple vim sessions within my screen session on my dev box. Now when I leave work for the day, I can leave my work session just as I left it, even while running builds. When I come into work the next day I can connect from my environment as if I never left.

Another reason to like vim or vi in particular, is that it can be found on virtually any Unix environment.

MattK
Yeah. vi is to vim what C is to C++.
Amardeep