Index of /editors/vim6+ruby/work/vim71/src
Name Last modified Size Description
Parent Directory 12-May-2007 05:10 -
xxd/ 03-Jan-2008 19:21 -
wsdebug.h 07-Jun-2004 07:32 1k
wsdebug.c 31-Jul-2005 05:53 4k
workshop.h 07-Jun-2004 07:32 1k
workshop.c 07-May-2007 12:47 42k
window.c 03-Jan-2008 19:21 147k
which.sh 07-Jun-2004 07:32 1k
vimtutor 03-Jan-2008 19:20 2k
vim_mask.xbm 07-Jun-2004 07:32 1k
vim_icon.xbm 07-Jun-2004 07:32 1k
vim.h 03-Jan-2008 19:20 64k
version.h 12-May-2007 03:20 1k
version.c 03-Jan-2008 19:21 24k
undo.c 03-Jan-2008 19:21 58k
ui.c 03-Jan-2008 19:20 73k
typemap 07-Jun-2004 07:32 1k
toolcheck 07-Jun-2004 07:32 1k
testdir/ 03-Jan-2008 19:21 -
termlib.c 03-Jan-2008 19:20 14k
term.h 14-Mar-2005 03:27 7k
term.c 03-Jan-2008 19:21 146k
tag.c 07-May-2007 12:36 95k
syntax.c 03-Jan-2008 19:21 236k
structs.h 03-Jan-2008 19:21 75k
spell.c 03-Jan-2008 19:20 407k
search.c 03-Jan-2008 19:20 126k
screen.c 03-Jan-2008 19:21 231k
regexp.h 13-Jul-2005 13:13 2k
regexp.c 03-Jan-2008 19:21 166k
quickfix.c 03-Jan-2008 19:21 93k
pty.c 19-Feb-2007 20:21 9k
proto/ 03-Jan-2008 19:21 -
proto.h 24-Mar-2006 09:15 6k
popupmnu.c 03-Jan-2008 19:20 16k
pathdef.sh 07-Jun-2004 07:32 1k
osdef2.h.in 19-Feb-2007 20:14 3k
osdef1.h.in 19-Feb-2007 20:13 4k
osdef.sh 07-Jun-2004 07:32 3k
os_unixx.h 25-Mar-2006 07:20 3k
os_unix.h 03-Jan-2008 19:20 13k
os_unix.c 03-Jan-2008 19:21 151k
option.h 07-May-2007 12:23 32k
option.c 03-Jan-2008 19:21 269k
ops.c 03-Jan-2008 19:21 153k
normal.c 03-Jan-2008 19:21 215k
netbeans.c 07-May-2007 12:51 81k
nbdebug.h 30-Jun-2005 10:20 2k
nbdebug.c 31-Jul-2005 05:53 4k
mysign 12-May-2007 04:52 1k
move.c 26-Sep-2006 07:45 65k
mkinstalldirs 13-Jun-2004 12:19 1k
misc2.c 03-Jan-2008 19:21 138k
misc1.c 03-Jan-2008 19:21 222k
message.c 03-Jan-2008 19:21 104k
menu.c 29-Nov-2006 12:15 56k
memline.c 07-May-2007 12:17 128k
memfile.c 11-May-2007 10:50 33k
mbyte.c 03-Jan-2008 19:20 154k
mark.c 07-May-2007 12:28 41k
main.c.orig 03-Jan-2008 19:21 99k
main.c 03-Jan-2008 19:21 99k
main.aap 03-Jan-2008 19:21 46k
macros.h 03-Jan-2008 19:20 9k
link.sh 26-Sep-2006 02:22 4k
keymap.h 03-Jan-2008 19:20 15k
integration.h 07-Jun-2004 07:32 16k
integration.c 31-Jul-2005 05:52 29k
installml.sh 03-Jan-2008 19:21 4k
installman.sh 30-Apr-2006 08:48 3k
if_xcmdsrv.c 07-May-2007 12:43 38k
if_tcl.c 07-May-2007 12:50 48k
if_sniff.h 13-Jun-2004 08:43 1k
if_ruby.c 03-Jan-2008 19:21 26k
if_python.c 06-Mar-2007 14:00 69k
if_perlsfio.c 07-Jun-2004 07:32 1k
if_perl.xs 03-Jan-2008 19:21 29k
if_mzsch.h 24-Mar-2006 08:09 2k
if_mzsch.c 03-Jan-2008 19:20 76k
if_cscope.h 03-Jan-2008 19:21 3k
if_cscope.c 03-Jan-2008 19:21 51k
hashtab.c 17-Apr-2006 03:41 13k
hardcopy.c 07-May-2007 12:34 94k
hangulin.c 07-Jun-2004 07:32 59k
gui_xmebwp.h 01-Jan-2005 06:31 2k
gui_xmebw.h 07-May-2007 12:15 2k
gui_xmebw.c 03-Jan-2008 19:21 39k
gui_xmdlg.c 07-May-2007 12:35 31k
gui_x11_pm.h 01-Jan-2005 06:37 2k
gui_x11.c 07-May-2007 12:27 86k
gui_motif.c 07-May-2007 12:20 101k
gui_gtk_x11.c 03-Jan-2008 19:21 186k
gui_gtk_f.h 31-Mar-2006 06:06 2k
gui_gtk_f.c 07-May-2007 12:38 23k
gui_gtk.c 03-Jan-2008 19:20 85k
gui_beval.h 07-Jun-2004 07:32 2k
gui_beval.c 07-May-2007 12:33 34k
gui_athena.c 17-Apr-2006 05:49 57k
gui_at_sb.h 07-May-2007 12:32 6k
gui_at_sb.c 07-Jun-2004 07:32 33k
gui_at_fs.c 12-May-2006 02:26 61k
gui.h 07-May-2007 12:50 19k
gui.c 03-Jan-2008 19:21 127k
globals.h 03-Jan-2008 19:21 56k
getchar.c 03-Jan-2008 19:21 119k
fold.c 03-Jan-2008 19:21 82k
fileio.c.orig 03-Jan-2008 19:21 236k
fileio.c 03-Jan-2008 19:21 236k
feature.h 03-Jan-2008 19:20 31k
farsi.h 07-May-2007 12:46 6k
farsi.c 07-May-2007 12:47 37k
ex_getln.c 03-Jan-2008 19:21 145k
ex_eval.c 03-Jan-2008 19:21 67k
ex_docmd.c.orig 03-Jan-2008 19:21 246k
ex_docmd.c 03-Jan-2008 19:21 246k
ex_cmds2.c 07-May-2007 12:25 91k
ex_cmds.h 07-Mar-2007 12:53 42k
ex_cmds.c 03-Jan-2008 19:21 169k
eval.c 03-Jan-2008 19:21 473k
edit.c 03-Jan-2008 19:21 233k
digraph.c 03-Jan-2008 19:21 54k
diff.c 03-Jan-2008 19:21 59k
configure.in 03-Jan-2008 19:21 90k
configure 12-May-2007 05:10 1k
config.mk.in 23-Mar-2006 13:05 3k
config.mk.dist 07-Jun-2004 07:32 1k
config.h.in 26-Apr-2007 07:40 9k
config.aap.in 23-Mar-2006 13:05 3k
charset.c 03-Jan-2008 19:20 44k
buffer.c 03-Jan-2008 19:21 130k
auto/ 03-Jan-2008 19:21 -
ascii.h 09-Mar-2006 02:37 5k
arabic.h 07-May-2007 12:46 7k
arabic.c 07-Jun-2004 07:32 20k
Makefile.orig 12-May-2007 04:57 112k
Makefile 03-Jan-2008 19:21 113k
INSTALL 11-May-2007 14:13 17k
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
mbyte.c multy-byte character handling
memfile.c storing lines for buffers in a swapfile
memline.c storing lines for buffers in memory
menu.c menus
message.c (error) messages
ops.c handling operators ("d", "y", "p")
option.c options
quickfix.c quickfix commands (":make", ":cn")
regexp.c pattern matching
screen.c updating the windows
search.c pattern searching
spell.c spell checking
syntax.c syntax and other highlighting
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 triggered
when going from the debugger to Vim and back. To avoid this, recompile with
some code in gui_focus_change() disabled.