Shougo / neosnippet.vim

neo-snippet plugin
Other
1.12k stars 108 forks source link

Immediate expansion with trigger #477

Closed al3xandru closed 4 years ago

al3xandru commented 4 years ago

I'm sorry for posting this as an issue but I could not find an answer. I have a snippet which doesn't use any of the word/head/indent options; thus my expectation is that after typing the snippet and triggering its expansion that will happen.

Relevant conf options:

imap <C-e> <Plug>(neosnippet_expand_or_jump)
smap <C-e> <Plug>(neosnippet_expand_or_jump)
xmap <C-e> <Plug>(neosnippet_expand_target)

Snippet:

snippet zfn
abbr footnote
alias ^fn
    [^fn-${1:fn1}] ${3}

    [^fn-$1]: ${2:#:footnote text}

Given the above I expect that wherever I type zfn followed by the snippet would expand. What is incorrect in the above? thank you

Shougo commented 4 years ago

You need to type <C-e>(<Plug>(neosnippet_expand_or_jump)).

al3xandru commented 4 years ago

@Shougo I apologize for my description above not being the most legible.

Yes, I do type zfn and then C-e and there is no expansion. If there is a space before typing zfn then expansion works. It makes me think that snippets have the word option by default on.

Shougo commented 4 years ago
                     *g:neosnippet#expand_word_boundary*
g:neosnippet#expand_word_boundary
        If it is not 0, neosnippet will expand snippets by a word
        boundary.
        Note: It must be initialized before snippet loading.

        The default value is 0.
al3xandru commented 4 years ago
:echo g:neosnippet#expand_word_boundary
0

Are you saying that I need to change that to non-zero?

Update: I have tried setting the value to both 0 and non-zero and I don't see any change in behavior.

I've recorded my screen for 20seconds to show the behavior I'm noticing.

neosnippet.mov.zip

Shougo commented 4 years ago

The uploaded file is broken.

Please upload the reproduce instruction. If not, I will ignore your report.

Shougo commented 4 years ago

word option default is g:neosnippet#expand_word_boundary. So g:neosnippet#expand_word_boundary should work.

But you have not uploaded reproduce instruction. We have not ESP skills. I don't work for non reproduce issues.

al3xandru commented 4 years ago

@Shougo what do you mean by the uploaded file is broken? The archive contains a short screen recording showing how typing a snippet and then trying to expand it while link to existing text does not expand. I downloaded the file a second ago and double checked I can watch the .mov file inside. Maybe you are on a system that doesn't play mov files? Below I have converted the mov to mp4 hoping that will play on your side. I don't know how to report this in an easier way.

Here is the scenario:

  1. Given the configuration above.
  2. Enter some text: "This is just a text"
  3. Continue now typing "zfn"
  4. Trigger expansion using C-e.

On my side nothing happens. The only case when C-e actually triggers the expansion is when the string zfn is preceded by a space.

neosnippet.mp4.zip

Shougo commented 4 years ago

OK. It is reproduced and it is feature. neosnippet searches textzfn snippet but it is not found.

You should know what is word boundary.