SCNVim - A NeoVim frontend for SuperCollider

The real problem is not really learning the commands but building muscle memory for them. Once you repeat the most basic operations one thousand times they start to become automatic actions just like most of us learned to copy/cut/paste or to manipulate windows. There are great resources to learn but the trick is not to read about it but to practice actively. For that, you can use the good old vimtutor, Vim adventures and probably many many other resources.

Using Vim is just like playing a musical instrument. Learning scales can seem daunting at first but after just a week of practice, you’ll be flying over the keyboard like it’s nothing.

1 Like

@Bubo - Well said! I play guitar and other things as well, same things with all - practice, practice, practice. However, editing text is one thing with Vim, actually making music within plugins is another. But all comes back to just what you’ve stated, muscle memory. It’s a bit of a hump, but well earned instrument in itself it seems.

I’m also pretty sure this is what keeps us healthy, especially our minds… until you get lost in code frustration on top of usage frustration. As such, I haven’t quite climbed the hill yet.

You mean a mixer in the terminal? Probably not super hard to knock something like that up. I’ve had a similar thought myself. Maybe I’ll knock something up in Rust when I’ve finished the…uh… quite long list of other projects I’m working on.

Ha. I learned using VI remoting to a remote Solaris server in the mid 90s. The only editor on that damn machine, so you really didn’t have any choice but to learn it.

3 Likes

I added some more info on how to configure snippets and completion in the wiki:

2 Likes

I found the default scnvim binding of ctrl-e for code evaluation to be unusable on a macbook keyboard. I’ve tried a couple different bindings but so far I’ve settled on ctrl+space.

The one thing I can’t figure out is implementation look-up, cmd+i in the SC ide. So I end up switching back and forth between scide and scnvim. Whenever I need to develop something more complex I end up using scide mostly for the implementation look up.

In neovim you can use g[ which is really convenient because it is the same binding you use to look up implementation in other languages and it is the same binding used for following links in the neovim help files.

And then use ctrl-o to jump back.

1 Like

I have to say, Neovim really is amazing. I’m still getting a bit of a grip, but with the right setup works beautifully. Thank you!

4 Likes

vim.g.scnvim_postwin_orientation = ‘v’
vim.g.scnvim_postwin_direction = ‘left’

the orientation and direction settings aren’t really working for me in lua for some reason. anyone have this problem as well?

also, to change the scnvim evaluation flash color:
highlight SCNvimEval guifg=black guibg=white ctermfg=black ctermbg=white

i need this in order to get it to work properly right?
augroup scnvim_vimrc
autocmd!
autocmd ColorScheme *
\ highlight SCNvimEval guifg=black guibg=cyan ctermfg=black ctermbg=cyan
augroup END

but is there an easy way to setup autocmd in lua? T_T

1 Like

Looks great. Congratulations!

I’m finding that the results are poor. It brings up matches in non SC file types. Probably need to spend more time figuring this out.

You can try the mapping suggested at the top of the “additional configuration” page of the wiki linked above.

Not sure why it would open non SC files though - what is the file type of the document you are doing this in ? Run :set filetype to output

I’m not sure if autocommands have been ported to lua yet. Last time I checked it hadn’t and so I usually run my autocommands like you inside of vim.cmd :slight_smile:

PS nice clean setup function !

Example:

vim.cmd("highlight SCNvimEval guifg=black guibg=white ctermfg=black ctermbg=white")`

And here an example of autocommand (not SC related but should still…)

vim.cmd[[
	autocmd BufRead,BufNewFile /tmp/neomutt* :TZMinimalist
	]]

it outputs

filetype=scnvim

I don’t know about your configuration of course, but in my case the filetype needs to be set to “supercollider” for syntax highlighting etc. to work. So maybe you could try

:set filetype=supercollider

and see if it improves the situation.

1 Like

Thanks Mads, really digging this. Honestly it was your original pandemic video that made me ask WTH is this? Starting to realize the power of this. Also wondering at my age how I haven’t used. Still getting my editing skills down, but my new favorite thing to work on (which goes beyond music).

Okay, noob neovim question here. I realize this is probably more neovim than an SCNVim question but thought maybe someone here could help first. I’d like to create key-maps for the basic commands like :SCVNvimStart and :SCVNvimStop. I know this is probably rudimentary, but will help with other things as well. I assume that these are based on file-type mode. I know I probably deserve a few laughs for this.

I don’t have a Lua configuration (yet), but you can just put something like this into your init.vim (should be found at ~/.config/nvim/):

autocmd FileType supercollider nnoremap <F2> :SCNvimStart<CR>

This will (as an example) map F2 in Nvim’s normal mode to start up scnvim. <CR> stands for the Enter key to actually execute the command.

1 Like

@flechtwerk - Thank you! I think that was the shortcut I needed. I really appreciate this thread as it lets people like me ask stupid questions and then learn from the answers :slight_smile:

4 Likes