Reputation: 545
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?
Upvotes: 3
Views: 2345
Reputation: 1551
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 check out 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. It is 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 log in to my development box, run screen (definitely something to checkout for the unfamiliar: GNU Screen) and run multiple Vim sessions within my screen session on my development 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.
Upvotes: 0
Reputation: 21728
I have a 57 MB log file that I need to view and search. While 57 MB does not look really large, it takes tens of seconds to open it with "GUI based" editors, with crashes highly probable. The search capabilities of vi are excellent and this editor serves me much better here.
Upvotes: 0
Reputation: 7383
This is obviously a hot topic, so I'm going to give a list of reasons why I prefer an IDE editor for coding.
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.
I prefer a one-click compile button/command as opposed to having to remember my compile command and its library of options
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.
Upvotes: 0
Reputation: 78852
You can find it (or easily install it) almost anywhere. It 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 configuration file is priceless.
Upvotes: 1
Reputation: 6774
Vim is not very good at code awareness. It is good at 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.
Formatting is done with =. You can also point equalprg to an external program to do the formatting for you.
Vim won't be able to remove unused imports, but if you select the import lines:
:'<,'>sort
: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.
Upvotes: 1
Reputation: 9155
I frequently work on a remote system, programming for a cluster, or editing configuration 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.
Upvotes: 2
Reputation: 487
People use non-IDE editors like Vi(m) for coding due to the following reasons,
For a normal programmer whose ideal work cycle is sit, write code, test, debug, more code, test debug, etc., 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 isn't any better thing.
Upvotes: 25
Reputation: 545508
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.
Upvotes: 2
Reputation: 72606
I've haven't done anything that you'd call a big project in Python (only little test scripts), but I use Vim exclusively for writing large embedded C applications, and I have never really felt the need for an IDE.
Vim is fast to start up, extremely fast to use and (with a bit of customisation) can do most things that an IDE can do. It'll do code completion, code auto-indentation and reformatting and it is very good at refactoring. The Project plugin makes it very easy to manage projects with lots of files and the Tag List plugin is great for browsing source code. It also allows you to have the C code open side-by-side with Python code, assembly code and LaTeX documentation without having to use a different tool for each.
Overall though, I think there is one really valuable thing that Vim gives you that very few other editors do and I would find it very hard to lose that: I can have a window split into three parts like this:
Each of the subwindows can either show a separate file or (as in the screenshot) a separate part of the file. I imagine Emacs can do this (although I could be wrong), but I doubt many IDEs can. This can be invaluable for refactoring and for referring to other parts of the file.
Upvotes: 7
Reputation: 15692
As usual: 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.
IDEs are specialized tools, which are good for problems they are made for. Vim is an incredible flexible and powerful general-purpose tool.
Upvotes: 0
Reputation: 272217
Here's why I use it.
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.
Upvotes: 3
Reputation: 4195
I've used vi/Vim and Emacs as my primary editors for years...
I've tried switching to IDEs, but I find they can't get out of my way enough. I always end up back in Vim 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 set up my own shortcuts for everything.
Upvotes: 6