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?


Add something like this below snippet name:

# condition: (not (bound-and-true-p shell-script-mode))
| improve this answer | |
  • 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 Jan 30 '15 at 13:25
  • Are those even updated? I've been using a fork of the original snippets for two years now. – abo-abo Jan 30 '15 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 Jan 30 '15 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 Jan 30 '15 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 Feb 2 '15 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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