Awesome
scnvim
Neovim frontend for SuperCollider.
Table of content
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
- Neovim >= 0.7
- SuperCollider
Install
- Using packer.nvim
use { 'davidgranstrom/scnvim' }
- Using vim-plug
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
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
:help scnvim
for detailed documentation.- API 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)
- telescope-scdoc
- Use Telescope to fuzzy find documentation
Supported platforms
- Linux
- macOS
- Windows (tested with
nvim-qt
andnvim.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 <http://www.gnu.org/licenses/>.