nx.str
nx.str.trim(text, mask, dir)
No documentation comment in the prelude.
Defined in stdlib.lua.
nx.str.startswith(s, prefix)
nx.str.startswith(s, prefix) [alias vim.startswith]: does s begin with prefix?
Defined in stdlib.lua.
nx.str.endswith(s, suffix)
nx.str.endswith(s, suffix) [alias vim.endswith]: does s end with suffix?
Defined in stdlib.lua.
nx.str.split(s, sep, opts)
nx.str.split(s, sep, opts) [alias vim.split]: split s on sep.
Defined in stdlib.lua.
nx.str.to_list(s, _utf8)
nx.str.to_list(s[, utf8]) [alias vim.fn.str2list]: the codepoint of each character
in s, as a list of numbers (str2list("AB") == { 65, 66 }). nxvim is always
UTF-8, so the utf8 flag is accepted and ignored (the result is the same either
way). A plugin’s key parser round-trips a keymap’s lhs through this and nr2char.
Defined in stdlib.lua.
nx.str.from_char(nr, _utf8)
nx.str.from_char(nr[, utf8]) [alias vim.fn.nr2char]: the string for codepoint nr
(nr2char(65) == "A"). The inverse of one nx.str.to_list element; nxvim is always
UTF-8 so utf8 is accepted and ignored.
Defined in stdlib.lua.
nx.str.chars(s, _skipcc)
nx.str.chars(s[, skipcc]) [alias vim.fn.strchars]: number of characters
(codepoints) in s. INCOMPLETE: skipcc (skip composing characters) is ignored —
every codepoint counts, since nxvim doesn’t classify combining marks.
Defined in stdlib.lua.
nx.str.displaywidth(s, col)
nx.str.displaywidth(s[, col]) [alias vim.fn.strdisplaywidth]: the display cells s
occupies, expanding tabs to the next tabstop boundary and counting wide chars as
two. col is the starting screen column used for tab-stop math (default 0); the
return value is the width of s itself (cells consumed beyond col). INCOMPLETE:
tabs expand on a fixed tabstop of 8, not the current buffer’s ‘tabstop’.
Defined in stdlib.lua.
nx.str.utfindex(s, a, b)
No documentation comment in the prelude.
Defined in stdlib.lua.
nx.str.byteindex(s, a, b)
No documentation comment in the prelude.
Defined in stdlib.lua.
nx.str.charpart(s, start, len)
nx.str.charpart(s, start[, len]) [alias vim.fn.strcharpart]: the substring of s
starting at character index start (0-based), spanning len characters (default:
to the end). A negative start drops that many leading characters off the count
(vim’s behavior) and clamps the start to 0.
Defined in stdlib.lua.
nx.str.trans(s)
nx.str.trans(s) [alias vim.fn.strtrans]: s with unprintable characters shown as
printable text — control chars 0x00–0x1F as ^@…^_, 0x7F as ^? — matching vim, so a
key label built from raw bytes displays readably. Multibyte UTF-8 is left intact.
Defined in stdlib.lua.
nx.str.substitute(str, pat, sub, flags)
nx.str.substitute(str, pat, sub, flags) [alias vim.fn.substitute]: a real vim-regex
substitution, backed by the Rust engine (nx._substitute) so plugins that rely on
vim’s magic dialect + replacement syntax (\(\), \{-}, &, \1, \U…\E, …) get
the same result neovim gives. This is a DIFFERENT dialect from nxvim’s / search
(canonical regex); the divergence is intentional and lives in the compat layer. An
invalid / unsupported pattern raises (fail loud).
Defined in stdlib.lua.