aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-11-27 17:21:58 +0800
committerGitHub <noreply@github.com>2023-11-27 17:21:58 +0800
commit574d25642fc9ca65b396633aeab6e2d32778b642 (patch)
tree3ec4fa989ef32615fc48d996bdafda448c31b03f /src
parent84bbe4b0ca935db1f6202db339aee5594a3b3908 (diff)
downloadrneovim-574d25642fc9ca65b396633aeab6e2d32778b642.tar.gz
rneovim-574d25642fc9ca65b396633aeab6e2d32778b642.tar.bz2
rneovim-574d25642fc9ca65b396633aeab6e2d32778b642.zip
refactor: move Arena and ArenaMem to memory_defs.h (#26240)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/clint.py30
-rw-r--r--src/nvim/api/autocmd.c2
-rw-r--r--src/nvim/api/autocmd.h4
-rw-r--r--src/nvim/api/buffer.h5
-rw-r--r--src/nvim/api/command.c3
-rw-r--r--src/nvim/api/command.h6
-rw-r--r--src/nvim/api/extmark.c2
-rw-r--r--src/nvim/api/extmark.h6
-rw-r--r--src/nvim/api/options.c1
-rw-r--r--src/nvim/api/options.h6
-rw-r--r--src/nvim/api/ui.h6
-rw-r--r--src/nvim/api/vim.c2
-rw-r--r--src/nvim/api/vim.h4
-rw-r--r--src/nvim/api/vimscript.h4
-rw-r--r--src/nvim/api/win_config.c4
-rw-r--r--src/nvim/api/win_config.h5
-rw-r--r--src/nvim/api/window.h2
-rw-r--r--src/nvim/base64.h2
-rw-r--r--src/nvim/buffer_updates.c2
-rw-r--r--src/nvim/buffer_updates.h5
-rw-r--r--src/nvim/bufwrite.h5
-rw-r--r--src/nvim/change.h2
-rw-r--r--src/nvim/channel.c2
-rw-r--r--src/nvim/cmdhist.h5
-rw-r--r--src/nvim/cursor.h5
-rw-r--r--src/nvim/cursor_shape.c1
-rw-r--r--src/nvim/cursor_shape.h4
-rw-r--r--src/nvim/debugger.h4
-rw-r--r--src/nvim/decoration_provider.c2
-rw-r--r--src/nvim/digraph.h5
-rw-r--r--src/nvim/edit.h5
-rw-r--r--src/nvim/eval.h1
-rw-r--r--src/nvim/eval/buffer.h5
-rw-r--r--src/nvim/eval/decode.h6
-rw-r--r--src/nvim/eval/executor.h2
-rw-r--r--src/nvim/eval/gc.h2
-rw-r--r--src/nvim/eval/typval.c2
-rw-r--r--src/nvim/eval/userfunc.c2
-rw-r--r--src/nvim/eval/vars.h9
-rw-r--r--src/nvim/ex_cmds.c1
-rw-r--r--src/nvim/ex_cmds.h2
-rw-r--r--src/nvim/ex_cmds2.h19
-rw-r--r--src/nvim/ex_session.h4
-rw-r--r--src/nvim/getchar.c2
-rw-r--r--src/nvim/grid.h3
-rw-r--r--src/nvim/help.h4
-rw-r--r--src/nvim/highlight.c2
-rw-r--r--src/nvim/highlight_group.h3
-rw-r--r--src/nvim/iconv.h2
-rw-r--r--src/nvim/indent.h5
-rw-r--r--src/nvim/indent_c.h3
-rw-r--r--src/nvim/input.h2
-rw-r--r--src/nvim/insexpand.h6
-rw-r--r--src/nvim/linematch.h2
-rw-r--r--src/nvim/lua/base64.h4
-rw-r--r--src/nvim/lua/secure.h4
-rw-r--r--src/nvim/lua/spell.h4
-rw-r--r--src/nvim/lua/stdlib.h2
-rw-r--r--src/nvim/lua/treesitter.c2
-rw-r--r--src/nvim/lua/treesitter.h6
-rw-r--r--src/nvim/lua/xdiff.h4
-rw-r--r--src/nvim/match.h6
-rw-r--r--src/nvim/memfile.h10
-rw-r--r--src/nvim/memory.c2
-rw-r--r--src/nvim/memory.h15
-rw-r--r--src/nvim/memory_defs.h15
-rw-r--r--src/nvim/move.h3
-rw-r--r--src/nvim/msgpack_rpc/channel.h8
-rw-r--r--src/nvim/msgpack_rpc/channel_defs.h2
-rw-r--r--src/nvim/msgpack_rpc/server.h2
-rw-r--r--src/nvim/msgpack_rpc/unpacker.h2
-rw-r--r--src/nvim/ops.h2
-rw-r--r--src/nvim/option.h9
-rw-r--r--src/nvim/option_defs.h7
-rw-r--r--src/nvim/optionstr.h8
-rw-r--r--src/nvim/os/dl.h3
-rw-r--r--src/nvim/os/fs.h5
-rw-r--r--src/nvim/os/input.h4
-rw-r--r--src/nvim/os/shell.h4
-rw-r--r--src/nvim/os/time.h4
-rw-r--r--src/nvim/os/tty.h2
-rw-r--r--src/nvim/path.h4
-rw-r--r--src/nvim/popupmenu.h4
-rw-r--r--src/nvim/profile.h6
-rw-r--r--src/nvim/quickfix.h6
-rw-r--r--src/nvim/regexp.h1
-rw-r--r--src/nvim/sha256.h4
-rw-r--r--src/nvim/shada.h2
-rw-r--r--src/nvim/sign.h3
-rw-r--r--src/nvim/sign_defs.h11
-rw-r--r--src/nvim/spell.h15
-rw-r--r--src/nvim/spell_defs.h18
-rw-r--r--src/nvim/spellfile.h7
-rw-r--r--src/nvim/state.c1
-rw-r--r--src/nvim/state.h4
-rw-r--r--src/nvim/statusline_defs.h1
-rw-r--r--src/nvim/tag.h63
-rw-r--r--src/nvim/terminal.h3
-rw-r--r--src/nvim/testing.h3
-rw-r--r--src/nvim/tui/tui.c4
-rw-r--r--src/nvim/tui/tui.h4
-rw-r--r--src/nvim/ui_compositor.h2
-rw-r--r--src/nvim/undo.h2
-rw-r--r--src/nvim/usercmd.c2
-rw-r--r--src/nvim/usercmd.h4
-rw-r--r--src/nvim/version.h2
-rw-r--r--src/nvim/window.c1
-rw-r--r--src/nvim/window.h7
108 files changed, 274 insertions, 279 deletions
diff --git a/src/clint.py b/src/clint.py
index 293545199b..d853428cd0 100755
--- a/src/clint.py
+++ b/src/clint.py
@@ -916,7 +916,6 @@ def CheckIncludes(filename, lines, error):
"src/nvim/assert.h",
"src/nvim/autocmd.h",
"src/nvim/autocmd_defs.h",
- "src/nvim/base64.h",
"src/nvim/buffer.h",
"src/nvim/buffer_defs.h",
"src/nvim/buffer_updates.h",
@@ -929,8 +928,6 @@ def CheckIncludes(filename, lines, error):
"src/nvim/cmdhist.h",
"src/nvim/context.h",
"src/nvim/cursor.h",
- "src/nvim/cursor_shape.h",
- "src/nvim/debugger.h",
"src/nvim/decoration.h",
"src/nvim/decoration_defs.h",
"src/nvim/decoration_provider.h",
@@ -943,9 +940,7 @@ def CheckIncludes(filename, lines, error):
"src/nvim/eval/buffer.h",
"src/nvim/eval/decode.h",
"src/nvim/eval/encode.h",
- "src/nvim/eval/executor.h",
"src/nvim/eval/funcs.h",
- "src/nvim/eval/gc.h",
"src/nvim/eval/typval.h",
"src/nvim/eval/typval_defs.h",
"src/nvim/eval/typval_encode.h",
@@ -963,13 +958,10 @@ def CheckIncludes(filename, lines, error):
"src/nvim/event/time.h",
"src/nvim/event/wstream.h",
"src/nvim/ex_cmds.h",
- "src/nvim/ex_cmds2.h",
"src/nvim/ex_cmds_defs.h",
"src/nvim/ex_docmd.h",
- "src/nvim/ex_eval.h",
"src/nvim/ex_eval_defs.h",
"src/nvim/ex_getln.h",
- "src/nvim/ex_session.h",
"src/nvim/extmark.h",
"src/nvim/extmark_defs.h",
"src/nvim/file_search.h",
@@ -982,7 +974,6 @@ def CheckIncludes(filename, lines, error):
"src/nvim/grid.h",
"src/nvim/grid_defs.h",
"src/nvim/hashtab.h",
- "src/nvim/help.h",
"src/nvim/highlight.h",
"src/nvim/highlight_defs.h",
"src/nvim/highlight_group.h",
@@ -994,13 +985,7 @@ def CheckIncludes(filename, lines, error):
"src/nvim/keycodes.h",
"src/nvim/linematch.h",
"src/nvim/log.h",
- "src/nvim/lua/base64.h",
"src/nvim/lua/executor.h",
- "src/nvim/lua/secure.h",
- "src/nvim/lua/spell.h",
- "src/nvim/lua/stdlib.h",
- "src/nvim/lua/treesitter.h",
- "src/nvim/lua/xdiff.h",
"src/nvim/macros.h",
"src/nvim/main.h",
"src/nvim/map.h",
@@ -1012,7 +997,6 @@ def CheckIncludes(filename, lines, error):
"src/nvim/match.h",
"src/nvim/mbyte.h",
"src/nvim/mbyte_defs.h",
- "src/nvim/memfile.h",
"src/nvim/memfile_defs.h",
"src/nvim/memline.h",
"src/nvim/memory.h",
@@ -1023,16 +1007,12 @@ def CheckIncludes(filename, lines, error):
"src/nvim/msgpack_rpc/channel.h",
"src/nvim/msgpack_rpc/channel_defs.h",
"src/nvim/msgpack_rpc/helpers.h",
- "src/nvim/msgpack_rpc/server.h",
"src/nvim/msgpack_rpc/unpacker.h",
"src/nvim/normal.h",
- "src/nvim/nvim/extmark.h",
"src/nvim/ops.h",
"src/nvim/option.h",
"src/nvim/option_defs.h",
"src/nvim/option_vars.h",
- "src/nvim/optionstr.h",
- "src/nvim/os/dl.h",
"src/nvim/os/fileio.h",
"src/nvim/os/fs.h",
"src/nvim/os/input.h",
@@ -1041,9 +1021,6 @@ def CheckIncludes(filename, lines, error):
"src/nvim/os/pty_conpty_win.h",
"src/nvim/os/pty_process_unix.h",
"src/nvim/os/pty_process_win.h",
- "src/nvim/os/shell.h",
- "src/nvim/os/time.h",
- "src/nvim/os/tty.h",
"src/nvim/path.h",
"src/nvim/plines.h",
"src/nvim/popupmenu.h",
@@ -1053,20 +1030,13 @@ def CheckIncludes(filename, lines, error):
"src/nvim/regexp_defs.h",
"src/nvim/runtime.h",
"src/nvim/search.h",
- "src/nvim/sha256.h",
- "src/nvim/shada.h",
"src/nvim/sign.h",
- "src/nvim/sign_defs.h",
"src/nvim/spell.h",
"src/nvim/spell_defs.h",
- "src/nvim/spellfile.h",
- "src/nvim/state.h",
"src/nvim/statusline.h",
"src/nvim/statusline_defs.h",
"src/nvim/strings.h",
"src/nvim/syntax.h",
- "src/nvim/tag.h",
- "src/nvim/terminal.h",
"src/nvim/testing.h",
"src/nvim/textformat.h",
"src/nvim/textobject.h",
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index c15095243d..15a76cb8b0 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -1,4 +1,5 @@
#include <assert.h>
+#include <lauxlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@@ -6,7 +7,6 @@
#include <string.h>
#include "klib/kvec.h"
-#include "lauxlib.h"
#include "nvim/api/autocmd.h"
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
diff --git a/src/nvim/api/autocmd.h b/src/nvim/api/autocmd.h
index 8aefd45793..c2ba59734f 100644
--- a/src/nvim/api/autocmd.h
+++ b/src/nvim/api/autocmd.h
@@ -1,9 +1,9 @@
#pragma once
-#include <stdint.h>
+#include <stdint.h> // IWYU pragma: keep
#include "nvim/api/keysets.h"
-#include "nvim/api/private/defs.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/autocmd.h.generated.h"
diff --git a/src/nvim/api/buffer.h b/src/nvim/api/buffer.h
index 0f18f5368e..927afe61d0 100644
--- a/src/nvim/api/buffer.h
+++ b/src/nvim/api/buffer.h
@@ -1,9 +1,10 @@
#pragma once
-#include <lauxlib.h>
+#include <lua.h> // IWYU pragma: keep
+#include <stdint.h> // IWYU pragma: keep
#include "nvim/api/keysets.h"
-#include "nvim/api/private/defs.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/buffer_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c
index e1691bb910..5e46797ca4 100644
--- a/src/nvim/api/command.c
+++ b/src/nvim/api/command.c
@@ -1,10 +1,10 @@
#include <inttypes.h>
+#include <lauxlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "klib/kvec.h"
-#include "lauxlib.h"
#include "nvim/api/command.h"
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
@@ -15,7 +15,6 @@
#include "nvim/autocmd.h"
#include "nvim/buffer_defs.h"
#include "nvim/cmdexpand_defs.h"
-#include "nvim/decoration.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
diff --git a/src/nvim/api/command.h b/src/nvim/api/command.h
index 78af5cbf64..7f8c35f89a 100644
--- a/src/nvim/api/command.h
+++ b/src/nvim/api/command.h
@@ -1,9 +1,9 @@
#pragma once
+#include <stdint.h> // IWYU pragma: keep
+
#include "nvim/api/keysets.h"
-#include "nvim/api/private/defs.h"
-#include "nvim/decoration.h"
-#include "nvim/ex_cmds.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/command.h.generated.h"
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index 5112d2474d..28fcf7dd0f 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -1,10 +1,10 @@
#include <assert.h>
+#include <lauxlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "klib/kvec.h"
-#include "lauxlib.h"
#include "nvim/api/extmark.h"
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
diff --git a/src/nvim/api/extmark.h b/src/nvim/api/extmark.h
index 88f1e9e8ad..d41a9828be 100644
--- a/src/nvim/api/extmark.h
+++ b/src/nvim/api/extmark.h
@@ -1,8 +1,10 @@
#pragma once
+#include <stdint.h> // IWYU pragma: keep
+
#include "nvim/api/keysets.h"
-#include "nvim/api/private/defs.h"
-#include "nvim/decoration.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
+#include "nvim/decoration_defs.h" // IWYU pragma: keep
#include "nvim/macros.h"
#include "nvim/map.h"
#include "nvim/types.h"
diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c
index f1aa69f48b..4cd5359cab 100644
--- a/src/nvim/api/options.c
+++ b/src/nvim/api/options.c
@@ -1,5 +1,4 @@
#include <assert.h>
-#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
diff --git a/src/nvim/api/options.h b/src/nvim/api/options.h
index 79aeead205..2a7385eb56 100644
--- a/src/nvim/api/options.h
+++ b/src/nvim/api/options.h
@@ -1,8 +1,10 @@
#pragma once
+#include <stdint.h> // IWYU pragma: keep
+
#include "nvim/api/keysets.h"
-#include "nvim/api/private/defs.h"
-#include "nvim/option.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
+#include "nvim/option_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/options.h.generated.h"
diff --git a/src/nvim/api/ui.h b/src/nvim/api/ui.h
index 0101e5d31b..ecfbb2d9f6 100644
--- a/src/nvim/api/ui.h
+++ b/src/nvim/api/ui.h
@@ -1,8 +1,10 @@
#pragma once
-#include <stdint.h>
+#include <stdint.h> // IWYU pragma: keep
-#include "nvim/api/private/defs.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
+#include "nvim/grid_defs.h" // IWYU pragma: keep
+#include "nvim/highlight_defs.h" // IWYU pragma: keep
#include "nvim/map.h"
#include "nvim/ui.h"
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index b4e9af491f..7279cb9b1a 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -1,5 +1,6 @@
#include <assert.h>
#include <inttypes.h>
+#include <lauxlib.h>
#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
@@ -8,7 +9,6 @@
#include <string.h>
#include "klib/kvec.h"
-#include "lauxlib.h"
#include "nvim/api/buffer.h"
#include "nvim/api/deprecated.h"
#include "nvim/api/keysets.h"
diff --git a/src/nvim/api/vim.h b/src/nvim/api/vim.h
index 81cb563aaf..eb165f285f 100644
--- a/src/nvim/api/vim.h
+++ b/src/nvim/api/vim.h
@@ -1,7 +1,9 @@
#pragma once
+#include <stdint.h> // IWYU pragma: keep
+
#include "nvim/api/keysets.h"
-#include "nvim/api/private/defs.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/vim.h.generated.h"
diff --git a/src/nvim/api/vimscript.h b/src/nvim/api/vimscript.h
index ee056999ed..d782f63aec 100644
--- a/src/nvim/api/vimscript.h
+++ b/src/nvim/api/vimscript.h
@@ -1,7 +1,9 @@
#pragma once
+#include <stdint.h> // IWYU pragma: keep
+
#include "nvim/api/keysets.h"
-#include "nvim/api/private/defs.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/vimscript.h.generated.h"
diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c
index de26c1255c..8b9f73ae87 100644
--- a/src/nvim/api/win_config.c
+++ b/src/nvim/api/win_config.c
@@ -255,8 +255,8 @@ void nvim_win_set_config(Window window, Dict(float_config) *config, Error *err)
}
}
-Dictionary config_put_bordertext(Dictionary config, FloatConfig *fconfig,
- BorderTextType bordertext_type)
+static Dictionary config_put_bordertext(Dictionary config, FloatConfig *fconfig,
+ BorderTextType bordertext_type)
{
VirtText vt;
AlignTextPos align;
diff --git a/src/nvim/api/win_config.h b/src/nvim/api/win_config.h
index f9befa6806..36f0e2bcf7 100644
--- a/src/nvim/api/win_config.h
+++ b/src/nvim/api/win_config.h
@@ -1,8 +1,9 @@
#pragma once
+#include <stdint.h> // IWYU pragma: keep
+
#include "nvim/api/keysets.h"
-#include "nvim/api/private/defs.h"
-#include "nvim/buffer_defs.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/win_config.h.generated.h"
diff --git a/src/nvim/api/window.h b/src/nvim/api/window.h
index 1a3da7be75..0255193ac7 100644
--- a/src/nvim/api/window.h
+++ b/src/nvim/api/window.h
@@ -1,7 +1,7 @@
#pragma once
#include "nvim/api/keysets.h"
-#include "nvim/api/private/defs.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/window.h.generated.h"
diff --git a/src/nvim/base64.h b/src/nvim/base64.h
index 39e04b3565..511aa27d10 100644
--- a/src/nvim/base64.h
+++ b/src/nvim/base64.h
@@ -1,6 +1,6 @@
#pragma once
-#include <stddef.h>
+#include <stddef.h> // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "base64.h.generated.h"
diff --git a/src/nvim/buffer_updates.c b/src/nvim/buffer_updates.c
index 39f2e07759..0f5d64cc62 100644
--- a/src/nvim/buffer_updates.c
+++ b/src/nvim/buffer_updates.c
@@ -1,9 +1,9 @@
#include <inttypes.h>
+#include <lauxlib.h>
#include <stdbool.h>
#include <stddef.h>
#include "klib/kvec.h"
-#include "lauxlib.h"
#include "nvim/api/buffer.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
diff --git a/src/nvim/buffer_updates.h b/src/nvim/buffer_updates.h
index f072434e81..5e40657537 100644
--- a/src/nvim/buffer_updates.h
+++ b/src/nvim/buffer_updates.h
@@ -1,7 +1,10 @@
#pragma once
-#include "nvim/buffer_defs.h"
+#include <stdint.h> // IWYU pragma: keep
+
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
#include "nvim/extmark.h"
+#include "nvim/pos.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "buffer_updates.h.generated.h"
diff --git a/src/nvim/bufwrite.h b/src/nvim/bufwrite.h
index f8b9d93318..41e1911d7c 100644
--- a/src/nvim/bufwrite.h
+++ b/src/nvim/bufwrite.h
@@ -1,7 +1,8 @@
#pragma once
-#include "nvim/buffer_defs.h"
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/pos.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "bufwrite.h.generated.h"
diff --git a/src/nvim/change.h b/src/nvim/change.h
index e6a78e966f..34cea981d1 100644
--- a/src/nvim/change.h
+++ b/src/nvim/change.h
@@ -1,6 +1,6 @@
#pragma once
-#include "nvim/buffer_defs.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
#include "nvim/pos.h"
// flags for open_line()
diff --git a/src/nvim/channel.c b/src/nvim/channel.c
index b601d50b49..e8fe80a3b6 100644
--- a/src/nvim/channel.c
+++ b/src/nvim/channel.c
@@ -1,11 +1,11 @@
#include <assert.h>
#include <inttypes.h>
+#include <lauxlib.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include "klib/kvec.h"
-#include "lauxlib.h"
#include "nvim/api/private/converter.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
diff --git a/src/nvim/cmdhist.h b/src/nvim/cmdhist.h
index 260730f7df..ed616ba801 100644
--- a/src/nvim/cmdhist.h
+++ b/src/nvim/cmdhist.h
@@ -1,9 +1,10 @@
#pragma once
-#include "nvim/cmdexpand_defs.h"
+#include "nvim/cmdexpand_defs.h" // IWYU pragma: export
#include "nvim/eval/typval_defs.h"
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: export
#include "nvim/os/time.h"
+#include "nvim/types.h"
/// Present history tables
typedef enum {
diff --git a/src/nvim/cursor.h b/src/nvim/cursor.h
index 1baa83d327..bd70ccfe60 100644
--- a/src/nvim/cursor.h
+++ b/src/nvim/cursor.h
@@ -1,8 +1,7 @@
#pragma once
-#include <stdbool.h>
-
-#include "nvim/vim.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/pos.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "cursor.h.generated.h"
diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c
index 2e5a28b07b..7fd4151f54 100644
--- a/src/nvim/cursor_shape.c
+++ b/src/nvim/cursor_shape.c
@@ -13,7 +13,6 @@
#include "nvim/highlight_group.h"
#include "nvim/log.h"
#include "nvim/macros.h"
-#include "nvim/memory.h"
#include "nvim/option_vars.h"
#include "nvim/strings.h"
#include "nvim/ui.h"
diff --git a/src/nvim/cursor_shape.h b/src/nvim/cursor_shape.h
index 1d4e1796f6..4c1d6d4eec 100644
--- a/src/nvim/cursor_shape.h
+++ b/src/nvim/cursor_shape.h
@@ -1,7 +1,7 @@
#pragma once
-#include "nvim/api/private/defs.h"
-#include "nvim/types.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
+#include "nvim/memory_defs.h" // IWYU pragma: keep
/// struct to store values from 'guicursor' and 'mouseshape'
/// Indexes in shape_table[]
diff --git a/src/nvim/debugger.h b/src/nvim/debugger.h
index 8b79fcf955..c4caeffd66 100644
--- a/src/nvim/debugger.h
+++ b/src/nvim/debugger.h
@@ -1,8 +1,6 @@
#pragma once
-#include <stdbool.h>
-
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "debugger.h.generated.h"
diff --git a/src/nvim/decoration_provider.c b/src/nvim/decoration_provider.c
index 2c0be2fe8a..852a4c4b10 100644
--- a/src/nvim/decoration_provider.c
+++ b/src/nvim/decoration_provider.c
@@ -1,8 +1,8 @@
#include <assert.h>
+#include <lauxlib.h>
#include <string.h>
#include "klib/kvec.h"
-#include "lauxlib.h"
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
diff --git a/src/nvim/digraph.h b/src/nvim/digraph.h
index d7662785fe..0a83ccbd3e 100644
--- a/src/nvim/digraph.h
+++ b/src/nvim/digraph.h
@@ -1,6 +1,9 @@
#pragma once
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/garray_defs.h" // IWYU pragma: keep
#include "nvim/types.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/edit.h b/src/nvim/edit.h
index c50b3bb0fb..33087f718f 100644
--- a/src/nvim/edit.h
+++ b/src/nvim/edit.h
@@ -1,7 +1,8 @@
#pragma once
-#include "nvim/autocmd_defs.h"
-#include "nvim/vim.h"
+#include "nvim/autocmd_defs.h" // IWYU pragma: keep
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/pos.h"
// Values for in_cinkeys()
#define KEY_OPEN_FORW 0x101
diff --git a/src/nvim/eval.h b/src/nvim/eval.h
index d4bf52c619..8d2e34b842 100644
--- a/src/nvim/eval.h
+++ b/src/nvim/eval.h
@@ -10,6 +10,7 @@
#include "nvim/eval/typval_defs.h"
#include "nvim/event/time.h"
#include "nvim/ex_cmds_defs.h"
+#include "nvim/globals.h"
#include "nvim/hashtab.h"
#include "nvim/macros.h"
#include "nvim/os/fileio.h"
diff --git a/src/nvim/eval/buffer.h b/src/nvim/eval/buffer.h
index fdd146885a..b0fc0f9208 100644
--- a/src/nvim/eval/buffer.h
+++ b/src/nvim/eval/buffer.h
@@ -1,7 +1,8 @@
#pragma once
-#include "nvim/buffer_defs.h"
-#include "nvim/eval/typval_defs.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
+#include "nvim/types.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "eval/buffer.h.generated.h"
diff --git a/src/nvim/eval/decode.h b/src/nvim/eval/decode.h
index 3000cd3211..b80786bc32 100644
--- a/src/nvim/eval/decode.h
+++ b/src/nvim/eval/decode.h
@@ -1,9 +1,9 @@
#pragma once
-#include <msgpack.h>
-#include <stddef.h>
+#include <msgpack.h> // IWYU pragma: keep
+#include <stddef.h> // IWYU pragma: keep
-#include "nvim/eval/typval_defs.h"
+#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
#include "nvim/types.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/eval/executor.h b/src/nvim/eval/executor.h
index 58edf7216b..d36ce08542 100644
--- a/src/nvim/eval/executor.h
+++ b/src/nvim/eval/executor.h
@@ -1,6 +1,6 @@
#pragma once
-#include "nvim/eval/typval_defs.h"
+#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
extern char *e_list_index_out_of_range_nr;
diff --git a/src/nvim/eval/gc.h b/src/nvim/eval/gc.h
index ea91952fff..36149ec060 100644
--- a/src/nvim/eval/gc.h
+++ b/src/nvim/eval/gc.h
@@ -6,5 +6,5 @@ extern dict_T *gc_first_dict;
extern list_T *gc_first_list;
#ifdef INCLUDE_GENERATED_DECLARATIONS
-# include "eval/gc.h.generated.h"
+# include "eval/gc.h.generated.h" // IWYU pragma: export
#endif
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index a0329221d5..e8ed6e5d32 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -1,11 +1,11 @@
#include <assert.h>
+#include <lauxlib.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "lauxlib.h"
#include "nvim/ascii.h"
#include "nvim/assert.h"
#include "nvim/charset.h"
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index cd1ee94298..13d1290fa2 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -3,11 +3,11 @@
#include <assert.h>
#include <ctype.h>
#include <inttypes.h>
+#include <lauxlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "lauxlib.h"
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/charset.h"
diff --git a/src/nvim/eval/vars.h b/src/nvim/eval/vars.h
index 124d73825b..646c6f24e3 100644
--- a/src/nvim/eval/vars.h
+++ b/src/nvim/eval/vars.h
@@ -1,7 +1,12 @@
#pragma once
-#include "nvim/ex_cmds_defs.h"
-#include "nvim/option_defs.h"
+#include <stddef.h> // IWYU pragma: keep
+
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/garray_defs.h" // IWYU pragma: keep
+#include "nvim/hashtab.h"
+#include "nvim/option_defs.h" // IWYU pragma: keep
+#include "nvim/types.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "eval/vars.h.generated.h"
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 8378c04197..267137cd0a 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -25,7 +25,6 @@
#include "nvim/change.h"
#include "nvim/channel.h"
#include "nvim/charset.h"
-#include "nvim/cmdexpand_defs.h"
#include "nvim/cmdhist.h"
#include "nvim/cursor.h"
#include "nvim/decoration.h"
diff --git a/src/nvim/ex_cmds.h b/src/nvim/ex_cmds.h
index c1cbaffa0b..7b7889e71f 100644
--- a/src/nvim/ex_cmds.h
+++ b/src/nvim/ex_cmds.h
@@ -2,7 +2,7 @@
#include <stdbool.h>
-#include "nvim/buffer_defs.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h" // IWYU pragma: export
#include "nvim/os/time.h"
diff --git a/src/nvim/ex_cmds2.h b/src/nvim/ex_cmds2.h
index ad5008f310..4f41f2cc41 100644
--- a/src/nvim/ex_cmds2.h
+++ b/src/nvim/ex_cmds2.h
@@ -1,15 +1,16 @@
#pragma once
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
-//
-// flags for check_changed()
-//
-#define CCGD_AW 1 // do autowrite if buffer was changed
-#define CCGD_MULTWIN 2 // check also when several wins for the buf
-#define CCGD_FORCEIT 4 // ! used
-#define CCGD_ALLBUF 8 // may write all buffers
-#define CCGD_EXCMD 16 // may suggest using !
+/// flags for check_changed()
+enum {
+ CCGD_AW = 1, ///< do autowrite if buffer was changed
+ CCGD_MULTWIN = 2, ///< check also when several wins for the buf
+ CCGD_FORCEIT = 4, ///< ! used
+ CCGD_ALLBUF = 8, ///< may write all buffers
+ CCGD_EXCMD = 16, ///< may suggest using !
+};
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ex_cmds2.h.generated.h"
diff --git a/src/nvim/ex_session.h b/src/nvim/ex_session.h
index 51917ebfb2..275f20e4a8 100644
--- a/src/nvim/ex_session.h
+++ b/src/nvim/ex_session.h
@@ -1,8 +1,8 @@
#pragma once
-#include <stdio.h>
+#include <stdio.h> // IWYU pragma: keep
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ex_session.h.generated.h"
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 8fc480009a..6c08987cdd 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -2,6 +2,7 @@
// file, manipulations with redo buffer and stuff buffer.
#include <assert.h>
+#include <lauxlib.h>
#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
@@ -10,7 +11,6 @@
#include <stdlib.h>
#include <string.h>
-#include "lauxlib.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"
diff --git a/src/nvim/grid.h b/src/nvim/grid.h
index b2766c27bd..0a0fe68cde 100644
--- a/src/nvim/grid.h
+++ b/src/nvim/grid.h
@@ -1,14 +1,13 @@
#pragma once
#include <stdbool.h>
+#include <stddef.h> // IWYU pragma: keep
#include <string.h>
-#include "nvim/ascii.h"
#include "nvim/buffer_defs.h"
#include "nvim/grid_defs.h" // IWYU pragma: export
#include "nvim/macros.h"
#include "nvim/mbyte.h"
-#include "nvim/memory.h"
#include "nvim/pos.h"
/// By default, all windows are drawn on a single rectangular grid, represented by
diff --git a/src/nvim/help.h b/src/nvim/help.h
index 7e65e9e133..f60f14c748 100644
--- a/src/nvim/help.h
+++ b/src/nvim/help.h
@@ -1,8 +1,6 @@
#pragma once
-#include <stdbool.h>
-
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "help.h.generated.h"
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
index cff62e736b..dcd6e0e8ad 100644
--- a/src/nvim/highlight.c
+++ b/src/nvim/highlight.c
@@ -2,9 +2,9 @@
#include <assert.h>
#include <inttypes.h>
+#include <lauxlib.h>
#include <string.h>
-#include "lauxlib.h"
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/dispatch.h"
diff --git a/src/nvim/highlight_group.h b/src/nvim/highlight_group.h
index f40a741003..857121b5ca 100644
--- a/src/nvim/highlight_group.h
+++ b/src/nvim/highlight_group.h
@@ -1,8 +1,9 @@
#pragma once
#include "nvim/api/keysets.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/api/private/helpers.h"
-#include "nvim/cmdexpand_defs.h"
+#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/highlight_defs.h"
#include "nvim/types.h"
diff --git a/src/nvim/iconv.h b/src/nvim/iconv.h
index 02470c4207..b6456b94ba 100644
--- a/src/nvim/iconv.h
+++ b/src/nvim/iconv.h
@@ -3,8 +3,6 @@
#include <errno.h>
#include <iconv.h>
-#include "auto/config.h"
-
// define some missing constants if necessary
#ifndef EILSEQ
# define EILSEQ 123
diff --git a/src/nvim/indent.h b/src/nvim/indent.h
index 0da2fbea47..c35338637f 100644
--- a/src/nvim/indent.h
+++ b/src/nvim/indent.h
@@ -1,6 +1,9 @@
#pragma once
-#include "nvim/vim.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/pos.h"
+#include "nvim/types.h"
typedef int (*IndentGetter)(void);
diff --git a/src/nvim/indent_c.h b/src/nvim/indent_c.h
index 140faaa33d..aa82bde4dc 100644
--- a/src/nvim/indent_c.h
+++ b/src/nvim/indent_c.h
@@ -1,6 +1,7 @@
#pragma once
-#include "nvim/vim.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/pos.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "indent_c.h.generated.h"
diff --git a/src/nvim/input.h b/src/nvim/input.h
index fbb8dec265..3d948fa4ca 100644
--- a/src/nvim/input.h
+++ b/src/nvim/input.h
@@ -1,6 +1,6 @@
#pragma once
-#include "nvim/vim.h"
+#include "nvim/event/multiqueue.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "input.h.generated.h"
diff --git a/src/nvim/insexpand.h b/src/nvim/insexpand.h
index 9098c50499..164aa5edce 100644
--- a/src/nvim/insexpand.h
+++ b/src/nvim/insexpand.h
@@ -1,9 +1,9 @@
#pragma once
-#include <stdbool.h>
-
#include "nvim/macros.h"
-#include "nvim/option_defs.h"
+#include "nvim/option_defs.h" // IWYU pragma: keep
+#include "nvim/pos.h"
+#include "nvim/types.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/linematch.h b/src/nvim/linematch.h
index a2c72d26e7..2d765b0b70 100644
--- a/src/nvim/linematch.h
+++ b/src/nvim/linematch.h
@@ -1,6 +1,6 @@
#pragma once
-#include <stddef.h>
+#include <stddef.h> // IWYU pragma: keep
#include "nvim/pos.h"
diff --git a/src/nvim/lua/base64.h b/src/nvim/lua/base64.h
index feb409ef38..3c95968cda 100644
--- a/src/nvim/lua/base64.h
+++ b/src/nvim/lua/base64.h
@@ -1,8 +1,6 @@
#pragma once
-#include <lauxlib.h>
-#include <lua.h>
-#include <lualib.h>
+#include <lua.h> // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/base64.h.generated.h"
diff --git a/src/nvim/lua/secure.h b/src/nvim/lua/secure.h
index b363a243a5..c69c0d4f8f 100644
--- a/src/nvim/lua/secure.h
+++ b/src/nvim/lua/secure.h
@@ -1,8 +1,6 @@
#pragma once
-#include <lua.h>
-
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/secure.h.generated.h"
diff --git a/src/nvim/lua/spell.h b/src/nvim/lua/spell.h
index adf3e9dd60..6f1b322e5b 100644
--- a/src/nvim/lua/spell.h
+++ b/src/nvim/lua/spell.h
@@ -1,8 +1,6 @@
#pragma once
-#include <lauxlib.h>
-#include <lua.h>
-#include <lualib.h>
+#include <lua.h> // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/spell.h.generated.h"
diff --git a/src/nvim/lua/stdlib.h b/src/nvim/lua/stdlib.h
index b2be54af90..26e96055ae 100644
--- a/src/nvim/lua/stdlib.h
+++ b/src/nvim/lua/stdlib.h
@@ -1,6 +1,6 @@
#pragma once
-#include <lua.h>
+#include <lua.h> // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/stdlib.h.generated.h"
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index ff942630a0..e5de369ed9 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -12,6 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <tree_sitter/api.h>
#include <uv.h>
#include "klib/kvec.h"
@@ -26,7 +27,6 @@
#include "nvim/pos.h"
#include "nvim/strings.h"
#include "nvim/types.h"
-#include "tree_sitter/api.h"
#define TS_META_PARSER "treesitter_parser"
#define TS_META_TREE "treesitter_tree"
diff --git a/src/nvim/lua/treesitter.h b/src/nvim/lua/treesitter.h
index c1c78b8a6a..4ef9a10602 100644
--- a/src/nvim/lua/treesitter.h
+++ b/src/nvim/lua/treesitter.h
@@ -1,10 +1,6 @@
#pragma once
-#include <lauxlib.h>
-#include <lua.h>
-#include <lualib.h>
-
-#include "tree_sitter/api.h"
+#include <lua.h> // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/treesitter.h.generated.h"
diff --git a/src/nvim/lua/xdiff.h b/src/nvim/lua/xdiff.h
index 9cb5cabbfb..2ea74a79e8 100644
--- a/src/nvim/lua/xdiff.h
+++ b/src/nvim/lua/xdiff.h
@@ -1,8 +1,6 @@
#pragma once
-#include <lauxlib.h>
-#include <lua.h>
-#include <lualib.h>
+#include <lua.h> // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/xdiff.h.generated.h"
diff --git a/src/nvim/match.h b/src/nvim/match.h
index 3e5ab04ddf..a4b0dc19b7 100644
--- a/src/nvim/match.h
+++ b/src/nvim/match.h
@@ -1,7 +1,9 @@
#pragma once
-#include "nvim/buffer_defs.h"
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/types.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "match.h.generated.h"
diff --git a/src/nvim/memfile.h b/src/nvim/memfile.h
index 753806b3c3..2d1930e95c 100644
--- a/src/nvim/memfile.h
+++ b/src/nvim/memfile.h
@@ -4,10 +4,12 @@
#include "nvim/memfile_defs.h" // IWYU pragma: export
/// flags for mf_sync()
-#define MFS_ALL 1 /// also sync blocks with negative numbers
-#define MFS_STOP 2 /// stop syncing when a character is available
-#define MFS_FLUSH 4 /// flushed file to disk
-#define MFS_ZERO 8 /// only write block 0
+enum {
+ MFS_ALL = 1, ///< also sync blocks with negative numbers
+ MFS_STOP = 2, ///< stop syncing when a character is available
+ MFS_FLUSH = 4, ///< flushed file to disk
+ MFS_ZERO = 8, ///< only write block 0
+};
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "memfile.h.generated.h"
diff --git a/src/nvim/memory.c b/src/nvim/memory.c
index 732c9ca39d..eee8e25086 100644
--- a/src/nvim/memory.c
+++ b/src/nvim/memory.c
@@ -577,7 +577,9 @@ void alloc_block(Arena *arena)
static size_t arena_align_offset(uint64_t off)
{
+#define ARENA_ALIGN MAX(sizeof(void *), sizeof(double))
return ((off + (ARENA_ALIGN - 1)) & ~(ARENA_ALIGN - 1));
+#undef ARENA_ALIGN
}
/// @param arena if NULL, do a global allocation. caller must then free the value!
diff --git a/src/nvim/memory.h b/src/nvim/memory.h
index 100d991656..18bcf11111 100644
--- a/src/nvim/memory.h
+++ b/src/nvim/memory.h
@@ -6,6 +6,7 @@
#include <time.h>
#include "nvim/macros.h"
+#include "nvim/memory_defs.h" // IWYU pragma: export
/// `malloc()` function signature
typedef void *(*MemMalloc)(size_t);
@@ -40,20 +41,6 @@ extern bool entered_free_all_mem;
EXTERN size_t arena_alloc_count INIT( = 0);
-typedef struct consumed_blk {
- struct consumed_blk *prev;
-} *ArenaMem;
-
-#define ARENA_ALIGN MAX(sizeof(void *), sizeof(double))
-
-typedef struct {
- char *cur_blk;
- size_t pos, size;
-} Arena;
-
-// inits an empty arena.
-#define ARENA_EMPTY { .cur_blk = NULL, .pos = 0, .size = 0 }
-
#define kv_fixsize_arena(a, v, s) \
((v).capacity = (s), \
(v).items = (void *)arena_alloc(a, sizeof((v).items[0]) * (v).capacity, true))
diff --git a/src/nvim/memory_defs.h b/src/nvim/memory_defs.h
new file mode 100644
index 0000000000..bde0e54f54
--- /dev/null
+++ b/src/nvim/memory_defs.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#include <stddef.h>
+
+typedef struct consumed_blk {
+ struct consumed_blk *prev;
+} *ArenaMem;
+
+typedef struct {
+ char *cur_blk;
+ size_t pos, size;
+} Arena;
+
+// inits an empty arena.
+#define ARENA_EMPTY { .cur_blk = NULL, .pos = 0, .size = 0 }
diff --git a/src/nvim/move.h b/src/nvim/move.h
index 846a316309..575da2f41e 100644
--- a/src/nvim/move.h
+++ b/src/nvim/move.h
@@ -2,6 +2,9 @@
#include <stdbool.h>
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
+#include "nvim/types.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/msgpack_rpc/channel.h b/src/nvim/msgpack_rpc/channel.h
index ac189c98dc..e8ea71173a 100644
--- a/src/nvim/msgpack_rpc/channel.h
+++ b/src/nvim/msgpack_rpc/channel.h
@@ -1,16 +1,16 @@
#pragma once
-#include <stdbool.h>
-#include <uv.h>
+#include <stdint.h> // IWYU pragma: keep
-#include "nvim/api/private/defs.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/channel.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/process.h"
#include "nvim/event/socket.h"
+#include "nvim/event/wstream.h"
#include "nvim/macros.h"
+#include "nvim/memory_defs.h" // IWYU pragma: keep
#include "nvim/msgpack_rpc/channel_defs.h" // IWYU pragma: export
-#include "nvim/vim.h"
#define METHOD_MAXLEN 512
diff --git a/src/nvim/msgpack_rpc/channel_defs.h b/src/nvim/msgpack_rpc/channel_defs.h
index 0bbffb8beb..1e3f8a72c1 100644
--- a/src/nvim/msgpack_rpc/channel_defs.h
+++ b/src/nvim/msgpack_rpc/channel_defs.h
@@ -4,10 +4,12 @@
#include <stdbool.h>
#include <uv.h>
+#include "klib/kvec.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/dispatch.h"
#include "nvim/event/process.h"
#include "nvim/event/socket.h"
+#include "nvim/map.h"
#include "nvim/vim.h"
typedef struct Channel Channel;
diff --git a/src/nvim/msgpack_rpc/server.h b/src/nvim/msgpack_rpc/server.h
index c6a240cd55..71b578a14b 100644
--- a/src/nvim/msgpack_rpc/server.h
+++ b/src/nvim/msgpack_rpc/server.h
@@ -1,6 +1,6 @@
#pragma once
-#include <stdio.h>
+#include <stddef.h> // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "msgpack_rpc/server.h.generated.h"
diff --git a/src/nvim/msgpack_rpc/unpacker.h b/src/nvim/msgpack_rpc/unpacker.h
index 72e1b04511..0317255df3 100644
--- a/src/nvim/msgpack_rpc/unpacker.h
+++ b/src/nvim/msgpack_rpc/unpacker.h
@@ -10,7 +10,7 @@
#include "nvim/api/private/dispatch.h"
#include "nvim/api/private/helpers.h"
#include "nvim/grid_defs.h"
-#include "nvim/memory.h"
+#include "nvim/memory_defs.h"
#include "nvim/msgpack_rpc/channel_defs.h"
#include "nvim/types.h"
#include "nvim/ui_client.h"
diff --git a/src/nvim/ops.h b/src/nvim/ops.h
index dfd3946432..7c8e7b4640 100644
--- a/src/nvim/ops.h
+++ b/src/nvim/ops.h
@@ -1,9 +1,9 @@
#pragma once
+#include <lauxlib.h>
#include <stdbool.h>
#include <stddef.h>
-#include "lauxlib.h"
#include "nvim/ascii.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
diff --git a/src/nvim/option.h b/src/nvim/option.h
index a36c57eab0..a7d02cc1cd 100644
--- a/src/nvim/option.h
+++ b/src/nvim/option.h
@@ -2,12 +2,14 @@
#include <stdint.h>
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/api/private/helpers.h"
#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#include "nvim/option_defs.h" // IWYU pragma: export
#include "nvim/search.h"
+#include "nvim/types.h"
/// The options that are local to a window or buffer have "indir" set to one of
/// these values. Special values:
@@ -94,13 +96,6 @@ enum {
SOPT_BUF = 0x20, ///< Option has buffer-local value
};
-/// Requested option scopes for various functions in option.c
-typedef enum {
- kOptReqGlobal = 0, ///< Request global option value
- kOptReqWin = 1, ///< Request window-local option value
- kOptReqBuf = 2, ///< Request buffer-local option value
-} OptReqScope;
-
// OptVal helper macros.
#define NIL_OPTVAL ((OptVal) { .type = kOptValTypeNil })
#define BOOLEAN_OPTVAL(b) ((OptVal) { .type = kOptValTypeBoolean, .data.boolean = b })
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 4ea543e79e..19fab293aa 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -114,3 +114,10 @@ typedef struct {
/// Note: If returned FAIL or *numMatches is 0, *matches will NOT be freed by
/// caller.
typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char ***matches);
+
+/// Requested option scopes for various functions in option.c
+typedef enum {
+ kOptReqGlobal = 0, ///< Request global option value
+ kOptReqWin = 1, ///< Request window-local option value
+ kOptReqBuf = 2, ///< Request buffer-local option value
+} OptReqScope;
diff --git a/src/nvim/optionstr.h b/src/nvim/optionstr.h
index 03d6f840b4..b317e55b7e 100644
--- a/src/nvim/optionstr.h
+++ b/src/nvim/optionstr.h
@@ -1,8 +1,10 @@
#pragma once
-#include "nvim/buffer_defs.h"
-#include "nvim/cmdexpand_defs.h"
-#include "nvim/option_defs.h"
+#include <stdint.h> // IWYU pragma: keep
+
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
+#include "nvim/option_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "optionstr.h.generated.h"
diff --git a/src/nvim/os/dl.h b/src/nvim/os/dl.h
index 9c41a28f69..0787c7fe46 100644
--- a/src/nvim/os/dl.h
+++ b/src/nvim/os/dl.h
@@ -1,8 +1,5 @@
#pragma once
-#include <stdbool.h>
-#include <stdint.h>
-
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/dl.h.generated.h"
#endif
diff --git a/src/nvim/os/fs.h b/src/nvim/os/fs.h
index aacb1c2f48..3e910be801 100644
--- a/src/nvim/os/fs.h
+++ b/src/nvim/os/fs.h
@@ -1,5 +1,10 @@
#pragma once
+#include <stddef.h> // IWYU pragma: keep
+#include <stdint.h> // IWYU pragma: keep
+#include <stdio.h> // IWYU pragma: keep
+#include <uv.h> // IWYU pragma: keep
+
#include "nvim/os/fs_defs.h" // IWYU pragma: export
#include "nvim/types.h"
diff --git a/src/nvim/os/input.h b/src/nvim/os/input.h
index 113dbbb8d5..b077f80860 100644
--- a/src/nvim/os/input.h
+++ b/src/nvim/os/input.h
@@ -1,9 +1,9 @@
#pragma once
#include <stdbool.h>
-#include <stdint.h>
+#include <stdint.h> // IWYU pragma: keep
-#include "nvim/api/private/defs.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/event/multiqueue.h"
#include "nvim/macros.h"
diff --git a/src/nvim/os/shell.h b/src/nvim/os/shell.h
index 498c72e63d..82c83543af 100644
--- a/src/nvim/os/shell.h
+++ b/src/nvim/os/shell.h
@@ -1,8 +1,6 @@
#pragma once
-#include <stdio.h>
-
-#include "nvim/types.h"
+#include <stddef.h> // IWYU pragma: keep
// Flags for os_call_shell() second argument
typedef enum {
diff --git a/src/nvim/os/time.h b/src/nvim/os/time.h
index 8f8b5511bd..fa9989c757 100644
--- a/src/nvim/os/time.h
+++ b/src/nvim/os/time.h
@@ -1,8 +1,8 @@
#pragma once
-#include <stdbool.h>
+#include <stddef.h> // IWYU pragma: keep
#include <stdint.h>
-#include <time.h>
+#include <time.h> // IWYU pragma: keep
typedef uint64_t Timestamp;
diff --git a/src/nvim/os/tty.h b/src/nvim/os/tty.h
index 3a78573189..a24d875c05 100644
--- a/src/nvim/os/tty.h
+++ b/src/nvim/os/tty.h
@@ -1,5 +1,5 @@
#pragma once
#ifdef INCLUDE_GENERATED_DECLARATIONS
-# include "os/tty.h.generated.h"
+# include "os/tty.h.generated.h" // IWYU pragma: export
#endif
diff --git a/src/nvim/path.h b/src/nvim/path.h
index 66dbb53fb6..0116e2ac97 100644
--- a/src/nvim/path.h
+++ b/src/nvim/path.h
@@ -1,7 +1,9 @@
#pragma once
+#include <stddef.h> // IWYU pragma: keep
+
#include "nvim/func_attr.h"
-#include "nvim/garray_defs.h"
+#include "nvim/garray_defs.h" // IWYU pragma: keep
#include "nvim/types.h"
// Flags for expand_wildcards()
diff --git a/src/nvim/popupmenu.h b/src/nvim/popupmenu.h
index 737e3b2f68..8f2b665174 100644
--- a/src/nvim/popupmenu.h
+++ b/src/nvim/popupmenu.h
@@ -2,10 +2,10 @@
#include <stdbool.h>
+#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
#include "nvim/grid_defs.h"
#include "nvim/macros.h"
-#include "nvim/types.h"
-#include "nvim/vim.h"
+#include "nvim/menu_defs.h" // IWYU pragma: keep
/// Used for popup menu items.
typedef struct {
diff --git a/src/nvim/profile.h b/src/nvim/profile.h
index 117e15d4bc..839c435b3e 100644
--- a/src/nvim/profile.h
+++ b/src/nvim/profile.h
@@ -1,10 +1,10 @@
#pragma once
-#include <stdint.h>
+#include <stdint.h> // IWYU pragma: keep
#include <time.h>
-#include "nvim/cmdexpand_defs.h"
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#include "nvim/runtime.h"
#define TIME_MSG(s) do { \
diff --git a/src/nvim/quickfix.h b/src/nvim/quickfix.h
index e406679dcb..ecbde31512 100644
--- a/src/nvim/quickfix.h
+++ b/src/nvim/quickfix.h
@@ -1,7 +1,9 @@
#pragma once
-#include "nvim/ex_cmds_defs.h"
-#include "nvim/option_defs.h"
+#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/option_defs.h" // IWYU pragma: keep
+#include "nvim/pos.h"
#include "nvim/types.h"
// flags for skip_vimgrep_pat()
diff --git a/src/nvim/regexp.h b/src/nvim/regexp.h
index 1f0e59aa89..3a490aec55 100644
--- a/src/nvim/regexp.h
+++ b/src/nvim/regexp.h
@@ -1,6 +1,7 @@
#pragma once
#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/pos.h"
#include "nvim/regexp_defs.h" // IWYU pragma: export
#include "nvim/types.h"
diff --git a/src/nvim/sha256.h b/src/nvim/sha256.h
index d0e6fb2a4e..942836a411 100644
--- a/src/nvim/sha256.h
+++ b/src/nvim/sha256.h
@@ -1,10 +1,8 @@
#pragma once
-#include <stddef.h>
+#include <stddef.h> // IWYU pragma: keep
#include <stdint.h>
-#include "nvim/types.h"
-
#define SHA256_BUFFER_SIZE 64
#define SHA256_SUM_SIZE 32
diff --git a/src/nvim/shada.h b/src/nvim/shada.h
index 234006bde4..d7cac24afc 100644
--- a/src/nvim/shada.h
+++ b/src/nvim/shada.h
@@ -1,6 +1,6 @@
#pragma once
-#include <msgpack.h>
+#include <msgpack.h> // IWYU pragma: keep
/// Flags for shada_read_file and children
typedef enum {
diff --git a/src/nvim/sign.h b/src/nvim/sign.h
index febde551f6..890c8fdfba 100644
--- a/src/nvim/sign.h
+++ b/src/nvim/sign.h
@@ -1,11 +1,10 @@
#pragma once
-#include <stdbool.h>
-
#include "nvim/buffer_defs.h" // IWYU pragma: keep
#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#include "nvim/sign_defs.h" // IWYU pragma: export
+#include "nvim/types.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "sign.h.generated.h"
diff --git a/src/nvim/sign_defs.h b/src/nvim/sign_defs.h
index 6b8deca02f..79d21585fc 100644
--- a/src/nvim/sign_defs.h
+++ b/src/nvim/sign_defs.h
@@ -1,10 +1,5 @@
#pragma once
-#include <stdbool.h>
-
-#include "nvim/pos.h"
-#include "nvim/types.h"
-
/// Sign attributes. Used by the screen refresh routines.
typedef struct {
char *text;
@@ -22,6 +17,6 @@ typedef struct sign {
int sn_num_hl; // highlight ID for line number
} sign_T;
-#define SIGN_WIDTH 2 // Number of display cells for a sign in the signcolumn
-#define SIGN_SHOW_MAX 9 // Maximum number of signs shown on a single line
-#define SIGN_DEF_PRIO 10 // Default sign highlight priority
+enum { SIGN_WIDTH = 2, }; ///< Number of display cells for a sign in the signcolumn
+enum { SIGN_SHOW_MAX = 9, }; ///< Maximum number of signs shown on a single line
+enum { SIGN_DEF_PRIO = 10, }; ///< Default sign highlight priority
diff --git a/src/nvim/spell.h b/src/nvim/spell.h
index 839c76e6e7..17e7dd6c40 100644
--- a/src/nvim/spell.h
+++ b/src/nvim/spell.h
@@ -7,6 +7,21 @@
#include "nvim/spell_defs.h" // IWYU pragma: export
#include "nvim/vim.h"
+/// First language that is loaded, start of the linked list of loaded languages.
+extern slang_T *first_lang;
+
+/// file used for "zG" and "zW"
+extern char *int_wordlist;
+
+extern spelltab_T spelltab;
+extern int did_set_spelltab;
+
+extern char *e_format;
+
+// Remember what "z?" replaced.
+extern char *repl_from;
+extern char *repl_to;
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "spell.h.generated.h"
#endif
diff --git a/src/nvim/spell_defs.h b/src/nvim/spell_defs.h
index 234ecd5804..bb5ebb8ec4 100644
--- a/src/nvim/spell_defs.h
+++ b/src/nvim/spell_defs.h
@@ -5,8 +5,8 @@
#include "nvim/buffer_defs.h"
#include "nvim/garray_defs.h"
+#include "nvim/hashtab.h"
#include "nvim/regexp_defs.h"
-#include "nvim/types.h"
#define MAXWLEN 254 // Assume max. word len is this many bytes.
// Some places assume a word length fits in a
@@ -221,18 +221,6 @@ typedef struct {
#define SPELL_ISUPPER(c) ((c) >= 128 ? mb_isupper(c) : spelltab.st_isu[c])
-// First language that is loaded, start of the linked list of loaded
-// languages.
-extern slang_T *first_lang;
-
-// file used for "zG" and "zW"
-extern char *int_wordlist;
-
-extern spelltab_T spelltab;
-extern int did_set_spelltab;
-
-extern char *e_format;
-
// Values for "what" argument of spell_add_word()
typedef enum {
SPELL_ADD_GOOD = 0,
@@ -248,7 +236,3 @@ typedef struct wordcount_S {
#define WC_KEY_OFF offsetof(wordcount_T, wc_word)
#define HI2WC(hi) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF))
#define MAXWORDCOUNT 0xffff
-
-// Remember what "z?" replaced.
-extern char *repl_from;
-extern char *repl_to;
diff --git a/src/nvim/spellfile.h b/src/nvim/spellfile.h
index ba5f193f33..3e68ddd5a4 100644
--- a/src/nvim/spellfile.h
+++ b/src/nvim/spellfile.h
@@ -1,10 +1,7 @@
#pragma once
-#include <stdbool.h>
-
-#include "nvim/ex_cmds_defs.h"
-#include "nvim/spell_defs.h"
-#include "nvim/types.h"
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/spell_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "spellfile.h.generated.h"
diff --git a/src/nvim/state.c b/src/nvim/state.c
index 1c00a00d8c..dfe1af7ab3 100644
--- a/src/nvim/state.c
+++ b/src/nvim/state.c
@@ -1,5 +1,4 @@
#include <stdbool.h>
-#include <stddef.h>
#include <string.h>
#include "nvim/ascii.h"
diff --git a/src/nvim/state.h b/src/nvim/state.h
index 326beaa9d9..6617b77fa0 100644
--- a/src/nvim/state.h
+++ b/src/nvim/state.h
@@ -1,9 +1,5 @@
#pragma once
-#include <stddef.h>
-
-struct vim_state;
-
typedef struct vim_state VimState;
typedef int (*state_check_callback)(VimState *state);
diff --git a/src/nvim/statusline_defs.h b/src/nvim/statusline_defs.h
index f502f33c49..e0beff9528 100644
--- a/src/nvim/statusline_defs.h
+++ b/src/nvim/statusline_defs.h
@@ -1,5 +1,6 @@
#pragma once
+#include <stdbool.h>
#include <stddef.h>
#include "nvim/fold_defs.h"
diff --git a/src/nvim/tag.h b/src/nvim/tag.h
index c5178503f1..f628d23fbe 100644
--- a/src/nvim/tag.h
+++ b/src/nvim/tag.h
@@ -1,39 +1,42 @@
#pragma once
-#include "nvim/ex_cmds_defs.h"
-#include "nvim/option_defs.h"
-#include "nvim/types.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/option_defs.h" // IWYU pragma: keep
-// Values for do_tag().
-#define DT_TAG 1 // jump to newer position or same tag again
-#define DT_POP 2 // jump to older position
-#define DT_NEXT 3 // jump to next match of same tag
-#define DT_PREV 4 // jump to previous match of same tag
-#define DT_FIRST 5 // jump to first match of same tag
-#define DT_LAST 6 // jump to first match of same tag
-#define DT_SELECT 7 // jump to selection from list
-#define DT_HELP 8 // like DT_TAG, but no wildcards
-#define DT_JUMP 9 // jump to new tag or selection from list
-#define DT_LTAG 11 // tag using location list
-#define DT_FREE 99 // free cached matches
+/// Values for do_tag().
+enum {
+ DT_TAG = 1, ///< jump to newer position or same tag again
+ DT_POP = 2, ///< jump to older position
+ DT_NEXT = 3, ///< jump to next match of same tag
+ DT_PREV = 4, ///< jump to previous match of same tag
+ DT_FIRST = 5, ///< jump to first match of same tag
+ DT_LAST = 6, ///< jump to first match of same tag
+ DT_SELECT = 7, ///< jump to selection from list
+ DT_HELP = 8, ///< like DT_TAG, but no wildcards
+ DT_JUMP = 9, ///< jump to new tag or selection from list
+ DT_LTAG = 11, ///< tag using location list
+ DT_FREE = 99, ///< free cached matches
+};
-// flags for find_tags().
-#define TAG_HELP 1 // only search for help tags
-#define TAG_NAMES 2 // only return name of tag
-#define TAG_REGEXP 4 // use tag pattern as regexp
-#define TAG_NOIC 8 // don't always ignore case
-#define TAG_VERBOSE 32 // message verbosity
-#define TAG_INS_COMP 64 // Currently doing insert completion
-#define TAG_KEEP_LANG 128 // keep current language
-#define TAG_NO_TAGFUNC 256 // do not use 'tagfunc'
+/// flags for find_tags().
+enum {
+ TAG_HELP = 1, ///< only search for help tags
+ TAG_NAMES = 2, ///< only return name of tag
+ TAG_REGEXP = 4, ///< use tag pattern as regexp
+ TAG_NOIC = 8, ///< don't always ignore case
+ TAG_VERBOSE = 32, ///< message verbosity
+ TAG_INS_COMP = 64, ///< Currently doing insert completion
+ TAG_KEEP_LANG = 128, ///< keep current language
+ TAG_NO_TAGFUNC = 256, ///< do not use 'tagfunc'
+ TAG_MANY = 300, ///< When finding many tags (for completion), find up to this many tags
+};
-#define TAG_MANY 300 // When finding many tags (for completion),
- // find up to this many tags
-
-// Structure used for get_tagfname().
+/// Structure used for get_tagfname().
typedef struct {
- char *tn_tags; // value of 'tags' when starting
- char *tn_np; // current position in tn_tags
+ char *tn_tags; ///< value of 'tags' when starting
+ char *tn_np; ///< current position in tn_tags
int tn_did_filefind_init;
int tn_hf_idx;
void *tn_search_ctx;
diff --git a/src/nvim/terminal.h b/src/nvim/terminal.h
index 0704423f1f..66cad7ee7a 100644
--- a/src/nvim/terminal.h
+++ b/src/nvim/terminal.h
@@ -1,6 +1,5 @@
#pragma once
-#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
@@ -9,7 +8,7 @@ typedef void (*terminal_write_cb)(char *buffer, size_t size, void *data);
typedef void (*terminal_resize_cb)(uint16_t width, uint16_t height, void *data);
typedef void (*terminal_close_cb)(void *data);
-#include "nvim/buffer_defs.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
typedef struct {
void *data; // PTY process channel
diff --git a/src/nvim/testing.h b/src/nvim/testing.h
index 64e74bc46a..563ce21302 100644
--- a/src/nvim/testing.h
+++ b/src/nvim/testing.h
@@ -1,6 +1,7 @@
#pragma once
-#include "nvim/eval/typval_defs.h"
+#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
+#include "nvim/types.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "testing.h.generated.h"
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 4bbdea8def..0272c974d5 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -1051,7 +1051,7 @@ void tui_grid_cursor_goto(TUIData *tui, Integer grid, Integer row, Integer col)
tui->col = (int)col;
}
-CursorShape tui_cursor_decode_shape(const char *shape_str)
+static CursorShape tui_cursor_decode_shape(const char *shape_str)
{
CursorShape shape;
if (strequal(shape_str, "block")) {
@@ -1144,7 +1144,7 @@ void tui_mouse_off(TUIData *tui)
}
}
-void tui_set_mode(TUIData *tui, ModeShape mode)
+static void tui_set_mode(TUIData *tui, ModeShape mode)
{
if (!cursor_style_enabled) {
return;
diff --git a/src/nvim/tui/tui.h b/src/nvim/tui/tui.h
index 1cd283cf49..76a5ef9a6b 100644
--- a/src/nvim/tui/tui.h
+++ b/src/nvim/tui/tui.h
@@ -1,6 +1,8 @@
#pragma once
-#include "nvim/cursor_shape.h"
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
+#include "nvim/grid_defs.h" // IWYU pragma: keep
+#include "nvim/highlight_defs.h" // IWYU pragma: keep
#include "nvim/ui.h"
typedef struct TUIData TUIData;
diff --git a/src/nvim/ui_compositor.h b/src/nvim/ui_compositor.h
index 7b177838e4..951160deaf 100644
--- a/src/nvim/ui_compositor.h
+++ b/src/nvim/ui_compositor.h
@@ -1,6 +1,8 @@
#pragma once
+#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/event/defs.h"
+#include "nvim/grid_defs.h" // IWYU pragma: keep
#include "nvim/ui.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/undo.h b/src/nvim/undo.h
index b2d7bef843..8282bd8d6e 100644
--- a/src/nvim/undo.h
+++ b/src/nvim/undo.h
@@ -2,6 +2,8 @@
#include "nvim/buffer_defs.h" // IWYU pragma: keep
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/pos.h"
+#include "nvim/types.h"
#include "nvim/undo_defs.h" // IWYU pragma: export
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/usercmd.c b/src/nvim/usercmd.c
index 0aec9388c7..69fed19388 100644
--- a/src/nvim/usercmd.c
+++ b/src/nvim/usercmd.c
@@ -2,12 +2,12 @@
#include <assert.h>
#include <inttypes.h>
+#include <lauxlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "auto/config.h"
-#include "lauxlib.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"
diff --git a/src/nvim/usercmd.h b/src/nvim/usercmd.h
index b1485ca707..09b5dac958 100644
--- a/src/nvim/usercmd.h
+++ b/src/nvim/usercmd.h
@@ -2,9 +2,9 @@
#include <stdint.h>
-#include "nvim/cmdexpand_defs.h"
+#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h"
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#include "nvim/garray_defs.h"
#include "nvim/types.h"
diff --git a/src/nvim/version.h b/src/nvim/version.h
index 0e313bb30c..6e5862501a 100644
--- a/src/nvim/version.h
+++ b/src/nvim/version.h
@@ -1,6 +1,6 @@
#pragma once
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#include "nvim/macros.h"
// defined in version.c
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 95098ddc11..bed47670cc 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -3,7 +3,6 @@
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
-#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/nvim/window.h b/src/nvim/window.h
index 734fa71d72..e38fb953ab 100644
--- a/src/nvim/window.h
+++ b/src/nvim/window.h
@@ -1,11 +1,12 @@
#pragma once
#include <stdbool.h>
-#include <stddef.h>
-#include "nvim/buffer_defs.h"
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
+#include "nvim/garray_defs.h" // IWYU pragma: keep
#include "nvim/macros.h"
-#include "nvim/option_defs.h"
+#include "nvim/option_defs.h" // IWYU pragma: keep
+#include "nvim/types.h"
// Values for file_name_in_line()
#define FNAME_MESS 1 // give error message