emacs - Autocomplete randomly working / not working with yasnippet, why? -
i have configured yasnippet , auto-complete bindings won't collide, auto complete uses <tab>
, yasnippet uses <backtab>
:
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet") (require 'yasnippet) (yas-global-mode 1) ;; remove yasnippet's default tab key binding (define-key yas-minor-mode-map (kbd "<tab>") nil) (define-key yas-minor-mode-map (kbd "tab") nil) ;; set yasnippet's key binding shift+tab (define-key yas-minor-mode-map (kbd "<backtab>") 'yas-expand)
i added yasnippet source ac-sources recommended in this question.
(defun add-yasnippet-ac-sources () (add-to-list 'ac-sources 'ac-source-yasnippet)) (add-hook 'web-mode-hook 'add-yasnippet-ac-sources)
i created 2 yasnippets 1 key lorem_dummy
, other key lorem_image
, 1 of examples:
# -*- mode: snippet; require-final-newline: nil -*- # name: lorem_image # key: lorem_image # binding: direct-keybinding # -- <img src="http://lorempixel.com/${1:width}/${2:height}/${3:$$(yas-choose-value '("abstract" "city" "animals" "food" "people" "transport" "business" "sports" "technics"))}/${4:text}" alt="$3">
after following solution in "duplicated question" link, seemed work perfectly, after few hours started behave strange, randomdly, works doesn't. made video showing problem, works, restart emacs , stops working again.
>update<
ok, found out something, it's not works randomly, it's doesn't works. in video auto complete works yasnippet keys because they're opened in other buffers, , it's using that. if close buffers, stop working. so, problem init.el ac doesn't works yasnippet
Comments
Post a Comment