Index of /editors/vim6/work/vim64/src
Name Last modified Size Description
Parent Directory 15-Oct-2005 07:31 -
2 03-Jan-2008 19:15 0k
INSTALL 22-Apr-2004 11:31 16k
Makefile 03-Jan-2008 19:13 101k
Makefile.orig 15-Oct-2005 04:52 101k
TAGS 03-Jan-2008 19:15 0k
arabic.c 08-May-2003 13:23 20k
arabic.h 03-May-2003 08:06 7k
ascii.h 07-Sep-2003 14:16 5k
auto/ 03-Jan-2008 19:16 -
buffer.c 16-Dec-2004 04:59 120k
charset.c 14-Oct-2005 08:24 39k
config.aap.in 14-Nov-2003 06:50 2k
config.h.in 25-Apr-2004 04:23 8k
config.mk.dist 07-Oct-2000 14:11 1k
config.mk.in 10-Oct-2005 03:34 3k
configure 15-Oct-2005 07:31 1k
configure.in 15-Oct-2005 05:53 81k
diff.c 09-Jun-2004 05:43 53k
digraph.c 18-Mar-2005 01:50 54k
edit.c 08-Apr-2005 02:16 180k
eval.c 28-Jul-2004 02:53 228k
ex_cmds.c 03-Jan-2008 19:13 147k
ex_cmds.h 03-Jan-2008 19:13 34k
ex_cmds2.c 23-Dec-2004 08:14 135k
ex_docmd.c 08-Oct-2005 07:24 218k
ex_eval.c 05-Dec-2004 06:25 64k
ex_getln.c 13-Feb-2005 11:35 129k
farsi.c 19-Apr-2004 10:01 37k
farsi.h 11-Feb-2004 06:12 6k
feature.h 13-Jan-2005 10:22 29k
fileio.c 03-Jan-2008 19:13 215k
fold.c 04-Dec-2004 05:54 80k
getchar.c 04-Sep-2004 09:16 110k
globals.h 27-Jun-2004 06:44 49k
gui.c 06-Oct-2005 12:31 114k
gui.h 04-May-2003 13:42 17k
gui_at_fs.c 04-May-2003 13:42 61k
gui_at_sb.c 01-Jun-2001 03:30 33k
gui_at_sb.h 01-Aug-1999 05:00 6k
gui_athena.c 07-Sep-2003 14:21 53k
gui_beval.c 29-Mar-2004 12:20 31k
gui_beval.h 30-Jan-2004 10:51 2k
gui_gtk.c 08-Oct-2005 07:29 82k
gui_gtk_f.c 23-Dec-2003 02:41 23k
gui_gtk_f.h 06-Sep-2002 12:59 2k
gui_gtk_x11.c 03-May-2004 02:19 168k
gui_motif.c 12-Feb-2004 04:39 75k
gui_x11.c 29-May-2004 04:37 90k
hangulin.c 04-Jun-2001 02:40 59k
if_cscope.c 07-Jun-2005 02:06 50k
if_cscope.h 08-Oct-2005 07:27 3k
if_perl.xs 16-Apr-2004 00:57 27k
if_perlsfio.c 29-Oct-2003 03:27 1k
if_python.c 13-Oct-2005 11:17 65k
if_ruby.c 16-Apr-2004 01:05 23k
if_tcl.c 16-Apr-2004 01:04 48k
if_xcmdsrv.c 08-Oct-2005 07:36 36k
integration.c 01-Feb-2004 06:20 28k
integration.h 22-Jun-2003 08:33 16k
keymap.h 11-Feb-2004 06:14 15k
link.sh 05-Apr-2004 06:09 4k
macros.h 19-Apr-2004 11:10 8k
main.aap 15-Apr-2004 01:11 33k
main.c 15-Feb-2005 05:09 82k
mark.c 19-Apr-2004 10:02 39k
mbyte.c 17-Aug-2005 03:22 148k
memfile.c 16-May-2004 06:13 33k
memline.c 03-Jan-2008 19:13 116k
menu.c 19-Apr-2004 10:02 54k
message.c 03-Jan-2008 19:13 71k
misc1.c 16-Dec-2004 03:13 198k
misc2.c 08-Oct-2005 07:37 129k
mkinstalldirs 04-May-2003 13:56 1k
move.c 13-Jan-2005 10:16 64k
mysign 17-May-2004 03:33 1k
nbdebug.c 14-Apr-2004 10:55 4k
nbdebug.h 12-Sep-2003 12:30 2k
netbeans.c 08-Oct-2005 07:47 75k
normal.c 06-Oct-2005 11:42 200k
objects/ 03-Jan-2008 19:15 -
ops.c 14-Oct-2005 08:36 145k
option.c 08-Oct-2005 07:27 235k
option.h 05-May-2004 02:43 27k
os_unix.c 03-Jan-2008 19:13 141k
os_unix.h 10-Nov-2003 01:53 12k
os_unixx.h 03-Nov-2001 04:55 3k
osdef.sh 05-Jan-2004 01:05 3k
osdef1.h.in 02-Jul-2003 14:01 4k
osdef2.h.in 05-Jan-2004 01:03 3k
pathdef.sh 11-Jun-2000 14:56 1k
proto.h 08-Oct-2005 07:22 6k
proto/ 15-Oct-2005 07:31 -
pty.c 28-Oct-2001 12:46 9k
quickfix.c 08-Oct-2005 07:29 53k
regexp.c 19-Apr-2004 10:04 139k
regexp.h 30-Jun-2001 09:25 2k
screen.c 03-Jan-2008 19:13 205k
search.c 14-Oct-2005 11:22 106k
structs.h 05-Dec-2004 06:26 60k
syntax.c 24-Jul-2005 10:39 216k
tag.c 20-Nov-2004 05:50 87k
tags 03-Jan-2008 19:15 0k
term.c 21-Jul-2005 04:00 138k
term.h 22-Mar-2001 11:07 6k
termlib.c 19-Apr-2004 10:05 14k
testdir/ 15-Oct-2005 07:31 -
toolcheck 04-May-2003 13:45 1k
typemap 01-Aug-1999 05:01 1k
ui.c 29-May-2004 04:37 71k
undo.c 05-Apr-2004 11:23 35k
version.c 03-Jan-2008 19:13 22k
version.h 15-Oct-2005 04:21 1k
vim.h 08-Oct-2005 07:22 56k
vim_icon.xbm 01-Aug-1999 05:01 1k
vim_mask.xbm 01-Aug-1999 05:01 1k
vimtutor 04-Apr-2004 07:20 2k
which.sh 28-Jul-2001 05:14 1k
window.c 06-Oct-2005 12:34 113k
workshop.c 13-Sep-2003 07:09 41k
workshop.h 01-May-2001 11:47 1k
wsdebug.c 13-Feb-2001 06:05 4k
wsdebug.h 27-Aug-2001 08:32 1k
xxd/ 03-Jan-2008 19:16 -
README for the Vim source code
Here are a few hints for finding your way around the source code. This
doesn't make it less complex than it is, but it gets you started.
You might also want to read ":help development".
JUMPING AROUND
First of all, use ":make tags" to generate a tags file, so that you can use
the ":tag" command to jump around the source code.
To jump to a function or variable definition, move the cursor on the name and
use the CTRL-] command. Use CTRL-T or CTRL-O to jump back.
To jump to a file, move the cursor on its name and use the "gf" command.
Most code can be found in a file with an obvious name (incomplete list):
buffer.c manipulating buffers (loaded files)
diff.c diff mode (vimdiff)
eval.c expression evaluation
fileio.c reading and writing files
fold.c folding
getchar.c getting characters and key mapping
mark.c marks
memfile.c storing lines for buffers in a swapfile
memline.c storing lines for buffers in memory
menu.c menus
message.c (error) messages
mbyte.c multy-byte character handling
ops.c handling operators ("d", "y", "p")
option.c options
quickfix.c quickfix commands (":make", ":cn")
screen.c updating the windows
search.c pattern searching
tag.c tags
term.c terminal handling, termcap codes
undo.c undo and redo
window.c handling split windows
IMPORTANT VARIABLES
The current mode is stored in "State". The values it can have are NORMAL,
INSERT, CMDLINE, and a few others.
The current window is "curwin". The current buffer is "curbuf". These point
to structures with the cursor position in the window, option values, the file
name, etc. These are defined in structs.h.
All the global variables are declared in globals.h.
THE MAIN LOOP
This is conveniently called main_loop(). It updates a few things and then
calls normal_cmd() to process a command. This returns when the command is
finished.
The basic idea is that Vim waits for the user to type a character and
processes it until another character is needed. Thus there are several places
where Vim waits for a character to be typed. The vgetc() function is used for
this. It also handles mapping.
Updating the screen is mostly postponed until a command or a sequence of
commands has finished. The work is done by update_screen(), which calls
win_update() for every window, which calls win_line() for every line.
See the start of screen.c for more explanations.
COMMAND-LINE MODE
When typing a ":", normal_cmd() will call getcmdline() to obtain a line with
an Ex command. getcmdline() contains a loop that will handle each typed
character. It returns when hitting <CR> or <Esc> or some other character that
ends the command line mode.
EX COMMANDS
Ex commands are handled by the function do_cmdline(). It does the generic
parsing of the ":" command line and calls do_one_cmd() for each separate
command. It also takes care of while loops.
do_one_cmd() parses the range and generic arguments and puts them in the
exarg_t and passes it to the function that handles the command.
The ":" commands are listed in ex_cmds.h. The third entry of each item is the
name of the function that handles the command. The last entry are the flags
that are used for the command.
NORMAL MODE COMMANDS
The Normal mode commands are handled by the normal_cmd() function. It also
handles the optional count and an extra character for some commands. These
are passed in a cmdarg_t to the function that handles the command.
There is a table nv_cmds in normal.c which lists the first character of every
command. The second entry of each item is the name of the function that
handles the command.
INSERT MODE COMMANDS
When doing an "i" or "a" command, normal_cmd() will call the edit() function.
It contains a loop that waits for the next character and handles it. It
returns when leaving Insert mode.
OPTIONS
There is a list with all option names in option.c, called options[].
THE GUI
Most of the GUI code is implemented like it was a clever terminal. Typing a
character, moving a scrollbar, clicking the mouse, etc. are all translated
into events which are written in the input buffer. These are read by the
main code, just like reading from a terminal. The code for this is scattered
through gui.c. For example: gui_send_mouse_event() for a mouse click and
gui_menu_cb() for a menu action. Key hits are handled by the system-specific
GUI code, which calls add_to_input_buf() to send the key code.
Updating the GUI window is done by writing codes in the output buffer, just
like writing to a terminal. When the buffer gets full or is flushed,
gui_write() will parse the codes and draw the appropriate items. Finally the
system-specific GUI code will be called to do the work.
DEBUGGING THE GUI
Remember to prevent that gvim forks and the debugger thinks Vim has exited,
add the "-f" argument. In gdb: "run -f -g".
When stepping through display updating code, the focus event is triggerred
when going from the debugger to Vim and back. To avoid this, recompile with
some code in gui_focus_change() disabled.