              ((local-set-key [tab] 'tab-indent-or-complete)
               (local-set-key (kbd "TAB") 'tab-indent-or-complete))))
 
+(defun my/dabbrev-find-all (abbrev)
+  "Return a list of expansions matched by ABBREV."
+  (let ((dabbrev-check-other-buffers t)
+        (dabbrev-check-all-buffers nil))
+    (dabbrev--reset-global-variables)
+    (save-excursion
+      (goto-char (point-min))
+      (dabbrev--find-all-expansions abbrev t))))
+
+(defun my/dabbrev-capf ()
+  "Dabbrev 'complete-at-point-functions' implementation."
+  (let ((bounds (bounds-of-thing-at-point 'symbol)))
+    (list
+     (car bounds)
+     (cdr bounds)
+     (my/dabbrev-find-all (substring (thing-at-point 'symbol t) 0 1)))))
+
 (provide 'init-company)
 ;;; init-company.el ends here

  :init
  (global-set-key (kbd "C-'") 'company-try-hard))

(use-package company-ycmd
  :commands (global-ycmd-mode)
  :diminish ycmd-mode
  :init
  (add-hook 'global-company-mode-hook
            (lambda ()
              (progn
                (global-ycmd-mode)
                (add-to-list 'company-backends
                             '(company-ycmd :with company-yasnippet)))))
  (setq ycmd-server-command '("python2" "/home/bruno/code/ycmd/ycmd")))

(global-set-key (kbd "M-/") 'hippie-expand)


(use-package company
  :commands (global-company-mode)
  :config
  (require 'dabbrev)
  (bind-keys :map company-active-map
             ("TAB" . company-select-next)
             ([tab] . company-select-next)
