I'm a fairly extensive user of YAsnippet but there is an annoying niggle when I'm working on shell scripts. The default prog-mode snippets includes "fi" which expands to FIXME. This would be fie but it fires every time I close a if<->fi statement in BASH. How can I disable this one snippet when I'm in shell-script-mode?

1 Answer 1


Add something like this below snippet name:

# condition: (not (bound-and-true-p shell-script-mode))
  • Unfortunately it's part of the default snippets bundled with YASnippet. As I find the rest of them useful I'd rather not disable all the bundled snipets (although I have my own directories as well).
    – stsquad
    Commented Jan 30, 2015 at 13:25
  • Are those even updated? I've been using a fork of the original snippets for two years now.
    – abo-abo
    Commented Jan 30, 2015 at 13:31
  • 2
    Does it really make sense for someone to update the snippets that you're used to? The bunded ones are examples, just fork them and maintain your own.
    – abo-abo
    Commented Jan 30, 2015 at 13:57
  • 1
    Iirc yasnippet looks in the user snippet directory first, so any snippet it finds there would shadow the ones in the bundle.
    – T. Verron
    Commented Jan 30, 2015 at 14:12
  • 1
    The condition didn't work me me. In the end I used "# condition: (not (eq major-mode 'sh-mode))" and submitted a pull request
    – stsquad
    Commented Feb 2, 2015 at 18:22

Your Answer

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

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