0

I'm using neosnippet to define and expand my snippets.

I have the following snippet defined for javascript development

snippet fn
abbr () => {}
    (${1}) => {${2}}

I can insert this snippet when starting to type on a new line using C-k. However I often find myself in the position where i wish to insert in in an existing line

let something = fn
test.then(fn)

when I'm after fn on either of these lines I would like to expand the snippet. Can this be achieved using neosnippet?

1 Answer 1

1

This should work:

snippet fn
option word
abbr () => {}
    (${1}) => {${2}}

You can find the necessary information if you read :h neosnippet-snippet-syntax, in particular the help under the snippet keyword option:

- options [options] (Optional)

    Options influence the snippet behavior. The possible values are:

    + word  This snippet expands by a word boundary.
        Note: To complete the trigger with neosnippet, it must be a
        word character (digits, alphabetical characters or "_").

    snippet     date
    options     word
        `strftime("%d %b %Y")`

The help text continuous with more help text on more options, but word is the relevant option here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.