Skip to content

Problem defining snippets #14

@recifx

Description

@recifx

Snippets defined in .doom.d/snippets seem to work fine. However snippets defined using the yas-define-snippets function don't seem to be working properly. A minimum example file loaded from .doom.d/config.el is listed below to indicate how I am using it.

In python mode some snippets like np expands fine, but many of the other snippets defined do not expand, or trigger company completion.

In asy-mode only the snippets defined in the doom.d/snippets/asy-mode subdirectory seem to be recognized, even though a file with an asy extension opens correctly in asy-mode.

I prefer to use the yas-define-snippets function to collect together multiple snippets in one file and I have used this approach before. Would this be possible with doom-emacs? Thanks.

;;; ~/.doom.d/+yas.el -*- lexical-binding: t; -*-

(load! "lisp/asy-mode.el" )
(autoload 'asy-mode "asy-mode.el" "Asymptote major mode." t)
(add-to-list 'auto-mode-alist '("\\.asy$" . asy-mode))

(after! snippets
  (yas-define-snippets
   'python-mode
   '(
     ("pd" "import pandas as pd\n$0" "pandas")
     ("np" "import numpy as np\n$0" "numpy")
     ("sp" "import scipy as sp\n$0" "scipy")))
  (yas-define-snippets
   'asy-mode
   '(
     ("gm" "import geometry;\n$0" "i_geometry")
     ("PI" "path ${1:P} = ${2:pA}--${3:pB};\n$0" "pathI"))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue hasn't been assessed yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions