SCNVim - A NeoVim frontend for SuperCollider

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

That’s usually how I work as well most of the time when working on new music. Neovim is really convenient because it offers an unified working environment with only one set of bindings.

I think that I must be using 10% of all of the SCNVim features but it’s already enough to feel at home. The most important part, IMO, was to configure UltiSnips and to generate completions. After that, I figured out that SCLang was already quite capable for invoking the documentation when needed or for opening little GUIs that can be helpful sometimes (s.makeGui, Function.help, etc…). When switching to Neovim, I also had to learn some cryptic commands that are usually launched by the various GUI Menus (thisProcess.recompile, etc…).

For everything else, I think that it’s all a matter of configuring Neovim to your liking. There is already too much stuff to learn to truly be a NeoVim wizard (Lua, Plugins, infinite Vim documentation scrolling). My only regret so far is that it’s not really convenient to spend my life in a Neovim process just like people tend to do when using Emacs (reading mail, writing notes, browsing .pdf, etc…).

I would recommand you to just switch to Neovim and take note of all the pain points. After that, it’s usually really easy to hack solutions or to create custom bindings and functions.

PS: one thing I’ve always dreamed of is to have a dedicated dynamic console mixer for SC, running in a GUI window lying around my editor. Haven’t found it yet so I’m just running Ableton as a dedicated console \o/.

Have you tried the built in commands for that stuff? You don’t need to make sclang hacks for recompiling etc. It’s already there and ready to use. Open up vim and run the command :h scnvim to see all the possibilities. Eg :SCNvimRecompile to recompile, :SCNvimHelp <subject> to open up help, etc.

Also, my advice for starting with (neo)vim is to start with the basics - don’t plunge in too deep to begin with by installing a lot of plugins etc. Further up this thread there are some resources for getting started that should be helpful, otherwise check out youtube if you want video tutorials. I personally made the mistake of skipping the basics of navigation, motion, commands etc when I started with Vim and I regret it. And use the help system when you can - there is a bunch of info in there. Hope this helps :slight_smile:

1 Like