Vim autocomplete dictionary file for Vex

   10090   10   3
User Avatar
Member
88 posts
Joined: 3月 2010
Offline
Hi

I have created this basic dictionary file for Vim. This is to get auto completion while writing Vex code in Vim.

You need to set couple things to get it working properly like sourcing in the command line, or in your .vimrc or in vex filetype plugin(if you have one)

Here is what I have in my vex.vim filetype plugin

“set dictionary+=~/.vim/dict/houdini/Vcc_Dictionary.txt iskeyword+=.,”

So for example everytime I have .vfl file loaded in Vim I get autocompletion of Vex functions.

Attachments:
Vcc_Dictionary.txt.zip (1.3 KB)

User Avatar
スタッフ
2638 posts
Joined: 7月 2005
Offline
kursad
Hi

I have created this basic dictionary file for Vim. This is to get auto completion while writing Vex code in Vim.

You need to set couple things to get it working properly like sourcing in the command line, or in your .vimrc or in vex filetype plugin(if you have one)

Here is what I have in my vex.vim filetype plugin

“set dictionary+=~/.vim/dict/houdini/Vcc_Dictionary.txt iskeyword+=.,”

So for example everytime I have .vfl file loaded in Vim I get autocompletion of Vex functions.

Just in case you didn't know, you can streamline this process:
% vcc -X surface > /tmp/Vcc_dictionary.txt

Then, it's fairly simple to create the required format by running the VIM keys:
/Functions^Md1G<G:%s/(.*^M:%s/.* ^M1G!Guniq^M


There's an embedded space in there, but you can probably copy-paste up until the ^M's, then just hit enter there.

Cheers,
User Avatar
Member
88 posts
Joined: 3月 2010
Offline
Mark, that is very nice indeed. Thanks for the tip.

I just needed a simple dictionary file, so I just copied the content from the help and ran a macro to clean up the file. It works very well. I will use your method to see if I can extend it to tooltip help in Vim.
User Avatar
Member
88 posts
Joined: 3月 2010
Offline
Mark

Do you know any similar trick for internal expressions and Python commands?
User Avatar
スタッフ
2638 posts
Joined: 7月 2005
Offline
kursad
Mark

Do you know any similar trick for internal expressions and Python commands?
For hscript expressions (needs a little formatting):
% echo exhelp | hbatch > hscript.help


For hscript commands:
% echo help | hbatch > hscript.commands


For Python? Maybe something like:
%hython
>>> print ‘\n’.join(dir(hou))

Though that's probably overkill.
User Avatar
Member
88 posts
Joined: 3月 2010
Offline
Mark, these are definetely great.

thanks
User Avatar
Member
320 posts
Joined: 8月 2007
Offline
Very nice indeed. Thanks
www.alan-warren.com
User Avatar
Member
29 posts
Joined: 5月 2018
Offline
To make this a little easier to setup, I created a VEX plugin for Vim [github.com] that contains the syntax file and dictionary created as described by mark. The plugin should be usable by any of the common Vim plugin managers (though I only tested with Vundle).
User Avatar
Member
43 posts
Joined: 12月 2010
Offline
DougRichardson
To make this a little easier to setup, I created a VEX plugin for Vim [github.com] that contains the syntax file and dictionary created as described by mark. The plugin should be usable by any of the common Vim plugin managers (though I only tested with Vundle).

Hi Doug,
I installed your plugin to Neovim, and it's great!

I'm now using neovim for my vex editing.. however as far as I can tell the generate-omnifunc-dictionary.py file generates a special kind of completion dictionary, that sounds like it's specific for something called omnifunc? Have I go that right? Sorry I'm still fairly new to (neo)vim.

Anyway I use coc-nvim and ale for auto completion and snippets, and I was wondering if you knew if that dictionary file was compatible with coc?
Also, the snippets file in vexsnippets/UltiSnips seems to be working well, but seems to be fairly incomplete, only having snippets for some functions.. do you know if there's a way to generate a complete snippets file for all the vex functions in the cvex context?

Cheers and apologies if I'm not understanding the plugin correctly, either way as it is working now for me with the syntax highlighting alone it's great
MC
User Avatar
Member
29 posts
Joined: 5月 2018
Offline
Chats
I'm now using neovim for my vex editing.. however as far as I can tell the generate-omnifunc-dictionary.py file generates a special kind of completion dictionary, that sounds like it's specific for something called omnifunc? Have I go that right? Sorry I'm still fairly new to (neo)vim.

Anyway I use coc-nvim and ale for auto completion and snippets, and I was wondering if you knew if that dictionary file was compatible with coc?

I'm not familiar with neovim, but coc looks like a Language Server Protocol based project, which is a different code completion mechanism than omnifunc. Omnifunc is specific to vim (though may also be available in neovim), you can read more about it here [vimhelp.org]. The gist is you do a Control+X Control-O and then get code completion options.

Language Server Protocol, on the other hand, allows someone to write an editor independent code completer, which can then be used by any LSP client (like neovim or Visual Studio Code). In the long run, LSP is probably a better solution to code completion than omnifunc since it allows the code completion work to be done one time, instead of one time for each editor. Ideally, SideFX would provide an LSP implementation for VEX.

Chats
Also, the snippets file in vexsnippets/UltiSnips seems to be working well, but seems to be fairly incomplete, only having snippets for some functions.. do you know if there's a way to generate a complete snippets file for all the vex functions in the cvex context?

Snippets are generally for commonly used code (like for loops). In my experience, I have not seen a UtiliSnips that provides a snip for each function… that is what code completion is for.
User Avatar
Member
43 posts
Joined: 12月 2010
Offline
Ah cool ok that makes perfect sense!

Thanks for the detailed reply, maybe I'll try regular vim with Omnifunc, but in the meantime using neovim with the syntac highlighting from your plugin is working great anyway!

Cheers again
MC
  • Quick Links