Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve yasnippet #1000

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions spacemacs/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,8 @@ ARG non nil means that the editing style is `vim'."
(global-set-key (kbd "M-/") 'hippie-expand) ;; replace dabbrev-expand
(setq hippie-expand-try-functions-list
'(
;; Try to expand yasnippet snippets based on prefix
yas-hippie-try-expand
;; Try to expand word "dynamically", searching the current buffer.
try-expand-dabbrev
;; Try to expand word "dynamically", searching all other buffers.
Expand Down Expand Up @@ -2665,16 +2667,17 @@ displayed in the mode-line.")
:init
(progn
(defun spacemacs/load-yasnippet ()
(if (not (boundp 'yas-minor-mode))
(progn
(let* ((dir (configuration-layer/get-layer-property 'spacemacs :ext-dir))
(private-yas-dir (concat configuration-layer-private-directory "snippets"))
(yas-dir (concat dir "yasnippet-snippets")))
(setq yas-snippet-dirs
(append (when (boundp 'yas-snippet-dirs)
yas-snippet-dirs)
(list private-yas-dir yas-dir)))
(yas-global-mode 1)))))
(if (not (boundp 'yas-minor-mode))
(progn
(let* ((dir (configuration-layer/get-layer-property 'spacemacs :ext-dir))
(private-yas-dir (concat configuration-layer-private-directory "snippets"))
(yas-dir (concat dir "yasnippet-snippets")))
(setq yas-snippet-dirs
(append (when (boundp 'yas-snippet-dirs)
yas-snippet-dirs)
(list private-yas-dir yas-dir)))
(setq yas-wrap-around-region t)
(yas-global-mode 1)))))
(add-to-hooks 'spacemacs/load-yasnippet '(prog-mode-hook
markdown-mode-hook
org-mode-hook))
Expand Down