Loading ...
Sorry, an error occurred while loading the content.

Re: Will custom completion of input() do completion at cursor pos?

Expand Messages
  • Dasn
    ... That is a good idea, but it still has a problem, that is after cp , the cp part cannot be changed. It seems that there s a lot to do if
    Message 1 of 6 , Apr 28, 2009
      On 27/04/09 23:41 +0300, Agathoklis D. Hatzimanikas wrote:
      > I don't think that is possible, everything after the prompt will be
      > discarded with auto-completion, since this what you require from the
      > input() function (completion).
      > A simple way to overcome this problem, is to use twice the input()
      > function, one for to get the command and the other for the completion
      > for your object, something like:
      > fun! MyFileComplete(ArgLead, CmdLine, CursorPos)
      > let ret=["file1", "file2", "file3"]
      > ".... A lot more other processing
      > return ret
      > endfun
      > let prompt = "Talking to shell> "
      > let cmd = input(prompt, '')." ".input(printf("%s%s ", prompt,
      > \histget("@", -1)), "", "customlist,MyFileComplete")
      > Then if you want to use <space> instead of <enter> you can map
      > temporally <enter> to <space>, like:
      > cnoremap <buffer> <silent> <space> <Char-0x0d>
      > So the whole procedure will be like this:
      > Talking to shell> cp<space> <tab>
      > That's an idea, there might be better ways, but its quite usable like
      > this, not robust but usable if you are careful.

      That is a good idea, but it still has a problem, that is after
      "cp<space> <tab>", the "cp" part cannot be changed. It seems that
      there's a lot to do if implementing this feature via input(), I'll try
      another way.

      Thank you.


      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.