  ("C-,"         . shrink-window-horizontally)
  ("C-."         . enlarge-window-horizontally)
  ("C-;"         . shrink-window)
- ("C-c k"       . windmove-up) ;; switch to buffer on top
- ("C-c j"       . windmove-down) ;; switch to buffer on bottom
- ("C-c h"       . windmove-left) ;; switch to buffer on left
- ("C-c l"       . windmove-right) ;; switch to buffer on right
  ("C-c t"       . toggle-window-split) ;; convert between horz-split <-> vert-split
  ("C-c s"       . rotate-windows) ;; rotate windows clockwise. This will do the act of swapping windows if the frame is split into only 2 windows
  ("C-x C-b"     . ibuffer)) ;; replace buffer-menu with ibuffer

(key-chord-define-global "XX" (λ (kill-buffer (current-buffer))))
(key-chord-define-global "ZZ" 'toggle-between-buffers)
(key-chord-define-global "5t" 'revert-buffer) ;; alternative to F5
(key-chord-define-global "p[" 'windmove-left)
(key-chord-define-global "[]" 'windmove-right)


(provide 'setup-windows-buffers)


  (progn
    (recentf-mode 1)
    (setq recentf-max-menu-items 2000)

    ;; ;; TODO: Fix below function, it sort of works, not perfect
    ;; ;; Reopen the last killed buffer
    ;; ;; Source: http://stackoverflow.com/questions/10394213/emacs-reopen-previous-killed-buffer
    ;; ;; UPDATE: The `reopen-killed-file' function works better than this.
    ;; (defun undo-kill-buffer ()
    ;;   (interactive)
    ;;   (let ((active-files (loop for buf in (buffer-list)
    ;;                             when (buffer-file-name buf) collect it)))
    ;;     (loop for file in recentf-list
    ;;           unless (member file active-files) return (find-file file))))

    ;; Customizing recentf mode map
    (bind-keys
     :map recentf-dialog-mode-map
     ("/" . isearch-forward)
     ("n" . isearch-repeat-forward)
     ("N" . isearch-repeat-backward))))

(req-package windmove
  :require (key-chord)
  :config
  (progn
    (setq windmove-wrap-around t) ; default = nil
    (windmove-default-keybindings) ; Bind windmove nav to S-left/right/up/down
    (key-chord-define-global "p[" 'windmove-left)
    (key-chord-define-global "[]" 'windmove-right)))

;; Source: http://emacs.stackexchange.com/a/3334/115
;; Reopen Killed File
(defvar killed-file-list nil
  "List of recently killed files.")

(defun add-file-to-killed-file-list ()
  "If buffer is associated with a file name, add that file to the
`killed-file-list' when killing the buffer."
  (when buffer-file-name
    (push buffer-file-name killed-file-list)))

(add-hook 'kill-buffer-hook #'add-file-to-killed-file-list)

(defun reopen-killed-file ()
  "Reopen the most recently killed file, if one exists."
  (interactive)
  (if killed-file-list
      (find-file (pop killed-file-list))
    (message "No recently killed file found to reopen.")))

;; Set initial frame size and position
;; fills full screen of the left monitor
