f3fora / cmp-spell Goto Github PK
View Code? Open in Web Editor NEWspell source for nvim-cmp based on vim's spellsuggest.
spell source for nvim-cmp based on vim's spellsuggest.
cmp-spell/lua/cmp-spell/init.lua
Line 55 in 20f3347
@spell
See :h treesitter-highlight-spell
#8@Spell
See :h spell-syntax
enable_in_context
option with hrsh7th/nvim-cmp#632If I only enable sources = {{name = 'spell'}}
, no suggestions are shown.
I wanted the completion window to be printed in the same order as the vim.fn.spellsuggest() function. like this.
To see this, I changed the sorting order in config of nvim-cmp like
sorting = {
priority_weight = 2.0,
comparators = {
compare.order,
}
},
but the completion window said the input word first like
1. overshot
2. overshoot
3. Overshot
4. overshoe
5. over shot
6. overshoots
Why does the first one displayed?
my source setting is
-- /////// source of lua
cmp.setup.filetype({'lua'}, {
sources = {
{
name = 'spell',
group_index = 1,
option = {
keep_all_entries = true, -- it can show more possible list
enable_in_context = function () -- is_available() does not work, this option make spell completion work only
return context.in_treesitter_capture('comment') or context.in_syntax_group('Comment')
end
}
},
}
})
I use lazy.nvim for all my configs.
Here is my config:
{
"hrsh7th/nvim-cmp",
dependencies = {
"f3fora/cmp-spell",
},
config = function()
local cmp = require "cmp"
-- Get the current sources
local sources = cmp.get_config().sources
-- Add the new source
table.insert(sources, {
name = "spell",
option = {
keep_all_entries = false,
enable_in_context = function()
return true
end,
preselect_correct_word = true,
},
})
-- Setup nvim-cmp with the updated sources
cmp.setup {
sources = sources,
}
end,
},
This loads the plugin, but when i ran :CmpStatus
, spell is under # unavailable source names
and words don't show up when I'm in a md document
Is it possible to use multiple languages as a language source?
Hi how can I get the plugin to work with lsp code action
nmap("<a-cr>", "<cmd>lua vim.lsp.buf.code_action()<cr>")
similar to #3
This is my cmp sources:
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "spell" },
{ name = "path" },
}),
When I input text, lsp source should be on the top of popup menu, but I got spell source first:
Is there something wrong with priority of spell source?
When I remove spell source, I got this:
It seems to be normal.
I had a problem with non-English spelling completion.
Turns out \w+ only captures ascii characters and then cmp doesn't count them as things to complete and cancels the completion.
It is an old vim limitation, that is inherited in neovim.
Tried it with \k or \K (\K is the better one, excludes numbers) and should work regardless of language?
At least it works for both English and any Cyrilic alphabet-based language
Hi there! Any way to make the extension suggest corrections for misspelled words?
Thanks a lot and keep up the good work! ๐ช
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.