Follow Us

We use cookies to provide you with a better experience. If you continue to use this site, we'll assume you're happy with this. Alternatively, click here to find out how to manage these cookies

hide cookie message

How to edit text with Vim

Old school geeks use a *nix text editor

Article comments

Free text editor Vim is a Windows (and many other platform) implementation of the classic *nix text editor, vi. "Vim" is short for "Vi, Improved", and while it has features vi lacked (such as scripting, file merge, and a GUI shell), the heart of it is vi.

Do not confuse "text editor" with "word processor." Vim is intended primarily for editing code, especially batch files and scripts, though it can certainly be used for other things. Furthermore, Vim is modal, which is a concept that might be odd to many modern (i.e, post 1980) users. In insert mode, when you hit a key, the key is entered into your document. In command mode, when you hit a key, an appropriate command is executed. Type "3dw" in insert mode, and you'll see those letters appear at your cursor. Type the same sequence in command mode, and you'll delete the next three words from your document. (Type 'u' to undo, of course!) You switch modes by hitting Escape. A small bar at the bottom of the screen will tell you what mode you're in.

This may sound like it's more trouble than it's worth, but once you're over the learning curve, Vim's power and speed is amazing. Because of the modality, the most common commands do not need to be "decorate" with ctrl- or alt- keys. Want to skip ahead a word? Hit 'w'. Want to skip ahead 7 words? Hit '7w'. Move to line 34? 34G. Top of file? gg. Last line in file? G. All of the major navigation and editing functions require only 2 or 3 keys, without the bizarre finger-straining exercises required by EMACS or prowling through menus. Vim for Windows maps most of the standard keys as well, so page up and page down work as expected, and if you want them to do something else, you can edit the keybindings file.

Vim includes a basic GUI, and allows you to use the mouse to perform many commands, but if you limit yourself just to the mouse functionality, you might as well be using Notepad. If you primarily write formatted text, Vim is not the best tool for you (but if you need to write marked-up text, such as LaTEX, it can be very useful!), but if you edit a lot of batch files, PERL scripts, or the like, and especially if you regularly move between Windows and *nix environments, it's extremely powerful. Besides which, if you master Vim, your geek cred will definitely go up a few notches.


Share:

More from Techworld

More relevant IT news

Comments




Send to a friend

Email this article to a friend or colleague:

PLEASE NOTE: Your name is used only to let the recipient know who sent the story, and in case of transmission error. Both your name and the recipient's name and address will not be used for any other purpose.

Techworld White Papers

Choose – and Choose Wisely – the Right MSP for Your SMB

End users need a technology partner that provides transparency, enables productivity, delivers...

Download Whitepaper

10 Effective Habits of Indispensable IT Departments

It’s no secret that responsibilities are growing while budgets continue to shrink. Download this...

Download Whitepaper

Gartner Magic Quadrant for Enterprise Information Archiving

Enterprise information archiving is contributing to organisational needs for e-discovery and...

Download Whitepaper

Advancing the state of virtualised backups

Dell Software’s vRanger is a veteran of the virtualisation specific backup market. It was the...

Download Whitepaper

Techworld UK - Technology - Business

Innovation, productivity, agility and profit

Watch this on demand webinar which explores IT innovation, managed print services and business agility.

Techworld Mobile Site

Access Techworld's content on the move

Get the latest news, product reviews and downloads on your mobile device with Techworld's mobile site.

Find out more...

From Wow to How : Making mobile and cloud work for you

On demand Biztech Briefing - Learn how to effectively deliver mobile work styles and cloud services together.

Watch now...

Site Map

* *