 (require 'xah-fly-keys)
 (xah-fly-keys-set-layout "qwerty")
 (xah-fly-keys 1)
+
+;; remove auto save when moving to command-mode
+(remove-hook 'xah-fly-command-mode-activate-hook 'xah-fly-save-buffer-if-file)
 
 (global-set-key (kbd "<end>") 'xah-fly-insert-mode-activate)
 

(xah-fly--define-keys
 (define-prefix-command 'my-clojure-mode-keymap)
 '(
   ("J" . cider-connect) ;; J (Dvorak) -> C (Qwerty)
   ("." . cider-eval-last-sexp)
   (";" . cider-switch-to-repl-buffer)
   ))



;; since I use qwerty keybinding, the leader key here is qwerty key
(define-key xah-fly-leader-key-map (kbd "b") 'my-clojure-mode-keymap)

;; redo 


(defun mavbozo-use-y-caps-as-redo ()
  (interactive)
  (xah-fly--define-keys
   xah-fly-key-map
   '(("Y" . redo))))


(defun mavbozo-use-y-regular-in-insert-mode ()
  (interactive)
  (xah-fly--define-keys
   xah-fly-key-map
   '(("Y" . nil))))

;; automatic save buffer when switching to command mode
(add-hook 'xah-fly-command-mode-activate-hook 'mavbozo-use-y-caps-as-redo)

(add-hook 'xah-fly-insert-mode-activate-hook 'mavbozo-use-y-regular-in-insert-mode)
