 (global-set-key (kbd "s-w") #'aya-create)
 (global-set-key (kbd "s-y") #'aya-expand)
 
+;; Greedy completion.
+
 ;; dabbrev-expand should match case
 (require 'dabbrev)
 (setq dabbrev-case-fold-search nil)

;; to offer completion inside comments too.
(setq company-dabbrev-code-everywhere t)

;; Don't bother with company-dabbrev when we have company-dabbrev-code
;; already. It's a little too aggressive at suggesting words,
;; especially when writing comments.
(setq company-backends
      (remove 'company-dabbrev company-backends))

(global-set-key (kbd "C-z") #'company-try-hard)
(define-key company-active-map (kbd "C-z") #'company-try-hard)

;;; Commentary
;; There are two types of completion: precise, and greedy.
;;
;; Precise completion offers things like methods on classes, library
;; imports and CSS values. These are values that are always valid at
;; the current position.
;;
;; Greedy completion is the opposite: it offers variable names (even
;; in other scopes or files), filenames, anything that looks like it
;; might match the current prefix.
;;
;; Company excels at precise completion, but hippie-expand still has
;; the edge on greedy completion. Precise completion with company
;; requires language specific support, whereas hippie-expand works
;; very well with dabbrev in pretty much any language.

;; TODO: snippet expansion isn't really completion as we've defined
;; it, so move to a separate file.

;; yasnippet, clever abbreviation expansion
(require 'yasnippet)
