       ;; "g t" (lambda () (interactive)
       ;;         (call-interactively 'lsp-goto-type-definition))
 
-      :desc "Open error list"
-      "e l" (lambda () (interactive) (lsp-treemacs-errors-list))
-
-      :desc "Next error"
-      "e n" (lambda () (interactive) (next-error))
-
-      :desc "Previous error"
-      "e N" (lambda () (interactive) (previous-error))
-
-      :desc "Code actions"
-      "c a" (lambda () (interactive)
-              (call-interactively 'lsp-execute-code-action))
-
-      :desc "Go to references"
-      "g r" (lambda () (interactive)
-              (call-interactively 'lsp-find-references))
-      :desc "Go to definition"
-      "g d" (lambda () (interactive)
-              (call-interactively 'lsp-find-definition))
-
-      ;; :desc "Go to type definition"
-      ;; "g t" (lambda () (interactive)
-      ;;         (call-interactively 'lsp-goto-type-definition))
-
       :desc "Go to implementation"
       "g i" (lambda () (interactive)
               (call-interactively 'lsp-goto-implementation))

;; (define-key evil-visual-state-map (kbd "C-c") 'evil-normal-state)
;; (define-key evil-visual-state-map (kbd "C-c") 'evil-exit-visual-state)

(map! :i "C-c" #'evil-normal-state)
(map! :v "C-c" #'evil-normal-state)
(map! :v "C-c" #'evil-normal-state)

(map! :n "C-_ C-_" #'comment-line)
(map! :v "C-_ C-_" #'comment-region)

(map! :i "C-x C-s" #'evil-write)
(map! :n "C-x C-s" #'evil-write)
(map! :v "C-x C-s" #'evil-write)

(map! :n ",," #'evil-buffer)
(map! :n ",f" #'projectile-find-file)
(map! :n ",b" #'+vertico/switch-workspace-buffer)
(map! :n ",gt" #'consult-lsp-symbols)

(map! :n "[d" #'previous-error)
(map! :n "]d" #'next-error)

(map! :n "-" #'lsp-format-buffer)
(map! :v "-" #'lsp-format-region)

;; (define-key evil-visual-state-map (kbd "C-x C-s") 'evil-write)

;; (define-key evil-normal-state-map (kbd ",,") 'evil-buffer)
;; (define-key evil-normal-state-map (kbd ",f") 'projectile-find-file)

;; Make C-e, C-d, C-k behave same as in Emacs when in insert mode.
(define-key evil-insert-state-map (kbd "C-e") nil)
(define-key evil-insert-state-map (kbd "C-d") nil)
(define-key evil-insert-state-map (kbd "C-k") nil)

;; Makes C-e behave same as in Emacs. C-a works out of the box
(define-key evil-motion-state-map (kbd "C-e") nil)

(define-key evil-normal-state-map (kbd "<left>") (lambda () (interactive)
                                                (call-interactively 'evil-window-decrease-width)
                                                (call-interactively 'evil-window-decrease-width)
                                                (call-interactively 'evil-window-decrease-width)
                                                (call-interactively 'evil-window-decrease-width)
                                                (call-interactively 'evil-window-decrease-width)
                                                ))

(define-key evil-normal-state-map (kbd "<right>") (lambda () (interactive)
                                                (call-interactively 'evil-window-increase-width)
                                                (call-interactively 'evil-window-increase-width)
                                                (call-interactively 'evil-window-increase-width)
                                                (call-interactively 'evil-window-increase-width)
                                                (call-interactively 'evil-window-increase-width)
                                                ))


(define-key evil-normal-state-map (kbd "<up>") (lambda () (interactive)
                                                (call-interactively 'evil-window-decrease-height)
                                                (call-interactively 'evil-window-decrease-height)
                                                (call-interactively 'evil-window-decrease-height)
                                                (call-interactively 'evil-window-decrease-height)
                                                (call-interactively 'evil-window-decrease-height)
                                                ))

(define-key evil-normal-state-map (kbd "<down>") (lambda () (interactive)
                                                (call-interactively 'evil-window-increase-height)
                                                (call-interactively 'evil-window-increase-height)
                                                (call-interactively 'evil-window-increase-height)
                                                (call-interactively 'evil-window-increase-height)
                                                (call-interactively 'evil-window-increase-height)
                                                ))


;; Switching between windows with C-hjkl
(define-key evil-normal-state-map (kbd "C-l") 'evil-window-right)
(define-key evil-normal-state-map (kbd "C-h") 'evil-window-left)
(define-key evil-normal-state-map (kbd "C-j") 'evil-window-down)
(define-key evil-normal-state-map (kbd "C-k") 'evil-window-up)

(define-key evil-normal-state-map (kbd "C-x h k") 'describe-key)
(define-key evil-normal-state-map (kbd "C-x h f") 'describe-function)
(define-key evil-normal-state-map (kbd "C-x h v") 'describe-variable)

; (define-key evil-normal-state-map (kbd "C-d") 'scroll-up-command)
; (define-key evil-normal-state-map (kbd "C-u") 'scroll-down-command)

;; Insert mode as well
(define-key evil-insert-state-map (kbd "C-a") 'move-beginning-of-line)

(define-key evil-insert-state-map (kbd "C-l") 'evil-window-right)
(define-key evil-insert-state-map (kbd "C-h") 'evil-window-left)
(define-key evil-insert-state-map (kbd "C-j") 'evil-window-down)
(define-key evil-insert-state-map (kbd "C-k") 'evil-window-up)

; (defadvice! hy/evil-scroll-advice (fn count)
;   :around #'evil-scroll-down

(map! :localleader
      :map rust-mode-map

      ;; :desc "Go to references"
      ;; "g r" (lambda () (interactive)
      ;;         (call-interactively 'lsp-find-references))

      ;; :desc "Go to definition"
      ;; "g d" (lambda () (interactive)
      ;;         (call-interactively 'lsp-find-definition))

      ;; :desc "Go to type definition"
      ;; "g t" (lambda () (interactive)
      ;;         (call-interactively 'lsp-goto-type-definition))

      ;; :desc "Open error list"
      ;; "e l" (lambda () (interactive) (lsp-treemacs-errors-list))

      ;; :desc "Next error"
      ;; "e n" (lambda () (interactive) (next-error))

      ;; :desc "Previous error"
      ;; "e N" (lambda () (interactive) (previous-error))

      :desc "Code actions"
      "c a" (lambda () (interactive)
              (call-interactively 'lsp-execute-code-action))

      :desc "Go to references"
      "g r" (lambda () (interactive)
              (call-interactively 'lsp-find-references))
