Respect iskeyword
FOSSilizedDaemon opened this issue · comments
Is your feature request related to a problem? Please describe.
In vim
default completion system there an option called iskeyword
which allows the user to denote what should or should not be treated as part of a word. For example, lets say you are writing in shell-script and want the variable my_fav_var
to be treated as a word in the completion system, for this you would append '_' to iskeyword. An example of a proper iskeyword
can be seen below, taken from my configuration for Python, C, Common Lisp, and POSIX Shell.
vim.opt.iskeyword:append({',', '_', '@', '.', '-'})
Describe the solution you'd like
Compe does not seem to respect this and thus I find myself having to manually type delimiters to finish completion options. I would like for compe to respect this option to allow me to have similar completion to the default system. This is extremely helpful for languages such as common-lisp and even python.
Describe alternatives you've considered
I am unsure if there any ways to get functionality outside of reverting back to using built-in completion, which I have done but the LSP integration offered by compe is too nice to leave behind.
Additional context
:help iskeyword
But in all seriousness, I find this to an extremely useful system for programming and even just writing in general. I saw another issue asking for dictionary completion support and these are the only two things compe is missing for me.
You can set default_pattern
config.
require'compe'.setup {
default_pattern = [[\k\+]],
}
@hrsh7th I tried adding this to set the pattern based on the file type.
-- Set default_pattern based on the current file type.
if opt_local.filetype:get() == 'python' then
nvim_compe.setup {
default_pattern = [[\_\.\@]]
}
elseif opt_local.filetype:get() == 'sh' then
nvim_compe.setup {
default_pattern = [[\_]]
}
elseif opt_local.filetype:get() == 'lisp' then
nvim_compe.setup {
default_pattern = [[\-]]
}
elseif opt_local.filetype:get() == 'c' or opt_local.filetype:get() == 'cpp' then
nvim_compe.setup {
default_pattern = [[\->\.]]
}
elseif opt_local.filetype:get() == 'lua' then
nvim_compe.setup {
default_pattern = [[\_\.\:]]
}
end
but then compe does not run as I have to have two different setup statements to do this.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.