Thank you! I finally got it working. That was not easy But I am very disapointed that I am not getting the help file in the popup Just kidding, so happy to have argument completion! I had tried to implement this in the past during the times when vimscript
was the only option and had failed… This is luxury!
@semiquaver Don’t give up. There is kind of crazy amount of plugins involved to get the full experience! Here is my configuration in case it helps (Make sure you commit your current setup before experimenting with any cut and paste of my mess though…).
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'nvim-treesitter/nvim-treesitter-refactor'
Plug 'nvim-treesitter/playground'
Plug 'haorenW1025/completion-nvim'
Plug 'nvim-treesitter/completion-treesitter'
Plug 'nvim-treesitter/nvim-treesitter-textobjects'
Plug 'neovim/nvim-lspconfig'
Plug 'williamboman/nvim-lsp-installer'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'ray-x/cmp-treesitter'
Plug 'quangnguyen30192/cmp-nvim-tags'
Plug 'hrsh7th/cmp-nvim-lua'
" For vsnip users.
Plug 'hrsh7th/cmp-vsnip'
" Snippets {{{
Plug 'rafamadriz/friendly-snippets'
Plug 'hrsh7th/vim-vsnip'
Plug 'L3MON4D3/LuaSnip'
Plug 'saadparwaiz1/cmp_luasnip'
let g:scnvim_snippet_format = "luasnip"
" Jump forward or backward in vsnip
imap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
smap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
imap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
smap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
" and here for luasnip
imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>'
" -1 for jumping backwards.
inoremap <silent> <S-Tab> <cmd>lua require'luasnip'.jump(-1)<Cr>
snoremap <silent> <Tab> <cmd>lua require('luasnip').jump(1)<Cr>
snoremap <silent> <S-Tab> <cmd>lua require('luasnip').jump(-1)<Cr>
"}}}
set completeopt=menu,menuone,noselect
and for lua
:
-- SuperCollider
require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets())
-- Rust
require('rust-tools').setup({})
require("nvim-treesitter.configs").setup {
-- ensure_installed = {"supercollider", "rust", "html", "javascript"},
ensure_installed = "maintained",
highlight = {
enable = true, additional_vim_regex_highlighting = true,
-- disable = { "supercollider"},
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<CR>",
scope_incremental = "<CR>",
node_incremental = "<TAB>",
node_decremental = "<S-TAB>",
},
},
indent = { enable = true },
matchup = { enable = true },
autopairs = { enable = true },
playground = {
enable = true,
disable = {},
updatetime = 25,
persist_queries = false,
keybindings = {
toggle_query_editor = "o",
toggle_hl_groups = "i",
toggle_injected_languages = "t",
toggle_anonymous_nodes = "a",
toggle_language_display = "I",
focus_language = "f",
unfocus_language = "F",
update = "R",
goto_node = "<cr>",
show_help = "?",
},
},
rainbow = {
enable = true,
extended_mode = true, -- Highlight also non-parentheses delimiters
max_file_lines = 1000,
},
refactor = {
smart_rename = { enable = true, keymaps = { smart_rename = "grr" } },
highlight_definitions = { enable = true },
navigation = {
enable = true,
keymaps = {
goto_definition_lsp_fallback = "gnd",
-- use telescope for these lists
-- list_definitions = "gnD",
-- list_definitions_toc = "gO",
-- @TODOUA: figure out if I need both below
goto_next_usage = "<a-*>", -- is this redundant?
goto_previous_usage = "<a-#>", -- also this one?
},
disable = { "supercollider"},
},
-- highlight_current_scope = {enable = true}
},
textobjects = {
lsp_interop = {
enable = true,
border = "none",
peek_definition_code = {
["df"] = "@function.outer",
["dF"] = "@class.outer",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@call.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@call.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@call.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@call.outer",
},
},
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@call.outer",
["ic"] = "@call.inner",
},
},
swap = {
enable = true,
swap_next = {
[",a"] = "@parameter.inner",
},
swap_previous = {
[",A"] = "@parameter.inner",
},
},
},
}
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
local cmp = require'cmp'
vim.opt.completeopt = { "menu", "menuone", "noselect" }
vim.opt.shortmess:append "c"
cmp.setup {
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
},
mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = 'path' },
{ name = 'vsnip' },
{ name = 'luasnip' },
{ name = 'nvim_lsp' },
{ name = 'tags' },
-- { name = 'nvim_lua' },
{ name = 'treesitter' },
-- { name = 'spell' },
{ name = 'buffer' , keyword_length=5}, -- dont complete until at 5 chars
},
view = {
entries = "native",
},
experimental = {
-- native_menu = true,
ghost_text = true
}
}
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
-- The following example advertise capabilities to `clangd`.
require'lspconfig'.clangd.setup {
capabilities = capabilities,
}
Good luck!
EDIT: Also check here Additional configuration · davidgranstrom/scnvim Wiki · GitHub