It seems like Vim passes a wrong ArgLead when you try to complete in
the middle of a command-line. E.g., try this:

command! -nargs=* -complete=custom,ComplTest Test :
function! ComplTest(ArgLead, CmdLine, CursorPos)
  return a:ArgLead
endfunction

Now try this (<Cursor> signifies the position of the cursor and <Tab>
signifies literabl <Tab> press when the cursor is at that position):

:Test something<Tab>

You get this as expected:

:Test something<Cursor>

But if you try this:

:Test <Tab>something

You get:

:Test something<Cursor>something

Other bad examples:

:Test another<Tab> something
:Test another something<Cursor> something

:Test <Tab>something anotherthing
:Test something anotherthing<Cursor>something anotherthing

The ArgLead that the completion function receives is not what is in
the front of the cursor, but what is after it, essentially everything
after that. Isn't this a bug? It makes the completion less useful in
the middle (which you would encounter, if you decide to move cursor
back to correct an argument once the command line is typed). A
workaround is to use CmdLine and CursorPos to determine the current
completion (by splitting it in words and determining the current
word), but this is tedious and none of the existing functions would be
expected to do.

-- 
Hari

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to