Welcome Guest, Not a member yet? Register   Sign In
Genuine request for merits of using Vim
#1

[eluser]Brian Dickson[/eluser]
My preferred development environment is Ubuntu/Linux and Geany/Gedit as my preferred text editors for developing PHP web apps.

I have tried Vim/Gvim on and off, but keep going back to a gui editor because of comfort zone. I don't mind spending the time to get acquainted with Vim, IF it is genuinely more powerful. The problem I have is separating the hype from fan boys and the real benefits Vim might have over a good gui text editor.

Leaving aside the 'time it takes to move your hand over to the mouse' argument, can anyone add their views as to why they think Vim might be more powerful?
#2

[eluser]Vheissu[/eluser]
[quote author="Brian Dickson" date="1292092033"]My preferred development environment is Ubuntu/Linux and Geany/Gedit as my preferred text editors for developing PHP web apps.

I have tried Vim/Gvim on and off, but keep going back to a gui editor because of comfort zone. I don't mind spending the time to get acquainted with Vim, IF it is genuinely more powerful. The problem I have is separating the hype from fan boys and the real benefits Vim might have over a good gui text editor.

Leaving aside the 'time it takes to move your hand over to the mouse' argument, can anyone add their views as to why they think Vim might be more powerful?[/quote]

From my brief experience in using Vim, I can honestly say it is for command line elitists who like to boast of only using command line Linux and that Vim is more powerful than any other text editor around.

Vim in my brief use is only good for people who are experienced in using command line operating systems like Unix and Linux, the learning curve of Vim is so great that it has many books written on how to use it. Is having to read a few hundred pages of a guide to edit some simple files really worth it?

I use NuSphere phpEd on Windows and it in my opinions craps all over Vim and most other editors.
#3

[eluser]Twisted1919[/eluser]
It is not.
Use an IDE to develop, the things will be more fast.
Of course, is nice to know how to work with vim because you will need it, but as long as you have alternatives, use an IDE. Vim will help you, if for example u try to edit a remote file from ssh and you don't have installed gedit/mcedit/nano/pico, but that's all it has to be used.
#4

[eluser]Brian Dickson[/eluser]
If find it difficult to see the benefits of learning Vim. I am not a touch typist, but I do type quite fast as I have been using a keyboard for donks, and so any perceived benefit of improved efficiency through fingers being constantly on the keyboard, doesn't apply to me, and I dare say, not really even to programmers that can touch type, because what programmer types constantly without pausing for thought or even for a coffee? That benefit is then nullified.

The main groups of commands are for movement around a document, and another for actions, ie move cursor to start of intended operation, then command for intended operation to take place over a stated part of the document from the current cursor position. All of this is easily achieved with a mouse, and where Vim might be seen as more 'serial' in it's movement, then a mouse can be seen as more 'direct'.

The only thing I have been awed with, is the use of Vim's regex in searching and replacing text in an entire document, which I haven't seen implemented as well in other text editors or IDEs.

Are there no other benefits Vim has over any other decent text editor?
#5

[eluser]smilie[/eluser]
I could not imagine _any_ benefit of Vim above any (decent) IDE.
Why would you for Christ sake create apps in Vim??

I am quite familiar with Vim and use it quite often (as Twisted said - mainly for fast editing / debugging remote files). But my OS is also Linux, thus I use Vim locally also a lot (i.e. to add new virtual host in Apache or to change configs on my workstation and such).

But I would never replace my IDE (NetBeans) for Vim (or nano / pico or what ever else).

Do not get me wrong on this one - Vim still _is_ one of most versatile editors I have ever seen / used. 'Pimped' with extensions it can be quite nice to work with. But things like code completion, debuggers and many more things an IDE can offer is simply not in a same rang as Vim.

Cheers,
Smilie
#6

[eluser]n0xie[/eluser]
VIM was designed and build to edit text quickly and efficiently. An IDE is developed with a whole different philosophy in mind. Since we as developers spend more time editing our code than actually writing it, VIM is still a very powerful and useful tool to have.

The power of VIM is the way it easily translate your _intent_ of how you wish to edit your file(s) to clear concise instructions (much like the CLI). It is quite trivial to do the following in VIM:

- Open a CSS stylesheet and transform all oneliners to multiple lines. After you're done editing transform all css styles to oneliners.
- Remove any spaces at the end of lines
- Transform multiple spaces to 1 space unless they are at the beginning of the line: if they are convert them to tabs ( I use this a lot because we have some legacy code that still used spaces as indentation)

You simply cannot do this in an IDE. Yes you can do it _manually_, or maybe setup some kind of macro/template. The point is, that like the CLI, VIM offers you a set of 'tools' which you can interchange to get whatever desired result you want. The more of these tools you 'understand', the more effective your editing will be. A lot of manual mouse-click/move cursor actions will disappear once you get used to VIM. This might not seem like a big gain but once you get used to it, you will start to see the real benefit.

For instance let's say for argument's sake you have a 10.000 LOC file and you wish to delete all the lines except the last 100. How would you go about it in an IDE? VIM offers you several 'tools' that can help you:
Code:
G100kdgg

G     -> go to last line
100k  -> go up 100 lines
dgg   -> delete to top of file

:1,$-100d

:1        Start at line 1
,        to
$        the end of the file
-100    -100 lines
d        then delete

:%!tail -100
% apply to the whole file
! execute
tail -100 (shell cmd that shows the last x lines of a file)

Another big selling point is the way copy/paste buffer works. Instead of 1 copy buffer, you can copy different blocks of text. I'm pretty sure you have run into the situation where you wanted to copy/paste several things at once from different documents. Now you do that manually. Also selecting text is much easier. You can copy a range with your mouse, but you can't copy a range EXCEPT lines, X,Y,Z. You'd have to manually un-select them. Copying a whole function, all functions starting with Foo or copying a whole class except function Bar is easy in VIM.

Does it replace an IDE? It depends on what your workflow is. I use Netbeans myself (for all the reasons mentioned earlier), but I open VIM quite often to do some real regex replacing. The learning curve of VIM is very steep: you will only get benefit once you have accustomed yourself with some of the tools, but depending on how many hours you spend coding a day, the return might be worth it. You be the judge.

Why, oh WHY, do those #?@! nutheads use vi?
Is VIM worth it
Some VIM tips Imagine doing these actions in an IDE and see if you can come up with a quicker way
#7

[eluser]Brian Dickson[/eluser]
Excellent post n0xie, this is the kind of insight I was after from objective Vim users, or developers that have used it in the past.

I'm glad to see you point out Vim's powerful search & replace feature which is something I mentioned above. I also wasn't ware of the multiple copy/paste buffer, and yes, I've found myself wanting to use more than one copy/paste action at a time.

but with regards the other examples, I'm not sure the frequency of those actions in my day to day work.

Quote:Does it replace an IDE? It depends on what your workflow is.

I agree about an individuals workflow, should help determine what environment is used for development. I've tried to get on with Netbeans for PHP, but it just seems so unwieldy, like a giant behemoth, and trying to add code snippets and change colour themes is like pulling teeth out.
#8

[eluser]n0xie[/eluser]
When it comes to editors VIM and Netbeans are probably almost the opposite of each other. VIM is lightweight, no nonsense, only show the code you're currently in (you can alter this but you get my point), Netbeans has several 'windows' where you see all sorts of trivial information, and the code window seems almost inferior to the rest (which in most cases to me at least it is) and tries to be just about everything one could need when writing code (editor, debugger, previewer, SCM, todo list, documenter, testsuite etc etc).

There are editors in the middle of course. Gedit, as you mentioned, is one of the better ones (although you need to install a bunch of plug-ins to make it useful). I use it as my default 'normal' text-editor.

My experience with Netbeans (and Java in general) is that you just need a really fast machine and a lot of Ram to make it work. Netbeans runs like a breeze on my machine because I run 12 Gb of Ram and have a zillion processors and run it from a SSD drive. It's the payoff for having a development environment where you enjoy working, instead of tearing your eyes out waiting for another indexing of your project to finish. The funny thing is that most people running windows are used to waiting for applications (photoshop?). Ever since I made the switch to Linux a couple of years back, every time I need to wait for an application to 'load' I get annoyed.

It takes patience to customize Netbeans, I give you that. As a theme I would recommend the twilight theme. It took me months to setup my shortcuts/snippets correctly but at least they work now. Don't get me started on setting the automated formatting correctly, but ALT+SHIFT+F is the first thing I press when opening code made by someone else.

In the end the benefits of Netbeans (inline code checking/parsing, debugging, code completion, syntax highlighting, intellisense, navigator (CTRL+7)) outweigh the costs. At least for me.




Theme © iAndrew 2016 - Forum software by © MyBB