VIDE User Guide Editor Reference VIDE Java Tutorial
Command Reference VIDE Version 1.21 - 28Feb2001 VIDE C++ Tutorial

VIDE - Editor Reference


The VIDE Editor

What is the most important part of any IDE? Why, the editor, of course! No matter how easy an IDE makes it to compile and debug your programs, you will still spend most of your time in the editor. The VIDE editor is based on the V TextEditor class, and has a long history.

I wrote the first version of the editor over twenty years ago in a language called Ratfor. Over the years, this editor code has evolved. It went from Ratfor to C to its current C++ version, and from supporting a simple console terminal to the current GUI version in an IDE. Over all this time, I always have found it easier to port the editor rather than learn a new one. This editor has the features that I've found the most useful as a programmer. For most of its life, the editor supported my own command interface called See, but the current version supports a standard GUI interface, as well as a Vi command emulation. No matter which command interface you use, the VIDE editor has a long history and includes many features very useful to a programmer.

Getting Started - Tips top

As I just noted, the VIDE editor has evolved into a fully featured programmer's editor. But in order for you to get the full value of these features, you have to know about them. This section will help you get started using the VIDE editor. It contains some tips for getting the most out of the VIDE editor -- understanding both its features, and its quirks. Do yourself a favor, and read this section!

VIDE features  top

This section describes some of the features of the VIDE editor emulations that are especially useful for programming. While most of these features are found in other editors, some are not native to the original editors VIDE emulates. In those cases, VIDE tries to fit the features into the natural command syntax of the original editor.

VIDE Keyboard Macros  top

The Standard, See, and Vi emulations all support a simple, yet powerful macro facility. There are 26 buffers called "Q-Registers". You can record character keystrokes into any of the Q-registers, and then execute those characters as a set of commands. A set of commands like this is often called a macro, or in VIDE terminology, Q-Macros. (Note: when you record special keys such as the arrow keys, they are all echoed as "{fn}" -- you won't be able to tell from the echo which key you entered.) You can enter any command into the editor, including find patterns and insertion strings.

The general procedure for using Q-Macros is the same on the currently supported emulations (the commands for using Q-Macros are different). First, you record a sequence of keystrokes into one of the 26 Q-Registers. The keystrokes you enter will be echoed on the status line. You can use backspace to edit your input. You terminate the Q-Macro by entering the special end-macro character defined for the emulation.

Once you have a macro recorded, you can then execute it using the execute-macro command of the emulation. You can provide a count, and thus execute the macro many times. Q-Macros terminate when any given command fails. For example, if a find fails, the macro will end. There are commands to specify which Q-Macro to execute.

Code Beautifier  top

The VIDE editor has a code beautifier for C, C++, and Java. How the beautifier works for Perl has not been fully tested. The editor will also fill text lines for text files.

To use the beautifier, you place the cursor on the line after a line that is already properly indented. Then enter the beautify command (as defined by the given emulation), and your code will be automatically indented, subject to a few limitation described later. Some parameters of the filling and beautification process can be adjusted in the Options->Editor dialog.

Code Beautifier

VIDE will format your C, C++, and Java source code by following a fairly simple set of rules. Because VIDE doesn't fully parse the code, you will have to follow some coding conventions, and may have to "help" manually sometimes. On the whole, however, VIDE's beautify command works better than using auto-indent. It is especially useful after you've revised a section of code.

Hint: when you are entering new code, it is often easier to not worry too much about the indentation. Just leave some whitespace at the beginning of each line, then go back and beautify it after you have your statement structure complete.

Hint: Using a command count often is especially useful when beautifying blocks of code. Remember to start on a line that is indented the way you want already.

Text Filling

When you use the beautify command on text files, VIDE will fill the text to the column set in the Options:Editor dialog. If the first column of the text has certain special characters or character sequences, VIDE will skip filling that line. This feature is intended to make filling of HTML and other markup language files work better. VIDE won't fill if the line is blank, or begins with a space, a period, a tab, a latex keyword, or a block oriented HTML command.

Syntax Highlighting  top

C, C++, Java, Perl

VIDE editors will highlight C, C++, Perl, and Java source code. The following default conventions are used: keywords in blue; constants in red; comments in green; C/C++ preprocessor directives in cyan; remainder in black. Other colors are used for alternate color schemes.

HTML

Highlighting of HTML files is very simple minded, but can really help you to read the HTML source code. Angle brackets (<, >) are always highlighted. If the first character sequence after the opening < is a valid HTML command, then it is also highlighted. Other parameter keywords within an HTML command are not highlighted. String constants and numbers are also highlighted. The "&" character is also highlighted.

ctags  top

Beginning with version 1.06, VIDE supports the ctags program. Ctags will generate a cross-reference tag file of C++ and Java source files. VIDE can read this file and locate the original definition or declaration of a symbol.

To use the ctags feature, first use the Build->Generate ctags command. This will generate a file called "tags" in the current directory. Then, to locate a symbol's definition, highlight it anywhere in a source file. (It is easiest to do this by double clicking over the symbol.) Any instances of that symbol will then be displayed in the status window. If the symbol is defined in multiple files, there will be multiple lines shown. There is extra information supplied about the symbol, and you can usually tell which is the instance you want. Often the information shown in the status window will be enough to help. If you need to see the actual definition or declaration, then right click the appropriate line in the status window, and the file will be opened.

Sometimes ctags will not include the symbol in the tags file. It does not generate entries for symbols local to a function, or for function parameters. And it will not automatically include symbols from libraries you use. If you want library symbols included in the tags file, you need to include the path to the library on the ctags args line.

By default, the arguments supplied to ctags are "-n", which is required for VIDE to use the tags file properly, and "*", which will make ctags use all the source and header files in the current directory. Most of the time, this will be just what you need. However, ctags has many options, and can tag files from other directories given the proper options.

You can change the default "*" argument using the Options->VIDE dialog. You can also supply a project specific ctags argument list using the project editor. Note that the "-n" switch will always be used.

To use the ctags feature, you normally don't have do anything other than be sure ctags is available. The Windows distribution of VIDE will install the ctags executable on the VIDE directory, and ctags is normally found on Linux systems. (You may have to add the VIDE directory to your AUTOEXEC.BAT PATH.) VIDE provides the ctags version known as Exuberant Ctags. A local text copy of the ctags man page is also included with VIDE. The source of Exuberant Ctags is available at its web site.

Other features  top

Wide lines

One attribute of the VIDE editor is how it handles lines wider than the window. It does not use a horizontal scroll bar. Instead, as you move right on long lines, the text will automatically shift to show more of the line. The last character displayed in the window of a wide line will be the last character in the line, and not the character that actually is in that column.

Auto save

You can set the Auto save value in the Options:Editor dialog to tell VIDE to automatically save open files at a given interval. This approach is different than some programmer's editors. You can end up with files that are in a state of transition. VIDE also supports making a backup file of the original when you edit. Note that whenever you do a project build, open files are automatically saved.

Time stamp

If you put a comment containing the string "date:" anywhere in the first 12 lines of your source code file (C++, Java, Perl, HTML), VIDE will automatically add a time stamp after the "date:" whenever you make changes to the file.


Commands common to all editors  top

In an effort to comply with standard interface design, especially as it applies to MS-Windows, there are several commands that are common to all editor emulations. These common commands are explained in this section.

In addition to the following keyboard commands, the action of the mouse to move the cursor and select text conforms to normal interface design.

Key Command Description
   
  Selection Highlighting
   
nShift-UpArrow Extend selection n lines up.
nShift-DownArrow Extend selection n lines down.
Shift-LeftArrow Extend selection left one character.
Shift-RightArrow Extend selection right one character.
Shift-Home Extend selection beginning of line.
Ctrl-Shift-Home Extend selection beginning of file.
Shift-End Extend selection end of line.
Ctrl-Shift-End Extend selection end of file.
   
  Clipboard
   
^X [Menu Edit:Cut] Cut selection to clipboard.
^C [Menu Edit:Copy] Copy selection to clipboard.
^V [Menu Edit:Paste] Paste clipboard to insertion point.
   
  Menu Commands
   
File:New Create a new file. You will be prompted for the name of the new file.
File:Open Open an existing file.
File:View Open an existing file for read only access.
File:Save Save (write) current file.
File:Save As Save current file under a new name. New file becomes current file.
File:Close Close current file.
File:Save All Save all open files.
File:Save / Close Save and close current file.
File:Send to Browser Send current HTML file to browser. This is an effective way to edit HTML files and view the results.
Edit:Undo VIDE's undo is a bit limited. Undo will undo the last text delete. It does not undo inserts, clipboard operations, or cursor movement.
Edit:Find Opens the VIDE Find dialog. This dialog gives you all the options available for finding text. The emulations will support both dialog based finds, and command line finds.
Edit:Find next [F3] Find next occurrence of find pattern.
Edit:Replace This opens the Find and Replace dialog. If you check the Confirm Replace option, you will be prompted before the replace is done. That confirmation dialog will also allow you to go ahead and replace all or cancel the find and replace.
Edit:Find Matching Paren Why is this a menu command? Because the command is useful for beginners who will often use menu commands over keyboard commands.
Edit:Editor Help Brings up a dialog with a command summary for the editor emulation.

Note about selections. You can use the mouse to highlight an area of text as well as the keyboard commands listed above. If you need to select more text than shows in the window, you will have to use the key selection commands (e.g., Shift-Down).


The Standard Editor  top

The generic command set of the VIDE editor is very similar to those found in many GUI based text editors. It is modeless. Commands are either special keys (e.g., arrow keys), or control keys (indicated by a ^ or Ctrl). Several commands use a meta modifier, Ctrl-A (^A) as a prefix. You can enter counts (noted by an "n") for commands by first pressing the Esc key, then a count, then the command. Not all commands are supported by command keys, and require you to use the menus (replace, for example). Note that the See and Vi editors have some features not found in the standard editor.

The Standard Command Set  top

Key Command Description
Esc Prefix to enter count n
   
  Movement Commands
   
Arrow keys Standard function
nLeft Move left [^L]
nCtl-Left Move left a word
nUp Move up [^U]
nRight Move right [^R]
nCtl-Right Move right a word
nDown Move down [^D]
Home Goto beg of line [^A,]
Ctrl-Home Goto beg of file
End Goto end of line [^A.]
Ctrl-End Goto end of file
nPgUp Move a screenful up
nCtrl-PgUp Scroll a screenful up
nPgDn Move a screenful down
nCtrl-PgDn Scroll a screenful down
   
  Searching commands
   
^A] Balance match
^F Find pattern (non-dialog). This form of find allows you to enter the find pattern directly from the keyboard. The find pattern is terminated with the Esc key. The pattern is echoed on the status bar. This form of find is useful for Q-Macros.
^A^F Find pattern - use find dialog.
Shift-^F [F3] Find next
   
  Insertion Commands
   
n^AIns Insert char with value of n
n^O Open a new blank line
Ins Toggle insert/overtype
   
  Editing commands
   
^ABkspace Delete to line begin [^A']
^ADel Delete to line end [^A\]
nShft-^C Fold case
^C Copy highlight to clipboard
^V Paste from clipboard
^X Cut highlight to clipboard
nBkspace Delete previous char
nDel Delete next char
nShft-Del Delete line
   
  Macros
   
^Aq<a-z> Set register to use (a-z)
^Q Record keystrokes in Q-Register until ^Q
n^E Execute current Q-Register N times
   
  Misc. commands
   
^AM Center Cursor in screen
^Av Repaint screen
n^G Goto line n
n^K Kill line
n^B Beautify code. This beautifies code or fills text. The beautify command will format C/C++, and Java code according to the V style conventions. To use this command, start on a code line that is indented how you want it. After that, 'n' lines will be formatted based on the starting indentation. This command is very useful if you use the V indent style. You can set the indentation for braces in the Options:Editor dialog. For text files (including HTML), this command will fill lines to the column specified in the Options:Editor dialog.


The See Editor  top

The command set of the See editor dates back to the late 1970's. The editor was originally called TVX, and the command set was modeled after the TECO editor. See, like Vi, has command mode and insert mode, and is normally in command mode. The commands are mnemonic. U for up, L for left, F for find, etc. It is very good for touch typists, and minimizes the need to move your fingers from the home row of the keyboard. If you don't have a favorite editor yet, or if you don't have a command mode editor you like, consider giving the See command set a try. It is really an efficient way to edit.

To use the See command set, start VIDE and select 'See' in the Options:Editor dialog. VIDE will remember your selection.

See is normally in Command mode. You can supply a count value to many commands by entering a value before the command. For example, entering 35d will move down 35 lines. When you enter insert mode, keys you type are inserted until you press the Esc key. The f find command lets you enter a find pattern that is echoed on the status line, and can include tabs. Press Esc to begin the search. The F version of find displays a dialog to enter the pattern.

In most cases, you can use a standard dedicated key (such as the arrow keys) as well as the equivalent mnemonic See command. You can highlight text with the mouse, and cut and paste in the usual fashion.

The See Command Set  top

Key Command Description
   
  Movement Commands
   
nl Move left [Left Arrow]
nr Move right [Right Arrow]
nu Move up to beginning of line/TD>
nd Move down to beginning of line
n^U Move up [Up Arrow]
n^D Move down [Down Arrow]
n[ Move left a word
nTab Move right a word [Ctrl-Right]
n^P Move a screenful up [PgUp]
np Move a screenful down [PgDn]
, Goto beginning of line [Home]
. Goto end of line [End]
b Goto beginning of file [Ctrl-Home]
e Goto end of file [Ctrl-End]
j Jump back to previous location. This is an easy way to get back to where you were before a find command, or a large movement.
n^L Goto line n
m Center Cursor in screen.
nn note (mark) location n. Locations go from 1 to 25. This is a bookmark feature.
n^N Goto noted location n
nCtrl-PgUp Scroll a screenful up
nCtrl-PgDn Scroll a screenful down
   
  Searching commands
   
n] Balance match. Find the matching
  paren, bracket, or brace.
f Find pattern (non-dialog). This form of find allows you to enter the find pattern directly from the keyboard. The find pattern is terminated with the Esc key. The pattern is echoed on the status bar. This form of find is useful for Q-Macros.
F Find pattern (dialog)
; Find next
^F Find/replace (dialog)
   
  Insertion Commands
   
ni Insert char with value of n. This lets you enter Escapes or other non-printing characters.
i Enter insert mode
Esc Exit from Insert Mode
^O Toggle insert/overtype [Ins]
no Open a new blank line
   
  Kill/change commands
   
^C Copy highlight to clipboard
^V Paste from clipboard
^X Cut highlight to clipboard
' Delete to line beginning
\" Delete to line end
n^K Kill line
n~ Toggle case
/ Kill 'last thing'. The 'last thing' is determined by the previous command. Commands that set the last thing include find, move a word, save, append, and get. Thus, a common way to perform a replace is to find a pattern, then use '=' to insert the replacement.
= Change 'last thing'. Delete last thing and enter insert mode.
nt Tidy (beautify) n lines. This will beautify C/C++, and Java code according to the V style conventions. To use this command, start on a code line that is indented how you want it. After that, 'n' lines will be formatted based on the starting indentation. This command is very useful if you use the V indent style. You can set the indentation for braces in the Options:Editor dialog. For text files (including HTML), this command will fill lines to the column specified in the Options:Editor dialog.
nBackspace Delete previous character
nDel Delete next character
   
  Save buffer commands
   
ns Save n lines in save buffer. See provides a buffer that allows you to save lines. Using the save buffer is often easier than cut and paste. After saving lines, you can use the '/' delete last thing command to delete the lines you just saved. The See save buffer is independent of the clipboard, and is local for each file being edited.
na Append n lines to save buffer
g Get contents of save buffer. Inserts the contents of the save buffer at the current location.
y Yank file to save buffer. This is an easy way to import text from an external file.
^y Write save buffer to file. This lets you save part of your file in a new external file. Using 'y' and '^y' is often an easy to copy parts of one file to another, or include standard text into new files.
   
  Macros
   
\<a-z> Set register to use (a-z)
q Record keystrokes in Q-Register until ^Q
n@ Execute current Q-Register N times
   
  Misc. commands
   
v Repaint screen
? Help
^Q Save and close

Macros for See  top

This section gives some specific examples of using Q-Macros with the See emulation.

First, consider search and replace. Even though VIDE has a search and replace function on the menu, you can do the same thing with a Q-register macro. Consider the following set of See commands:

fthe$=THE$

The '$' represents the Esc key. You would enter this macro by selecting a Q-Register (e.g., \a to select Q-Register 'a'), entering a 'q' command, then entering the command sequence, and ending the recording the sequence with a Control-Q (^Q). The characters you enter will be echoed on the status bar (which will indicate you are recording). Then execute the macro (22 times, for example):

\a22@

The next 22 occurrences of 'the' will be changed to 'THE'. The corresponding command in Vi would be: /the<CR>xiTHE$ where '<CR>' is a Return, and '$' is 'Escape'. Then execute it with 22@a. Note that in this emulation of Vi, 'x' will delete the pattern just found.

If you want to execute the macro for the whole file, give a very large count. The macro will exit after any command, such as a find, fails.

This is a See example for placing a '** ' at the beginning of every line that contains the word 'special'.

\aqfspecial$,i** $d^Q and execute \a1000@

The same function in Vi:

qa/special<CR>0i** $j0^Q and execute 1000@a

Future additions  top

Things missing from the editor that WILL be included in future versions:


The Vi Editor Emulation  top

VIDE now includes an emulation of the Vi command set. The emulation is not yet complete, and it is likely it will never be a complete emulation of Vi. However, it is a pretty good "finger memory" emulation. For the most part, the right things will happen when you edit using your automatic "finger memory" of Vi commands. This emulation should improve over time. See the limitations section for a description of the current limitations and differences of this emulation.

To use the Vi emulation set, start VIDE and select 'Vi' in the Options->Editor dialog. VIDE will remember your selection.

The Vi Command Set

  (* after cmd means emulation not exact)
Key Command Description
   
  *** Movement Commands ***
   
h,<Left> cursor N chars to the left
j,<Down> cursor N lines downward
k,<Up> cursor N lines up
l,<Right>,<Space> cursor N chars to the right
m<a-z> set mark <a-z> at cursor position
CTRL-D scroll Down N lines (default: half a screen)
CTRL-U scroll N lines Upwards (default: half a screen)
CTRL-B,<PageUp> scroll N screens Backwards
CTRL-F,<PageDown> scroll N screens Forward
<CR> cursor to the first CHAR N lines lower
0 cursor to the first char of the line
$ cursor to the end of Nth next line
<Home> line beginning
<CTRL-Home> file beginning
<End> line end
<CTRL-End> file end
B* cursor N WORDS backward ['word' not same]
"b cursor N words backward
`<a-z> cursor to the first CHAR on the line with mark <a-z>
`` cursor to the position before latest jump
'<a-z> cursor to the first CHAR on the line with mark <a-z>
'' cursor to first CHAR of line where cursor was before latest jump
<MouseClick> move cursor to the mouse click position
   
  *** Searching commands ***
   
/{pattern}<CR> search forward for {pattern}
/<CR> search forward for {pattern} of last search
?{pattern}<CR> search backward for {pattern}
?<CR> search backward for {pattern} of last search
N repeat the latest '/' or '?' in opposite direction
n repeat the latest '/' or '?'
% go to matching paren (){}[]
   
  *** Insertion Commands ***
   
A append text after the end of the line
a append text after the cursor
i,<Insert> insert text before the cursor (until Esc)
O begin a new line above cursor and insert text
o begin a new line below the cursor and insert text
R* toggle replace mode: overtype existing characters [just toggle]
CTRL-C Copy to clipboard
CTRL-V Paste from clipboard
CTRL-X Cut to clipboard
   
  *** Kill/change commands ***
   
C change from cursor position to end of line, and N-1 more
cc delete N lines and start insert
c[bBhjklwW$0] delete Nmotion and start insert
D delete chars under cursor until end of line and N-1 more
dd delete N lines
d[bBhjklwW$0] delete Nmotion
J* Join 2 lines [2 lines only]
S delete N lines and start insert;
s (substitute) delete N characters and start insert
u undo changes
X, <BS>* delete N characters before the cursor
x, <Del> delete N characters under and after cursor
~ switch case of N characters under cursor
   
  *** Yank buffer commands ***
   
P put the text on line before cursor
p put the text on line after the cursor
Y* yank N lines; synonym for 'yy' [cursor at end]
y< read file into yank buffer
y> write yank buffer to file
   
  *** Misc. commands ***
   
CTRL-L redraw screen
ZZ save file and close window
gb beautify N lines of C/C++/Java code, fill text
gm center cursor in screen
"<a-z> set q-reg/buff for next op
["<a-z>]q record to q-register until ^Q
["<a-z>]@ execute q-register N times

Emulation Limitations  top

As much as possible, this emulation tries to do the same thing Vi would do with the same command. Probably one of the main things missing in this emulation is the total lack of Ex support, i.e., there are no ":" commands supported. In fact, this should be a minor limitation as there are usually menu commands that support the most important ":" equivalents. You can also record macros that can duplicate many of the functions typically done with ":" commands.

Another major difference is the lack of support for a count for insert and find operations. Thus, "5ifoo$" will not insert 5 instances of "foo". This is true for some other commands as well. Generally, if you enter a command expecting some kind of repeated operation, and the VIDE Vi emulation does not support repeat, then the operation will be done only once. Again, you can use macros to get around this limitation.

The following list summarizes some of the other differences in how this emulation works.

The following list summarizes most of the Vi features that have not yet been implemented. They are likely to be added in future releases.


No Warranty  top

This program is provided on an "as is" basis, without warranty of any kind. The entire risk as to the quality and performance of the program is borne by you.

VIDE Reference Manual
Copyright © 1999-2000, Bruce E. Wampler
All rights reserved.

Bruce E. Wampler, Ph.D.
bruce@objectcentral.com
www.objectcentral.com