From 162edf7b30dd4a98b85fa490d0dfd1a73db23b88 Mon Sep 17 00:00:00 2001 From: glepnir Date: Tue, 18 Mar 2025 15:44:45 +0800 Subject: vim-patch:9.1.1214: matchfuzzy() can be improved for camel case matches Problem: When searching for "Cur", CamelCase matches like "lCursor" score higher than exact prefix matches like Cursor, which is counter-intuitive (Maxim Kim). Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable CamelCase bonuses when needed, making prefix matches rank higher. (glepnir) fixes: vim/vim#16504 closes: vim/vim#16797 https://github.com/vim/vim/commit/28e40a7b55ce471656cccc2260c11a29d5da447e Co-authored-by: glepnir --- runtime/doc/builtin.txt | 3 +++ runtime/lua/vim/_meta/vimfn.lua | 3 +++ 2 files changed, 6 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 04d24e7a92..a4adfb3a63 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -6410,6 +6410,9 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()* given sequence. limit Maximum number of matches in {list} to be returned. Zero means no limit. + camelcase Use enhanced camel case scoring making results + better suited for completion related to + programming languages. Default is v:true If {list} is a list of dictionaries, then the optional {dict} argument supports the following additional items: diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 2b4f1a32b0..69e739225f 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -5815,6 +5815,9 @@ function vim.fn.matchend(expr, pat, start, count) end --- given sequence. --- limit Maximum number of matches in {list} to be --- returned. Zero means no limit. +--- camelcase Use enhanced camel case scoring making results +--- better suited for completion related to +--- programming languages. Default is v:true --- --- If {list} is a list of dictionaries, then the optional {dict} --- argument supports the following additional items: -- cgit From 797195e0ea554f2e546ced9104e8fbfa376f283f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 27 Mar 2025 08:21:08 +0800 Subject: vim-patch:9.1.1219: Strange error with wrong type for matchfuzzy() "camelcase" Problem: Strange error with type for matchfuzzy() "camelcase". Solution: Show the error "Invalid value for argument camelcase" instead of "Invalid argument: camelcase" (zeertzjq). Note that using tv_get_string() will lead to confusion, as when the value cannot be converted to a string tv_get_string() will also give an error about that, but "camelcase" takes a boolean, not a string. Also don't use tv_get_string() for the "limit" argument above. closes: vim/vim#16926 https://github.com/vim/vim/commit/c4815c157b27923001e44bfd241fb540bf1fb518 --- runtime/doc/builtin.txt | 2 +- runtime/lua/vim/_meta/vimfn.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index a4adfb3a63..3ad5d83ac2 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -6412,7 +6412,7 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()* returned. Zero means no limit. camelcase Use enhanced camel case scoring making results better suited for completion related to - programming languages. Default is v:true + programming languages. Defaults to v:true. If {list} is a list of dictionaries, then the optional {dict} argument supports the following additional items: diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 69e739225f..813a89898e 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -5817,7 +5817,7 @@ function vim.fn.matchend(expr, pat, start, count) end --- returned. Zero means no limit. --- camelcase Use enhanced camel case scoring making results --- better suited for completion related to ---- programming languages. Default is v:true +--- programming languages. Defaults to v:true. --- --- If {list} is a list of dictionaries, then the optional {dict} --- argument supports the following additional items: -- cgit