]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.1341: cannot define completion triggers v9.1.1341
authorglepnir <glephunter@gmail.com>
Thu, 24 Apr 2025 19:48:35 +0000 (21:48 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 24 Apr 2025 19:48:35 +0000 (21:48 +0200)
commitbcd5995b40a1c26e735bc326feb2e3ac4b05426b
tree9f330cbf18b1a36c69695b77b4f2d005559900e1
parent32f49738d1807b1553d1fbd2f5d1b0b4849dbcb5
patch 9.1.1341: cannot define completion triggers

Problem:  Cannot define completion triggers and act upon it
Solution: add the new option 'isexpand' and add the complete_match()
          function to return the completion matches according to the
          'isexpand' setting (glepnir)

Currently, completion trigger position is determined solely by the
'iskeyword' pattern (\k\+$), which causes issues when users need
different completion behaviors - such as triggering after '/' for
comments or '.' for methods. Modifying 'iskeyword' to include these
characters has undesirable side effects on other Vim functionality that
relies on keyword definitions.

Introduce a new buffer-local option 'isexpand' that allows specifying
different completion triggers and add the complete_match() function that
finds the appropriate start column for completion based on these
triggers, scanning backwards from cursor position.

This separation of concerns allows customized completion behavior
without affecting iskeyword-dependent features. The option's
buffer-local nature enables per-filetype completion triggers.

closes: #16716

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
20 files changed:
runtime/doc/builtin.txt
runtime/doc/options.txt
runtime/doc/tags
runtime/doc/todo.txt
runtime/doc/usr_41.txt
runtime/doc/version9.txt
runtime/optwin.vim
src/buffer.c
src/evalfunc.c
src/insexpand.c
src/option.c
src/option.h
src/optiondefs.h
src/optionstr.c
src/proto/insexpand.pro
src/proto/optionstr.pro
src/structs.h
src/testdir/gen_opt_test.vim
src/testdir/test_ins_complete.vim
src/version.c