 ;; Keep cursor away from edges when scrolling up/down
 (use-package smooth-scrolling :disabled t)
 
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Backups
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar backup-dir "~/.emacs.d/backups/")
 (setq backup-directory-alist
-      `(("." . ,(expand-file-name
-                 (concat user-emacs-directory "backups"))))
+      `(("." . ,(expand-file-name "backups" user-emacs-directory)))
       backup-by-copying t
       delete-old-versions t
       make-backup-files t
       kept-new-versions 6
       kept-old-versions 2
-      version-control t)
-
-;; Make backups of files, even when they're in version control
-(setq vc-make-backup-files t)
-
-
-;; autsave no longer puts it in my working directory
-(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
-
+      version-control t
+
+      ;; Make backups of files, even when they're in version control
+      vc-make-backup-files t
+
+      ;; autsave no longer puts it in my working directory
+      auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
+      )
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Autocomplete

  (setq-default
   company-backends '((company-capf company-dabbrev-code) company-dabbrev))

  (setq company-idle-delay 0.2)
  (setq completion-cycling 5)
  (setq company-selection-wrap-around t)
  (setq company-tooltip-align-annotations t)

  (define-key evil-insert-state-map (kbd "M-n") 'company-complete-common)
  (evil-define-key 'hybrid company-active-map
    (kbd "M-n") 'company-select-next
    (kbd "M-p") 'company-select-previous
    )
  )

(use-package company-quickhelp
  :after company
  :disabled t
  :config
  (evil-define-key 'hybrid company-quickhelp-mode-map
    (kbd "M-n") 'company-select-next
    (kbd "M-p") 'company-select-previous
    )
  (company-quickhelp-mode t))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Snippets

  :config
  (yas-reload-all)
  (yas-global-mode t)
  (setq yas-snippet-dirs (jlr/path-join (getenv "HOME") ".emacs" "snippets")

        tab-always-indent 'complete

        yas-prompt-functions '(yas-completing-prompt
                               yas-ido-prompt
                               yas-dropdown-prompt))

  (define-key yas-minor-mode-map (kbd "<tab>") nil)
  (define-key yas-minor-mode-map (kbd "TAB") nil)
  (key-chord-define-global (kbd "jk") 'yas-expand)
  (key-chord-define yas-keymap (kbd "jk") 'yas-next-field-or-maybe-expand)
  (define-key yas-minor-mode-map (kbd "<escape>") 'yas-exit-snippet)

  ;; Add yasnippet support for all company backends
  ;; https://github.com/syl20bnr/spacemacs/pull/179
  (defun company-mode/backend-with-yas (backend)
    "Enable yas suggestions for the BACKEND."
    (if (and (listp backend)
             (member 'company-yasnippet backend))
        backend
      (append (if (consp backend) backend (list backend))
              '(:with company-yasnippet))))

  (setq company-backends (mapcar #'company-mode/backend-with-yas company-backends)))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
