显示yasnippet的所有片段

Rea*_*onk 24 emacs yasnippet

有什么方法可以显示yasnippet可用于当前主要模式的所有片段?

kin*_*ero 36

这个命令显示了片段和密钥

 m-x yas/describe-tables
Run Code Online (Sandbox Code Playgroud)


小智 12

yas/describe-tablesyas-describe-tablesin 的别名yasnippet.el.

(yas/describe-tables&optional CHOOSE)

自yasnippet 0.8以来,此功能已过时;

使用yas-describe-tables来代替.

显示每个表的代码段.


小智 5

你在找M-x yas/insert-snippet?它将列出所有可用的片段,您可以选择其中一个插入.


law*_*ist 5

(defvar lawlist-context-menu-map
  (let ((map (make-sparse-keymap "Context Menu")))
    (define-key map [help-for-help] (cons "Help" 'help-for-help))
    (define-key map [seperator-two] '(menu-item "--"))
    (define-key map [my-menu] (cons "LAWLIST" (make-sparse-keymap "My Menu")))
    (define-key map [my-menu 01] (cons "Next Line" 'next-line))
    (define-key map [my-menu 02] (cons "Previous Line" 'previous-line))
    (define-key map [seperator-one] '(menu-item "--"))
  map) "Keymap for the LAWLIST context menu.")

(defun lawlist-popup-context-menu  (event &optional prefix)
  "Popup a context menu."
  (interactive "@e \nP")
    (define-key lawlist-context-menu-map [lawlist-major-mode-menu]
      `(menu-item ,(symbol-name major-mode)
        ,(mouse-menu-major-mode-map) :visible t))
    (define-key lawlist-context-menu-map (vector major-mode)
      `(menu-item ,(concat "YAS " (symbol-name major-mode))
        ,(gethash major-mode yas--menu-table)
          :visible (yas--show-menu-p ',major-mode)))
    (popup-menu lawlist-context-menu-map event prefix))

(global-set-key [mouse-3] 'lawlist-popup-context-menu)
Run Code Online (Sandbox Code Playgroud)

例: