Skip to main content
Home
Maxiorel.com
software, websites, development
  • Home
  • Software, websites
  • Development
  • Tutorials
  • Hardware

Vim: A Programmer's Editor

  1. Home
  2. Vim: A Programmer's Editor

15. August 2011

If you've worked with Microsoft Word, you're familiar with the same basic pattern: type some text via keyboard, copy and paste with the mouse, type more text, move the cursor back a paragraph with the mouse, type yet more text, spell check using the mouse on the main menu etc.

You'll notice that not only are you pecking away at the keyboard but you're also using the mouse to edit what you've just typed and to run commands. The perpetual switching from keyboard to mouse soon becomes cumbersome and slows down your productivity.

For many users this is just how it is and, in their minds, there is no better way. But long ago, before mice and windows with sparkling interfaces and controls were commonplace, coders and system administrators and computer enthusiasts were busy editing text and code with a little editor called vi (visual interface).

vi is highly used in the UNIX world, whose creators subscribed to the philosophy of writing small programs that did one thing well and then coding those programs to work together to create something bigger, like an operating system, for example. vi is ideal for editing code or for editing text files such as operating system config files.

The one thing many devout users love about vi is that everything can be accomplished (editing text, copying, pasting, moving around a file, opening a file etc.) from the keyboard. You can spend all day inside vI and never touch the mouse, and once you've mastered vi, you'll find that your productivity will greatly increase in leaps and bounds.

Vim: vi Improved

The original vi was a bit crude and lacking in some respects for a lot of users, so Vim (download here) came onto the scene, an easier-to-use version of vi. Once installed, fire it up and take a look at it. The first thing you must understand about Vim is that there are two modes, "Insert Mode" and "Command Mode".

Vim

It helps to think of it like this: in "Insert" mode, the keyboard acts just like a typewriter, and in "Command" mode the keyboard is used to issue commands, such as copying, pasting, opening a file etc. You switch back and forth between these two modes to get your work done.

When you first launch Vim, you'll be inside "Command" mode. Hit the "i" key to get into "Insert" mode and you can start typing. When you're in "Insert" mode you'll be able to type normally as if you were inside, say, Notepad or Microsoft Word. Type out a few lines of text and then hit the "ESC" key to get back into "Command" mode.

Once in "Command" mode, you can move around via the keyboard: "h" key to move left, "j" to move down, "k" to move up, and "l" to move right. It takes a little getting used to, but once you do, you'll begin to feel the gains of never having to reach for the mouse to navigate.

Still in "Command" mode (when in Insert mode, Vim will display "Insert" at the bottom of the editor), press the "0" key to move to the beginning of the line and the "$" key to get to the end of it. The "w" key moves the cursor one word forward, and "b" move one word back. And, of course", hitting the "i" key will get you back into "Insert" mode where your keyboard will no longer issue commands but rather act as a typewriter. We've barely scratched the very surface of what Vim is capable of.

Vim: Edit Without Taking Your Fingers Off The Keyboard

Vim is a very ancient (ancient in computer years, that is) text editor that is popular on UNIX/Linux operating systems and has been ported to almost every major OS that's out there. Vim may be old, but it's still a very powerful code/text editor that affords the user tremendous gains in productivity if they take the time to practice the way it functions.

If you're a programmer, you can edit source code and compile it without ever taking your fingers off the keyboard, and if you're a UNIX/Linux administrator, Vim can be your best friend when it comes to editing essential configuration files. If you take the time to get to know Vim's peculiar modes and commands, you may never go back to any other text editor again.

Tags: 
utilities

Similar content

Cygwin: Linux Commands on Windows
Cygwin: Linux Commands on Windows
Autoruns: Configure Startup Programs
Autoruns: Configure Startup Programs
Bionicspider: Window Organizer
Bionicspider: Window Organizer
uTorrent: A BitTorrent Client
uTorrent: A BitTorrent Client

Search

Latest content

Blockera: when you want WordPress with the Gutenberg block editor on steroids
Blockera: when you want WordPress with the Gutenberg block editor on steroids
Drupal 7 is over. A look back at the popular content management system
Drupal 7 is over. A look back at the popular content management system
DrupalCamp Poland 2024: tips for developers and ideas for marketing and teamwork
DrupalCamp Poland 2024: tips for developers and ideas for marketing and teamwork
How to play MP4 video in Gmail without downloading
How to play MP4 video in Gmail without downloading
How to do it yourself: repair Epson L355 and ink pad error
How to do it yourself: repair Epson L355 and ink pad error

Tags & topics

database burning Internet Explorer conferences Gmail CSS Hugo web PHP photos Drupal Linux Google Firefox security SEO Windows iPad printers video Python git Backdrop Office Microsoft internet Raspberry Pi e-mail JavaScript WordPress utilities Apple Adobe macOS
More

(c) Jan Polzer, 2008 - 2022, Maxiorel.com
About, Privacy Policy.