gelguy / Cmd2.vim

cmdline-mode enhancement for Vim
MIT License
94 stars 4 forks source link

A question and maybe a feature request #13

Open cpfaff opened 8 years ago

cpfaff commented 8 years ago

He

I just stumbled upon your plug-in and really like it. By now I was always using ''vim-scripts/CmdlineComplete.git' to allow for a completion on command line. The problem with that one however is that the completion in a search and replace is only working before the / not in the second part. This seems to be the same for your plug-in? Or can I achieve that with the right options set? Any help with that would be appreciated.

My setup now is:

let g:Cmd2_options = {
       \ '_complete_ignorecase': 1,
       \ '_complete_uniq_ignorecase': 0,
       \ '_complete_fuzzy': 1,
       \ }

 cmap <expr> <Tab> Cmd2#ext#complete#InContext() ? "\<Plug>(Cmd2Complete)" : "\<Tab>"

 set wildcharm=<Tab>
gelguy commented 8 years ago

Thank you for using and sorry for the big delay in replying.

The cmap <expr> <Tab> checks that Cmd2#ext#complete#InContext() is true to trigger the completion. The current implementation is quite simple, checking if it is just before the first s/. Hence it is possible to replace the check if a function of your own, or even just default to always true. Check the implementation in the source code. The regex would need to be changed to something a bit more complicated as now it would have to check for possible escaped /s in the search string.

If you need further help I might be able to write the regex depending on your use case.