Snippets
My snippet configuration lies here. This is using YASnippet.
Popup
Want to use a text-based popup, not a GTK-based. I don't like it that much.
(use-package popup :ensure t :demand :bind <<do.snippets.popup/keys>> :config <<do.snippets.popup/prompt>> <<do.snippets.popup/theme>>)
Custom prompt function
(defun do.snippets.yas/popup-isearch-prompt (prompt choices &optional display-fn) "Open up a `popup.el' prompt so choose from snippets." (popup-menu* (mapcar (lambda (choice) (popup-make-item (or (and display-fn (funcall display-fn choice)) choice) :value choice)) choices) :prompt prompt ;; start isearch mode immediately :isearch t))
Keybindings
(:map popup-menu-keymap ("M-n" . popup-next) ("<tab>" . popup-next) ("<backtab>" . popup-previous) ("M-p" . popup-previous))
Theme
(do.theme/set-face-attr-from-list 'popup-face do.theme.popup/popup-face-attrs) (do.theme/set-face-attr-from-list 'popup-menu-mouse-face do.theme.popup/popup-face-attrs) (do.theme/set-face-attr-from-list 'popup-menu-selection-face do.theme.popup/selected-face-attrs) (do.theme/set-face-attr-from-list 'popup-menu-summary-face do.theme.popup/summary-face-attrs) (do.theme/set-face-attr-from-list 'popup-summary-face do.theme.popup/summary-face-attrs) (do.theme/set-face-attr-from-list 'popup-scroll-bar-foreground-face do.theme.popup/scrollbar-fg-attrs) (do.theme/set-face-attr-from-list 'popup-scroll-bar-background-face do.theme.popup/scrollbar-bg-attrs)
Load YASnippet
(use-package yasnippet :ensure t :demand :diminish yas-minor-mode :bind <<do.snippets.yas/keys>> :init (yas-global-mode 1) :config (setq yas-snippet-dirs '()) (add-to-list 'yas-snippet-dirs (concat (file-name-as-directory initel-directory) "snippets")) ;; use popup.el to select between different snippets (setq yas-prompt-functions '(do.snippets.yas/popup-isearch-prompt yas-ido-prompt yas-no-prompt)))
Keybindings
(:map yas-minor-mode-map ("<tab>" . nil) ("<backtab>" . yas-expand))