Closed lacygoill closed 7 years ago
Sorry, I've just realised that the 'dictionary'
option could contain several filepaths. I don't know how to handle that.
Maybe, instead of:
let l:suggestions = readfile(&l:dictionary)
One should write:
let l:suggestions = []
for l:list in map(split(&l:dictionary, ','), "readfile(v:val)")
call extend(l:suggestions, l:list)
endfor
I think this should do it:
let l:suggestions = []
for l:list in map(split(&l:dictionary, ','), "readfile(v:val)")
call extend(l:suggestions, l:list)
endfor
call filter(l:suggestions, 'stridx(v:val, l:word) == 0')
I added the option g:mucomplete#dict#match_at_start
, similar to g:mucomplete#ultisnips#match_at_start
. When it's set to 0, the method should suggest any word from the dictionary containing the word before the cursor, even if it's not at the beginning.
Well, I'm not sure this is a good idea, after all...
There are several problems to take care of. Like possible commas in the filename, spell
entry, add the filename of the dictionary in the description field of the menu...
I think I could do that, but I'm not sure you would be interested in it. Let me know what you think.
I think that this is going towards a direction that is against µcomplete's philosophy. Also, the motivation for this, i.e., overcoming a limitation of some key mappings (https://github.com/lifepillar/vim-mucomplete/issues/43) is not so strong, because the key mappings may be redefined.
Thanks anyway for the effort you've put on it!
Thinking more about this, a plugin that collects several custom completion methods (abbrev, extended dict, snippets, etc…) might be interesting independent of µcomplete. It could easily provide integration with µcomplete, but also work for other plugins (or without other plugins), and it would allow me to keep µcomplete as minimal as it deserves.
If you decide to take such an endeavour, let me know!
Hello,
this is an attempt at implementing a custom
dict
method to get around the issue discussed here.It seems to work, but the code is so similar to the file implementing the
uspl
method that it could be improved by creating only one file which would be used to give suggestions from various sources. It could be used as a kind of library, is that the correct term?