Home

Awesome

scnvim

Neovim frontend for SuperCollider.

unit tests lint and style check docs

Table of content

Features

Installation

Requirements

Install

use { 'davidgranstrom/scnvim' }
Plug 'davidgranstrom/scnvim'

Verify

Run :checkhealth scnvim to verify that the installation was successful.

Usage

Configuration

scnvim uses lua for configuration. Below is an example that you can copy and paste to your init.lua.

If you are using init.vim for configuration you will need to surround the call to scnvim.setup in a lua-heredoc:

" file: init.vim
lua << EOF
require('scnvim').setup({})
EOF

Example

local scnvim = require 'scnvim'
local map = scnvim.map
local map_expr = scnvim.map_expr

scnvim.setup({
  keymaps = {
    ['<M-e>'] = map('editor.send_line', {'i', 'n'}),
    ['<C-e>'] = {
      map('editor.send_block', {'i', 'n'}),
      map('editor.send_selection', 'x'),
    },
    ['<CR>'] = map('postwin.toggle'),
    ['<M-CR>'] = map('postwin.toggle', 'i'),
    ['<M-L>'] = map('postwin.clear', {'n', 'i'}),
    ['<C-k>'] = map('signature.show', {'n', 'i'}),
    ['<F12>'] = map('sclang.hard_stop', {'n', 'x', 'i'}),
    ['<leader>st'] = map('sclang.start'),
    ['<leader>sk'] = map('sclang.recompile'),
    ['<F1>'] = map_expr('s.boot'),
    ['<F2>'] = map_expr('s.meter'),
  },
  editor = {
    highlight = {
      color = 'IncSearch',
    },
  },
  postwin = {
    float = {
      enabled = true,
    },
  },
})

Start

Open a new file in nvim with a .scd or .sc extension and type :SCNvimStart to start SuperCollider.

Commands

CommandDescription
SCNvimStartStart SuperCollider
SCNvimStopStop SuperCollider
SCNvimRecompileRecompile SCClassLibrary
SCNvimGenerateAssetsGenerate tags, syntax, snippets etc.
SCNvimHelp <subject>Open help for <subject> (By default mapped to K)
SCNvimStatusLineStart to poll server status to be displayed in the status line

Additional setup

Run :SCNvimGenerateAssets after starting SuperCollider to generate syntax highlighting and tags.

The plugin should work "out of the box", but if you want even more fine-grained control please have a look at the configuration section in the wiki.

Documentation

Extensions

The extension system provides additional functionalities and integrations. If you have made a scnvim extension, please open a PR and add it to this list!

Supported platforms

Note to Windows users

The path to sclang.exe needs to be specified in the config:

local scnvim = require('scnvim')
scnvim.setup({
  sclang = {
    cmd = 'C:/Program Files/SuperCollider-3.12.2/sclang.exe'
  },
})

Modify the sclang.cmd to point to where SuperCollider is installed on your system.

Additionally, to be able to boot the server you will need to add the following to startup.scd:

if (\SCNvim.asClass.notNil) {
  Server.program = (Platform.resourceDir +/+ "scsynth.exe").quote;
}

License

scnvim - Neovim frontend for SuperCollider
Copyright © 2018 David Granström

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.