vim/src
Yegappan Lakshmanan 7e89800988
patch 9.1.1105: Vim9: no support for protected new() method
Problem:  Vim9: no support for protected new() method
Solution: support the protected "_new()" object method
          (Yegappan Lakshmanan)

closes: #16604

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-02-11 22:07:05 +01:00
..
auto patch 9.1.1064: not possible to use plural forms with gettext() 2025-02-01 15:47:51 +01:00
GvimExt patch 9.1.1029: the installer can be improved 2025-01-17 14:04:44 +01:00
libvterm patch 9.1.1078: Terminal ansi colors off by one after tgc reset 2025-02-06 20:31:27 +01:00
po translation(sr): Update Serbian messages translation 2025-01-21 21:42:48 +01:00
proto patch 9.1.1097: --log with non-existent path causes a crash 2025-02-10 21:12:19 +01:00
tee
testdir patch 9.1.1105: Vim9: no support for protected new() method 2025-02-11 22:07:05 +01:00
xdiff
xpm
xxd patch 9.1.0912: xxd: integer overflow with sparse files and -autoskip 2024-12-07 16:27:22 +01:00
alloc.c
alloc.h
arabic.c
arglist.c patch 9.1.1003: [security]: heap-buffer-overflow with visual mode 2025-01-11 15:25:00 +01:00
ascii.h
autocmd.c patch 9.1.1084: Unable to persistently ignore events in a window and its buffers 2025-02-08 18:52:39 +01:00
beval.c
beval.h
bigvim.bat
bigvim64.bat
blob.c
blowfish.c
buffer.c patch 9.1.0997: too many strlen() calls in drawscreen.c 2025-01-08 20:10:59 +01:00
bufwrite.c patch 9.1.0615: Unnecessary STRLEN() in make_percent_swname() 2024-07-25 20:58:42 +02:00
change.c patch 9.1.0546: vim-tiny fails on CTRL-X/CTRL-A 2024-07-08 21:12:55 +02:00
channel.c patch 9.1.0639: channel timeout may wrap around 2024-07-29 20:39:12 +02:00
charset.c patch 9.1.0803: tests: no error check when setting global 'isk' 2024-10-22 22:27:19 +02:00
cindent.c
clientserver.c patch 9.1.0356: MS-Windows: --remote may change working directory 2024-04-19 15:26:21 +02:00
clipboard.c patch 9.1.0852: No warning when X11 registers are not available 2024-11-11 20:52:55 +01:00
cmdexpand.c patch 9.1.0948: Missing cmdline completion for :pbuffer 2024-12-19 20:05:28 +01:00
cmdhist.c patch 9.1.0798: too many strlen() calls in cmdhist.c 2024-10-21 22:37:07 +02:00
config.h.in patch 9.1.1064: not possible to use plural forms with gettext() 2025-02-01 15:47:51 +01:00
config.mk.dist
config.mk.in patch 9.1.0173: msgfmt ver. 0.22 forcibly converts text to UTF-8 2024-03-12 22:14:39 +01:00
configure
configure.ac patch 9.1.1064: not possible to use plural forms with gettext() 2025-02-01 15:47:51 +01:00
create_cmdidxs.vim
create_nvcmdidxs.c
create_nvcmdidxs.vim
crypt.c
crypt_zip.c
debugger.c
dict.c patch 9.1.1063: too many strlen() calls in userfunc.c 2025-02-01 15:25:34 +01:00
diff.c patch 9.1.1072: 'diffopt' "linematch" cannot be used with {n} less than 10 2025-02-03 18:49:49 +01:00
digraph.c patch 9.1.1065: no digraph for "Approaches the limit" 2025-02-01 16:17:14 +01:00
dlldata.c
dosinst.c patch 9.1.0370: MS-Windows: patch number is zero in installer 2024-04-25 21:25:19 +02:00
dosinst.h
drawline.c patch 9.1.1086: completion doesn't work with multi lines 2025-02-08 19:09:02 +01:00
drawscreen.c patch 9.1.1021: string might be used without a trailing NUL 2025-01-16 18:58:20 +01:00
edit.c patch 9.1.1056: Vim doesn't highlight to be inserted text when completing 2025-01-29 18:58:04 +01:00
errors.h patch 9.1.1094: Vim9: problem finding implemented method in type hierarchy 2025-02-09 19:39:52 +01:00
eval.c patch 9.1.1063: too many strlen() calls in userfunc.c 2025-02-01 15:25:34 +01:00
evalbuffer.c patch 9.1.0831: 'findexpr' can't be used as lambad or Funcref 2024-11-02 18:43:42 +01:00
evalfunc.c patch 9.1.1081: has('bsd') is true for GNU/Hurd 2025-02-06 21:39:35 +01:00
evalvars.c patch 9.1.1063: too many strlen() calls in userfunc.c 2025-02-01 15:25:34 +01:00
evalwindow.c patch 9.1.0888: leftcol property not available in getwininfo() 2024-11-25 19:39:04 +01:00
ex_cmdidxs.h patch 9.1.0934: hard to view an existing buffer in the preview window 2024-12-16 21:22:09 +01:00
ex_cmds.c patch 9.1.0849: there are a few typos in the source 2024-11-10 20:26:12 +01:00
ex_cmds.h patch 9.1.0985: Vim9: some ex commands can be shortened 2025-01-03 10:19:45 +01:00
ex_cmds2.c patch 9.1.0653: Patch v9.1.0648 not completely right 2024-08-02 19:06:41 +02:00
ex_docmd.c patch 9.1.0959: Coverity complains about type conversion 2024-12-25 10:20:51 +01:00
ex_eval.c patch 9.1.0999: Vim9: leaking finished exception 2025-01-09 22:14:34 +01:00
ex_getln.c patch 9.1.0957: MS-Windows: conversion warnings 2024-12-24 09:50:01 +01:00
feature.h patch 9.1.0864: message history is fixed to 200 2024-11-14 22:34:24 +01:00
fileio.c patch 9.1.1031: Coverity complains about insecure data handling 2025-01-18 10:29:46 +01:00
filepath.c patch 9.1.0959: Coverity complains about type conversion 2024-12-25 10:20:51 +01:00
findfile.c patch 9.1.0761: :cd completion fails on Windows with backslash in path 2024-10-06 16:34:20 +02:00
float.c
fold.c patch 9.1.1015: Coverity complains about dereferencing NULL value 2025-01-14 17:25:02 +01:00
gc.c patch 9.1.0831: 'findexpr' can't be used as lambad or Funcref 2024-11-02 18:43:42 +01:00
getchar.c patch 9.1.1070: Cannot control cursor positioning of getchar() 2025-02-02 19:01:01 +01:00
globals.h patch 9.1.1060: Vim always enables 'termguicolors' in a terminal 2025-01-31 16:16:48 +01:00
gui.c patch 9.1.1079: GUI late startup leads to uninitialized scrollbars 2025-02-06 21:18:17 +01:00
gui.h patch 9.1.0133: MS-Windows: ligatures not rendering correctly 2024-02-24 14:26:52 +01:00
gui_beval.c
gui_dwrite.cpp
gui_dwrite.h
gui_gtk.c patch 9.1.0881: GUI: message dialog may not get focus 2024-11-23 13:35:43 +01:00
gui_gtk_f.c
gui_gtk_f.h
gui_gtk_res.xml
gui_gtk_vms.h
gui_gtk_x11.c patch 9.1.0930: tests: test_terminal2 may hang in GUI mode 2024-12-15 19:32:39 +01:00
gui_haiku.cc
gui_haiku.h
gui_motif.c patch 9.1.0210: Motif: leaking memory when mui_mch_dialog() fails 2024-03-26 18:44:48 +01:00
gui_photon.c
gui_w32.c patch 9.1.0641: MS-Windows: OLE enabled in console version 2024-07-29 20:57:19 +02:00
gui_w32_rc.h
gui_x11.c patch 9.1.0432: Ancient XPM preprocessor hack may cause build errors 2024-05-22 16:51:53 +02:00
gui_x11_pm.h
gui_xim.c
gui_xmdlg.c
gui_xmebw.c
gui_xmebw.h
gui_xmebwp.h
gvimtutor
hardcopy.c patch 9.1.0907: printoptions:portrait does not change postscript Orientation 2024-12-06 17:19:25 +01:00
hashtab.c
help.c patch 9.1.0658: Coverity warns about dereferencing NULL pointer. 2024-08-03 14:52:00 +02:00
highlight.c patch 9.1.1001: ComplMatchIns highlight hard to read on light background 2025-01-10 20:08:20 +01:00
if_cscope.c patch 9.1.0959: Coverity complains about type conversion 2024-12-25 10:20:51 +01:00
if_lua.c patch 9.1.0848: if_lua: v:false/v:true are not evaluated to boolean 2024-11-09 18:31:08 +01:00
if_mzsch.c patch 9.1.0630: MS-Windows: build fails with VIMDLL and mzscheme 2024-07-27 13:25:34 +02:00
if_mzsch.h
if_ole.cpp
if_ole.h
if_ole.idl
if_perl.xs patch 9.1.1103: if_perl: still some compile errors with Perl 5.38 2025-02-11 20:06:07 +01:00
if_perlsfio.c
if_py_both.h patch 9.1.0844: if_python: no way to pass local vars to python 2024-11-06 21:53:07 +01:00
if_python.c patch 9.1.0844: if_python: no way to pass local vars to python 2024-11-06 21:53:07 +01:00
if_python3.c patch 9.1.0844: if_python: no way to pass local vars to python 2024-11-06 21:53:07 +01:00
if_ruby.c
if_tcl.c
if_xcmdsrv.c
iid_ole.c
indent.c patch 9.1.0806: tests: no error check when setting global 'briopt' 2024-10-22 22:59:39 +02:00
insexpand.c patch 9.1.1101: insexpand.c hard to read 2025-02-10 22:18:00 +01:00
INSTALL INSTALL: remove outdated notice about statically linked executable 2024-07-20 12:08:43 +02:00
install-sh
INSTALLami.txt
INSTALLmac.txt
installman.sh
installml.sh
INSTALLpc.txt runtime(doc): clarify ARCH value for 32-bit in INSTALLpc.txt 2024-12-27 15:51:09 +01:00
INSTALLvms.txt
INSTALLx.txt
iscygpty.c
iscygpty.h
job.c
json.c
json_test.c
keymap.h
kword_test.c
linematch.c patch 9.1.1076: vim_strnchr() is strange and unnecessary 2025-02-04 16:48:36 +01:00
link.390
link.sh patch 9.1.0452: Configure checks for libelf unnecessarily 2024-05-30 19:31:36 +02:00
list.c patch 9.1.0524: the recursive parameter in the *_equal functions can be removed 2024-07-04 17:20:53 +02:00
locale.c
logfile.c
macros.h patch 9.1.0824: too many strlen() calls in register.c 2024-10-31 10:09:04 +01:00
main.c patch 9.1.1097: --log with non-existent path causes a crash 2025-02-10 21:12:19 +01:00
Make_all.mak
Make_ami.mak patch 9.1.1009: diff feature can be improved 2025-01-12 09:58:00 +01:00
Make_cyg.mak
Make_cyg_ming.mak patch 9.1.1009: diff feature can be improved 2025-01-12 09:58:00 +01:00
Make_ming.mak
Make_mvc.mak patch 9.1.1009: diff feature can be improved 2025-01-12 09:58:00 +01:00
Make_vms.mms patch 9.1.1009: diff feature can be improved 2025-01-12 09:58:00 +01:00
Makefile patch 9.1.1058: translation(sr): Missing Serbian translation for the tutor 2025-01-31 15:20:03 +01:00
map.c patch 9.1.0814: mapset() may remove unrelated mapping 2024-10-24 21:43:43 +02:00
mark.c patch 9.1.0556: :bwipe doesn't remove file from jumplist of other tabpages 2024-07-10 19:36:36 +02:00
match.c patch 9.1.0340: Problem: Error with matchaddpos() and empty list 2024-04-16 22:23:17 +02:00
mbyte.c patch 9.1.1032: link error when FEAT_SPELL not defined 2025-01-18 10:35:57 +01:00
memfile.c patch 9.1.0842: not checking for the sync() systemcall 2024-11-04 20:36:41 +01:00
memfile_test.c
memline.c patch 9.1.0615: Unnecessary STRLEN() in make_percent_swname() 2024-07-25 20:58:42 +02:00
menu.c
message.c patch 9.1.0916: messages.c is exceeding 80 columns 2024-12-09 20:05:59 +01:00
message_test.c patch 9.1.1097: --log with non-existent path causes a crash 2025-02-10 21:12:19 +01:00
misc1.c patch 9.1.1003: [security]: heap-buffer-overflow with visual mode 2025-01-11 15:25:00 +01:00
misc2.c patch 9.1.0828: string_T struct could be used more often 2024-11-02 16:11:58 +01:00
mouse.c patch 9.1.1062: terminal: E315 when dragging the terminal with the mouse 2025-02-01 14:48:35 +01:00
move.c patch 9.1.1048: crash after scrolling and pasting in silent Ex mode 2025-01-22 22:27:30 +01:00
msvc-latest.bat
msvc2015.bat
msvc2017.bat
msvc2019.bat
msvc2022.bat
msys32.bat
msys64.bat
mysign
nbdebug.c
nbdebug.h
netbeans.c patch 9.1.0561: netbeans: variable used un-initialized (Coverity) 2024-07-11 21:41:23 +02:00
normal.c patch 9.1.0938: exclusive selection not respected when re-selecting block mode 2024-12-16 22:49:15 +01:00
nv_cmdidxs.h
nv_cmds.h
ops.c patch 9.1.1003: [security]: heap-buffer-overflow with visual mode 2025-01-11 15:25:00 +01:00
option.c patch 9.1.1084: Unable to persistently ignore events in a window and its buffers 2025-02-08 18:52:39 +01:00
option.h patch 9.1.1084: Unable to persistently ignore events in a window and its buffers 2025-02-08 18:52:39 +01:00
optiondefs.h patch 9.1.1084: Unable to persistently ignore events in a window and its buffers 2025-02-08 18:52:39 +01:00
optionstr.c patch 9.1.1084: Unable to persistently ignore events in a window and its buffers 2025-02-08 18:52:39 +01:00
os_amiga.c
os_amiga.h
os_dos.h
os_haiku.h
os_haiku.rdef.in
os_mac.h
os_mac_conv.c
os_macosx.m
os_mswin.c patch 9.1.0915: GVim: default font size a bit too small 2024-12-08 10:26:51 +01:00
os_qnx.c
os_qnx.h
os_unix.c patch 9.1.1050: too many strlen() calls in os_unix.c 2025-01-23 20:05:29 +01:00
os_unix.h patch 9.1.0979: VMS: type warning with $XDG_VIMRC_FILE 2024-12-30 10:10:01 +01:00
os_unixx.h
os_vms.c
os_vms_conf.h
os_vms_fix.com
os_vms_mms.c
os_w32dll.c patch 9.1.0621: MS-Windows: startup code can be improved 2024-07-26 18:46:54 +02:00
os_w32exe.c patch 9.1.0630: MS-Windows: build fails with VIMDLL and mzscheme 2024-07-27 13:25:34 +02:00
os_win32.c patch 9.1.0780: MS-Windows: incorrect Win32 error checking 2024-10-13 19:44:07 +02:00
os_win32.h patch 9.1.0750: there are some Win9x legacy references 2024-09-30 19:42:28 +02:00
osdef.sh
osdef1.h.in
osdef2.h.in
pathdef.sh
popupmenu.c patch 9.1.1011: popupmenu internal error with some abbr in completion item 2025-01-13 07:27:43 +01:00
popupwin.c patch 9.1.0949: popups inconsistently shifted to the left 2024-12-19 20:22:19 +01:00
profiler.c
proto.h patch 9.1.1009: diff feature can be improved 2025-01-12 09:58:00 +01:00
protodef.h
pty.c
quickfix.c patch 9.1.0785: cannot preserve error position when setting quickfix list 2024-10-14 20:53:07 +02:00
README.md patch 9.1.0431: eval.c is too long 2024-05-22 16:45:04 +02:00
regexp.c patch 9.1.0828: string_T struct could be used more often 2024-11-02 16:11:58 +01:00
regexp.h
regexp_bt.c patch 9.1.0645: regex: wrong match when searching multi-byte char case-insensitive 2024-07-30 20:39:18 +02:00
regexp_nfa.c patch 9.1.0701: crash with NFA regex engine when searching for composing chars 2024-08-28 23:17:52 +02:00
register.c patch 9.1.1083: setreg() doesn't correctly handle mbyte chars in blockwise mode 2025-02-08 18:19:15 +01:00
screen.c patch 9.1.1028: too many strlen() calls in screen.c 2025-01-17 13:54:49 +01:00
scriptfile.c patch 9.1.0984: exception handling can be improved 2025-01-02 18:06:00 +01:00
search.c patch 9.1.1046: fuzzymatching doesn't prefer matching camelcase 2025-01-21 22:33:13 +01:00
session.c patch 9.1.0207: No autocommand when writing session file 2024-03-26 18:23:06 +01:00
sha256.c
sign.c patch 9.1.0887: Wrong expression in sign.c 2024-11-25 09:59:20 +01:00
sound.c patch 9.1.0879: source is not consistently formatted 2024-11-19 22:55:13 +01:00
spell.c patch 9.1.0903: potential overflow in spell_soundfold_wsal() 2024-12-04 20:16:17 +01:00
spell.h
spellfile.c patch 9.1.0608: Coverity warns about a few potential issues 2024-07-20 13:26:44 +02:00
spellsuggest.c patch 9.1.0418: Cannot move to previous/next rare word 2024-05-17 18:52:45 +02:00
strings.c patch 9.1.1076: vim_strnchr() is strange and unnecessary 2025-02-04 16:48:36 +01:00
structs.h patch 9.1.1084: Unable to persistently ignore events in a window and its buffers 2025-02-08 18:52:39 +01:00
syntax.c patch 9.1.1077: included syntax items do not understand contains=TOP 2025-02-05 23:59:25 +01:00
tag.c patch 9.1.0581: Various lines are indented inconsistently 2024-07-14 10:20:20 +02:00
tearoff.bmp
term.c patch 9.1.1082: unexpected DCS responses may cause out of bounds reads 2025-02-07 20:54:56 +01:00
termdefs.h patch 9.1.0321: Garbled output on serial terminals with XON/XOFF flow control 2024-04-14 20:02:50 +02:00
terminal.c patch 9.1.0808: Terminal scrollback doesn't shrink when decreasing 'termwinscroll' 2024-10-22 23:17:45 +02:00
termlib.c
testing.c patch 9.1.0666: assert_equal() doesn't show multibyte string correctly 2024-08-09 19:52:10 +02:00
textformat.c patch 9.1.0940: Wrong cursor shape with "gq" and 'indentexpr' executes :normal 2024-12-17 20:26:45 +01:00
textobject.c patch 9.1.0504: inner-tag textobject confused about ">" in attributes 2024-06-19 20:26:51 +02:00
textprop.c patch 9.1.0722: crash with large id in text_prop interface 2024-09-08 20:05:23 +02:00
time.c
toolbar.phi
toolcheck
tools.bmp
typemap
typval.c patch 9.1.1068: getchar() can't distinguish between C-I and Tab 2025-02-02 09:14:35 +01:00
ui.c
undo.c patch 9.1.0957: MS-Windows: conversion warnings 2024-12-24 09:50:01 +01:00
uninstall.c
usercmd.c patch 9.1.0957: MS-Windows: conversion warnings 2024-12-24 09:50:01 +01:00
userfunc.c patch 9.1.1074: Strange error when heredoc marker starts with "trim" 2025-02-03 18:56:16 +01:00
version.c patch 9.1.1105: Vim9: no support for protected new() method 2025-02-11 22:07:05 +01:00
version.h patch 9.1.0368: MS-Windows: Hard to define the Vim Patchlevel with leading zeroes 2024-04-23 20:33:38 +02:00
vim.h patch 9.1.1084: Unable to persistently ignore events in a window and its buffers 2025-02-08 18:52:39 +01:00
vim.ico
vim.manifest
vim.rc
vim.tlb
vim9.h patch 9.1.0673: Vim9: too recursive func calls when calling super-class method 2024-08-13 23:27:22 +02:00
vim9class.c patch 9.1.1105: Vim9: no support for protected new() method 2025-02-11 22:07:05 +01:00
vim9cmds.c patch 9.1.0976: Vim9: missing return statement with throw 2024-12-30 09:56:34 +01:00
vim9compile.c patch 9.1.1099: Vim9: import with extends may crash 2025-02-10 21:35:07 +01:00
vim9execute.c patch 9.1.1099: Vim9: import with extends may crash 2025-02-10 21:35:07 +01:00
vim9expr.c patch 9.1.1075: Vim9: len variable not used in compile_load() 2025-02-04 16:40:08 +01:00
vim9instr.c patch 9.1.1063: too many strlen() calls in userfunc.c 2025-02-01 15:25:34 +01:00
vim9script.c patch 9.1.0359: MS-Windows: relative import in a script sourced from a buffer doesn't work 2024-04-20 18:31:21 +02:00
vim9type.c patch 9.1.0688: Vim9: dereferences NULL pointer in check_type_is_value() 2024-08-22 21:25:18 +02:00
vim_alert.ico
vim_error.ico
vim_icon.xbm
vim_info.ico
vim_mask.xbm
vim_quest.ico
viminfo.c patch 9.1.0957: MS-Windows: conversion warnings 2024-12-24 09:50:01 +01:00
vimrun.c
vimtutor patch 9.1.0901: MS-Windows: vimtutor batch script can be improved 2024-12-02 20:07:58 +01:00
which.sh
winclip.c
window.c patch 9.1.1084: Unable to persistently ignore events in a window and its buffers 2025-02-08 18:52:39 +01:00
xpm_w32.c
xpm_w32.h

Vim Logo

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 jump around in 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):

File name Description
alloc.c memory management
arglist.c handling argument list
autocmd.c autocommands
blob.c blob data type
buffer.c manipulating buffers (loaded files)
bufwrite.c writing a buffer to file
change.c handling changes to text
cindent.c C and Lisp indentation
clientserver.c client server functionality
clipboard.c handling the clipboard
cmdexpand.c command-line completion
cmdhist.c command-line history
debugger.c vim script debugger
diff.c diff mode (vimdiff)
drawline.c drawing a window line
drawscreen.c drawing the windows
eval.c expression evaluation
evalbuffer.c buffer related built-in functions
evalfunc.c built-in functions
evalvars.c vim variables
evalwindow.c window related built-in functions
fileio.c reading and writing files
filepath.c dealing with file names and paths
findfile.c search for files in 'path'
fold.c folding
getchar.c getting characters and key mapping
gc.c garbage collection
help.c vim help related functions
highlight.c syntax highlighting
indent.c text indentation
insexpand.c Insert mode completion
locale.c locale/language handling
map.c mapping and abbreviations
mark.c marks
match.c highlight matching
float.c floating point functions
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
mouse.c handling the mouse
ops.c handling operators ("d", "y", "p")
option.c options
optionstr.c handling string options
popupmenu.c popup menu
popupwin.c popup window
profiler.c vim script profiler
quickfix.c quickfix commands (":make", ":cn")
regexp.c pattern matching
register.c handling registers
scriptfile.c runtime directory handling and sourcing scripts
screen.c lower level screen functions
search.c pattern searching
session.c sessions and views
sign.c signs
spell.c spell checking core
spellfile.c spell file handling
spellsuggest.c spell correction suggestions
strings.c string manipulation functions
syntax.c syntax and other highlighting
tag.c tags
term.c terminal handling, termcap codes
testing.c testing: assert and test functions
textformat.c text formatting
textobject.c text objects
textprop.c text properties
time.c time and timer functions
typval.c vim script type/value functions
undo.c undo and redo
usercmd.c user defined commands
userfunc.c user defined functions
viminfo.c viminfo handling
window.c handling split windows

Debugging

If you have a reasonable recent version of gdb, you can use the :Termdebug command to debug Vim. See :help :Termdebug.

When something is time critical or stepping through code is a hassle, use the channel logging to create a time-stamped log file. Add lines to the code like this:

ch_log(NULL, "Value is now %02x", value);

After compiling and starting Vim, do:

:call ch_logfile('debuglog', 'w')

And edit debuglog to see what happens. The channel functions already have ch_log() calls, thus you always see that in the log.

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.

Contributing

If you would like to help making Vim better, see the CONTRIBUTING.md file.

This is README.md for version 9.1 of the Vim source code.