Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

..
Octocat-spinner-32 GvimExt
Octocat-spinner-32 MacVim
Octocat-spinner-32 VisVim
Octocat-spinner-32 auto
Octocat-spinner-32 os_mac_rsrc updated for version 7.0d01 April 11, 2006
Octocat-spinner-32 po
Octocat-spinner-32 proto
Octocat-spinner-32 tee updated for version 7.0001 June 13, 2004
Octocat-spinner-32 testdir
Octocat-spinner-32 xxd
Octocat-spinner-32 INSTALL
Octocat-spinner-32 INSTALLami.txt updated for version 7.0001 June 13, 2004
Octocat-spinner-32 INSTALLmac.txt updated for version 7.0g April 30, 2006
Octocat-spinner-32 INSTALLpc.txt
Octocat-spinner-32 INSTALLvms.txt
Octocat-spinner-32 INSTALLx.txt First step in the Vim 7.3 branch. Changed version numbers. May 15, 2010
Octocat-spinner-32 Make_bc3.mak Add blowfish and sha256 source files to more Makefiles. May 18, 2010
Octocat-spinner-32 Make_bc5.mak
Octocat-spinner-32 Make_cyg.mak
Octocat-spinner-32 Make_dice.mak Add blowfish and sha256 source files to more Makefiles. May 18, 2010
Octocat-spinner-32 Make_djg.mak Add blowfish and sha256 source files to more Makefiles. May 18, 2010
Octocat-spinner-32 Make_dvc.mak updated for version 7.0001 June 13, 2004
Octocat-spinner-32 Make_ivc.mak
Octocat-spinner-32 Make_manx.mak Add blowfish and sha256 source files to more Makefiles. May 18, 2010
Octocat-spinner-32 Make_ming.mak
Octocat-spinner-32 Make_mint.mak updated for version 7.2a June 24, 2008
Octocat-spinner-32 Make_morph.mak Add blowfish and sha256 source files to more Makefiles. May 18, 2010
Octocat-spinner-32 Make_mvc.mak
Octocat-spinner-32 Make_os2.mak Add blowfish and sha256 source files to more Makefiles. May 18, 2010
Octocat-spinner-32 Make_ro.mak
Octocat-spinner-32 Make_sas.mak
Octocat-spinner-32 Make_vms.mms
Octocat-spinner-32 Make_w16.mak
Octocat-spinner-32 Makefile
Octocat-spinner-32 README.txt First step in the Vim 7.3 branch. Changed version numbers. May 15, 2010
Octocat-spinner-32 arabic.c
Octocat-spinner-32 arabic.h updated for version 7.1b May 10, 2007
Octocat-spinner-32 ascii.h
Octocat-spinner-32 bigvim.bat
Octocat-spinner-32 blowfish.c
Octocat-spinner-32 buffer.c
Octocat-spinner-32 charset.c
Octocat-spinner-32 config.aap.in Added Lua interfae. (Luis Carvalho) July 14, 2010
Octocat-spinner-32 config.h.in
Octocat-spinner-32 config.mk.dist updated for version 7.0001 June 13, 2004
Octocat-spinner-32 config.mk.in
Octocat-spinner-32 configure
Octocat-spinner-32 configure.in
Octocat-spinner-32 dehqx.py
Octocat-spinner-32 diff.c
Octocat-spinner-32 digraph.c
Octocat-spinner-32 dimm.idl updated for version 7.0001 June 13, 2004
Octocat-spinner-32 dlldata.c updated for version 7.0001 June 13, 2004
Octocat-spinner-32 dosinst.c
Octocat-spinner-32 dosinst.h Windows uninstaller: Instead of calling RegDeleteKeyEx() directly loa… August 02, 2010
Octocat-spinner-32 edit.c
Octocat-spinner-32 eval.c
Octocat-spinner-32 ex_cmds.c
Octocat-spinner-32 ex_cmds.h
Octocat-spinner-32 ex_cmds2.c
Octocat-spinner-32 ex_docmd.c
Octocat-spinner-32 ex_eval.c
Octocat-spinner-32 ex_getln.c
Octocat-spinner-32 farsi.c
Octocat-spinner-32 farsi.h updated for version 7.1b May 10, 2007
Octocat-spinner-32 feature.h
Octocat-spinner-32 fileio.c
Octocat-spinner-32 fold.c
Octocat-spinner-32 getchar.c
Octocat-spinner-32 glbl_ime.cpp
Octocat-spinner-32 glbl_ime.h updated for version 7.0098 June 30, 2005
Octocat-spinner-32 globals.h
Octocat-spinner-32 gui.c
Octocat-spinner-32 gui.h
Octocat-spinner-32 gui_at_fs.c
Octocat-spinner-32 gui_at_sb.c Avoid compiler warnings. June 06, 2010
Octocat-spinner-32 gui_at_sb.h updated for version 7.1b May 10, 2007
Octocat-spinner-32 gui_athena.c
Octocat-spinner-32 gui_beval.c
Octocat-spinner-32 gui_beval.h Add +balloon_eval support July 25, 2010
Octocat-spinner-32 gui_gtk.c
Octocat-spinner-32 gui_gtk_f.c Remove the old and not well supported GTK 1 code. (James Vega) June 25, 2010
Octocat-spinner-32 gui_gtk_f.h Remove the old and not well supported GTK 1 code. (James Vega) June 25, 2010
Octocat-spinner-32 gui_gtk_vms.h updated for version 7.1b May 10, 2007
Octocat-spinner-32 gui_gtk_x11.c
Octocat-spinner-32 gui_mac.c
Octocat-spinner-32 gui_motif.c
Octocat-spinner-32 gui_photon.c
Octocat-spinner-32 gui_riscos.c
Octocat-spinner-32 gui_riscos.h
Octocat-spinner-32 gui_w16.c
Octocat-spinner-32 gui_w32.c
Octocat-spinner-32 gui_w32_rc.h updated for version 7.0001 June 13, 2004
Octocat-spinner-32 gui_w48.c
Octocat-spinner-32 gui_x11.c
Octocat-spinner-32 gui_x11_pm.h updated for version 7.0028 January 02, 2005
Octocat-spinner-32 gui_xmdlg.c
Octocat-spinner-32 gui_xmebw.c
Octocat-spinner-32 gui_xmebw.h updated for version 7.1b May 10, 2007
Octocat-spinner-32 gui_xmebwp.h
Octocat-spinner-32 guiw16rc.h updated for version 7.0001 June 13, 2004
Octocat-spinner-32 gvim.exe.mnf
Octocat-spinner-32 gvimtutor updated for version 7.1-298 May 10, 2008
Octocat-spinner-32 hangulin.c updated for version 7.0001 June 13, 2004
Octocat-spinner-32 hardcopy.c
Octocat-spinner-32 hashtab.c
Octocat-spinner-32 if_cscope.c
Octocat-spinner-32 if_cscope.h updated for version 7.2-228 July 10, 2009
Octocat-spinner-32 if_lua.c
Octocat-spinner-32 if_mzsch.c
Octocat-spinner-32 if_mzsch.h
Octocat-spinner-32 if_ole.cpp
Octocat-spinner-32 if_ole.h
Octocat-spinner-32 if_ole.idl updated for version 7.1-282 March 16, 2008
Octocat-spinner-32 if_perl.xs
Octocat-spinner-32 if_perlsfio.c updated for version 7.0001 June 13, 2004
Octocat-spinner-32 if_py_both.h
Octocat-spinner-32 if_python.c
Octocat-spinner-32 if_python3.c
Octocat-spinner-32 if_ruby.c
Octocat-spinner-32 if_sniff.c
Octocat-spinner-32 if_sniff.h First step in the Vim 7.3 branch. Changed version numbers. May 15, 2010
Octocat-spinner-32 if_tcl.c
Octocat-spinner-32 if_xcmdsrv.c
Octocat-spinner-32 iid_ole.c updated for version 7.1-065 August 12, 2007
Octocat-spinner-32 infplist.xml updated for version 7.0c10 April 05, 2006
Octocat-spinner-32 installman.sh updated for version 7.2c-000 August 06, 2008
Octocat-spinner-32 installml.sh updated for version 7.0g April 30, 2006
Octocat-spinner-32 integration.c
Octocat-spinner-32 integration.h Remove unused code. August 08, 2010
Octocat-spinner-32 keymap.h
Octocat-spinner-32 link.390 updated for version 7.0001 June 13, 2004
Octocat-spinner-32 link.sh
Octocat-spinner-32 macros.h
Octocat-spinner-32 main.aap
Octocat-spinner-32 main.c
Octocat-spinner-32 mark.c
Octocat-spinner-32 mbyte.c
Octocat-spinner-32 memfile.c
Octocat-spinner-32 memline.c
Octocat-spinner-32 menu.c
Octocat-spinner-32 message.c
Octocat-spinner-32 misc1.c
Octocat-spinner-32 misc2.c
Octocat-spinner-32 mkinstalldirs updated for version 7.2.329 January 12, 2010
Octocat-spinner-32 move.c
Octocat-spinner-32 msvc2008.bat
Octocat-spinner-32 msvcsetup.bat updated for version 7.0216 March 06, 2006
Octocat-spinner-32 mysign updated for version 7.1 May 12, 2007
Octocat-spinner-32 nbdebug.c
Octocat-spinner-32 nbdebug.h updated for version 7.2-115 February 21, 2009
Octocat-spinner-32 netbeans.c
Octocat-spinner-32 normal.c
Octocat-spinner-32 ops.c
Octocat-spinner-32 option.c
Octocat-spinner-32 option.h
Octocat-spinner-32 os_amiga.c
Octocat-spinner-32 os_amiga.h
Octocat-spinner-32 os_beos.c
Octocat-spinner-32 os_beos.h
Octocat-spinner-32 os_beos.rsrc updated for version 7.0001 June 13, 2004
Octocat-spinner-32 os_dos.h
Octocat-spinner-32 os_mac.h
Octocat-spinner-32 os_mac.rsr.hqx updated for version 7.0001 June 13, 2004
Octocat-spinner-32 os_mac_conv.c
Octocat-spinner-32 os_macosx.m
Octocat-spinner-32 os_mint.h updated for version 7.0001 June 13, 2004
Octocat-spinner-32 os_msdos.c
Octocat-spinner-32 os_msdos.h
Octocat-spinner-32 os_mswin.c
Octocat-spinner-32 os_os2_cfg.h updated for version 7.1b May 10, 2007
Octocat-spinner-32 os_qnx.c
Octocat-spinner-32 os_qnx.h updated for version 7.0001 June 13, 2004
Octocat-spinner-32 os_riscos.c
Octocat-spinner-32 os_riscos.h
Octocat-spinner-32 os_unix.c
Octocat-spinner-32 os_unix.h
Octocat-spinner-32 os_unixx.h updated for version 7.2.392 March 10, 2010
Octocat-spinner-32 os_vms.c
Octocat-spinner-32 os_vms_conf.h Changes for VMS. Mostly by Zoltan Arpadffy. July 28, 2010
Octocat-spinner-32 os_vms_fix.com updated for version 7.0001 June 13, 2004
Octocat-spinner-32 os_vms_mms.c updated for version 7.0073 May 19, 2005
Octocat-spinner-32 os_w32dll.c updated for version 7.0001 June 13, 2004
Octocat-spinner-32 os_w32exe.c updated for version 7.2-036 November 12, 2008
Octocat-spinner-32 os_win16.c
Octocat-spinner-32 os_win16.h
Octocat-spinner-32 os_win32.c
Octocat-spinner-32 os_win32.h
Octocat-spinner-32 osdef.sh
Octocat-spinner-32 osdef1.h.in updated for version 7.2.371 February 24, 2010
Octocat-spinner-32 osdef2.h.in updated for version 7.0-202 February 27, 2007
Octocat-spinner-32 pathdef.sh updated for version 7.0001 June 13, 2004
Octocat-spinner-32 popupmnu.c
Octocat-spinner-32 proto.h
Octocat-spinner-32 pty.c
Octocat-spinner-32 quickfix.c
Octocat-spinner-32 regexp.c
Octocat-spinner-32 regexp.h
Octocat-spinner-32 screen.c
Octocat-spinner-32 search.c
Octocat-spinner-32 sha256.c
Octocat-spinner-32 spell.c
Octocat-spinner-32 structs.h
Octocat-spinner-32 swis.s updated for version 7.0001 June 13, 2004
Octocat-spinner-32 syntax.c
Octocat-spinner-32 tag.c
Octocat-spinner-32 tearoff.bmp updated for version 7.0001 June 13, 2004
Octocat-spinner-32 term.c
Octocat-spinner-32 term.h
Octocat-spinner-32 termlib.c
Octocat-spinner-32 toolbar.phi updated for version 7.0001 June 13, 2004
Octocat-spinner-32 toolcheck updated for version 7.0001 June 13, 2004
Octocat-spinner-32 tools.bmp updated for version 7.0001 June 13, 2004
Octocat-spinner-32 tools16.bmp updated for version 7.0001 June 13, 2004
Octocat-spinner-32 typemap
Octocat-spinner-32 ui.c
Octocat-spinner-32 undo.c
Octocat-spinner-32 uninstal.c Remove unused code. August 08, 2010
Octocat-spinner-32 version.c
Octocat-spinner-32 version.h
Octocat-spinner-32 vim.def
Octocat-spinner-32 vim.h
Octocat-spinner-32 vim.ico updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vim.rc
Octocat-spinner-32 vim.tlb updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vim16.def
Octocat-spinner-32 vim16.rc
Octocat-spinner-32 vim_alert.ico updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vim_error.ico updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vim_icon.xbm updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vim_info.ico updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vim_mask.xbm updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vim_quest.ico updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vimio.h
Octocat-spinner-32 vimrun.c updated for version 7.1a May 05, 2007
Octocat-spinner-32 vimtbar.dll updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vimtbar.h updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vimtbar.lib updated for version 7.0001 June 13, 2004
Octocat-spinner-32 vimtutor updated for version 7.1-295 May 07, 2008
Octocat-spinner-32 which.sh updated for version 7.0001 June 13, 2004
Octocat-spinner-32 window.c
Octocat-spinner-32 workshop.c
Octocat-spinner-32 workshop.h updated for version 7.0001 June 13, 2004
Octocat-spinner-32 wsdebug.c updated for version 7.2a June 24, 2008
Octocat-spinner-32 wsdebug.h updated for version 7.0001 June 13, 2004
Octocat-spinner-32 xpm_w32.c
Octocat-spinner-32 xpm_w32.h updated for version 7.0001 June 13, 2004
README.txt
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		multi-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.
Something went wrong with that request. Please try again.