Closed AgentCosmic closed 2 years ago
Please minimal reproducible steps.
This is my init.vim
" This is the folder where we'll store all the files
" set environment variable $env:XDG_CONFIG_HOME="D:/Applications/Neovim"
let $ROOT = expand('D:/Applications/Neovim/nvim')
set runtimepath+=$ROOT
" we reset $HOME directory here so plugins won't dirty our real home directory
let $HOME = $ROOT . '/home'
runtime mswin.vim
call plug#begin('$HOME/plugged')
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
Plug 'rafamadriz/friendly-snippets' " snippets
call plug#end()
" nvim-cmp
set completeopt=menu,menuone,noselect
lua << EOF
local cmp = require'cmp'
cmp.setup({
mapping = {
['<tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
['<s-tab>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 's' }),
['<c-space>'] = cmp.mapping.complete(),
['<cr>'] = cmp.mapping.confirm({ select = true }),
['<c-d>'] = cmp.mapping.scroll_docs(-4),
['<c-f>'] = cmp.mapping.scroll_docs(4),
},
sources = {
{ name = 'vsnip' },
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
})
EOF
" vsnip
imap <expr> <c-s-n> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<c-s-n>'
smap <expr> <c-s-n> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<c-s-n>'
I open any javascript/typescript/python/css file. Then I type something like for
and choose the snippet. But I noticed after working for a while, sometimes the selection works correctly.
Hello, is there anything I can help you to debug this more easily?
Same issuse happens to me. vim8.2 in Windows.
{
"Class": {
"prefix": ["let"],
"body": [
"let ${1:name} = $0"
]
}
}
After triggered:
Expect:
@JimmyHuang454 I think the name
will replace to a
If you press a
with After triggered:
condition. If so It's expected behavior.
I am new to vsnip, just starting in today. And I just want vsnip works as ultisnips:
the first let
in the gif is triggered by vsnip, the second one is triggered by ultisnips.
My vimrc:
Plug 'hrsh7th/vim-vsnip'
let g:vsnip_snippet_dir = 'D:/Vim/test_snip'
" Expand or jump
imap <expr> <C-l> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>'
For example:
My first selection will be
inde
, but notindex
. Then I jump to next positionarra
, again missing they
. I'm using it with nvim-cmp. Neovim 5.1 Windows.