mirror of
https://github.com/neovim/neovim.git
synced 2026-04-19 14:00:49 +00:00
feat(lua): vim.tbl_contains supports general tables and predicates (#23040)
* feat(lua): vim.tbl_contains supports general tables and predicates Problem: `vim.tbl_contains` only works for list-like tables (integer keys without gaps) and primitive values (in particular, not for nested tables). Solution: Rename `vim.tbl_contains` to `vim.list_contains` and add new `vim.tbl_contains` that works for general tables and optionally allows `value` to be a predicate function that is checked for every key.
This commit is contained in:
@@ -325,7 +325,7 @@ local function check_tmux()
|
||||
-- check for RGB capabilities
|
||||
local info = vim.fn.system({ 'tmux', 'display-message', '-p', '#{client_termfeatures}' })
|
||||
info = vim.split(vim.trim(info), ',', { trimempty = true })
|
||||
if not vim.tbl_contains(info, 'RGB') then
|
||||
if not vim.list_contains(info, 'RGB') then
|
||||
local has_rgb = false
|
||||
if #info == 0 then
|
||||
-- client_termfeatures may not be supported; fallback to checking show-messages
|
||||
|
||||
Reference in New Issue
Block a user