gVim

This page describes the Vim and gVim text editors.

What is Vim?

Vim is a powerful, highly configurable text editor that is popular with programmers.

Some exerpts from the vim website:

What Is Vim?


Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems.

Vim is often called a “programmer's editor,” and so useful for programming that many consider it an entire IDE. It's not just for programmers, though. Vim is perfect for all kinds of text editing, from composing email to editing configuration files.
What Vim Is Not?


Vim isn't an editor designed to hold its users' hands. It is a tool, the use of which must be learned.

Vim isn't a word processor. Although it can display text with various forms of highlighting and formatting, it isn't there to provide WYSIWYG editing of typeset documents.
With Vim you can edit very effectively. The most often used commands are just a single key stroke. To allow for this, you need to start Insert mode to enter text and return to Normal mode to execute commands. The big advantage is that you can keep your hands on the keyboard and work very fast. This takes a little time to get used to. It's a small investment that pays itself back soon.

Features

Features and why it's popular:

  • Concept of command mode, insert mode, etc.
  • The most often used commands are just a single key stroke. Fast! Don't rely on the mouse.
  • Very configurable - create your own key mappings etc.
  • Available on just about all platforms - Unix/Linux, Windows, Mac, etc..
  • Lightweight (low system requirements).
  • Built in syntax highlighting for just about any programming language or scripting language you can think of.

Cons:

  • Not easy to pick up at first. Requires you to invest a little bit of time learning and getting used to it.

Resources

Vim homepage: http://www.vim.org/

Vim in 6 kilobytes (English): http://www.vim.org/6k/features.en.txt Vim for non-vim users: http://www.vim.org/others.php

Using Vim

Useful keys in command mode

Key Effect
0 or <HOME> very start of line
^ start of line (not inc whitespace)
$ end of line
i edit mode to left of cursor
a edit mode to right of cursor
I start of line and edit mode
A end of line and edit mode
o open new line below current line (and change to insert mode)
O open new line above current line (and change to insert mode)
yy yank (copy) current line into register
p put (paste) line from register

Useful commands

Command Description
:e filename.txt open file filename.txt
:w save
:q quit
:bn go to next buffer
:bp go to previous buffer
:bd delete buffer
:hardcopy print document
/x search for x
:%s/x/y replace the first occurence of x on any line with y
:%s/x/y/g replace all occurences of x with y

Macros

Hit q to start recording a macro, then a letter to save it under (e.g. a), then the commands you want, then q again to stop recording.

Now to recall (play) the macro use @a.

Configuration

When an instance of gVim is started, it reads in two config files. Under Windows these are named _vimrc and _gvimrc and they are located in your C:\Program Files\Vim directory (or wherever you installed gVim). By convention, the _vimrc file contains general configuration details that are not specific to the GUI version of Vim, including stuff like your tab stops, whether highlight search is on or off, special key bindings, and so on. The _gvimrc is specific to the GUI version of Vim.

Here are some configuration files for gVim under Windows.

 
useful_software/gvim.txt · Last modified: 2008/06/05 08:10 by phil
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki