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>
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index a3f2d7c..5223687 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 9.1. Last change: 2025 Mar 27
+*todo.txt* For Vim version 9.1. Last change: 2025 Apr 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4749,20 +4749,10 @@
7 When expanding file names with an environment variable, add the match with
the unexpanded var. So $HOME/tm expands to "/home/guy/tmp" and
"$HOME/tmp"
-8 When there is no word before the cursor but something like "sys." complete
- with "sys.". Works well for C and similar languages.
9 ^X^L completion doesn't repeat correctly. It uses the first match with
the last added line, instead of continuing where the last match ended.
(Webb)
-8 Add option to set different behavior for Insert mode completion:
- - ignore/match case
- - different characters than 'iskeyword'
-8 Add option 'isexpand', containing characters when doing expansion (so that
- "." and "\" can be included, without changing 'iskeyword'). (Goldfarb)
- Also: 'istagword': characters used for CTRL-].
- When 'isexpand' or 'istagword' are empty, use 'iskeyword'.
- Alternative: Use a pattern so that start and end of a keyword can be
- defined, only allow dash in the middle, etc.
+8 Add option 'istagword': characters used for CTRL-]. like 'isexpand'
8 Add a command to undo the completion, go back to the original text.
7 Completion of an abbreviation: Can leave letters out, like what Instant
text does: www.textware.com