Shougo / neosnippet.vim

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

InsertLeave Triggered #474

Closed thecontinium closed 5 years ago

thecontinium commented 5 years ago

When I set

autocmd InsertLeave * NeoSnippetClearMarkers

and I have a snippet that has a first placeholder with a default ( as in defn-doc with ${1:name} below ) all the markers are cleared.

When I have a snippet that does not have a default ( as in try with ${1} ) below there are not cleared.

I would expect them both to behave like 'try'; what would you expect ?

snippet     defn-doc
abbr        defn function "..." [...] ...
options     head
    (defn ${1:name}
        "${2:doc}"
        [${3}]
        ${0})

snippet     try
abbr        (try ... (catch ...
    (try
        ${1}
        (catch ${2:Exception} e ${3:nil}))

Cheers

Shougo commented 5 years ago

I will check it later.

Shougo commented 5 years ago

snoremap <silent><ESC> <ESC>:NeoSnippetClearMarkers<CR> fixes the issue.

thecontinium commented 5 years ago

Hi - thanks for the suggestion.

The problem I am having is still present after adding this. Some more details:


def-doc

When I trigger the snippet def-doc with autocmd InsertLeave * NeoSnippetClearMarkers I get this:

(defn name
  "doc"
  []
  )

All the markers have been cleared and I can't move/tab through the placeholders.

When I trigger the snippet def-docwithout autocmd InsertLeave * NeoSnippetClearMarkers I get

(defn name
  "<`2:doc`>"
  [<`3`>]
  <`0`>)

and can move/tab through the placeholders but the markers are left if I don't complete filling in all the placeholders.


try

But, when I trigger the try snippet ( which does not have a first placeholder default ) with or without autocmd InsertLeave * NeoSnippetClearMarkers I get

(try

  (catch <`2:Exception`> e <`3:nil`>))

and can move/tab through the placeholders.

With autocmd InsertLeave * NeoSnippetClearMarkers it removes the markers if I don't fill them all in as we want. Without it does not.


I would expectdef-doc to behave the same way as the try snippet.

Do you get this behaviour with the def-doc and try snippets ?

cheers

Shougo commented 5 years ago

@thecontinium I have not reproduce your problem. You have not upload the minimal vimrc. So I will ignore your issue.

thecontinium commented 5 years ago

ok - cheers; let me track it down.

Shougo commented 5 years ago

And please upload the reproduce instructions like this.

Shougo commented 5 years ago

All the markers have been cleared and I can't move/tab through the placeholders.

The markers are cleared when you input <ESC>. This is feature.

thecontinium commented 5 years ago

ok - I’ll keep that in consideration; anything else that clears them by design ?

-- The Continium

On 15 September 2019 at 17:09:14, Shougo (notifications@github.commailto:notifications@github.com) wrote:

All the markers have been cleared and I can't move/tab through the placeholders.

The markers are cleared when you input . This is feature.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Shougo/neosnippet.vim/issues/474?email_source=notifications&email_token=ACHXEBRTJG7KGPBCZWM6OFTQJX3TPA5CNFSM4IVQHQDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6XMTLY#issuecomment-531548591, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACHXEBQE6UW2KUNFGMXRGL3QJX3TPANCNFSM4IVQHQDA.

Shougo commented 5 years ago

No.

thecontinium commented 5 years ago

With the following settings for neosnippet and deoplete & neosnippet-snippets installed:

let g:neosnippet#enable_snipmate_compatibility = 1 let g:neosnippet#enable_completed_snippet = 1 let g:neosnippet#enable_complete_done = 1 let g:neosnippet#expand_word_boundary = 1 let g:neosnippet#enable_auto_clear_markers = 1 autocmd user_events InsertLeave * NeoSnippetClearMarkers

Using deoplete

results in all the markers being cleared.

results in the markers showing


Not using deoplete

With these mappings in place:

imap <C-k> (neosnippet_expand_or_jump) smap <C-k> (neosnippet_expand_or_jump) xmap <C-k> (neosnippet_expand_target)

they both expand with the markers showing as expected.

Shougo commented 5 years ago

OK. I get it. Unfortunately, this is feature.

You must disable g:neosnippet#enable_complete_done feature.

Shougo commented 5 years ago

g:neosnippet#enable_complete_done conflicts with NeoSnippetClearMarkers.