From be1fbe38b31b6046d396407c4efbf238941c6b08 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 21 Feb 2025 02:02:32 +0100 Subject: feat(lua): vim.text.indent() Problem: Indenting text is a common task in plugins/scripts for presentation/formatting, yet vim has no way of doing it (especially "dedent", and especially non-buffer text). Solution: Introduce `vim.text.indent()`. It sets the *exact* indentation because that's a more difficult (and thus more useful) task than merely "increasing the current indent" (which is somewhat easy with a `gsub()` one-liner). --- src/nvim/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 8112045d11..36bcd5fbce 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -342,6 +342,7 @@ set(LUA_KEYMAP_MODULE_SOURCE ${NVIM_RUNTIME_DIR}/lua/vim/keymap.lua) set(LUA_LOADER_MODULE_SOURCE ${NVIM_RUNTIME_DIR}/lua/vim/loader.lua) set(LUA_OPTIONS_MODULE_SOURCE ${NVIM_RUNTIME_DIR}/lua/vim/_options.lua) set(LUA_SHARED_MODULE_SOURCE ${NVIM_RUNTIME_DIR}/lua/vim/shared.lua) +set(LUA_TEXT_MODULE_SOURCE ${NVIM_RUNTIME_DIR}/lua/vim/text.lua) file(GLOB API_HEADERS CONFIGURE_DEPENDS api/*.h) list(REMOVE_ITEM API_HEADERS ${CMAKE_CURRENT_LIST_DIR}/api/ui_events.in.h) @@ -624,6 +625,7 @@ add_custom_command( ${LUA_DEFAULTS_MODULE_SOURCE} "vim._defaults" ${LUA_OPTIONS_MODULE_SOURCE} "vim._options" ${LUA_SHARED_MODULE_SOURCE} "vim.shared" + ${LUA_TEXT_MODULE_SOURCE} "vim.text" DEPENDS ${CHAR_BLOB_GENERATOR} ${LUA_INIT_PACKAGES_MODULE_SOURCE} @@ -637,6 +639,7 @@ add_custom_command( ${LUA_DEFAULTS_MODULE_SOURCE} ${LUA_OPTIONS_MODULE_SOURCE} ${LUA_SHARED_MODULE_SOURCE} + ${LUA_TEXT_MODULE_SOURCE} VERBATIM ) -- cgit