spell.lua (951B)
1 --- @meta 2 3 -- luacheck: no unused args 4 5 --- Check {str} for spelling errors. Similar to the Vimscript function 6 --- [spellbadword()]. 7 --- 8 --- Note: The behaviour of this function is dependent on: 'spelllang', 9 --- 'spellfile', 'spellcapcheck' and 'spelloptions' which can all be local to 10 --- the buffer. Consider calling this with [nvim_buf_call()]. 11 --- 12 --- Example: 13 --- 14 --- ```lua 15 --- vim.spell.check("the quik brown fox") 16 --- -- => 17 --- -- { 18 --- -- {'quik', 'bad', 5} 19 --- -- } 20 --- ``` 21 --- 22 --- @param str string 23 --- @return [string, 'bad'|'rare'|'local'|'caps', integer][] 24 --- List of tuples with three items: 25 --- - The badly spelled word. 26 --- - The type of the spelling error: 27 --- "bad" spelling mistake 28 --- "rare" rare word 29 --- "local" word only valid in another region 30 --- "caps" word should start with Capital 31 --- - The position in {str} where the word begins. 32 function vim.spell.check(str) end