let me give a simple example, from JavaScript:
when i type:
document.getEle
and then
<c-x><c-o>
i want it to complete to
document.getElementById()
but that is NOT enough, i want the cursor to MOVE <left>, so it will already
be between the parentheses after i select the completion.
Now, in the help files there is a vague paragraph that implies that
theoretically this is possible, i mean in insert.txt (line 613)
it says the following:
"Note: While completion is active Insert mode can't be used
recursively.
Mappings that somehow invoke ":normal i.." will generate an E523
error."
I mean, it warns against invoking the insert mode recursively, but could it
be possible in the first place?
Because in order to invoke the :normal command you must first ESCAPE the
insert mode, now what is the trick to do that from INSIDE an item of the
popupmenu?
if i look in the example (insert.txt line 1059), the res variable is always
set to a list of "simple" strings that do no more than to complete a string
but not so much as to complete the magic by jumping the cursor from place to
place, and in order to do that, you must first ESCAPE the insert mode or to
let the function interpret the <left><up> etc. inside the strings (as in
mapping and abbreviations), but can we do that?
Thanks in advance for ANY help, please keep in mind that im new to vim so
that ANY help would be much appreciated.
Alex
--
View this message in context: http://vim.1045645.n5.nabble.com/how-to-write-omnifunction-tp2637764p2637764.html
Sent from the Vim - General mailing list archive at Nabble.com.
Did you try ending your completion text with "\<Left>" e.g. :return
"document.getElementById()\<Left>" (with double quotes and a backslash
before the less-than sign)? (I haven't, so I don't know if it works.)
See
:help expr-quote
:help complete-functions
Best regards,
Tony.
--
"God gives burdens; also shoulders"
Jimmy Carter cited this Jewish saying in his concession speech at the
end of the 1980 election. At least he said it was a Jewish saying; I
can't find it anywhere. I'm sure he's telling the truth though; why
would he lie about a thing like that?
-- Arthur Naiman, "Every Goy's Guide to Yiddish"
On 17/08/10 08:28, aleCodd wrote:
>
> I would like the items in the popupmenu to be more than simple strings, i
> mean that after i select an item i want the cursor to automatically jump to
> specific locations.
>u
--
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
View message @ http://vim.1045645.n5.nabble.com/how-to-write-omnifunction-tp2637764p2637823.html
To unsubscribe from how to write omnifunction?, click here.
--
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
View message @ http://vim.1045645.n5.nabble.com/how-to-write-omnifunction-tp2637764p2637823.html
To unsubscribe from how to write omnifunction?, click here.
can you please check the linked script
http://vim.1045645.n5.nabble.com/file/n2637863/test test ?
thanks
--
View this message in context: http://vim.1045645.n5.nabble.com/how-to-write-omnifunction-tp2637764p2637863.html
On Di, 17 Aug 2010, aleCodd wrote:
>
> just a minor correction to the script...
> i.e. the line "return start" was moved after "endwhile" as it should be...
> here is the script: http://vim.1045645.n5.nabble.com/file/n2637872/test
> test
I am not sure that is possible, what you want.
You can however do map e.g. C-Y to move the cursor after selecting the
entry from the popup menu.
e.g. something like this:
inoremap <expr> <C-Y> pumvisible() ? "\<lt>C-Y>\<lt>Left>" : "\<lt>C-Y>"
However, I don't think you can move the cursor depending on which item
was selected. There seems no function available that tells you which
match is currently selected.
regards,
Christian