Skip to content
/ scnvim Public
forked from davidgranstrom/scnvim

Neovim frontend for SuperCollider.

License

Notifications You must be signed in to change notification settings

mxw/scnvim

 
 

Repository files navigation

scnvim

Neovim frontend for SuperCollider.

unit tests lint and style check docs

Table of content

News

This plugin has recently undergone a big rewrite, take a look at the installation and usage sections to update your config.

Please report any issues or bugs on the issue tracker.

Have other questions? Start a discussion or join the IRC channel.

Features

  • Post window output is displayed in a scratch buffer
    • Uses a split or a floating window for display
    • Navigate/move/copy etc. as with any other window
    • Toggle back if hidden automatically on errors
  • Automatic display of function signatures
  • Status line widgets
    • Display SuperCollider server status in the status line
  • Snippet generator
    • Generates snippets for creation methods in SCClassLibrary.
  • Can be used with Neovim GUI frontends
  • Supports on-demand loading
  • Context aware (block or line) evaluation (like Cmd-Enter in ScIDE)
  • Flashy eval flash (configurable)
  • Partial Document support (e.g. thisProcess.nowExecutingPath, .load etc.)
  • Plain text help system for SuperCollider documentation
    • Evaluate code examples inside the help buffer

Installation

Requirements

Install

use {
  'davidgranstrom/scnvim',
  config = function()
    require('scnvim').setup()
  end
}
Plug 'davidgranstrom/scnvim'

" add this after calling plug#end()

lua << EOF
require('scnvim').setup()
EOF

Verify

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

Usage

Configuration

scnvim is configurable from lua only. Here is an example configuration that you can copy and paste to your init.vim.

lua << EOF
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,
    },
  },
}
EOF

Start

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

Commands

Command Description
SCNvimStart Start SuperCollider
SCNvimStop Stop SuperCollider
SCNvimRecompile Recompile SCClassLibrary
SCNvimGenerateAssets Generate tags, syntax, snippets etc.
SCNvimHelp <subject> Open help for <subject> (By default mapped to K)
SCNvimStatusLine Start 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!

  • fzf-sc
    • Combine the magic of fuzzy searching with the magic of SuperCollider in Neovim
  • nvim-supercollider-piano
    • Play SuperCollider synths using your (computer) keyboard in neovim!
  • scnvim-tmux
    • Redirect post window ouput to a tmux pane.
  • scnvim-logger
    • Log post window output to a file (example scnvim extension)

Supported platforms

  • Linux
  • macOS
  • Windows (tested with nvim-qt and nvim.exe in Windows PowerShell)

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 <https://www.gnu.org/licenses/>.

About

Neovim frontend for SuperCollider.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 60.3%
  • SuperCollider 18.8%
  • Vim Script 13.1%
  • Scala 7.2%
  • Makefile 0.6%