Hello all, I’m struggling to install SCNVim in Windows 10. I’m using Nvim-qt.
I load SCNvim in my init.lua using Packer:
require('packer').startup(function()
use 'wbthomason/packer.nvim'
use 'davidgranstrom/scnvim'
use 'nvim-treesitter/nvim-treesitter'
end)
And then I can’t run any of the commands associated with the plugin. Running :checkhealth scnvim outputs this:
scnvim: health#scnvim#check
========================================================================
- ERROR: Failed to run healthcheck for "scnvim" plugin. Exception:
function health#check[24]..health#scnvim#check[3]..<SNR>69_check_linkage, line 1
Vim(let):E5108: Error executing lua [string "luaeval()"]:1: loop or previous error loading module 'scnvim/install'
stack traceback:
[C]: in function 'require'
[string "luaeval()"]:1: in main chunk
FYI I’m just beginning with NeoVim and Vim in general, so it may be something simple I missed.
Any idea? Thanks!
What version of neovim is this based on ? Judging from the release date on github for neovim-qt it looks like it’s older than most of the important recent stuff in neovim. You should use something that is based on neovim 0.5 at least.
Thanks @madskjeldgaard for getting back to me quickly. nvim-qt is released as part of nvim for Windows. I’ve got the version 0.6.0, which I think is the latest stable version. So the problem is somewhere else.
One other piece of the puzzle is that when I run checkhealth for the first time, it issues this message about not finding the plugin root dir:
scnvim: health#scnvim#check
========================================================================
- ERROR: Failed to run healthcheck for "scnvim" plugin. Exception:
function health#check[24]..health#scnvim#check[3]..<SNR>63_check_linkage, line 1
Vim(let):E5108: Error executing lua ...-data\site\pack\packer\start\scnvim/lua/scnvim/utils.lua:107: [scnvim] could not find plugin root dir
stack traceback:
[C]: in function 'error'
...-data\site\pack\packer\start\scnvim/lua/scnvim/utils.lua:107: in function 'get_scnvim_root_dir'
...ata\site\pack\packer\start\scnvim/lua/scnvim/install.lua:12: in main chunk
[C]: in function 'require'
If I run checkhealth again right after, it issues the message from my previous post. This behaviour occurs every time I start nvim.
Okay one thing that looks fishy here is the paths. Notice how they combine windows style back slash with Unix style forward slash. I have no idea how this neovim implementation works but it looks like either it or scnvim is getting the system mixed up? It might be time to open an issue on this on scnvim’s GitHub
On the other hand, I can call SCNvimStart on a .scd file and it starts sclang and reads the startup file (in which I’ve added the code snippet for Windows). But it doesn’t find scsynth.exe, which is in the same non-standard directory as sclang.
For info, I’ll drop the message I get here, but I’ll open an issue on GitHub.
*** Welcome to SuperCollider 3.12.1. *** For help press F1.
ERROR: Class not defined.
in interpreted text
line 1 char 6:
SCNvim.port = 60925
-----------------------------------
ERROR: Class not defined.
in interpreted text
line 1 char 6:
SCNvim.currentPath = "C:\\WINDOWS\\system32\\test.scd"
-----------------------------------
-> localhost
Booting server 'localhost' on address 127.0.0.1:57110.
'scsynth.exe' is not recognized as an internal or external command,
operable program or batch file.
Server 'localhost' exited with exit code 1.```
i’ve been using nvim for other things than SC, and recently installed coc.nvim for c++, python and javascript help, but it interfered with documentation keybinding. tried to use CocDisable on BufNew, BufRead, BufEnter but it still throws this error:
[coc.nvim]: Error on “doHover”: current buffer 3 not attached
Has some of you used it, is there an easy work-around or should i just remove coc.nvim?
I have been messing around with neovim configuration in lua on a netbook (does anyone remember those?) with a fairly fresh Debian (testing branch).
One thing that had me scratching my head was the statusline. I had been using airline.vim with pretty standard settings so far; getting a custom function into it looked like more of a hassle than I wanted. So I switched to lualine and here’s my (minimal and not very pretty yet) lualine configuration, including a very basic word count function for markdown and text files:
-- settings for lualine
local function getwords()
if vim.bo.filetype == "md" or vim.bo.filetype == "markdown" or vim.bo.filetype == "txt" then
return tostring(vim.fn.wordcount().words)
else
return ""
end
end
local function scstatus()
if vim.bo.filetype == "supercollider" then
local stat = vim.api.nvim_call_function("scnvim#statusline#server_status", {})
return stat
else
return ""
end
end
require('lualine').setup {
options = {
icons_enabled = false
},
sections = {
lualine_c = { 'filename', scstatus },
lualine_x = { 'filetype' },
lualine_y = { 'progress', getwords }
}
}
Unrelated question: How do I configure SCNvim so I don’t have to switch the server status line on manually with :SCNvimStatusLine?
Oh, ok, then I was doing more work than I needed to, I have that in my startup.scd as well! (Hadn’t tried if it would work without calling :SCNvimStatusLine)
I now switched to LuaLine as well but if I use the server status function above, it seems LuaLine interprets the %-signs in the status line string as string substitutions and so it looks a bit strange. I can’t get it to work with percentage signs for cpu usage, so I changed them to musical notes:
local function scstatus()
if vim.bo.filetype == "supercollider" then
stat = vim.fn["scnvim#statusline#server_status"]()
stat = stat:gsub("%%", "♪")
return stat
else
return ""
end
end
Hi all, I’ve been messing with scnvim since december and I really really like it (one of the reasons that I switched to sc from max was that I got sick of all the clicking, so the switch to vim seems like a logical continuation of that)…
There’s a few noob questions though that I still haven’t quite been able to resolve on my own. Or maybe they’re not so noob, what do I know (fwiw, I have more of a composition/music background than a programming one).
First, I’ve been wondering if it’s possible to keep focus on the nvim window at all times? Currently, whenever I s.boot or make an UI window, the supercollider app gets activated and I have to Cmd-Tab to get back to neovim. (I’m on macos, using VimR as a frontend). I’ve naively attempted to make an autocmd for this, something like nmap <silent> <F9> <Cmd>SCNvimStart<CR><Cmd>!osascript -e 'activate application "VimR"'<CR>
but that won’t really help either… it activates before sclang is finished starting up, and ask me to press enter to confirm, and in order to do that I have to Cmd-tab all over again.
Maybe there’s a way to get Supercollider to send that shell command? Or to get the OS to just never activate (i.e., focus on) the supercollider app?
The other thing is that although I like the default keymappings in scnvim, conflicts with the mapping I’m using for window navigation (i.e., map <c-k> <c-w>k), so I’m wondering what the cleanest way would be to unmap just <c-k>? I mean, I can just comment out that bit in in the plugin’s mappings.lua, but won’t that cause problems when I try to update the plugin?
Anyway, SCNvim is awesome and Mads, your compilations of resources have been sooo helpful for finding my way into vim!
Thanks in advance for any help, forum folks!
I also find this change of focus vexing when using nvim with Kitty! There are some Qt based Gui front ends - maybe somehow that offers some magical possibilities?
Now I seem to have found a workaround of sorts for the focus issue…
Basically what I do is, after all window creation tasks in sc, add a line: {Pipe.new("osascript -e \'activate application \"VimR\"\'", "w").close}.defer(0.1)
The .defer seems to be important, and also that the argument is not nil.
So the osascript is for macos using VimR, but I suppose that some equivalent shell command would take care of it in linux … no idea about windows.
As for my other mapping question, I realized it’s pretty straightforward and it was indeed a newbie question… just :unmap the one mapping I’m unhappy with and remap to what I want.
On the other hand, for whatever reason, <M-L> to clear post window still doesn’t work for me. (The mode key does work in other mappings). Clearing it via :call scnvim#etc. does work, I’m just confused why that particular mapping wouldn’t work… anybody have similar issues? Might be the VimR app, or something.
We just merged a PR that makes it possible to evaluate Neovim Lua code in sclang and thus control the editor from the language. Lots of fun possibilities here !
Someday it would be interesting to implement msgpack serialization in SuperCollider to access the nvim API directly, it would even make it possible to write nvim plugins using sclang!