Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
..
Failed to load latest commit information.
GvimExt updated for version 7.4.030
MacVim Fix background color of active tab for Yosemite
VisVim updated for version 7.3.1308
auto Merge branch 'vim'
os_mac_rsrc updated for version 7.0d01
po Updated runtime files.
proto Merge branch 'vim'
tee updated for version 7.0001
testdir updated for version 7.4.378
xpm updated for version 7.3.655
xxd updated for version 7.4.030
INSTALL updated for version 7.3.191
INSTALLami.txt updated for version 7.0001
INSTALLmac.txt updated for version 7.0g
INSTALLpc.txt Update runtime files.
INSTALLvms.txt updated for version 7.3.925
INSTALLx.txt First step in the Vim 7.3 branch. Changed version numbers.
Make_bc3.mak Add blowfish and sha256 source files to more Makefiles.
Make_bc5.mak updated for version 7.4.141
Make_cyg.mak updated for version 7.4.117
Make_dice.mak Add blowfish and sha256 source files to more Makefiles.
Make_djg.mak Add blowfish and sha256 source files to more Makefiles.
Make_dvc.mak updated for version 7.0001
Make_ivc.mak updated for version 7.3.836
Make_manx.mak Add blowfish and sha256 source files to more Makefiles.
Make_ming.mak updated for version 7.4.134
Make_mint.mak updated for version 7.2a
Make_morph.mak Add blowfish and sha256 source files to more Makefiles.
Make_mvc.mak updated for version 7.4.304
Make_os2.mak Add blowfish and sha256 source files to more Makefiles.
Make_sas.mak updated for version 7.3.925
Make_vms.mms updated for version 7.4.197
Make_w16.mak updated for version 7.3.925
Makefile Merge branch 'vim'
README.txt First step in the Vim 7.3 branch. Changed version numbers.
arabic.c updated for version 7.3.535
arabic.h updated for version 7.1b
ascii.h updated for version 7.3.383
bigvim.bat updated for version 7.3.894
bigvim64.bat updated for version 7.3.724
blowfish.c updated for version 7.4.172
buffer.c Merge branch 'vim'
charset.c updated for version 7.4.373
config.aap.in Added Lua interfae. (Luis Carvalho)
config.h.in updated for version 7.4.238
config.mk.dist updated for version 7.0001
config.mk.in Merge branch 'vim'
configure Restore 'src/configure' script from upstream
configure.in Merge branch 'vim'
dehqx.py updated for version 7.3.567
diff.c updated for version 7.4.308
digraph.c updated for version 7.4.335
dimm.idl updated for version 7.0001
dlldata.c updated for version 7.0001
dosinst.c updated for version 7.4.103
dosinst.h Windows uninstaller: Instead of calling RegDeleteKeyEx() directly loa…
edit.c Merge branch 'vim'
eval.c Merge branch 'vim'
ex_cmds.c updated for version 7.4.364
ex_cmds.h Merge branch 'vim'
ex_cmds2.c Merge branch 'vim'
ex_docmd.c Merge branch 'vim'
ex_eval.c updated for version 7.4.107
ex_getln.c Merge branch 'vim'
farsi.c updated for version 7.3.925
farsi.h updated for version 7.1b
feature.h Merge branch 'vim'
fileio.c Merge branch 'vim'
fold.c updated for version 7.4.212
getchar.c Merge branch 'vim'
glbl_ime.cpp updated for version 7.3.925
glbl_ime.h updated for version 7.0098
globals.h Merge branch 'vim'
gui.c Merge branch 'vim'
gui.h Merge branch 'vim'
gui_at_fs.c updated for version 7.3.1255
gui_at_sb.c Avoid compiler warnings.
gui_at_sb.h updated for version 7.1b
gui_athena.c updated for version 7.3.925
gui_beval.c Merge branch 'vim'
gui_beval.h Add +balloon_eval support
gui_gtk.c updated for version 7.3.1289
gui_gtk_f.c Remove the old and not well supported GTK 1 code. (James Vega)
gui_gtk_f.h Remove the old and not well supported GTK 1 code. (James Vega)
gui_gtk_vms.h updated for version 7.1b
gui_gtk_x11.c updated for version 7.4.332
gui_mac.c updated for version 7.4.212
gui_motif.c updated for version 7.3.1225
gui_photon.c updated for version 7.3.925
gui_w16.c updated for version 7.3.925
gui_w32.c updated for version 7.4b.018
gui_w32_rc.h updated for version 7.0001
gui_w48.c updated for version 7.4.212
gui_x11.c updated for version 7.4a.024
gui_x11_pm.h updated for version 7.0028
gui_xmdlg.c updated for version 7.3.102
gui_xmebw.c updated for version 7.3.925
gui_xmebw.h updated for version 7.1b
gui_xmebwp.h updated for version 7.3.925
guiw16rc.h updated for version 7.0001
gvim.exe.mnf Vim 7.4a BETA release.
gvimtutor updated for version 7.1-298
hangulin.c updated for version 7.0001
hardcopy.c updated for version 7.3.925
hashtab.c updated for version 7.3.740
if_cscope.c updated for version 7.3.1276
if_cscope.h updated for version 7.2-228
if_lua.c updated for version 7.4.278
if_mzsch.c updated for version 7.3.925
if_mzsch.h updated for version 7.3.791
if_ole.cpp updated for version 7.3.925
if_ole.h updated for version 7.3.199
if_ole.idl updated for version 7.1-282
if_perl.xs updated for version 7.4.321
if_perlsfio.c updated for version 7.0001
if_py_both.h updated for version 7.4.278
if_python.c Merge branch 'vim'
if_python3.c updated for version 7.4.228
if_ruby.c Merge branch 'vim'
if_sniff.c updated for version 7.3.723
if_sniff.h First step in the Vim 7.3 branch. Changed version numbers.
if_tcl.c updated for version 7.4.046
if_xcmdsrv.c Merge branch 'vim'
iid_ole.c updated for version 7.1-065
infplist.xml updated for version 7.0c10
installman.sh updated for version 7.4.340
installml.sh updated for version 7.0g
integration.c updated for version 7.3.087
integration.h Remove unused code.
keymap.h Merge branch 'vim'
link.390 updated for version 7.0001
link.sh updated for version 7.3.050
macros.h updated for version 7.4.295
main.aap updated for version 7.3.925
main.c Merge branch 'vim'
mark.c updated for version 7.4.212
mbyte.c Merge branch 'vim'
memfile.c updated for version 7.4.238
memfile_test.c Add missing files for patch 7.3.143.
memline.c updated for version 7.4.213
menu.c Merge branch 'vim'
message.c Merge branch 'vim'
misc1.c Merge branch 'vim'
misc2.c Merge branch 'vim'
mkinstalldirs updated for version 7.2.329
move.c updated for version 7.4.226
msvc2008.bat updated for version 7.3.1308
msvc2010.bat updated for version 7.3.1308
msvcsetup.bat updated for version 7.0216
mysign updated for version 7.1
nbdebug.c updated for version 7.3.925
nbdebug.h updated for version 7.2-115
netbeans.c Merge branch 'vim'
normal.c Merge branch 'vim'
ops.c updated for version 7.4.338
option.c Merge branch 'vim'
option.h Merge branch 'vim'
os_amiga.c updated for version 7.4.235
os_amiga.h updated for version 7.3.1178
os_beos.c updated for version 7.3.719
os_beos.h updated for version 7.3.719
os_beos.rsrc updated for version 7.0001
os_dos.h updated for version 7.4.112
os_mac.h updated for version 7.4.055
os_mac.rsr.hqx updated for version 7.0001
os_mac_conv.c updated for version 7.3.342
os_macosx.m Merge branch 'vim'
os_mint.h updated for version 7.0001
os_msdos.c updated for version 7.4.235
os_msdos.h updated for version 7.3.719
os_mswin.c updated for version 7.4.206
os_os2_cfg.h updated for version 7.4.188
os_qnx.c updated for version 7.4.212
os_qnx.h updated for version 7.0001
os_unix.c Merge branch 'vim'
os_unix.h updated for version 7.4.216
os_unixx.h updated for version 7.2.392
os_vms.c updated for version 7.4.235
os_vms_conf.h updated for version 7.4.197
os_vms_fix.com updated for version 7.0001
os_vms_mms.c updated for version 7.0073
os_w32dll.c updated for version 7.0001
os_w32exe.c updated for version 7.2-036
os_win16.c updated for version 7.3.719
os_win16.h updated for version 7.4.188
os_win32.c updated for version 7.4.363
os_win32.h updated for version 7.4.212
osdef.sh updated for version 7.4.068
osdef1.h.in updated for version 7.2.371
osdef2.h.in updated for version 7.0-202
pathdef.sh updated for version 7.0001
popupmnu.c updated for version 7.4.383
proto.h Merge branch 'vim'
pty.c updated for version 7.3.409
quickfix.c updated for version 7.4.379
regexp.c updated for version 7.4.360
regexp.h updated for version 7.4.262
regexp_nfa.c updated for version 7.4.293
screen.c Merge branch 'vim'
search.c Merge branch 'vim'
sha256.c updated for version 7.3.816
spell.c updated for version 7.4.288
structs.h Merge branch 'vim'
swis.s updated for version 7.0001
syntax.c Merge branch 'vim'
tag.c updated for version 7.4.240
tearoff.bmp updated for version 7.0001
term.c updated for version 7.4.363
term.h updated for version 7.3.859
termlib.c updated for version 7.3.187
toolbar.phi updated for version 7.0001
toolcheck updated for version 7.0001
tools.bmp updated for version 7.0001
tools16.bmp updated for version 7.0001
typemap updated for version 7.3.439
ui.c Merge branch 'vim'
undo.c Merge branch 'vim'
uninstal.c Remove unused code.
version.c Merge branch 'vim'
version.h release version 7.4
vim.def release version 7.4
vim.h Merge branch 'vim'
vim.ico updated for version 7.0001
vim.rc updated for version 7.4a.003
vim.tlb updated for version 7.0001
vim16.def release version 7.4
vim16.rc updated for version 7.4a.003
vim_alert.ico updated for version 7.0001
vim_error.ico updated for version 7.0001
vim_icon.xbm updated for version 7.0001
vim_info.ico updated for version 7.0001
vim_mask.xbm updated for version 7.0001
vim_quest.ico updated for version 7.0001
vimio.h updated for version 7.3.719
vimrun.c updated for version 7.1a
vimtbar.dll updated for version 7.0001
vimtbar.h updated for version 7.0001
vimtbar.lib updated for version 7.0001
vimtutor updated for version 7.1-295
which.sh updated for version 7.0001
winclip.c updated for version 7.4.202
window.c Merge branch 'vim'
workshop.c updated for version 7.3.087
workshop.h updated for version 7.0001
wsdebug.c updated for version 7.2a
wsdebug.h updated for version 7.0001
xpm_w32.c updated for version 7.3.723
xpm_w32.h updated for version 7.0001

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.