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.
Vim autocomplete dictionary file for Vex
10083 10 3- kursad
- Member
- 88 posts
- Joined: March 2010
- Offline
- mark
- Staff
- 2638 posts
- Joined: July 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,
- kursad
- Member
- 88 posts
- Joined: March 2010
- Offline
- kursad
- Member
- 88 posts
- Joined: March 2010
- Offline
- mark
- Staff
- 2638 posts
- Joined: July 2005
- Offline
kursadFor hscript expressions (needs a little formatting):
Mark
Do you know any similar trick for internal expressions and Python commands?
% 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.
- kursad
- Member
- 88 posts
- Joined: March 2010
- Offline
- Alanw
- Member
- 320 posts
- Joined: Aug. 2007
- Offline
- DougRichardson
- Member
- 29 posts
- Joined: May 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).
- Chats
- Member
- 43 posts
- Joined: Dec. 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
- DougRichardson
- Member
- 29 posts
- Joined: May 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.
- Chats
- Member
- 43 posts
- Joined: Dec. 2010
- Offline
-
- Quick Links