Need help with omnicompletions

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Need help with omnicompletions

Kyku-2
Hello all,

My main problem is that, well, it doesn't work. I've followed
instructions in :he ft-c-omni: patched and installed ctags, created tags
file. Now I edit something press Ctrl-X in insert mode and get:

-- ^X++ mode (/^E/^Y/^L/^]/^F/^I/^K/^D/^V/^N/^P/n/p)

Where is "^O"? If I press Ctrl-O now, it waits for a normal mode
command. Please help me.

Here are some settings that might be of some interest:

:set omnifunc?
omnifunc=ccomplete#Complete

:set completeopt?
completeopt=menu,preview

:version
VIM - Vi IMproved 7.0e BETA (2006 Apr 16, compiled Apr 16 2006 20:43:17)
Skompilowany przez kyku@silverthread
Normalna wersja z GTK2 GUI. Opcje włączone (+) lub nie (-):
-arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset
+cindent +clientserver
+clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv
-cscope +cursorshape
+dialog_con_gui +diff +digraphs +dnd -ebcdic -emacs_tags +eval +ex_extra
+extra_search -farsi
+file_in_path +find_in_path +folding -footer +fork() +gettext
-hangul_input +iconv +insert_expand
+jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds
+localmap +menu +mksession
+modify_fname +mouse +mouseshape -mouse_dec +mouse_gpm -mouse_jsbterm
-mouse_netterm +mouse_xterm
+multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra
-perl +postscript +printer
-profile -python +quickfix -rightleft -ruby +scrollbind +signs
+smartindent -sniff +statusline
-sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl
+terminfo +termresponse
+textobjects +title +toolbar +user_commands +vertsplit +virtualedit
+visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset
+xim +xsmp_interact
+xterm_clipboard -xterm_save
vimrc systemu: "$VIM/vimrc"
vimrc użytkownika: "$HOME/.vimrc"
exrc użytkownika: "$HOME/.exrc"
gvimrc systemu: "$VIM/gvimrc"
gvimrc użytkownika: "$HOME/.gvimrc"
systemowy plik menu: "$VIMRUNTIME/menu.vim"
odwet dla $VIM-a: "/usr/local/stow/vim7//share/vim"
Kompilacja: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
-I/usr/include/gtk-2.0 -I/usr/lib/gtk
-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pango-1.0 -I/usr/include/gli
b-2.0 -I/usr/lib/glib-2.0/include -g -O2
Konsolidacja: gcc -L/usr/local/lib -o vim -lgtk-x11-2.0 -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0
-lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0
-lglib-2.0 -lXt -lncurses -l
acl -lgpm

My extensions:
/home/kyku/.vim/ftplugin/php_abb.vim
/home/kyku/.vim/ftplugin/ruby_macros.vim
/home/kyku/.vim/ftplugin/html_closetag.vim
/home/kyku/.vim/ftplugin/xml_closetag.vim
/home/kyku/.vim/ftplugin/eruby.vim
/home/kyku/.vim/ftplugin/ruby.vim
/home/kyku/.vim/autoload/netrwFileHandlers.vim
/home/kyku/.vim/autoload/netrwSettings.vim
/home/kyku/.vim/autoload/netrw.vim
/home/kyku/.vim/autoload/vimball.vim
/home/kyku/.vim/filetype.vim
/home/kyku/.vim/compiler/eruby.vim
/home/kyku/.vim/compiler/ruby.vim
/home/kyku/.vim/compiler/rubyunit.vim
/home/kyku/.vim/indent/eruby.vim
/home/kyku/.vim/indent/ruby.vim
/home/kyku/.vim/indent/php.vim
/home/kyku/.vim/plugin/quotes.vim
/home/kyku/.vim/plugin/a.vim
/home/kyku/.vim/plugin/netrwPlugin.vim
/home/kyku/.vim/plugin/themes.vim
/home/kyku/.vim/plugin/cd.vim
/home/kyku/.vim/plugin/mru.vim
/home/kyku/.vim/plugin/GetLatestVimScripts.vim
/home/kyku/.vim/plugin/ShowFunc.vim
/home/kyku/.vim/plugin/vimballPlugin.vim
/home/kyku/.vim/plugin/SuperTab.vim
/home/kyku/.vim/plugin/totd.vim
/home/kyku/.vim/GetLatest/cd.vim
/home/kyku/.vim/GetLatest/mru.vim
/home/kyku/.vim/GetLatest/SearchComplete.vim
/home/kyku/.vim/GetLatest/SuperTab.vim
/home/kyku/.vim/syntax/eruby.vim
/home/kyku/.vim/syntax/ruby.vim
/home/kyku/.vim/syntax/netrwlist.vim
/home/kyku/.vim/ftdetect/ruby.vim



Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Raimon Grau
Take a look at SuperTab plugin.

It catches the <c-x> and offers you "all" kind of completions. You'll
have to modify it to offer you <c-o>.   It worked for me


HTH,


On 4/23/06, Kyku <[hidden email]> wrote:

> Hello all,
>
> My main problem is that, well, it doesn't work. I've followed
> instructions in :he ft-c-omni: patched and installed ctags, created tags
> file. Now I edit something press Ctrl-X in insert mode and get:
>
> -- ^X++ mode (/^E/^Y/^L/^]/^F/^I/^K/^D/^V/^N/^P/n/p)
>
> Where is "^O"? If I press Ctrl-O now, it waits for a normal mode
> command. Please help me.
>
> Here are some settings that might be of some interest:
>
> :set omnifunc?
> omnifunc=ccomplete#Complete
>
> :set completeopt?
> completeopt=menu,preview
>
> :version
> VIM - Vi IMproved 7.0e BETA (2006 Apr 16, compiled Apr 16 2006 20:43:17)
> Skompilowany przez kyku@silverthread
> Normalna wersja z GTK2 GUI. Opcje włączone (+) lub nie (-):
> -arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset
> +cindent +clientserver
> +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv
> -cscope +cursorshape
> +dialog_con_gui +diff +digraphs +dnd -ebcdic -emacs_tags +eval +ex_extra
> +extra_search -farsi
> +file_in_path +find_in_path +folding -footer +fork() +gettext
> -hangul_input +iconv +insert_expand
> +jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds
> +localmap +menu +mksession
> +modify_fname +mouse +mouseshape -mouse_dec +mouse_gpm -mouse_jsbterm
> -mouse_netterm +mouse_xterm
> +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra
> -perl +postscript +printer
> -profile -python +quickfix -rightleft -ruby +scrollbind +signs
> +smartindent -sniff +statusline
> -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl
> +terminfo +termresponse
> +textobjects +title +toolbar +user_commands +vertsplit +virtualedit
> +visual +visualextra +viminfo
> +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset
> +xim +xsmp_interact
> +xterm_clipboard -xterm_save
> vimrc systemu: "$VIM/vimrc"
> vimrc użytkownika: "$HOME/.vimrc"
> exrc użytkownika: "$HOME/.exrc"
> gvimrc systemu: "$VIM/gvimrc"
> gvimrc użytkownika: "$HOME/.gvimrc"
> systemowy plik menu: "$VIMRUNTIME/menu.vim"
> odwet dla $VIM-a: "/usr/local/stow/vim7//share/vim"
> Kompilacja: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
> -I/usr/include/gtk-2.0 -I/usr/lib/gtk
> -2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo
> -I/usr/include/pango-1.0 -I/usr/include/gli
> b-2.0 -I/usr/lib/glib-2.0/include -g -O2
> Konsolidacja: gcc -L/usr/local/lib -o vim -lgtk-x11-2.0 -lgdk-x11-2.0
> -latk-1.0 -lgdk_pixbuf-2.0
> -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0
> -lglib-2.0 -lXt -lncurses -l
> acl -lgpm
>
> My extensions:
> /home/kyku/.vim/ftplugin/php_abb.vim
> /home/kyku/.vim/ftplugin/ruby_macros.vim
> /home/kyku/.vim/ftplugin/html_closetag.vim
> /home/kyku/.vim/ftplugin/xml_closetag.vim
> /home/kyku/.vim/ftplugin/eruby.vim
> /home/kyku/.vim/ftplugin/ruby.vim
> /home/kyku/.vim/autoload/netrwFileHandlers.vim
> /home/kyku/.vim/autoload/netrwSettings.vim
> /home/kyku/.vim/autoload/netrw.vim
> /home/kyku/.vim/autoload/vimball.vim
> /home/kyku/.vim/filetype.vim
> /home/kyku/.vim/compiler/eruby.vim
> /home/kyku/.vim/compiler/ruby.vim
> /home/kyku/.vim/compiler/rubyunit.vim
> /home/kyku/.vim/indent/eruby.vim
> /home/kyku/.vim/indent/ruby.vim
> /home/kyku/.vim/indent/php.vim
> /home/kyku/.vim/plugin/quotes.vim
> /home/kyku/.vim/plugin/a.vim
> /home/kyku/.vim/plugin/netrwPlugin.vim
> /home/kyku/.vim/plugin/themes.vim
> /home/kyku/.vim/plugin/cd.vim
> /home/kyku/.vim/plugin/mru.vim
> /home/kyku/.vim/plugin/GetLatestVimScripts.vim
> /home/kyku/.vim/plugin/ShowFunc.vim
> /home/kyku/.vim/plugin/vimballPlugin.vim
> /home/kyku/.vim/plugin/SuperTab.vim
> /home/kyku/.vim/plugin/totd.vim
> /home/kyku/.vim/GetLatest/cd.vim
> /home/kyku/.vim/GetLatest/mru.vim
> /home/kyku/.vim/GetLatest/SearchComplete.vim
> /home/kyku/.vim/GetLatest/SuperTab.vim
> /home/kyku/.vim/syntax/eruby.vim
> /home/kyku/.vim/syntax/ruby.vim
> /home/kyku/.vim/syntax/netrwlist.vim
> /home/kyku/.vim/ftdetect/ruby.vim
>
>
>
>


--
Vi is clearly superior to emacs, since "vi" has only two characters
(and two keystrokes), while "emacs" has five.  (Randy C. Ford)
Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Eric Arnold-3
Search on sourceforge doesn't turn up anything for that name.


On 4/23/06, Raimon Grau <[hidden email]> wrote:

> Take a look at SuperTab plugin.
>
> It catches the <c-x> and offers you "all" kind of completions. You'll
> have to modify it to offer you <c-o>.   It worked for me
>
>
> HTH,
>
>
> On 4/23/06, Kyku <[hidden email]> wrote:
> > Hello all,
> >
> > My main problem is that, well, it doesn't work. I've followed
> > instructions in :he ft-c-omni: patched and installed ctags, created tags
> > file. Now I edit something press Ctrl-X in insert mode and get:
> >
> > -- ^X++ mode (/^E/^Y/^L/^]/^F/^I/^K/^D/^V/^N/^P/n/p)
> >
> > Where is "^O"? If I press Ctrl-O now, it waits for a normal mode
> > command. Please help me.
> >
> > Here are some settings that might be of some interest:
> >
> > :set omnifunc?
> > omnifunc=ccomplete#Complete
> >
> > :set completeopt?
> > completeopt=menu,preview
> >
> > :version
> > VIM - Vi IMproved 7.0e BETA (2006 Apr 16, compiled Apr 16 2006 20:43:17)
> > Skompilowany przez kyku@silverthread
> > Normalna wersja z GTK2 GUI. Opcje włączone (+) lub nie (-):
> > -arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset
> > +cindent +clientserver
> > +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv
> > -cscope +cursorshape
> > +dialog_con_gui +diff +digraphs +dnd -ebcdic -emacs_tags +eval +ex_extra
> > +extra_search -farsi
> > +file_in_path +find_in_path +folding -footer +fork() +gettext
> > -hangul_input +iconv +insert_expand
> > +jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds
> > +localmap +menu +mksession
> > +modify_fname +mouse +mouseshape -mouse_dec +mouse_gpm -mouse_jsbterm
> > -mouse_netterm +mouse_xterm
> > +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra
> > -perl +postscript +printer
> > -profile -python +quickfix -rightleft -ruby +scrollbind +signs
> > +smartindent -sniff +statusline
> > -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl
> > +terminfo +termresponse
> > +textobjects +title +toolbar +user_commands +vertsplit +virtualedit
> > +visual +visualextra +viminfo
> > +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset
> > +xim +xsmp_interact
> > +xterm_clipboard -xterm_save
> > vimrc systemu: "$VIM/vimrc"
> > vimrc użytkownika: "$HOME/.vimrc"
> > exrc użytkownika: "$HOME/.exrc"
> > gvimrc systemu: "$VIM/gvimrc"
> > gvimrc użytkownika: "$HOME/.gvimrc"
> > systemowy plik menu: "$VIMRUNTIME/menu.vim"
> > odwet dla $VIM-a: "/usr/local/stow/vim7//share/vim"
> > Kompilacja: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
> > -I/usr/include/gtk-2.0 -I/usr/lib/gtk
> > -2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo
> > -I/usr/include/pango-1.0 -I/usr/include/gli
> > b-2.0 -I/usr/lib/glib-2.0/include -g -O2
> > Konsolidacja: gcc -L/usr/local/lib -o vim -lgtk-x11-2.0 -lgdk-x11-2.0
> > -latk-1.0 -lgdk_pixbuf-2.0
> > -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0
> > -lglib-2.0 -lXt -lncurses -l
> > acl -lgpm
> >
> > My extensions:
> > /home/kyku/.vim/ftplugin/php_abb.vim
> > /home/kyku/.vim/ftplugin/ruby_macros.vim
> > /home/kyku/.vim/ftplugin/html_closetag.vim
> > /home/kyku/.vim/ftplugin/xml_closetag.vim
> > /home/kyku/.vim/ftplugin/eruby.vim
> > /home/kyku/.vim/ftplugin/ruby.vim
> > /home/kyku/.vim/autoload/netrwFileHandlers.vim
> > /home/kyku/.vim/autoload/netrwSettings.vim
> > /home/kyku/.vim/autoload/netrw.vim
> > /home/kyku/.vim/autoload/vimball.vim
> > /home/kyku/.vim/filetype.vim
> > /home/kyku/.vim/compiler/eruby.vim
> > /home/kyku/.vim/compiler/ruby.vim
> > /home/kyku/.vim/compiler/rubyunit.vim
> > /home/kyku/.vim/indent/eruby.vim
> > /home/kyku/.vim/indent/ruby.vim
> > /home/kyku/.vim/indent/php.vim
> > /home/kyku/.vim/plugin/quotes.vim
> > /home/kyku/.vim/plugin/a.vim
> > /home/kyku/.vim/plugin/netrwPlugin.vim
> > /home/kyku/.vim/plugin/themes.vim
> > /home/kyku/.vim/plugin/cd.vim
> > /home/kyku/.vim/plugin/mru.vim
> > /home/kyku/.vim/plugin/GetLatestVimScripts.vim
> > /home/kyku/.vim/plugin/ShowFunc.vim
> > /home/kyku/.vim/plugin/vimballPlugin.vim
> > /home/kyku/.vim/plugin/SuperTab.vim
> > /home/kyku/.vim/plugin/totd.vim
> > /home/kyku/.vim/GetLatest/cd.vim
> > /home/kyku/.vim/GetLatest/mru.vim
> > /home/kyku/.vim/GetLatest/SearchComplete.vim
> > /home/kyku/.vim/GetLatest/SuperTab.vim
> > /home/kyku/.vim/syntax/eruby.vim
> > /home/kyku/.vim/syntax/ruby.vim
> > /home/kyku/.vim/syntax/netrwlist.vim
> > /home/kyku/.vim/ftdetect/ruby.vim
> >
> >
> >
> >
>
>
> --
> Vi is clearly superior to emacs, since "vi" has only two characters
> (and two keystrokes), while "emacs" has five.  (Randy C. Ford)
>
Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Kyku-2
In reply to this post by Raimon Grau
Rehi,

Changing SuperTab.vim fixed the problem, thank you very much. I have one
more problem with omnicomplete usability. Given the following snippet,
it completes the S<C-xC-o>creen( function but refuses to complete after
p.W<C-xC-o>idth in main().

#include <iostream>

// A nonsense C file.

struct Rectangle
{
    unsigned short X,  Y;
    unsigned short Width, Height;
};

Rectangle Screen()
{
    Rectangle rec = { 0, 0, 1280, 1024 };
    return rec;
}

int main()
{
    Rectangle p;
    // some more editing here with cool omnicompletions.
}

Raimon Grau wrote:

> Take a look at SuperTab plugin.
>
> It catches the <c-x> and offers you "all" kind of completions. You'll
> have to modify it to offer you <c-o>.   It worked for me
>
>
> HTH,
>
>
> On 4/23/06, Kyku <[hidden email]> wrote:
>  
>> Hello all,
>>
>> My main problem is that, well, it doesn't work. I've followed
>> instructions in :he ft-c-omni: patched and installed ctags, created tags
>> file. Now I edit something press Ctrl-X in insert mode and get:
>>
>> -- ^X++ mode (/^E/^Y/^L/^]/^F/^I/^K/^D/^V/^N/^P/n/p)
>>
>> Where is "^O"? If I press Ctrl-O now, it waits for a normal mode
>> command. Please help me.
>>
>> Here are some settings that might be of some interest:
>>
>> :set omnifunc?
>> omnifunc=ccomplete#Complete
>>
>> :set completeopt?
>> completeopt=menu,preview
>>
>> :version
>> VIM - Vi IMproved 7.0e BETA (2006 Apr 16, compiled Apr 16 2006 20:43:17)
>> Skompilowany przez kyku@silverthread
>> Normalna wersja z GTK2 GUI. Opcje włączone (+) lub nie (-):
>> -arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset
>> +cindent +clientserver
>> +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv
>> -cscope +cursorshape
>> +dialog_con_gui +diff +digraphs +dnd -ebcdic -emacs_tags +eval +ex_extra
>> +extra_search -farsi
>> +file_in_path +find_in_path +folding -footer +fork() +gettext
>> -hangul_input +iconv +insert_expand
>> +jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds
>> +localmap +menu +mksession
>> +modify_fname +mouse +mouseshape -mouse_dec +mouse_gpm -mouse_jsbterm
>> -mouse_netterm +mouse_xterm
>> +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra
>> -perl +postscript +printer
>> -profile -python +quickfix -rightleft -ruby +scrollbind +signs
>> +smartindent -sniff +statusline
>> -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl
>> +terminfo +termresponse
>> +textobjects +title +toolbar +user_commands +vertsplit +virtualedit
>> +visual +visualextra +viminfo
>> +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset
>> +xim +xsmp_interact
>> +xterm_clipboard -xterm_save
>> vimrc systemu: "$VIM/vimrc"
>> vimrc użytkownika: "$HOME/.vimrc"
>> exrc użytkownika: "$HOME/.exrc"
>> gvimrc systemu: "$VIM/gvimrc"
>> gvimrc użytkownika: "$HOME/.gvimrc"
>> systemowy plik menu: "$VIMRUNTIME/menu.vim"
>> odwet dla $VIM-a: "/usr/local/stow/vim7//share/vim"
>> Kompilacja: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
>> -I/usr/include/gtk-2.0 -I/usr/lib/gtk
>> -2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo
>> -I/usr/include/pango-1.0 -I/usr/include/gli
>> b-2.0 -I/usr/lib/glib-2.0/include -g -O2
>> Konsolidacja: gcc -L/usr/local/lib -o vim -lgtk-x11-2.0 -lgdk-x11-2.0
>> -latk-1.0 -lgdk_pixbuf-2.0
>> -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0
>> -lglib-2.0 -lXt -lncurses -l
>> acl -lgpm
>>
>> My extensions:
>> /home/kyku/.vim/ftplugin/php_abb.vim
>> /home/kyku/.vim/ftplugin/ruby_macros.vim
>> /home/kyku/.vim/ftplugin/html_closetag.vim
>> /home/kyku/.vim/ftplugin/xml_closetag.vim
>> /home/kyku/.vim/ftplugin/eruby.vim
>> /home/kyku/.vim/ftplugin/ruby.vim
>> /home/kyku/.vim/autoload/netrwFileHandlers.vim
>> /home/kyku/.vim/autoload/netrwSettings.vim
>> /home/kyku/.vim/autoload/netrw.vim
>> /home/kyku/.vim/autoload/vimball.vim
>> /home/kyku/.vim/filetype.vim
>> /home/kyku/.vim/compiler/eruby.vim
>> /home/kyku/.vim/compiler/ruby.vim
>> /home/kyku/.vim/compiler/rubyunit.vim
>> /home/kyku/.vim/indent/eruby.vim
>> /home/kyku/.vim/indent/ruby.vim
>> /home/kyku/.vim/indent/php.vim
>> /home/kyku/.vim/plugin/quotes.vim
>> /home/kyku/.vim/plugin/a.vim
>> /home/kyku/.vim/plugin/netrwPlugin.vim
>> /home/kyku/.vim/plugin/themes.vim
>> /home/kyku/.vim/plugin/cd.vim
>> /home/kyku/.vim/plugin/mru.vim
>> /home/kyku/.vim/plugin/GetLatestVimScripts.vim
>> /home/kyku/.vim/plugin/ShowFunc.vim
>> /home/kyku/.vim/plugin/vimballPlugin.vim
>> /home/kyku/.vim/plugin/SuperTab.vim
>> /home/kyku/.vim/plugin/totd.vim
>> /home/kyku/.vim/GetLatest/cd.vim
>> /home/kyku/.vim/GetLatest/mru.vim
>> /home/kyku/.vim/GetLatest/SearchComplete.vim
>> /home/kyku/.vim/GetLatest/SuperTab.vim
>> /home/kyku/.vim/syntax/eruby.vim
>> /home/kyku/.vim/syntax/ruby.vim
>> /home/kyku/.vim/syntax/netrwlist.vim
>> /home/kyku/.vim/ftdetect/ruby.vim
>>
>>
>>
>>
>>    
>
>
> --
> Vi is clearly superior to emacs, since "vi" has only two characters
> (and two keystrokes), while "emacs" has five.  (Randy C. Ford)
>  

Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Bram Moolenaar

Kyku wrote:

> Changing SuperTab.vim fixed the problem, thank you very much. I have one
> more problem with omnicomplete usability. Given the following snippet,
> it completes the S<C-xC-o>creen( function but refuses to complete after
> p.W<C-xC-o>idth in main().
>
> #include <iostream>
>
> // A nonsense C file.
>
> struct Rectangle
> {
>     unsigned short X,  Y;
>     unsigned short Width, Height;
> };
>
> Rectangle Screen()
> {
>     Rectangle rec = { 0, 0, 1280, 1024 };
>     return rec;
> }
>
> int main()
> {
>     Rectangle p;
>     // some more editing here with cool omnicompletions.
> }

Your syntax is wrong: you define "struct Rectangle" but then use
"Rectangle" without "struct".

--
The psychic said, "God bless you."  I said, "I didn't sneeze."  She
looked deep into my eyes and said, "You will, eventually."  And, damn
if she wasn't right.  Two days later, I sneezed.  --Ellen Degeneres

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         ///
Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Kyku-2
Hi,

In fact, it is a C++ program, as #include <iostream> might suggest. The
comment should say "A nonsense C++ file", sorry. In C++ one doesn't need
to write 'class', 'struct' or 'union' in variables definitions.  Do you
also mean that ccomplete doesn't support C++ yet? 10e15 C++ users in
this galaxy are rather disappointed ;-)

Keep up good work with Vim.


Bram Moolenaar wrote:

> Kyku wrote:
>
>  
>> Changing SuperTab.vim fixed the problem, thank you very much. I have one
>> more problem with omnicomplete usability. Given the following snippet,
>> it completes the S<C-xC-o>creen( function but refuses to complete after
>> p.W<C-xC-o>idth in main().
>>
>> #include <iostream>
>>
>> // A nonsense C file.
>>
>> struct Rectangle
>> {
>>     unsigned short X,  Y;
>>     unsigned short Width, Height;
>> };
>>
>> Rectangle Screen()
>> {
>>     Rectangle rec = { 0, 0, 1280, 1024 };
>>     return rec;
>> }
>>
>> int main()
>> {
>>     Rectangle p;
>>     // some more editing here with cool omnicompletions.
>> }
>>    
>
> Your syntax is wrong: you define "struct Rectangle" but then use
> "Rectangle" without "struct".
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Bram Moolenaar

Kyku -

> In fact, it is a C++ program, as #include <iostream> might suggest. The
> comment should say "A nonsense C++ file", sorry. In C++ one doesn't need
> to write 'class', 'struct' or 'union' in variables definitions.  Do you
> also mean that ccomplete doesn't support C++ yet? 10e15 C++ users in
> this galaxy are rather disappointed ;-)

The completion supports C++ for as far as it looks like C.

C++ is much too complicated to do completion for without "half a
compiler".  Nice challenge for someone, too much for me...

- Bram

--
I'd like to meet the man who invented sex and see what he's working on now.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         ///
Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Kyku-2
Maybe it's not about implementing half of a compiler, but only the
features that are used most often. What's more, if one has:

struct foo { /* ... */ };
typedef struct foo foo;

int main() {
  foo myfoo;
  /* ... */
}

then omnicompletion works for myfoo, even if it doesn't see "struct"
before foo.

Bram Moolenaar wrote:

> Kyku -
>
>  
>> In fact, it is a C++ program, as #include <iostream> might suggest. The
>> comment should say "A nonsense C++ file", sorry. In C++ one doesn't need
>> to write 'class', 'struct' or 'union' in variables definitions.  Do you
>> also mean that ccomplete doesn't support C++ yet? 10e15 C++ users in
>> this galaxy are rather disappointed ;-)
>>    
>
> The completion supports C++ for as far as it looks like C.
>
> C++ is much too complicated to do completion for without "half a
> compiler".  Nice challenge for someone, too much for me...
>
> - Bram
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Bram Moolenaar

Kyku wrote:

> Maybe it's not about implementing half of a compiler, but only the
> features that are used most often. What's more, if one has:
>
> struct foo { /* ... */ };
> typedef struct foo foo;
>
> int main() {
>   foo myfoo;
>   /* ... */
> }
>
> then omnicompletion works for myfoo, even if it doesn't see "struct"
> before foo.

This is correct C, and Vim knows about typedefs, thus it works.
You are using confusing names here.  If you have:

struct foo { /* ... */ };
typedef struct foo foo_t;

int main() {
  foo myfoo;
  /* ... */
}

The it wouldn't work, because it's not valid C.

--
Even got a Datapoint 3600(?) with a DD50 connector instead of the
usual DB25...  what a nightmare trying to figure out the pinout
for *that* with no spex...

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         ///
Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Kyku-2
Ok, using the old saying "Use the force, read the source" I browsed
ccomplete.vim a little. If I knew Vim scripting a little, I'd do the
following:

After line 406:
  if we're dealing with C++ file:
    if item['kind'] is 'c', 'u' or 's':
       kind2name = {'c': 'class', 'u': 'union', 's': 'struct'}
       call StructMembers for kind2name[item['kind']] . ':' . tokens[tidx]

That should do the trick. What do you think?

Bram Moolenaar wrote:

> Kyku wrote:
>
>  
>> Maybe it's not about implementing half of a compiler, but only the
>> features that are used most often. What's more, if one has:
>>
>> struct foo { /* ... */ };
>> typedef struct foo foo;
>>
>> int main() {
>>   foo myfoo;
>>   /* ... */
>> }
>>
>> then omnicompletion works for myfoo, even if it doesn't see "struct"
>> before foo.
>>    
>
> This is correct C, and Vim knows about typedefs, thus it works.
> You are using confusing names here.  If you have:
>
> struct foo { /* ... */ };
> typedef struct foo foo_t;
>
> int main() {
>   foo myfoo;
>   /* ... */
> }
>
> The it wouldn't work, because it's not valid C.
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Bram Moolenaar

Kyku wrote:

> Ok, using the old saying "Use the force, read the source" I browsed
> ccomplete.vim a little. If I knew Vim scripting a little, I'd do the
> following:
>
> After line 406:
>   if we're dealing with C++ file:
>     if item['kind'] is 'c', 'u' or 's':
>        kind2name = {'c': 'class', 'u': 'union', 's': 'struct'}
>        call StructMembers for kind2name[item['kind']] . ':' . tokens[tidx]
>
> That should do the trick. What do you think?

I don't think this gives good results.  A name can be defined in several
ways with different types.  If you omit the "struct" like you did in
your first example it is not valid C and completion _should_ fail.  I
don't know why C++ would allow this, looks like a bug to me (so do many
others things in C++ :-).

--
You were lucky. We lived for three months in a brown paper bag in a
septic tank. We used to have to get up at six o'clock in the morning,
clean the bag, eat a crust of stale bread, go to work down mill for
fourteen hours a day week in-week out. When we got home, our Dad
would thrash us to sleep with his belt!

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         ///
Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Kyku-2
I wrote this pseudo-code ONLY for C++/./  If we're not dealing with C++
then the code simply doesn't execute, and you get the old behavior, so
the completion WILL FAIL in C.

Defining variables only with type name (and without 'struct' keyword
before this type name) is a well-established language feature that is
used by almost all C++ programmers. Why do you call this a bug?

Bram Moolenaar wrote:

> Kyku wrote:
>
>  
>> Ok, using the old saying "Use the force, read the source" I browsed
>> ccomplete.vim a little. If I knew Vim scripting a little, I'd do the
>> following:
>>
>> After line 406:
>>   if we're dealing with C++ file:
>>     if item['kind'] is 'c', 'u' or 's':
>>        kind2name = {'c': 'class', 'u': 'union', 's': 'struct'}
>>        call StructMembers for kind2name[item['kind']] . ':' . tokens[tidx]
>>
>> That should do the trick. What do you think?
>>    
>
> I don't think this gives good results.  A name can be defined in several
> ways with different types.  If you omit the "struct" like you did in
> your first example it is not valid C and completion _should_ fail.  I
> don't know why C++ would allow this, looks like a bug to me (so do many
> others things in C++ :-).
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Bram Moolenaar

Kyku -

> I wrote this pseudo-code ONLY for C++/./  If we're not dealing with C++
> then the code simply doesn't execute, and you get the old behavior, so
> the completion WILL FAIL in C.
>
> Defining variables only with type name (and without 'struct' keyword
> before this type name) is a well-established language feature that is
> used by almost all C++ programmers. Why do you call this a bug?

Because you can't see what you are doing and it's not backwards
compatible with C.  One of the examples of a feature of C++ that makes
it more difficult to understand the code.  It may make writing code a
little bit easier, but code is read ten times more often than it's
written.

- Bram

--
Luxury. We used to have to get out of the lake at three o'clock in the
morning, clean the lake, eat a handful of hot gravel, go to work at the
mill every day for tuppence a month, come home, and Dad would beat us
around the head and neck with a broken bottle, if we were LUCKY!

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         ///
Reply | Threaded
Open this post in threaded view
|

Re: Need help with omnicompletions

Kyku-2
Ok, it's your opinion. I could argue, but I value your time. Anyhow,
there are zillions of us, unenlightened C++ programmers, who would like
to use omnicompletion when editing code with their favorite editor. Make
these lower beings a favor and put those several additional lines to
ccomplete.vim. You will lose nothing when editing normal C files.

Bram Moolenaar wrote:

> Kyku -
>
>  
>> I wrote this pseudo-code ONLY for C++/./  If we're not dealing with C++
>> then the code simply doesn't execute, and you get the old behavior, so
>> the completion WILL FAIL in C.
>>
>> Defining variables only with type name (and without 'struct' keyword
>> before this type name) is a well-established language feature that is
>> used by almost all C++ programmers. Why do you call this a bug?
>>    
>
> Because you can't see what you are doing and it's not backwards
> compatible with C.  One of the examples of a feature of C++ that makes
> it more difficult to understand the code.  It may make writing code a
> little bit easier, but code is read ten times more often than it's
> written.
>
> - Bram
>
>