Name Date Size #Lines LOC

..25-Jul-2025-

GvimExt/H25-Jul-2025-1,6561,164

VisVim/H25-Jul-2025-3,1722,303

auto/H25-Jul-2025-16,38713,934

if_perl_msvc/H25-Jul-2025-41

libvterm/H25-Jul-2025-12,2039,765

os_mac_rsrc/H25-Jul-2025-

po/H25-Jul-2025-256,904185,820

proto/H25-Jul-2025-4,9774,818

tee/H25-Jul-2025-208147

testdir/H25-Jul-2025-173,842152,380

xdiff/H25-Jul-2025-4,2052,695

xpm/H25-Jul-2025-705447

xxd/H25-Jul-2025-1,029806

INSTALLH A D25-Jul-20257.9 KiB230168

INSTALLami.txtH A D25-Jul-2025736 2014

INSTALLmac.txtH A D25-Jul-20252.6 KiB8454

INSTALLpc.txtH A D25-Jul-202535.3 KiB1,029706

INSTALLvms.txtH A D25-Jul-202512.1 KiB394281

INSTALLx.txtH A D25-Jul-20254.9 KiB157117

Make_all.makH A D25-Jul-2025251 1715

Make_ami.makH A D25-Jul-20252.8 KiB205192

Make_cyg.makH A D25-Jul-20251.4 KiB5440

Make_cyg_ming.makH A D25-Jul-202533.9 KiB1,3271,143

Make_ming.makH A D25-Jul-20251.4 KiB5240

Make_mvc.makH A D25-Jul-202555.9 KiB2,0581,742

Make_vms.mmsH A D25-Jul-202545.6 KiB1,2331,170

MakefileH A D25-Jul-2025169.9 KiB4,3932,578

README.mdH A D25-Jul-20258.1 KiB236176

alloc.cH A D25-Jul-202517.9 KiB868599

alloc.hH A D25-Jul-2025742 3421

arabic.cH A D25-Jul-20259.5 KiB397287

arglist.cH A D25-Jul-202531.6 KiB1,3911,026

ascii.hH A D25-Jul-20254.6 KiB187133

autocmd.cH A D25-Jul-202566.4 KiB2,6901,892

beval.cH A D25-Jul-20257.7 KiB327239

beval.hH A D25-Jul-20252.4 KiB9679

bigvim.batH A D25-Jul-2025715 64

bigvim64.batH A D25-Jul-2025492 86

blob.cH A D25-Jul-202510.3 KiB548397

blowfish.cH A D25-Jul-202523.5 KiB686569

buffer.cH A D25-Jul-2025142.2 KiB5,8464,418

bufwrite.cH A D25-Jul-202567.9 KiB2,6252,030

change.cH A D25-Jul-202561.6 KiB2,3751,682

channel.cH A D25-Jul-2025120 KiB5,1043,915

charset.cH A D25-Jul-202549.7 KiB2,1411,547

cindent.cH A D25-Jul-2025102.4 KiB4,1482,843

clientserver.cH A D25-Jul-202524.1 KiB1,046802

clipboard.cH A D25-Jul-202553.7 KiB2,2261,678

cmdexpand.cH A D25-Jul-202572.9 KiB2,9752,360

cmdhist.cH A D25-Jul-202516.9 KiB780603

config.h.inH A D25-Jul-202511.9 KiB510388

config.mk.distH A D25-Jul-202595 65

config.mk.inH A D25-Jul-20254.3 KiB179144

configureH A D25-Jul-2025318 115

configure.acH A D25-Jul-2025150.4 KiB4,6274,254

create_cmdidxs.vimH A D25-Jul-20253.2 KiB10591

crypt.cH A D25-Jul-202523.5 KiB992711

crypt_zip.cH A D25-Jul-20253.3 KiB15795

debugger.cH A D25-Jul-202523.5 KiB1,043833

dehqx.pyH A D25-Jul-20251 KiB4628

dict.cH A D25-Jul-202528.4 KiB1,376989

diff.cH A D25-Jul-202581.7 KiB3,3702,526

digraph.cH A D25-Jul-202559.3 KiB2,7372,471

dimm.idlH A D25-Jul-202526 KiB545487

dlldata.cH A D25-Jul-2025787 3913

dosinst.cH A D25-Jul-202573.1 KiB2,8112,139

dosinst.hH A D25-Jul-202511.9 KiB511343

drawline.cH A D25-Jul-202581.1 KiB3,2402,658

drawscreen.cH A D25-Jul-202583.7 KiB3,2802,425

edit.cH A D25-Jul-2025129 KiB5,4343,978

errors.hH A D25-Jul-202531.8 KiB687666

eval.cH A D25-Jul-2025143.4 KiB6,4464,811

evalbuffer.cH A D25-Jul-202520.9 KiB963713

evalfunc.cH A D25-Jul-2025243.2 KiB10,0898,413

evalvars.cH A D25-Jul-2025104.3 KiB4,4593,359

evalwindow.cH A D25-Jul-202527.9 KiB1,321990

ex_cmdidxs.hH A D25-Jul-20254 KiB7359

ex_cmds.cH A D25-Jul-2025135.4 KiB5,4453,942

ex_cmds.hH A D25-Jul-202567.1 KiB1,9471,880

ex_cmds2.cH A D25-Jul-202522 KiB999733

ex_docmd.cH A D25-Jul-2025220.3 KiB9,5117,204

ex_eval.cH A D25-Jul-202572.5 KiB2,5411,535

ex_getln.cH A D25-Jul-2025108.2 KiB4,6643,506

feature.hH A D25-Jul-202530.7 KiB1,273509

fileio.cH A D25-Jul-2025138 KiB5,6694,183

filepath.cH A D25-Jul-202596.7 KiB4,2113,119

findfile.cH A D25-Jul-202572.7 KiB2,8771,956

float.cH A D25-Jul-202511.5 KiB592402

fold.cH A D25-Jul-202593.6 KiB3,8262,603

getchar.cH A D25-Jul-202592.2 KiB3,7672,528

glbl_ime.cppH A D25-Jul-20255.6 KiB257150

glbl_ime.hH A D25-Jul-2025921 3423

globals.hH A D25-Jul-202571.6 KiB1,9111,107

gui.cH A D25-Jul-2025138.8 KiB5,6384,089

gui.hH A D25-Jul-202519.4 KiB577415

gui_at_fs.cH A D25-Jul-202557.4 KiB2,7542,309

gui_at_sb.cH A D25-Jul-202532.2 KiB1,193924

gui_at_sb.hH A D25-Jul-20255.7 KiB16275

gui_athena.cH A D25-Jul-202554.5 KiB2,2921,796

gui_beval.cH A D25-Jul-202531.2 KiB1,239949

gui_dwrite.cppH A D25-Jul-202529.5 KiB1,3501,132

gui_dwrite.hH A D25-Jul-20252.4 KiB9349

gui_gtk.cH A D25-Jul-202573.7 KiB2,6942,053

gui_gtk_f.cH A D25-Jul-202522 KiB884671

gui_gtk_f.hH A D25-Jul-20252.1 KiB8151

gui_gtk_res.xmlH A D25-Jul-2025766 1918

gui_gtk_vms.hH A D25-Jul-202530.9 KiB731638

gui_gtk_x11.cH A D25-Jul-2025186.9 KiB7,0955,019

gui_haiku.ccH A D25-Jul-2025119.7 KiB5,0953,605

gui_haiku.hH A D25-Jul-20251.1 KiB5220

gui_motif.cH A D25-Jul-202597.5 KiB4,0333,144

gui_photon.cH A D25-Jul-202567.7 KiB2,9892,222

gui_w32.cH A D25-Jul-2025206.6 KiB8,8046,465

gui_w32_rc.hH A D25-Jul-2025193 91

gui_x11.cH A D25-Jul-202579.8 KiB3,3562,520

gui_x11_pm.hH A D25-Jul-20252.3 KiB9373

gui_xim.cH A D25-Jul-202544.8 KiB1,7701,304

gui_xmdlg.cH A D25-Jul-202531.1 KiB1,280986

gui_xmebw.cH A D25-Jul-202538.9 KiB1,4611,117

gui_xmebw.hH A D25-Jul-20251.7 KiB7334

gui_xmebwp.hH A D25-Jul-20252 KiB8942

gvimtutorH A D25-Jul-2025144 91

hardcopy.cH A D25-Jul-202589 KiB3,4752,576

hashtab.cH A D25-Jul-202512.5 KiB483278

help.cH A D25-Jul-202532.5 KiB1,3261,009

highlight.cH A D25-Jul-2025117.1 KiB4,5283,587

if_cscope.cH A D25-Jul-202555.7 KiB2,4871,827

if_cscope.hH A D25-Jul-20251.8 KiB7246

if_lua.cH A D25-Jul-202570.5 KiB2,7852,459

if_mzsch.cH A D25-Jul-2025101.1 KiB3,8832,983

if_mzsch.hH A D25-Jul-20252 KiB7754

if_ole.cppH A D25-Jul-202518.1 KiB804521

if_ole.hH A D25-Jul-20257.3 KiB291176

if_ole.idlH A D25-Jul-2025985 4642

if_perl.xsH A D25-Jul-202549.9 KiB1,9821,624

if_perlsfio.cH A D25-Jul-20251.3 KiB6738

if_py_both.hH A D25-Jul-2025149.2 KiB6,9915,678

if_python.cH A D25-Jul-202548.6 KiB1,5561,225

if_python3.cH A D25-Jul-202557.6 KiB1,8691,471

if_ruby.cH A D25-Jul-202548.8 KiB1,9901,694

if_tcl.cH A D25-Jul-202548.1 KiB2,1021,654

if_xcmdsrv.cH A D25-Jul-202537.6 KiB1,5271,010

iid_ole.cH A D25-Jul-20251.2 KiB5829

indent.cH A D25-Jul-202549.7 KiB2,1621,615

infplist.xmlH A D25-Jul-20251.8 KiB7568

insexpand.cH A D25-Jul-2025114.7 KiB4,3613,251

install-shH A D25-Jul-202514.3 KiB502327

installman.shH A D25-Jul-20253.7 KiB12588

installml.shH A D25-Jul-20254.5 KiB171118

iscygpty.cH A D25-Jul-20254.7 KiB184124

iscygpty.hH A D25-Jul-20251.5 KiB4210

job.cH A D25-Jul-202545.4 KiB2,0181,610

json.cH A D25-Jul-202526.2 KiB1,2071,006

json_test.cH A D25-Jul-20256.4 KiB204151

keymap.hH A D25-Jul-202516.7 KiB516315

kword_test.cH A D25-Jul-20251.7 KiB8356

link.390H A D25-Jul-2025154 87

link.shH A D25-Jul-20254.5 KiB152100

list.cH A D25-Jul-202569.7 KiB3,2982,593

locale.cH A D25-Jul-202512.7 KiB565413

macros.hH A D25-Jul-202512.7 KiB404252

main.cH A D25-Jul-202593.6 KiB3,6672,637

map.cH A D25-Jul-202563.1 KiB2,8182,204

mark.cH A D25-Jul-202535.6 KiB1,5271,136

match.cH A D25-Jul-202532.6 KiB1,4201,150

mbyte.cH A D25-Jul-2025130.8 KiB5,6714,429

memfile.cH A D25-Jul-202536.8 KiB1,501931

memfile_test.cH A D25-Jul-20253 KiB14491

memline.cH A D25-Jul-2025155.9 KiB5,9464,189

menu.cH A D25-Jul-202567.8 KiB3,0172,345

message.cH A D25-Jul-202592 KiB4,1273,001

message_test.cH A D25-Jul-20259.6 KiB330225

misc1.cH A D25-Jul-202560.2 KiB2,7351,956

misc2.cH A D25-Jul-202569.6 KiB2,9862,206

mouse.cH A D25-Jul-202578.6 KiB3,1222,377

move.cH A D25-Jul-202569.1 KiB2,9362,271

msvc2008.batH A D25-Jul-2025198 86

msvc2010.batH A D25-Jul-2025200 86

msvc2015.batH A D25-Jul-20251.1 KiB3834

msvcsetup.batH A D25-Jul-2025471 139

msys32.batH A D25-Jul-2025207 75

msys64.batH A D25-Jul-2025207 75

mysignH A D25-Jul-2025140

nbdebug.cH A D25-Jul-20253.8 KiB15899

nbdebug.hH A D25-Jul-20251.4 KiB7342

netbeans.cH A D25-Jul-202582.3 KiB3,4952,577

normal.cH A D25-Jul-2025180.3 KiB7,6255,680

ops.cH A D25-Jul-2025107.8 KiB4,2093,228

option.cH A D25-Jul-2025177.7 KiB7,2385,597

option.hH A D25-Jul-202539.9 KiB1,3341,229

optiondefs.hH A D25-Jul-202595.4 KiB3,0662,984

optionstr.cH A D25-Jul-202561 KiB2,5852,079

os_amiga.cH A D25-Jul-202537.4 KiB1,7351,221

os_amiga.hH A D25-Jul-20254.9 KiB238177

os_dos.hH A D25-Jul-20253.1 KiB136105

os_haiku.hH A D25-Jul-20251.3 KiB3821

os_haiku.rdef.inH A D25-Jul-20257.8 KiB143134

os_mac.hH A D25-Jul-20256.3 KiB269181

os_mac.rsr.hqxH A D25-Jul-202541.6 KiB660657

os_mac_conv.cH A D25-Jul-202513.7 KiB596431

os_macosx.mH A D25-Jul-20255.6 KiB216177

os_mswin.cH A D25-Jul-202568 KiB3,0402,182

os_qnx.cH A D25-Jul-20253.3 KiB156106

os_qnx.hH A D25-Jul-2025395 208

os_unix.cH A D25-Jul-2025191.8 KiB8,2866,096

os_unix.hH A D25-Jul-202511.6 KiB501385

os_unixx.hH A D25-Jul-20252.5 KiB11776

os_vms.cH A D25-Jul-202518.9 KiB817595

os_vms_conf.hH A D25-Jul-20255 KiB221128

os_vms_fix.comH A D25-Jul-20257.6 KiB277276

os_vms_mms.cH A D25-Jul-20251.3 KiB7876

os_w32dll.cH A D25-Jul-2025712 2811

os_w32exe.cH A D25-Jul-20251 KiB5232

os_win32.cH A D25-Jul-2025193 KiB8,3766,165

os_win32.hH A D25-Jul-20255.1 KiB208138

osdef.shH A D25-Jul-20252.9 KiB10167

osdef1.h.inH A D25-Jul-20253.7 KiB139129

osdef2.h.inH A D25-Jul-20252.5 KiB10189

pathdef.shH A D25-Jul-2025251 125

popupmenu.cH A D25-Jul-202538.2 KiB1,6111,237

popupwin.cH A D25-Jul-2025105.4 KiB4,3833,317

profiler.cH A D25-Jul-202522.4 KiB1,019754

proto.hH A D25-Jul-20258.3 KiB339275

protodef.hH A D25-Jul-2025450 198

pty.cH A D25-Jul-202510.5 KiB476343

quickfix.cH A D25-Jul-2025201.9 KiB8,4745,992

regexp.cH A D25-Jul-202569.5 KiB2,9622,177

regexp.hH A D25-Jul-20254.6 KiB17794

regexp_bt.cH A D25-Jul-2025140 KiB5,5744,465

regexp_nfa.cH A D25-Jul-2025187.3 KiB7,6666,115

register.cH A D25-Jul-202570.5 KiB3,0232,347

screen.cH A D25-Jul-2025121.4 KiB5,0113,768

scriptfile.cH A D25-Jul-202549.9 KiB2,0891,543

search.cH A D25-Jul-2025120 KiB4,9123,711

session.cH A D25-Jul-202535.8 KiB1,4131,074

sha256.cH A D25-Jul-202511.9 KiB428332

sign.cH A D25-Jul-202561.7 KiB2,8272,104

sound.cH A D25-Jul-20259.9 KiB465341

spell.cH A D25-Jul-2025103.1 KiB4,4293,170

spell.hH A D25-Jul-202511.6 KiB323193

spellfile.cH A D25-Jul-2025171.4 KiB6,6834,731

spellsuggest.cH A D25-Jul-2025118.9 KiB4,4813,263

strings.cH A D25-Jul-202560.9 KiB2,8042,095

structs.hH A D25-Jul-2025142.2 KiB4,4843,098

syntax.cH A D25-Jul-2025173.3 KiB6,8085,001

tag.cH A D25-Jul-2025103.3 KiB4,3243,250

tearoff.bmpH A D25-Jul-2025118

term.cH A D25-Jul-2025171.8 KiB6,7614,974

termdefs.hH A D25-Jul-20259.5 KiB226188

terminal.cH A D25-Jul-2025177.1 KiB7,3945,676

termlib.cH A D25-Jul-202513.2 KiB619423

testing.cH A D25-Jul-202531.7 KiB1,4021,161

textformat.cH A D25-Jul-202531.2 KiB1,174841

textobject.cH A D25-Jul-202545.6 KiB1,9941,451

textprop.cH A D25-Jul-202540 KiB1,7101,300

time.cH A D25-Jul-202525.2 KiB1,116837

toolbar.phiH A D25-Jul-202533.2 KiB1,2841,220

toolcheckH A D25-Jul-2025855 3729

tools.bmpH A D25-Jul-20254.6 KiB

typemapH A D25-Jul-2025284 1513

typval.cH A D25-Jul-202548.9 KiB2,1971,733

ui.cH A D25-Jul-202528.6 KiB1,216811

undo.cH A D25-Jul-202591.3 KiB3,7312,716

uninstall.cH A D25-Jul-202510.6 KiB426330

usercmd.cH A D25-Jul-202538.1 KiB1,7851,413

userfunc.cH A D25-Jul-2025138.7 KiB5,7524,329

version.cH A D25-Jul-202578.1 KiB8,7214,933

version.hH A D25-Jul-20251.9 KiB5123

vim.defH A D25-Jul-202581 54

vim.hH A D25-Jul-202591 KiB2,7992,000

vim.icoH A D25-Jul-20251.1 KiB

vim.manifestH A D25-Jul-20252.2 KiB5945

vim.rcH A D25-Jul-20253.2 KiB137122

vim.tlbH A D25-Jul-20251.8 KiB

vim9.hH A D25-Jul-202517 KiB531379

vim9compile.cH A D25-Jul-2025253.3 KiB10,7037,993

vim9execute.cH A D25-Jul-2025150.4 KiB6,0054,832

vim9script.cH A D25-Jul-202524.8 KiB1,057782

vim9type.cH A D25-Jul-202530.4 KiB1,2901,031

vim_alert.icoH A D25-Jul-20251.1 KiB

vim_error.icoH A D25-Jul-20251.1 KiB

vim_icon.xbmH A D25-Jul-2025896 1514

vim_info.icoH A D25-Jul-20251.1 KiB

vim_mask.xbmH A D25-Jul-2025911 1514

vim_quest.icoH A D25-Jul-20251.1 KiB

viminfo.cH A D25-Jul-202580.1 KiB3,3572,635

vimrun.cH A D25-Jul-20252.3 KiB11472

vimtutorH A D25-Jul-20252.1 KiB7540

which.shH A D25-Jul-2025254 137

winclip.cH A D25-Jul-202518.6 KiB777518

window.cH A D25-Jul-2025163 KiB7,0175,134

xpm_w32.cH A D25-Jul-20251.1 KiB5733

xpm_w32.hH A D25-Jul-2025131 83

README.md

1![Vim Logo](https://github.com/vim/vim/blob/master/runtime/vimlogo.gif)
2
3# Vim source code #
4
5Here are a few hints for finding your way around the source code.  This
6doesn't make it less complex than it is, but it gets you started.
7
8You might also want to read
9[`:help development`](http://vimdoc.sourceforge.net/htmldoc/develop.html#development).
10
11
12## Jumping around ##
13
14First of all, use `:make tags` to generate a tags file, so that you can jump
15around in the source code.
16
17To jump to a function or variable definition, move the cursor on the name and
18use the `CTRL-]` command.  Use `CTRL-T` or `CTRL-O` to jump back.
19
20To jump to a file, move the cursor on its name and use the `gf` command.
21
22Most code can be found in a file with an obvious name (incomplete list):
23
24File name       | Description
25--------------- | -----------
26alloc.c		| memory management
27arglist.c	| handling argument list
28autocmd.c	| autocommands
29blob.c		| blob data type
30buffer.c	| manipulating buffers (loaded files)
31bufwrite.c	| writing a buffer to file
32change.c	| handling changes to text
33cindent.c	| C and Lisp indentation
34clientserver.c	| client server functionality
35clipboard.c	| handling the clipboard
36cmdexpand.c	| command-line completion
37cmdhist.c	| command-line history
38debugger.c	| vim script debugger
39diff.c		| diff mode (vimdiff)
40drawline.c	| drawing a window line
41drawscreen.c	| drawing the windows
42eval.c		| expression evaluation
43evalbuffer.c	| buffer related built-in functions
44evalfunc.c	| built-in functions
45evalvars.c	| vim variables
46evalwindow.c	| window related built-in functions
47fileio.c	| reading and writing files
48filepath.c	| dealing with file names and paths
49findfile.c	| search for files in 'path'
50fold.c		| folding
51getchar.c	| getting characters and key mapping
52help.c		| vim help related functions
53highlight.c	| syntax highlighting
54indent.c	| text indentation
55insexpand.c	| Insert mode completion
56locale.c	| locale/language handling
57map.c		| mapping and abbreviations
58mark.c		| marks
59match.c		| highlight matching
60float.c		| floating point functions
61mbyte.c		| multi-byte character handling
62memfile.c	| storing lines for buffers in a swapfile
63memline.c	| storing lines for buffers in memory
64menu.c		| menus
65message.c	| (error) messages
66mouse.c		| handling the mouse
67ops.c		| handling operators ("d", "y", "p")
68option.c	| options
69optionstr.c	| handling string options
70popupmenu.c	| popup menu
71popupwin.c	| popup window
72profiler.c	| vim script profiler
73quickfix.c	| quickfix commands (":make", ":cn")
74regexp.c	| pattern matching
75register.c	| handling registers
76scriptfile.c	| runtime directory handling and sourcing scripts
77screen.c	| lower level screen functions
78search.c	| pattern searching
79session.c	| sessions and views
80sign.c		| signs
81spell.c		| spell checking core
82spellfile.c	| spell file handling
83spellsuggest.c	| spell correction suggestions
84strings.c	| string manipulation functions
85syntax.c	| syntax and other highlighting
86tag.c		| tags
87term.c		| terminal handling, termcap codes
88testing.c	| testing: assert and test functions
89textformat.c	| text formatting
90textobject.c	| text objects
91textprop.c	| text properties
92time.c		| time and timer functions
93typval.c	| vim script type/value functions
94undo.c		| undo and redo
95usercmd.c	| user defined commands
96userfunc.c	| user defined functions
97viminfo.c	| viminfo handling
98window.c	| handling split windows
99
100
101## Debugging ##
102
103If you have a reasonable recent version of gdb, you can use the `:Termdebug`
104command to debug Vim.  See  `:help :Termdebug`.
105
106When something is time critical or stepping through code is a hassle, use the
107channel logging to create a time-stamped log file.  Add lines to the code like
108this:
109
110	ch_log(NULL, "Value is now %02x", value);
111
112After compiling and starting Vim, do:
113
114	:call ch_logfile('debuglog', 'w')
115
116And edit `debuglog` to see what happens.  The channel functions already have
117`ch_log()` calls, thus you always see that in the log.
118
119
120## Important Variables ##
121
122The current mode is stored in `State`.  The values it can have are `NORMAL`,
123`INSERT`, `CMDLINE`, and a few others.
124
125The current window is `curwin`.  The current buffer is `curbuf`.  These point
126to structures with the cursor position in the window, option values, the file
127name, etc.  These are defined in
128[`structs.h`](https://github.com/vim/vim/blob/master/src/structs.h).
129
130All the global variables are declared in
131[`globals.h`](https://github.com/vim/vim/blob/master/src/globals.h).
132
133
134## The main loop ##
135
136This is conveniently called `main_loop()`.  It updates a few things and then
137calls `normal_cmd()` to process a command.  This returns when the command is
138finished.
139
140The basic idea is that Vim waits for the user to type a character and
141processes it until another character is needed.  Thus there are several places
142where Vim waits for a character to be typed.  The `vgetc()` function is used
143for this.  It also handles mapping.
144
145Updating the screen is mostly postponed until a command or a sequence of
146commands has finished.  The work is done by `update_screen()`, which calls
147`win_update()` for every window, which calls `win_line()` for every line.
148See the start of
149[`screen.c`](https://github.com/vim/vim/blob/master/src/screen.c)
150for more explanations.
151
152
153## Command-line mode ##
154
155When typing a `:`, `normal_cmd()` will call `getcmdline()` to obtain a line
156with an Ex command.  `getcmdline()` contains a loop that will handle each typed
157character.  It returns when hitting `CR` or `Esc` or some other character that
158ends the command line mode.
159
160
161## Ex commands ##
162
163Ex commands are handled by the function `do_cmdline()`.  It does the generic
164parsing of the `:` command line and calls `do_one_cmd()` for each separate
165command.  It also takes care of while loops.
166
167`do_one_cmd()` parses the range and generic arguments and puts them in the
168`exarg_t` and passes it to the function that handles the command.
169
170The `:` commands are listed in `ex_cmds.h`.  The third entry of each item is
171the name of the function that handles the command.  The last entry are the
172flags that are used for the command.
173
174
175## Normal mode commands ##
176
177The Normal mode commands are handled by the `normal_cmd()` function.  It also
178handles the optional count and an extra character for some commands.  These
179are passed in a `cmdarg_t` to the function that handles the command.
180
181There is a table `nv_cmds` in
182[`normal.c`](https://github.com/vim/vim/blob/master/src/normal.c)
183which lists the first character of every command.  The second entry of each
184item is the name of the function that handles the command.
185
186
187## Insert mode commands ##
188
189When doing an `i` or `a` command, `normal_cmd()` will call the `edit()`
190function. It contains a loop that waits for the next character and handles it.
191It returns when leaving Insert mode.
192
193
194## Options ##
195
196There is a list with all option names in
197[`option.c`](https://github.com/vim/vim/blob/master/src/option.c),
198called `options[]`.
199
200
201## The GUI ##
202
203Most of the GUI code is implemented like it was a clever terminal.  Typing a
204character, moving a scrollbar, clicking the mouse, etc. are all translated
205into events which are written in the input buffer.  These are read by the
206main code, just like reading from a terminal.  The code for this is scattered
207through [`gui.c`](https://github.com/vim/vim/blob/master/src/gui.c).
208For example, `gui_send_mouse_event()` for a mouse click and `gui_menu_cb()` for
209a menu action.  Key hits are handled by the system-specific GUI code, which
210calls `add_to_input_buf()` to send the key code.
211
212Updating the GUI window is done by writing codes in the output buffer, just
213like writing to a terminal.  When the buffer gets full or is flushed,
214`gui_write()` will parse the codes and draw the appropriate items.  Finally the
215system-specific GUI code will be called to do the work.
216
217
218## Debugging the GUI ##
219
220Remember to prevent that gvim forks and the debugger thinks Vim has exited,
221add the `-f` argument.  In gdb: `run -f -g`.
222
223When stepping through display updating code, the focus event is triggered
224when going from the debugger to Vim and back.  To avoid this, recompile with
225some code in `gui_focus_change()` disabled.
226
227
228## Contributing ##
229
230If you would like to help making Vim better, see the
231[`CONTRIBUTING.md`](https://github.com/vim/vim/blob/master/CONTRIBUTING.md)
232file.
233
234
235This is `README.md` for version 8.2 of the Vim source code.
236