Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#70 Compare This branch is 527 commits ahead of b4winckler:master.
..
Failed to load latest commit information.
GvimExt patch 7.4.727 Problem: Cannot build GvimExt with MingW. Solution: Add…
MacVim Revert "Regression of "Early-out of resize handling if the window has…
VisVim updated for version 7.3.1308
auto updated for version 7.4.677 Problem: Configure fails when specifying …
create-dmg Add DMG background source in pixlr.com format
os_mac_rsrc updated for version 7.0d01
po Updated runtime files.
proto Add optional blur to transparent windows
tee updated for version 7.0001
testdir patch 7.4.769 Problem: Behavior of :diffoff is not tested. Solution: …
xpm updated for version 7.3.655
xxd updated for version 7.4.652 Problem: Xxd lacks a few features. Soluti…
INSTALL updated for version 7.4.553
INSTALLami.txt updated for version 7.0001
INSTALLmac.txt updated for version 7.0g
INSTALLpc.txt updated for version 7.4.496
INSTALLvms.txt updated for version 7.3.925
INSTALLx.txt First step in the Vim 7.3 branch. Changed version numbers.
Make_bc3.mak updated for version 7.4.401
Make_bc5.mak updated for version 7.4.401
Make_cyg.mak updated for version 7.4.496
Make_cyg_ming.mak patch 7.4.756 Problem: Can't use strawberry Perl 5.22 x64 on MS-Windo…
Make_dice.mak updated for version 7.4.401
Make_djg.mak updated for version 7.4.401
Make_dvc.mak updated for version 7.0001
Make_ivc.mak updated for version 7.4.401
Make_manx.mak updated for version 7.4.401
Make_ming.mak updated for version 7.4.496
Make_mint.mak updated for version 7.2a
Make_morph.mak updated for version 7.4.401
Make_mvc.mak patch 7.4.756 Problem: Can't use strawberry Perl 5.22 x64 on MS-Windo…
Make_os2.mak updated for version 7.4.401
Make_sas.mak updated for version 7.4.401
Make_vms.mms updated for version 7.4.553
Make_w16.mak updated for version 7.3.925
Makefile Add task for creating DMG installation image
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.399
buffer.c patch 7.4.742 Problem: Cannot specify a vertical split when loading a…
charset.c updated for version 7.4.579
config.aap.in Added Lua interfae. (Luis Carvalho)
config.h.in updated for version 7.4.475
config.mk.dist updated for version 7.0001
config.mk.in Merge branch 'vim'
configure Restore 'src/configure' script from upstream
configure.in patch 7.4.750 Problem: Cannot build with clang 3.5 on Cygwin with per…
crypt.c updated for version 7.4.509
crypt_zip.c updated for version 7.4.399
dehqx.py updated for version 7.3.567
diff.c patch 7.4.768 Problem: :diffoff only works properly once. Solution: A…
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 updated for version 7.4.688 Problem: When "$" is in 'cpo' the popup m…
eval.c patch 7.4.755 Problem: It is not easy to count the number of characte…
ex_cmds.c patch 7.4.716 Problem: When using the 'c' flag of ":substitute" and s…
ex_cmds.h Merge branch 'vim'
ex_cmds2.c patch 7.4.697 Problem: The filename used for ":profile" must be given…
ex_docmd.c patch 7.4.740 Problem: ":1quit" works like ":.quit". (Bohr Shaw) Solu…
ex_eval.c updated for version 7.4.107
ex_getln.c patch 7.4.758 Problem: When 'conceallevel' is 1 and quitting the comm…
farsi.c updated for version 7.3.925
farsi.h updated for version 7.1b
feature.h Merge branch 'vim'
fileio.c updated for version 7.4.684 Problem: When starting several Vim instan…
fold.c patch 7.4.700 Problem: Fold can't be opened after ":move". (Ein Brown…
getchar.c Merge branch 'vim'
glbl_ime.cpp updated for version 7.3.925
glbl_ime.h updated for version 7.0098
globals.h patch 7.4.710 Problem: It is not possible to make spaces visibible in…
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_dwrite.cpp updated for version 7.4.398
gui_dwrite.h updated for version 7.4.393
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 patch 7.4.731 Problem: The tab menu shows "Close tab" even when it do…
gui_mac.c patch 7.4.731 Problem: The tab menu shows "Close tab" even when it do…
gui_motif.c patch 7.4.731 Problem: The tab menu shows "Close tab" even when it do…
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.4.681 Problem: MS-Windows: When Vim is minimize…
gui_w32_rc.h updated for version 7.0001
gui_w48.c patch 7.4.731 Problem: The tab menu shows "Close tab" even when it do…
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 patch 7.4.701 Problem: Compiler warning for using uninitialized varia…
hashtab.c updated for version 7.3.740
if_cscope.c updated for version 7.4.684 Problem: When starting several Vim instan…
if_cscope.h updated for version 7.2-228
if_lua.c patch 7.4.763 Problem: Building with Lua 5.1 doesn't work. Solution: …
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 patch 7.4.756 Problem: Can't use strawberry Perl 5.22 x64 on MS-Windo…
if_perlsfio.c updated for version 7.0001
if_py_both.h updated for version 7.4.625 Problem: Possible NULL pointer dereferenc…
if_python.c Merge branch 'vim'
if_python3.c updated for version 7.4.611
if_ruby.c patch 7.4.705 Problem: Can't build with Ruby 2.2. Solution: Add #ifde…
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.502
main.aap updated for version 7.3.925
main.c patch 7.4.767 Problem: --remote-tab-silent can fail on MS-Windows. So…
mark.c updated for version 7.4.212
mbyte.c patch 7.4.752 Problem: Unicode 8.0 not supported. Solution: Update ta…
memfile.c patch 7.4.730 Problem: When setting the crypt key and using a swap fi…
memfile_test.c Add missing files for patch 7.3.143.
memline.c patch 7.4.730 Problem: When setting the crypt key and using a swap fi…
menu.c Merge branch 'vim'
message.c patch 7.4.722 Problem: 0x202f is not recognized as a non-breaking spa…
misc1.c patch 7.4.723 Problem: For indenting, finding the C++ baseclass can b…
misc2.c patch 7.4.704 Problem: Searching for a character matches an illegal b…
mkinstalldirs updated for version 7.2.329
move.c updated for version 7.4.669 Problem: When netbeans is active the sign…
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 updated for version 7.4.669 Problem: When netbeans is active the sign…
normal.c patch 7.4.765 Problem: CTRL-A and CTRL-X in Visual mode do not always…
ops.c patch 7.4.765 Problem: CTRL-A and CTRL-X in Visual mode do not always…
option.c Add optional blur to transparent windows
option.h Add optional blur to transparent windows
os_amiga.c updated for version 7.4.672 Problem: When completing a shell command,…
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.672 Problem: When completing a shell command,…
os_msdos.h updated for version 7.3.719
os_mswin.c updated for version 7.4.506
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 updated for version 7.4.684 Problem: When starting several Vim instan…
os_unix.h patch 7.4.713 Problem: Wrong condition for #ifdef. Solution: Change U…
os_unixx.h updated for version 7.2.392
os_vms.c updated for version 7.4.672 Problem: When completing a shell command,…
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.679 Problem: Color values greater than 255 ca…
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 patch 7.4.747 Problem: ":cnext" may jump to the wrong column when set…
regexp.c patch 7.4.736 Problem: Invalid memory access. Solution: Avoid going o…
regexp.h updated for version 7.4.497
regexp_nfa.c patch 7.4.715 Problem: Invalid memory access when there are illegal b…
screen.c patch 7.4.738 Problem: Can't compile without the syntax highlighting …
search.c updated for version 7.4.662 Problem: When 'M' is in the 'cpo' option …
sha256.c updated for version 7.3.816
spell.c updated for version 7.4.684 Problem: When starting several Vim instan…
structs.h patch 7.4.698 Problem: Various problems with locked and fixed lists a…
swis.s updated for version 7.0001
syntax.c patch 7.4.760 Problem: Spelling mistakes are not displayed after ":sy…
tag.c patch 7.4.746 Problem: ":[count]tag" is not always working. (cs86661)…
tearoff.bmp updated for version 7.0001
term.c patch 7.4.766 Problem: Background color check does not work on Tera T…
term.h patch 7.4.757 Problem: Cannot detect the background color of a termin…
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 patch 7.4.707 Problem: Undo files can have their executable bit set. …
uninstal.c Remove unused code.
version.c patch 7.4.769 Problem: Behavior of :diffoff is not tested. Solution: …
version.h release version 7.4
vim.def release version 7.4
vim.h updated for version 7.4.672 Problem: When completing a shell command,…
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 patch 7.4.709 Problem: ":tabmove" does not work as documented. Soluti…
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.