New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wildmenu source #443
Comments
It cannot be implemented. Because, Vim's command line has few features for custom. |
I managed to create the function that returns competition info. It uses fu! Get(cmd) exe "nn <buffer> z& :" . a:cmd . "<c-a><c-f>yyo<cr>" norm z& return split(@0) endf It looks like this list could be used as a source. It can even be used with help:
The function obviously needs some love (i.e. save 0 register and use safer map but it proves the point). Output : ['NeoBundle', 'NeoBundleCheck', 'NeoBundleClean', 'NeoBundleDepends', 'NeoBundleDirectEdit', 'NeoBundleDirectInstall', 'NeoBundleDisable', 'NeoBundleDocs', 'NeoBundleFetch', 'NeoBundleInstall', 'NeoBundleLazy', 'NeoBundleList', 'NeoBundleLocal', 'NeoBundleLog', 'NeoBundleRecipe', 'NeoBundleReinstall', 'NeoBundleSource', 'NeoBundleUpdate', 'NeoBundleUpdatesLog', 'NeoComplCacheAutoCompletionLength', 'NeoComplCacheCachingBuffer', 'NeoComplCacheCachingDictionary', 'NeoComplCacheCachingInclude', 'NeoComplCacheCachingSyntax', 'NeoComplCacheCachingTags', 'NeoComplCacheCachingVim', 'NeoComplCacheClean', 'NeoComplCacheDisable', 'NeoComplCacheDisableCaching', 'NeoComplCacheEnable', 'NeoComplCacheEnableCaching', 'NeoComplCacheLock', 'NeoComplCacheLockSource', 'NeoComplCacheOutputKeyword', 'NeoComplCachePrintSource', 'NeoComplCacheSetFileType', 'NeoComplCacheToggle', 'NeoComplCacheUnlock', 'NeoComplCacheUnlockSource', 'NeoSnippetClearMarkers', 'NeoSnippetEdit', 'NeoSnippetMakeCache', 'NeoSnippetSource'] |
BTW, in order to prevent constant function call (as it could make screen flicker) its enough to call it only once with first letter only ( |
I think this feauture must be implemented by external sources. Not unite.vim internal source. |
OK, here it is. Its still not polished yet but it should work: https://github.com/majkinetor/unite-cmdmatch If I could only figure out how to prevent visual glitch while gathering candidates (i.e. how to hide cmd line) all wildmenu options would be supported - currently in completes only last word. |
BTW, plugin is not loaded until first time I type |
Yes. It is feature. You should use plugin directory for initialize. |
I checked your code. https://github.com/majkinetor/unite-cmdmatch
|
Fixed: c4b818 Thanks. |
if !hasmapto('<Plug>(unite_cmdmatch_complete)')
cm <c-o> <Plug>(unite_cmdmatch_complete)
en
cno <Plug>(unite_cmdmatch_complete) <c-f>^"vyg_ddo<cr>:Unite -buffer-name=cmdmatch -direction=botr -start-insert -input=<c-r>=strpart(@v, strridx(@v, ' ')+1)<cr> cmdmatch:<c-r>=escape(@v,' ')<cr><cr> It should be defined in plugin/unite-cmdmatch.vim. |
Did it. |
Thanks. I will try it. |
Thats strange. It works on 4 different OS-es here.
The point of that part is to grab the text user typed before invoking the hotkey. You can replicate this manually after typing something in command line and see what part is problematic. At the end you should have typed text in
and later |
Also, you can test it by invoking command manually:
|
Ah, thats how you lazy load it.. I tried bunch of things and finally reverted to non-lazy. Perhaps you want to update the documentation where it says: Note: You can omit "autoload" dictionary. It is useful for |:NeoBundleLazy| command and specify that you can put its keys directly in options. This works here: NeoBundleLazy 'majkinetor/unite-cmdmatch', { 'depends': 'Shougo/unite.vim', 'mappings' : [['c', '(unite_cmdmatch_complete)']] } " cm <c-o> <Plug>(unite_cmdmatch_complete) Looking at error info I can't say why error occurred.
What happens when you execute this function: fu! g:GetCmdCompletition(cmd) let [cwh,ls,v] = [&cwh, &ls, @v] set cwh=1 ls=0 exe 'nn <buffer> z&u :' . a:cmd . '<c-a><c-f>"vyyo<cr>' norm z&u let res = split(@v) let [&cwh,&ls,@v] = [cwh,ls,v] return res endf :echo g:GetCmdCompletition('neo') |
I think your function executes command line like |
So I presume that you didn't get the list with Line
first prints the argument on cmd line in order to complete it, then calls OK, I will checkout your .vimrc and see if I can find whats wrong ... |
Hmmm... You source print errors in my .vimrc. |
Without telling me what exactly did you do I can't deduce whats wrong. This is really simply simple function. You should be able to reproduce it manually without any problems to obtain the completion list. So tell me. What does this mapping return:
My output is
|
I see. There is a new, awesome method to get completion data which is much more robust, faster and without visual glitch. It would also allow to complete exactly the same as in wildmenu. I will update plugin soon and let you know. |
Thanks! I wait until you implement it. |
I don't like that you have to iterate over wildmenu items when there are lots of them.
For instance, typing unite gives me huge number of wildmenu items. Is it possible to create a source of completition items ?
I looked in the vim documentation and around how could such list be obtained but didn't have any luck.
The source would need to have an argument that would be always supplied by the user or it could be also specified as command line mapping ( TAB would be logical choice) that will get the currently typed sentence and feed it to source as an argument. From that point on you could use fuzzy search to reduce candidates.
The text was updated successfully, but these errors were encountered: