Skip to content

Commit

Permalink
prevent yasnippet from expanding inside comments and fall back properly
Browse files Browse the repository at this point in the history
  • Loading branch information
DoMiNeLa10 committed Dec 26, 2018
1 parent a7d5d97 commit 891dcf5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions config/my-extensions.el
Expand Up @@ -106,13 +106,18 @@ like `js2-include-SYMBOL-externs'.")
;; load snippets (neccesary when using only the minor mode)
(yas-reload-all)
(setq yas-also-indent-empty-lines t
yas-also-auto-indent-first-line t)
yas-also-auto-indent-first-line t
;; prevent expanding snippets in comments and fall back to default
;; command when needed:
;; https://emacs.stackexchange.com/a/46776/12563
yas-buffer-local-condition yas-not-string-or-comment-condition
yas-fallback-behavior 'call-other-command)

;; minor mode keys
;; unbind TAB
(define-key yas-minor-mode-map (kbd "<tab>") nil)
(define-key yas-minor-mode-map (kbd "TAB") nil)
;; Bind `SPC' to `yas-expand' when snippet expansion available (it
;; Bind `SPC' to `yas-maybe-expand' when snippet expansion available (it
;; will still call `self-insert-command' otherwise).
(define-key yas-minor-mode-map (kbd "SPC") yas-maybe-expand)
;; Bind `C-c y' to `yas-expand' ONLY.
Expand Down

0 comments on commit 891dcf5

Please sign in to comment.