Straightforward with lazy: GitHub - Saghen/blink.nvim: Set of simple, performant neovim plugins you want blink-cmp although the other modules are nice too!
Thanks wil give it a try once more
It is basically working but I struggle with getting the classes, snippets and the tags loaded which are in ~/.cache/nvim/scnvim. Should I define the paths in the blink_cmp.lua file or somewhere else?
return{
{
'saghen/blink.cmp',
-- optional: provides snippets for the snippet source
dependencies = { 'rafamadriz/friendly-snippets' },
-- use a release tag to download pre-built binaries
version = '1.*',
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
-- build = 'cargo build --release',
-- If you use nix, you can build from source using latest nightly rust with:
-- build = 'nix run .#build-plugin',
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
-- 'super-tab' for mappings similar to vscode (tab to accept)
-- 'enter' for enter to accept
-- 'none' for no mappings
--
-- All presets have the following mappings:
-- C-space: Open menu or open docs if already open
-- C-n/C-p or Up/Down: Select next/previous item
-- C-e: Hide menu
-- C-k: Toggle signature help (if signature.enabled = true)
--
-- See :h blink-cmp-config-keymap for defining your own keymap
keymap = { preset = 'default' },
appearance = {
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = 'mono'
},
-- (Default) Only show the documentation popup when manually triggered
completion = { documentation = { auto_show = false } },
-- Default list of enabled providers defined so that you can extend it
-- elsewhere in your config, without redefining it, due to `opts_extend`
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' },
},
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
--
-- See the fuzzy documentation for more information
fuzzy = { implementation = "prefer_rust_with_warning" }
},
opts_extend = { "sources.default" }
}
}
Im away from the computer rn but I believe you need to add the snippets in your luasnip.lua ! I’ll check when I see my machine!
try
require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets())
in your luasnip config!
Oh that was you, sorry. I’ll give it a try. I’m just fiddling with it.
I gave up an will open a separate thread tomorrow. Really want to get this running.
Maybe I´m confusing things. When thinking about autocompletion I mainly mean things like Pulse, SinOsc.ar, EnvGen, etc.
I guess snippets are smaller blocks of code and EnvGen,etc. is not handled by luasnippets, right? How do I get simple autocompletion like in scIDE running? Is it sufficient just to install blink.cmp which I did.
Nvim is aware of the SC classes as e.g. SinOsc, and Pulse have a different color compared to e.g. House or Car. But I don´t get suggestions of e.g. Pulse when hitting TAB. Words present in the buffer are suggested though.
EnvGen should have a snippet and will autocomplete
this is what I see using blink when I type ‘Env’:
Blink also has “frecency” meaning that terms you type often or recently will be available to autocomplete.
you have to make sure that luasnip is selected in blink config - in opts:
sources = {
default = { ''path', 'snippets', 'buffer' }, --you can change the order here or add/remove other sources
},
snippets = { preset = 'luasnip' },
and you need to be sure luasnip knows where to look for supercolliders snippets (see post above)
If you want *only the classname" to be autocompleted (ie no args) then you want to use nvim-cmp and add a tags source GitHub - quangnguyen30192/cmp-nvim-tags: tags sources for nvim-cmp
Thanks a lot!! This was missing and now I get more or less what I expect:
Next I want to remove the symbols at the beginning of each entry and then I need to figure out how the keybindings work. At the moment I immediately get the list (not on TAB).
When pressing Ctrl + SPACE after “Pulse” I get this
I looks quite usable now:
The nerd icons I replaced with simple letters in the the blink-cmp configuration file with ChatGPT.
Then I installed the status line according to: Neovim as a SuperCollider IDE | Mads Kjeldgaard
Again ChatGPT was a help here. It however completely failed in getting the lua snippets right.
I will now use this over the weekend and get used to vim. Nice side effect is that I hopefully learn a bit lua which then I can use for Reaper and maybe Renoise as well.
return {
'saghen/blink.cmp',
dependencies = { 'rafamadriz/friendly-snippets' },
version = '1.*',
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
-- Key mappings
keymap = { preset = 'default' },
-- Appearance
appearance = {
nerd_font_variant = 'none', -- disables Nerd Font spacing
kind_icons = { -- remove all icons (ASCII-only)
Text = 'T',
Method = 'M',
Function = 'F',
Constructor = 'c',
Field = 'F',
Variable = 'V',
Class = 'C',
Interface = 'I',
Module = 'm',
Property = 'P',
Unit = 'U',
Value = '',
Enum = '',
Keyword = '',
Snippet = 'S',
Color = '',
File = '',
Reference = '',
Folder = '',
EnumMember = '',
Constant = '',
Struct = '',
Event = '',
Operator = '',
TypeParameter = '',
},
},
-- Completion menu settings
completion = { documentation = { auto_show = false } },
-- Completion sources
sources = { default = { 'lsp', 'path', 'snippets', 'buffer' } },
-- Snippets
snippets = { preset = 'luasnip' },
-- Fuzzy matcher
fuzzy = { implementation = "prefer_rust_with_warning" },
},
-- Optional: extend default sources without redefining
opts_extend = { "sources.default" }
}