Disclaimer: This content is not owned by the current webmaster nor do we claim the credit. Ownership of this domain has changed hands. This URL however as a courtesy to web users is a historic copy of what was originally published.
Conner Mcdaniel has created a new blog at https://connermcd.wordpress.com You can find all of his current publication there.
conner mcdaniel about projects rss
Vim. What? Why? How?
APR 12TH, 2011
Vim is a text editor, just like Notepad or TextEdit. At their most basic form, files can generally be interpreted as text depending on their encoding. Many files begin as text, not just .txt files. For example, the files that webpages interpret are composed by text in a language called HTML. Source code and configuration files begin as text before being compiled or read. Thus, text editors can be used to manipulate all of these files. Whether you want to make a quick grocery list or edit the configuration of your web server, you need a text editor.
Notepad and TextEdit are “GUIs” (graphical user interfaces). They are programs that you can move around on your desktop as a window. However, the people who wrote the original program called Notepad had to use something else to write it. They didn’t necessarily have a Desktop or windows to move around graphically. They may have coded it completely from the command line. Vim is such a program. It can edit files directly from the command line. It also has the ability to be used as a GUI like Notepad or TextEdit. The people who wrote vim also used something else to write it (probably a former counterpart of vim called vi), and so on until you finally get down to the actual hand-coded binary that was originally used to create the ability to edit text at all. However, because VI was used for years by developers, it gradually grew in features and efficiency.
Programmers are intelligent and efficient. In other words, programmers are lazy. They want to get in and out as fast as possible. This is exactly what vim is useful for. I’m not stating that vim is for everyone or that it’s easy to use, but there is no doubt about its speed in comparison to Notepad or TextEdit. Vim is basically a way to have keyboard shortcuts for anything you could possibly want to do to a text document. There are shortcuts for jumping to the end of a word, line, paragraph, or document. There are shortcuts for copy and pasting, finding and replacing, and opening or saving. You can view multiple documents at once in tabs or split screens, and there is a built-in file browser for navigating through your files. That being said, whenever you have that many key shortcuts there is going to be a learning curve. You must learn the shortcuts before you can reap all of vim’s benefits.
Because there is such a learning curve, the “why?” question is valid. Why should you waste your time with this? The answer is that you probably shouldn’t. Unless you do a lot of text editing, you probably don’t have a lot of use for vim. If you program, write blogs, configure servers, use the command line, or do a lot of technical writing then vim might be for you. Other options are either slower, too simple, too bloated or on the whole less elegant than vim. Vim is lightweight and fast. It doesn’t have a lot of bloated, built-in features. Instead it is an entire language of its own. If you learn this language, then you can tell it to do literally anything you want it to do (as far as editing text goes) with unlimited customization and unbeatable speed. You never have to reach for the mouse or look through lists of options again.
Let me give an example of what I mean by speed (better in full screen).
Getting vim is easy. You can install it on any operating system either graphically, on the command line, or both. The downloadable files are found here. Learning vim takes a little more effort. The best way is to find an online tutorial that spells it out very simply. I found this reference to be very simple and useful as I was beginning. A more exhaustive reference can be found here.