What's a nice way to display all snippets available to yasnippet to the current major mode?
Display all snippets of yasnippet
this command shows the snippets and keys
m-x yas/describe-tables
@Tass please update your yas package github.com/capitaomorte/yasnippet/downloads –
Gameto
FYI in 2020 yasnippet has a new home - github.com/joaotavora/yasnippet –
Sheets
GOTHA: this show all snippets for the current active mode. So not all available snippets for all modes. I know this was the original question, however I'm just posting this as a comment since I know I might make the same mistake twice. –
Simonsimona
yas/describe-tables
is an alias for yas-describe-tables
in yasnippet.el.
(yas/describe-tables &optional CHOOSE)
This function is obsolete since yasnippet 0.8;
use yas-describe-tables
instead.
Display snippets for each table.
Are you looking for M-x yas/insert-snippet
? It will list all available snippets and you can choose one of them to insert.
(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)
If you are using company mode for autocompletion you can also call company-yasnippet
to show all available snippets in the company interface.
© 2022 - 2024 — McMap. All rights reserved.