octaltree/cmp-look

slow auto complete

issadarkthing opened this issue · 3 comments

The auto-completion is slow due to the hefty amount of results returned by look command. As mentioned by the author of nvim-cmp too much result may make the auto completion slow. As a workaround, we can reduce the results returned by look command by passing at least two characters as argument.

One character will return 13k results

$ look s | wc -l
13624

Two characters will return 1k results

$ look sa | wc -l
1213

As a solution, I think we can trigger the auto-complete on at least two characters. This significantly improves the response time and make it more bearable to type.

M.get_keyword_pattern = function()
  return [[\w\{2,}]]
end

I hard-coded 2 for now.

p0da commented

It seems that the plugin does not work at all for me unless I remove that check. It also seems that the per source keyword_length setting provided by cmp works perfectly. Would you consider removing this check? @octaltree

Thank you. Now it's configurable from keyword_length.
8763244