In-word expansion not working
Description
i option does not cause snippy to recognise triggers at the end of words
Steps to Reproduce
Given the following snippet, with the i option
snippet ft "\footnote" i
%
\\footnote{%
${1:${VISUAL:text}}%
}
${0}
Expected Result
Lorem ipsumft| expands to Lorem ipsum%
\footnote{%
|text%
}
Actual Result
No suggestion or expansion, trigger is not recognised.
Trigger is however recognised when using the w option and typing Lorem ipsum.ft|
Additional Context
No response
I'm not sure if I can reproduce this bug. Here's what I tried:
- Created a minimal config at
/tmp/minimal.vim(see below). - Added
/tmp/snippets/lua.snippetscontaining theftsnippet. - Ran
nvim --clean -u minimal.vim test.lua. - Typed
Lorem ipsumftand pressed tab. It seems to have expanded correctly for me.
So, it seems manual expansion is working, but I noticed that nvim-cmp doesn't show any suggestion. I think it's filtering based on the entire word, and I'm not sure if this behavior can be changed in cmp-snippy.
Can you confirm that manual expansion is working (i.e not using nvim-cmp)?
Contents of `minimal.vim`
if has('vim_starting')
set encoding=utf-8
endif
scriptencoding utf-8
if &compatible
set nocompatible
endif
let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end
execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'dcampos/nvim-snippy'
Plug 'honza/vim-snippets'
call plug#end()
PlugInstall | quit
imap <expr> <Tab> snippy#can_expand_or_advance() ? '<Plug>(snippy-expand-or-advance)' : '<Tab>'
imap <expr> <S-Tab> snippy#can_jump(-1) ? '<Plug>(snippy-previous)' : '<S-Tab>'
smap <expr> <Tab> snippy#can_jump(1) ? '<Plug>(snippy-next)' : '<Tab>'
smap <expr> <S-Tab> snippy#can_jump(-1) ? '<Plug>(snippy-previous)' : '<S-Tab>'
xmap <Tab> <Plug>(snippy-cut-text)
lua << EOF
require('snippy').setup({
hl_group = 'Search',
snippet_dirs = '/tmp/snippets/',
})
EOF
This issue from cmp-nvim-ultisnips may be related: quangnguyen30192/cmp-nvim-ultisnips#78