 ;; This section is dedicated to "fixing" certain keys so that they behave
 ;; sensibly (and consistently with similar contexts).
 
-(define-key input-decode-map [S-iso-lefttab] [backtab])
-
-;; Fix TAB in terminal
-(unless window-system
+(if window-system
+    (define-key! input-decode-map
+      [S-iso-lefttab] [backtab] ;; Fix MacOS shift+tab
+      (kbd "ESC") [escape])
+  ;; Fix TAB in terminal
   (define-key input-decode-map (kbd "TAB") [tab]))
 
 (after! tabulated-list

    [S-M-return] #'evil-open-above
    ;; Emacsien motions for insert mode
    "\C-b" #'backward-word
    "\C-f" #'forward-word)

  (evil-define-key* 'insert 'global
    ;; textmate-esque deletion
    [M-backspace] #'doom/backward-kill-to-bol-and-indent)


    "\C-f" #'forward-word)

  (after! view
    (define-key view-mode-map [escape] #'View-quit-all)))

;; Restore common editing keys (and ESC) in minibuffer
(defun +default|fix-minibuffer-in-map (map)
