Vim/src
Ernie Rael 3f821d6de2
patch 9.1.0369: Vim9: problem when importing autoloaded scripts
Problem:  Vim9: problem when importing autoloaded scripts
Solution: In `:def` handle storing to vim9 autoload export
          (Ernie Rael)

Problem occurs when `import autoload ./.../autoload/...`. The autoload
in the specified path causes the use of an autoload_prefix which combines
with the `import autoload` to create trouble.

In `generate_store_var()` `case dest_script` use ISN_STOREEXPORT,
when needed, instead of ISN_STORES. When executing ISN_STOREEXPORT,
check for autoload_prefix.

fixes: #14606
closes: #14615

Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-04-24 20:07:50 +02:00
..
GvimExt patch 9.1.0000: Vim 9.1 release 2024-01-02 16:51:11 +01:00
auto patch 9.1.0308: configure: msgfmt hardcoded 2024-04-11 21:57:02 +02:00
libvterm patch 9.0.1940: wrong upstream version in libvterm README 2023-09-24 23:43:38 +02:00
po Problem: Commit 6f585d breaks CI 2024-04-11 23:10:54 +02:00
proto patch 9.1.0360: Vim9: does not handle autoloaded variables well 2024-04-21 14:45:48 +02:00
tee patch 9.0.0421: MS-Windows makefiles are inconsistently named 2022-09-09 10:52:47 +01:00
testdir patch 9.1.0369: Vim9: problem when importing autoloaded scripts 2024-04-24 20:07:50 +02:00
xdiff patch 9.0.2153: no support to build on OpenVMS 2023-12-05 16:04:23 +01:00
xpm patch 9.0.0542: MSVC build still has support for 2012 edition 2022-09-22 13:17:30 +01:00
xxd patch 9.1.0094: xxd: buffer-overflow when writing color output 2024-02-10 13:31:06 +01:00
INSTALL patch 9.0.0700: there is no real need for a "big" build 2022-10-08 19:26:41 +01:00
INSTALLami.txt
INSTALLmac.txt Update runtime files 2023-05-14 18:50:25 +01:00
INSTALLpc.txt doc(INSTALLpc): mention additional packages for msys2 2023-09-17 16:36:33 +02:00
INSTALLvms.txt patch 9.0.2153: no support to build on OpenVMS 2023-12-05 16:04:23 +01:00
INSTALLx.txt Update runtime files 2023-04-22 22:40:14 +01:00
Make_all.mak
Make_ami.mak patch 9.0.1001: classes are not documented or implemented yet 2022-12-04 20:13:24 +00:00
Make_cyg.mak
Make_cyg_ming.mak patch 9.0.2052: win32: using deprecated wsock32 api 2023-10-19 17:24:02 +02:00
Make_ming.mak
Make_mvc.mak patch 9.1.0368: MS-Windows: Hard to define the Vim Patchlevel with leading zeroes 2024-04-23 20:33:38 +02:00
Make_vms.mms patch 9.1.0005: OpenVMS does not support python3 and xterm_save 2024-01-04 21:05:18 +01:00
Makefile patch 9.1.0331: make install does not install all files 2024-04-15 18:54:38 +02:00
README.md patch 9.1.0000: Vim 9.1 release 2024-01-02 16:51:11 +01:00
alloc.c patch 9.0.1594: some internal error messages are translated 2023-05-31 17:12:14 +01:00
alloc.h
arabic.c
arglist.c patch 9.1.0147: Cannot keep a buffer focused in a window 2024-03-03 16:16:47 +01:00
ascii.h
autocmd.c patch 9.1.0341: Problem: a few memory leaks are found 2024-04-16 22:44:31 +02:00
beval.c patch 9.0.2032: cannot get mouse click pos for tab or virt text 2023-10-15 10:03:30 +02:00
beval.h
bigvim.bat patch 9.0.1994: inconsistent feature description 2023-10-05 22:25:12 +02:00
bigvim64.bat patch 9.0.1994: inconsistent feature description 2023-10-05 22:25:12 +02:00
blob.c patch 9.1.0027: Vim is missing a foreach() func 2024-01-13 11:47:33 +01:00
blowfish.c patch 9.0.1594: some internal error messages are translated 2023-05-31 17:12:14 +01:00
buffer.c patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf 2024-03-31 18:41:27 +02:00
bufwrite.c patch 9.0.1962: No support for writing extended attributes 2023-09-30 12:49:18 +02:00
change.c patch 9.1.0258: half-page scrolling broke backward compatibility 2024-04-02 20:49:45 +02:00
channel.c patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN() 2024-03-12 21:50:32 +01:00
charset.c patch 9.1.0313: Crash when using heredoc with comment in command block 2024-04-13 17:52:26 +02:00
cindent.c patch 9.1.0022: Coverity complains about improper use of negative value 2024-01-12 17:48:08 +01:00
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.0063: GTK code can be improved 2024-01-29 20:18:22 +01:00
cmdexpand.c patch 9.1.0010: Keymap completion is not available 2024-01-04 22:37:44 +01:00
cmdhist.c patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
config.h.in patch 9.0.1962: No support for writing extended attributes 2023-09-30 12:49:18 +02: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.0308: configure: msgfmt hardcoded 2024-04-11 21:57:02 +02:00
create_cmdidxs.vim
create_nvcmdidxs.c
create_nvcmdidxs.vim
crypt.c patch 9.0.2153: no support to build on OpenVMS 2023-12-05 16:04:23 +01:00
crypt_zip.c patch 9.0.1481: decrypting with libsodium may fail if the library changes 2023-04-23 17:50:22 +01:00
debugger.c patch 9.0.1930: compiler warnings with clang-17 2023-09-24 16:16:06 +02:00
dict.c patch 9.1.0341: Problem: a few memory leaks are found 2024-04-16 22:44:31 +02:00
diff.c patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode 2024-03-16 09:40:22 +01:00
digraph.c patch 9.0.2180: POSIX function name in exarg causes issues 2023-12-19 20:53:07 +01:00
dlldata.c
dosinst.c patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
dosinst.h
drawline.c patch 9.1.0223: code duplication in loop to add active text properties 2024-03-28 11:51:10 +01:00
drawscreen.c patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap 2024-03-16 15:03:33 +01:00
edit.c patch 9.1.0251: Filetype test fails 2024-04-01 14:46:20 +02:00
errors.h patch 9.1.0314: Vim9: Can define a class in a function 2024-04-13 18:04:53 +02:00
eval.c patch 9.1.0335: String interpolation fails for List type 2024-04-15 19:19:52 +02:00
evalbuffer.c patch 9.1.0049: Make "[Command Line]" a special buffer name 2024-01-23 22:37:39 +01:00
evalfunc.c patch 9.1.0265: console dialog cannot save unnamed buffers 2024-04-04 23:43:19 +02:00
evalvars.c patch 9.1.0369: Vim9: problem when importing autoloaded scripts 2024-04-24 20:07:50 +02:00
evalwindow.c patch 9.1.0171: Small split-move related improvements 2024-03-12 21:11:39 +01:00
ex_cmdidxs.h patch 9.0.1001: classes are not documented or implemented yet 2022-12-04 20:13:24 +00:00
ex_cmds.c patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf 2024-03-31 18:41:27 +02:00
ex_cmds.h patch 9.1.0352: Finding cmd modifiers and cmdline-specials is inefficient 2024-04-18 22:46:56 +02:00
ex_cmds2.c patch 9.1.0267: File name entered in GUI dialog is ignored 2024-04-05 20:02:55 +02:00
ex_docmd.c patch 9.1.0352: Finding cmd modifiers and cmdline-specials is inefficient 2024-04-18 22:46:56 +02:00
ex_eval.c patch 9.0.2059: outstanding exceptions may be skipped 2023-10-21 11:59:42 +02:00
ex_getln.c patch 9.1.0049: Make "[Command Line]" a special buffer name 2024-01-23 22:37:39 +01:00
feature.h patch 9.0.1964: xattr support fails to build on MacOS X 2023-09-30 18:51:36 +02:00
fileio.c patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf 2024-03-31 18:41:27 +02:00
filepath.c patch 9.1.0341: Problem: a few memory leaks are found 2024-04-16 22:44:31 +02:00
findfile.c patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
float.c patch 9.0.1132: code is indented more than needed 2023-01-02 16:54:53 +00:00
fold.c patch 9.1.0177: Coverity reports dead code 2024-03-13 20:42:26 +01:00
getchar.c patch 9.1.0365: Crash when typing many keys with D- modifier 2024-04-22 21:04:29 +02:00
globals.h patch 9.1.0349: Vim9: need static type for typealias 2024-04-18 21:33:27 +02:00
gui.c patch 9.1.0139: MS-Windows: ligatures map cleared on startup 2024-02-26 22:23:05 +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 patch 9.1.0063: GTK code can be improved 2024-01-29 20:18:22 +01:00
gui_dwrite.cpp
gui_dwrite.h
gui_gtk.c patch 9.0.1743: Parameter of gui_gtk:gui_mch_browse incorrectly marked as UNUSED 2023-08-19 13:13:11 +02:00
gui_gtk_f.c patch 9.0.1158: code is indented more than necessary 2023-01-08 13:44:24 +00:00
gui_gtk_f.h
gui_gtk_res.xml
gui_gtk_vms.h
gui_gtk_x11.c patch 9.1.0348: X11 does not ignore smooth scroll event 2024-04-18 21:25:36 +02:00
gui_haiku.cc patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
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 patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
gui_w32.c patch 9.1.0050: Win32 Keyboard handling is sub-optimal 2024-01-23 23:19:02 +01:00
gui_w32_rc.h
gui_x11.c patch 9.0.1302: on a Belgian keyboard CTRL-] does not work 2023-02-11 16:15:50 +00:00
gui_x11_pm.h
gui_xim.c patch 9.1.0078: GTK3: using wrong style for pre-edit area 2024-02-06 10:49:14 +01:00
gui_xmdlg.c
gui_xmebw.c patch 9.0.1234: the code style has to be checked manually 2023-01-22 21:14:53 +00:00
gui_xmebw.h
gui_xmebwp.h
gvimtutor
hardcopy.c patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
hashtab.c patch 9.0.1390: FOR_ALL_ macros are defined in an unexpected file 2023-03-07 17:13:51 +00:00
help.c patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN() 2024-03-12 21:50:32 +01:00
highlight.c patch 9.1.0288: MS-Windows: compiler warning for size_t to int conversion 2024-04-09 22:04:54 +02:00
if_cscope.c patch 9.0.1594: some internal error messages are translated 2023-05-31 17:12:14 +01:00
if_lua.c patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines 2024-01-29 19:32:39 +01:00
if_mzsch.c patch 9.0.2013: confusing ifdefs in if_<lang>.c 2023-10-11 21:27:06 +02:00
if_mzsch.h
if_ole.cpp patch 9.0.1687: mapset() not properly handling script ID 2023-08-11 23:16:10 +02:00
if_ole.h
if_ole.idl
if_perl.xs patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines 2024-01-29 19:32:39 +01:00
if_perlsfio.c
if_py_both.h patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines 2024-01-29 19:32:39 +01:00
if_python.c patch 9.0.2013: confusing ifdefs in if_<lang>.c 2023-10-11 21:27:06 +02:00
if_python3.c patch 9.0.2048: python: uninitialized warning 2023-10-18 12:03:41 +02:00
if_ruby.c patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines 2024-01-29 19:32:39 +01:00
if_tcl.c patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines 2024-01-29 19:32:39 +01:00
if_xcmdsrv.c patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
iid_ole.c
indent.c patch 9.1.0218: Unnecessary multiplications in backspace code 2024-03-28 10:30:08 +01:00
insexpand.c patch 9.1.0254: [security]: Heap buffer overflow when calling complete_add() in 'cfu' 2024-04-02 19:01:14 +02:00
install-sh patch 9.0.0287: Irix systems no longer exist 2022-08-27 21:24:26 +01:00
installman.sh
installml.sh
iscygpty.c patch 9.0.2054: win32: iscygpty needs update 2023-10-20 11:57:08 +02:00
iscygpty.h
job.c patch 9.0.1527: crash when using negative value for term_cols 2023-05-08 18:26:03 +01:00
json.c patch 9.0.2076: Vim9: No support for type aliases 2023-10-27 19:35:26 +02:00
json_test.c
keymap.h patch 9.1.0058: Cannot map Super Keys in GTK UI 2024-01-25 22:44:00 +01:00
kword_test.c
link.390
link.sh patch 9.0.2028: confusing build dependencies 2023-10-15 09:50:53 +02:00
list.c patch 9.1.0027: Vim is missing a foreach() func 2024-01-13 11:47:33 +01:00
locale.c patch 9.0.1196: code is indented more than necessary 2023-01-14 12:32:28 +00:00
logfile.c patch 9.0.1453: typos in source code and tests 2023-04-14 21:54:25 +01:00
macros.h patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
main.c patch 9.1.0327: No support for using $XDG_CONFIG_HOME 2024-04-14 22:57:50 +02:00
map.c patch 9.1.0341: Problem: a few memory leaks are found 2024-04-16 22:44:31 +02:00
mark.c patch 9.0.1921: not possible to use the jumplist like a stack 2023-09-20 20:25:17 +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.0344: Cursor wrong after using setcellwidth() in terminal 2024-04-17 22:06:54 +02:00
memfile.c patch 9.0.1594: some internal error messages are translated 2023-05-31 17:12:14 +01:00
memfile_test.c
memline.c patch 9.1.0270: a few minor issues to fix 2024-04-05 20:12:19 +02:00
menu.c patch 9.0.1687: mapset() not properly handling script ID 2023-08-11 23:16:10 +02:00
message.c patch 9.1.0277: Cannot highlight the Command-line 2024-04-08 22:16:33 +02:00
message_test.c patch 9.0.1905: FEAT_FLOAT no longer defined 2023-09-17 16:58:22 +02:00
misc1.c patch 9.1.0294: Text height function does not respect it's argument 2024-04-09 22:43:49 +02:00
misc2.c patch 9.1.0256: Finding autocmd events is inefficient 2024-04-02 20:26:01 +02:00
mouse.c patch 9.1.0215: Half-page scrolling does not support smooth-scrolling 2024-03-28 10:10:40 +01:00
move.c patch 9.1.0357: Page scrolling should place cursor at window boundaries 2024-04-20 17:38:20 +02:00
msvc-latest.bat patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions 2022-09-21 11:56:41 +01:00
msvc2015.bat patch 9.0.0526: MS-Windows: still some support for XP and old compilers 2022-09-21 10:51:13 +01:00
msvc2017.bat patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions 2022-09-21 11:56:41 +01:00
msvc2019.bat patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions 2022-09-21 11:56:41 +01:00
msvc2022.bat patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions 2022-09-21 11:56:41 +01:00
msys32.bat
msys64.bat
mysign
nbdebug.c patch 9.0.1234: the code style has to be checked manually 2023-01-22 21:14:53 +00:00
nbdebug.h patch 9.0.1234: the code style has to be checked manually 2023-01-22 21:14:53 +00:00
netbeans.c patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN() 2024-03-12 21:50:32 +01:00
normal.c patch 9.1.0343: 'showcmd' wrong for partial mapping with multibyte 2024-04-17 21:28:54 +02:00
nv_cmdidxs.h
nv_cmds.h patch 9.0.1234: the code style has to be checked manually 2023-01-22 21:14:53 +00:00
ops.c patch 9.1.0274: MS-Windows: a few compiler warnings 2024-04-07 18:26:22 +02:00
option.c patch 9.1.0362: expanding rc config files does not work well 2024-04-21 14:55:36 +02:00
option.h patch 9.1.0147: Cannot keep a buffer focused in a window 2024-03-03 16:16:47 +01:00
optiondefs.h patch 9.1.0321: Garbled output on serial terminals with XON/XOFF flow control 2024-04-14 20:02:50 +02:00
optionstr.c patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf 2024-03-31 18:41:27 +02:00
os_amiga.c patch 9.0.1529: code style test doesn't check for space after "if" 2023-05-09 15:00:00 +01:00
os_amiga.h patch 9.0.1653: Amiga: default 'viewdir' may not work 2023-06-23 22:23:01 +01:00
os_dos.h patch 9.0.1650: MS-Windows: default 'viewdir' may include read-only directory 2023-06-23 16:15:13 +01:00
os_haiku.h
os_haiku.rdef.in
os_mac.h patch 9.0.1621: FILETYPE_FILE is defined to the same value multiple times 2023-06-08 22:16:23 +01:00
os_mac_conv.c patch 9.0.1234: the code style has to be checked manually 2023-01-22 21:14:53 +00:00
os_macosx.m patch 9.0.1471: warnings for function declarations 2023-04-19 20:28:48 +01:00
os_mswin.c patch 9.1.0026: win32: Windows default font lacking 2024-01-12 18:12:04 +01:00
os_qnx.c patch 9.0.1391: "clear" macros are not always used 2023-03-07 17:45:11 +00:00
os_qnx.h
os_unix.c patch 9.1.0321: Garbled output on serial terminals with XON/XOFF flow control 2024-04-14 20:02:50 +02:00
os_unix.h patch 9.1.0345: Problem: gvimrc not sourced from XDG_CONFIG_HOME 2024-04-17 22:30:50 +02:00
os_unixx.h patch 9.0.1544: recent glibc marks sigset() as a deprecated 2023-05-11 22:25:42 +01:00
os_vms.c patch 9.0.1234: the code style has to be checked manually 2023-01-22 21:14:53 +00:00
os_vms_conf.h patch 9.1.0005: OpenVMS does not support python3 and xterm_save 2024-01-04 21:05:18 +01:00
os_vms_fix.com
os_vms_mms.c
os_w32dll.c
os_w32exe.c
os_win32.c patch 9.1.0123: MS-Windows: system() may deadlock 2024-02-21 20:16:38 +01:00
os_win32.h patch 9.0.2052: win32: using deprecated wsock32 api 2023-10-19 17:24:02 +02:00
osdef.sh
osdef1.h.in
osdef2.h.in
pathdef.sh
popupmenu.c patch 9.0.1789: too early declaration of variable in pum_set_selected() 2023-08-26 18:11:31 +02:00
popupwin.c patch 9.1.0294: Text height function does not respect it's argument 2024-04-09 22:43:49 +02:00
profiler.c patch 9.1.0089: qsort() comparison functions should be transitive 2024-02-09 19:39:14 +01:00
proto.h patch 9.0.1001: classes are not documented or implemented yet 2022-12-04 20:13:24 +00:00
protodef.h
pty.c patch 9.0.2180: POSIX function name in exarg causes issues 2023-12-19 20:53:07 +01:00
quickfix.c patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf 2024-03-31 18:41:27 +02:00
regexp.c patch 9.1.0297: Patch 9.1.0296 causes too many issues 2024-04-10 16:22:17 +02:00
regexp.h patch 9.1.0011: regexp cannot match combining chars in collection 2024-01-04 22:54:08 +01:00
regexp_bt.c patch 9.1.0297: Patch 9.1.0296 causes too many issues 2024-04-10 16:22:17 +02:00
regexp_nfa.c patch 9.1.0297: Patch 9.1.0296 causes too many issues 2024-04-10 16:22:17 +02:00
register.c patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN() 2024-03-12 21:50:32 +01:00
screen.c patch 9.1.0358: wrong drawing in GUI with setcellwidth() 2024-04-20 18:04:06 +02:00
scriptfile.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
search.c patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN() 2024-03-12 21:50:32 +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.0.1390: FOR_ALL_ macros are defined in an unexpected file 2023-03-07 17:13:51 +00:00
sound.c patch 9.0.2089: sound_playfile() fails when using powershell 2023-11-04 09:54:00 +01:00
spell.c patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN() 2024-03-12 21:50:32 +01:00
spell.h patch 9.0.0855: comment not located above the code it refers to 2022-11-10 17:05:28 +00:00
spellfile.c patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN() 2024-03-12 21:50:32 +01:00
spellsuggest.c patch 9.1.0177: Coverity reports dead code 2024-03-13 20:42:26 +01:00
strings.c patch 9.1.0181: no overflow check for string formatting 2024-03-14 18:58:04 +01:00
structs.h patch 9.1.0338: Vim9: import through symlinks not correctly handled 2024-04-16 22:11:56 +02:00
syntax.c patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN() 2024-03-12 21:50:32 +01:00
tag.c patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf' 2024-03-28 10:11:57 +01:00
tearoff.bmp
term.c patch 9.1.0321: Garbled output on serial terminals with XON/XOFF flow control 2024-04-14 20:02:50 +02: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.0184: Cursor pos wrong when clicking with conceal and wrap 2024-03-16 15:03:33 +01:00
termlib.c patch 9.0.1234: the code style has to be checked manually 2023-01-22 21:14:53 +00:00
testing.c patch 9.1.0219: Vim9: No enum support 2024-03-28 10:38:28 +01:00
textformat.c patch 9.1.0309: crash when 'textwidth' > MAX_INT 2024-04-11 22:54:44 +02:00
textobject.c patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN() 2024-03-12 21:50:32 +01:00
textprop.c patch 9.1.0224: cursor may move too many lines over "right" & "below" virt text 2024-03-28 12:01:14 +01:00
time.c patch 9.0.2050: Vim9: crash with deferred function call and exception 2023-10-19 10:52:34 +02:00
toolbar.phi
toolcheck
tools.bmp
typemap
typval.c patch 9.1.0219: Vim9: No enum support 2024-03-28 10:38:28 +01:00
ui.c patch 9.0.2069: possible to escape bracketed paste mode with Ctrl-C 2023-10-26 22:08:41 +02:00
undo.c patch 9.1.0113: duplicate code when cleaning undo stack 2024-02-15 20:17:37 +01:00
uninstall.c patch 9.1.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
usercmd.c patch 9.1.0010: Keymap completion is not available 2024-01-04 22:37:44 +01:00
userfunc.c patch 9.1.0301: Vim9: heredoc start may be recognized in string 2024-04-10 17:37:47 +02:00
version.c patch 9.1.0369: Vim9: problem when importing autoloaded scripts 2024-04-24 20:07:50 +02: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.0297: Patch 9.1.0296 causes too many issues 2024-04-10 16:22:17 +02:00
vim.ico
vim.manifest patch 9.1.0000: Vim 9.1 release 2024-01-02 16:51:11 +01:00
vim.rc
vim.tlb
vim9.h patch 9.1.0369: Vim9: problem when importing autoloaded scripts 2024-04-24 20:07:50 +02:00
vim9class.c patch 9.1.0314: Vim9: Can define a class in a function 2024-04-13 18:04:53 +02:00
vim9cmds.c patch 9.1.0335: String interpolation fails for List type 2024-04-15 19:19:52 +02:00
vim9compile.c patch 9.1.0369: Vim9: problem when importing autoloaded scripts 2024-04-24 20:07:50 +02:00
vim9execute.c patch 9.1.0369: Vim9: problem when importing autoloaded scripts 2024-04-24 20:07:50 +02:00
vim9expr.c patch 9.1.0338: Vim9: import through symlinks not correctly handled 2024-04-16 22:11:56 +02:00
vim9instr.c patch 9.1.0369: Vim9: problem when importing autoloaded scripts 2024-04-24 20:07:50 +02: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.0367: compile_def_function is too long 2024-04-23 20:14:46 +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.0006: is*() and to*() function may be unsafe 2024-01-04 21:19:04 +01:00
vimrun.c
vimtutor
which.sh
winclip.c patch 9.0.1246: code is indented more than necessary 2023-01-26 12:00:00 +00:00
window.c patch 9.1.0272: autocmd may change cwd after :tcd and :lcd 2024-04-07 18:16:10 +02:00
xpm_w32.c
xpm_w32.h

README.md

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
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.