SCNVim - A NeoVim frontend for SuperCollider

I’m not making an independent topic for this but another small plugin utilizing the api of scnvim to create magic: fzf-sc. This one uses the fzf.vim plugin to allow fuzzy searching basically anything in SuperCollider and executing SuperCollider code with the result of that search.

4 Likes

So cool can’t wait to play with this

I’ve never had time to dig deeply into SCNVim, but even using it a bit has majorly increased my user experience. One issue I haven’t solved yet is running multiple SC files at the same time. I used to have pieces composed in two files - one with the SynthDefs, one with controls for them. I’ve found ways around this and it’s not a big deal, but I’m wondering how I can use multiple files (buffers?) at the same time without booting the server twice. This is a pretty serious noob question I think but maybe someone has the answer?

Newbie questions are more than welcome! When you run the :SCnvimStart command you get an sclang which receives code every time you evaluate code in your files. If you want to have multiple files open you can for example open a new tab using :tabnew other-file.scd or you can start nvim with all the files you want to edit like this: nvim firstfile.scd secondfile.scd -p. Does that make sense ?

If you open a separate nvim instance with supercollider files you get a separate sclang for that one.

This article series on vim is absolutely brilliant. The first article is aimed at beginners and then it gets progressively more advanced as you go. Highly recommended

3 Likes

Awesome, thankyou! Keen to check out those articles when I get more time…

Alternatively, if you don’t want tabs but only new buffers, you can just run :e otherfile.scd to open it in a separate buffer. After that you can use any number of commands to jump back and forth between the open buffers. My personal favorite is fzf-vim, where I have bound ctrl-b to listing open buffers, ctrl-g to search for a text string in any open buffer and ctrl-p to open a file anywhere in the current folder or subfolder. Makes for an incredibly fast way to jump between many files.

3 Likes

Wow. This is amazing. Thank you for building this.

Hey @madskjeldgaard, thanks for the info here. Have been wanting to look at an alternative editing environment for a long time. Got this set up last night and seems great so far. Also thanks for your other thread Tips and tricks: SuperCollider on Arch-based operating systems, really appreciate it.

1 Like

Another silly supercollider plugin has seen the light of day

7 Likes

Not silly. Life-changing!

I’m in bed after an operation and trying to get my SCNvim up to scratch. At the moment I’m trying to get luasnips and fzf-sc happening, both of those are giving error messages when I run nvim:

Error detected while processing /home/jordan/.config/nvim/init.vim:
line   60:
E5105: Error while calling lua chunk: /home/jordan/.config/nvim/plugged/fzf-sc/lua/fzf-sc.lua:10: attempt to call field 'cmd' (a nil value)
Error detected while processing /home/jordan/.config/nvim/plugged/LuaSnip/plugin/luasnip.vim:
line   37:
E5105: Error while calling lua chunk: ...n/.config/nvim/plugged/LuaSnip/lua/luasnip/util/util.lua:497: attempt to index field 'fn' (a nil value)

Maybe some nvim/lua gurus here could have a look? Thanks!

Hope you get well soon !

What version of neovim are you running ? You need at least v0.5.0 and preferably 0.5.1 since these offer lua support (which is what these plugins depend on).

Are there any good resources for configuring neovim (preferably in LUA)?

Hi Cian

There are some lua specific stuff here, but I think a lot of it assumes knowledge of vim, but anyways:

This one seems to give a nice overview I think:
https://icyphox.sh/blog/nvim-lua/

And then using that knowledge in conjunction with what is in the excellent help system of neovim would be a way to go. I think there’s also some youtube tutorials as well

2 Likes

any tips on how to get luasnip to work for scnvim?
luasnip support has been added right? i added luasnip to source for nvim-cmp but the scnvim generated snippets are not showing up :frowning:

Sorry I forgot to add instructions on doing that.

Follow the normal instructions to setup luasnip, and then you can insert all the scnvim snippets like this:

vim.g.scnvim_snippet_format = "luasnip"
require'luasnip'.snippets.supercollider = require'scnvim/utils'.get_snippets()

Then recompile your scnvimtags+snippets using :SCNvimTags and restart neovim, then you should be good to go.

1 Like

And then to get it working with nvim cmp you need to add luasnip as a source in nvim cmp. See info here: https://github.com/hrsh7th/nvim-cmp

1 Like

Well, that’s that solved, now I just need to learn how this all works! Thanks!

If there are any tutorials by Neovim users are configuring a usable setup I’d love to learn. When only using SC, I had tended to use the SCIDE. Lately I’ve been experimenting with both Tidal and SC at the same time. Both work in Neovim (and eMacs - which I’ve also tried). I like Neovim the best, but just seems more difficult to me than it should be to set up a standard sort of layout. I’ve been using Atom across multiple platforms instead.

I also find the commands (at least without configuring) a bit hard to get used to. Obviously this is something I’m interested in learning, especially in context. So, if there are (or will be) some tutorials, I’d be extremely grateful!

Thanks,
Isaac