2015-04-02 1:25 GMT+03:00 Peng Yu <pengyu.ut@gmail.com>:
> On Wed, Apr 1, 2015 at 2:11 AM, Gary Johnson <garyjohn@spocom.com> wrote:
>> On 2015-03-31, Peng Yu wrote:
>>> On Tue, Mar 31, 2015 at 4:07 PM, Gary Johnson wrote:
>>> > On 2015-03-31, Peng Yu wrote:
>>
>>> >> In bash, there is `compgen`. So, it might make sense to add something
>>> >> similar to vim as well?
>>> >
>>> > Isn't that what Tim already explained above with
>>>
>>> Check compgen in bash, then you will see what I mean.
>
> compgen as a command would be able to generate, for example, anything
> that would be completed by typing TAB in bash (equivalent to ctrl-D as
> in vim). But compgen is a command rather than key combinations. I
> don't see vim command that would be able to print all the commands had
> one typed ctrl-D. In other words, I am looking an equivalent of
> compgen of bash in vim, rather than an equivalent of TAB of bash in
> vim. Does this make sense?
I remember myself talking (on #vim) about a hack to do this.
Specifically you need to use
let prefix=''
let last_word='b'
:execute 'normal! :'.prefix last_word."\<C-a>\<C-\>eextend(l:,
{'cmdline':getcmdline()}).cmdline[1:0]\n\<C-c>"
let completions = split(cmdline[len(prefix)+1 :], '\v(\\@<!(\\.)*\\)@<!\ ')
. This hack is currently used in some plugin.
>
> ~$ compgen -c ls
> ls
> ls
> lsof
> lsappinfo
> lsbom
> lsm
> lsvfs
> ls
>
>> I am quite familiar with compgen, having written a number of
>> bash_completion scripts. I still don't understand what you think
>> bash has that Vim doesn't, when it comes to command or argument
>> completion.
>>
>> I thought you were just looking for completion of help topics. If
>> you're looking for general context-dependent completion, see
>>
>> :help 20.3
>> :help cmdline-completion
>> :help :command-completion
>>
>> I found the last by typing
>>
>> :help complet<Tab>
>>
>> Regards,
>> Gary
>>
>> --
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>> ---
>> You received this message because you are subscribed to a topic in the Google Groups "vim_use" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/sQk2EPvlEVY/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Regards,
> Peng
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment