<commit_before>;;; config/default/+bindings.el -*- lexical-binding: t; -*-

;; This file defines a Spacemacs-esque keybinding scheme

;; Don't let evil-collection interfere with certain keys
(setq evil-collection-key-blacklist
      (list "C-j" "C-k" "gd" "gf" "K" "[" "]" "gz"
            doom-leader-key doom-localleader-key
            doom-leader-alt-key doom-localleader-alt-key))


;;
;;; Global keybindings

(map! (:map override
        ;; A little sandbox to run code in
        "M-;" #'eval-expression
        "A-;" #'eval-expression)

      ;; Smart tab, these will only work in GUI Emacs
      :i [tab] (general-predicate-dispatch nil ; fall back to nearest keymap
                 (and (featurep! :editor snippets)
                      (bound-and-true-p yas-minor-mode)
                      (yas-maybe-expand-abbrev-key-filter 'yas-expand))
                 'yas-expand
                 (and (featurep! :completion company +tng)
                      (+company-has-completion-p))
                 '+company/complete)
      :n [tab] (general-predicate-dispatch nil
                 (and (featurep! :editor fold)
                      (save-excursion (end-of-line) (invisible-p (point))))
                 '+fold/toggle
                 (fboundp 'evil-jump-item)
                 'evil-jump-item)
      :v [tab] (general-predicate-dispatch nil
                 (and (bound-and-true-p yas-minor-mode)
                      (or (eq evil-visual-selection 'line)
                          (not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\))))))
                 'yas-insert-snippet
                 (fboundp 'evil-jump-item)
                 'evil-jump-item)

      ;; Smarter newlines
      :i [remap newline] #'newline-and-indent  ; auto-indent on newline
      :i "C-j"           #'+default/newline    ; default behavior

      (:after vc-annotate
        :map vc-annotate-mode-map
        [remap quit-window] #'kill-current-buffer)

      (:map (help-mode-map helpful-mode-map)
        :n "o" 'ace-link-help)

      ;; misc
      :n "C-S-f"  #'toggle-frame-fullscreen

      ;; Global evil keybinds
      :m  "]a"    #'evil-forward-arg
      :m  "[a"    #'evil-backward-arg
      :m  "]o"    #'outline-next-visible-heading
      :m  "[o"    #'outline-previous-visible-heading
      :n  "]b"    #'next-buffer
      :n  "[b"    #'previous-buffer
      :n  "zx"    #'kill-current-buffer
      :n  "ZX"    #'bury-buffer
      :n  "gp"    #'+evil/reselect-paste
      :n  "g="    #'evil-numbers/inc-at-pt
      :n  "g-"    #'evil-numbers/dec-at-pt
      :v  "g="    #'evil-numbers/inc-at-pt-incremental
      :v  "g-"    #'evil-numbers/dec-at-pt-incremental
      :v  "g+"    #'evil-numbers/inc-at-pt
      :nv "z="    #'flyspell-correct-word-generic
      :nv "g@"    #'+evil:apply-macro
      :nv "gc"    #'evil-commentary
      :nv "gx"    #'evil-exchange
      :v  "gp"    #'+evil/paste-preserve-register
      :v  "@"     #'+evil:apply-macro
      ;; repeat in visual mode (FIXME buggy)
      :v  "."     #'+evil:apply-macro
      ;; don't leave visual mode after shifting
      :v  "<"     #'+evil/visual-dedent  ; vnoremap < <gv
      :v  ">"     #'+evil/visual-indent  ; vnoremap > >gv

      ;; window management (prefix "C-w")
      (:map evil-window-map
        ;; Navigation
        "C-h"     #'evil-window-left
        "C-j"     #'evil-window-down
        "C-k"     #'evil-window-up
        "C-l"     #'evil-window-right
        "C-w"     #'other-window
        ;; Swapping windows
        "H"       #'+evil/window-move-left
        "J"       #'+evil/window-move-down
        "K"       #'+evil/window-move-up
        "L"       #'+evil/window-move-right
        "C-S-w"   #'ace-swap-window
        ;; Window undo/redo
        (:prefix "m"
          "m"       #'doom/window-maximize-buffer
          "v"       #'doom/window-maximize-vertically
          "s"       #'doom/window-maximize-horizontally)
        "u"       #'winner-undo
        "C-u"     #'winner-undo
        "C-r"     #'winner-redo
        "o"       #'doom/window-enlargen
        ;; Delete window
        "c"       #'+workspace/close-window-or-workspace
        "C-C"     #'ace-delete-window)

      ;; Plugins
      ;; evil-easymotion
      :m  "gs"    #'+evil/easymotion  ; lazy-load `evil-easymotion'
      (:after evil-easymotion
        :map evilem-map
        "a" (evilem-create #'evil-forward-arg)
        "A" (evilem-create #'evil-backward-arg)
        "s" (evilem-create #'evil-snipe-repeat
                           :name 'evil-easymotion-snipe-forward
                           :pre-hook (save-excursion (call-interactively #'evil-snipe-s))
                           :bind ((evil-snipe-scope 'buffer)
                                  (evil-snipe-enable-highlight)
                                  (evil-snipe-enable-incremental-highlight)))
        "S" (evilem-create #'evil-snipe-repeat
                           :name 'evil-easymotion-snipe-backward
                           :pre-hook (save-excursion (call-interactively #'evil-snipe-S))
                           :bind ((evil-snipe-scope 'buffer)
                                  (evil-snipe-enable-highlight)
                                  (evil-snipe-enable-incremental-highlight)))
        "SPC" #'avy-goto-char-timer
        "/" (evilem-create #'evil-ex-search-next
                           :pre-hook (save-excursion (call-interactively #'evil-ex-search-forward))
                           :bind ((evil-search-wrap)))
        "?" (evilem-create #'evil-ex-search-previous
                           :pre-hook (save-excursion (call-interactively #'evil-ex-search-backward))
                           :bind ((evil-search-wrap))))

      ;; text object plugins
      :textobj "x" #'evil-inner-xml-attr               #'evil-outer-xml-attr
      :textobj "a" #'evil-inner-arg                    #'evil-outer-arg
      :textobj "B" #'evil-textobj-anyblock-inner-block #'evil-textobj-anyblock-a-block
      :textobj "i" #'evil-indent-plus-i-indent         #'evil-indent-plus-a-indent
      :textobj "k" #'evil-indent-plus-i-indent-up      #'evil-indent-plus-a-indent-up
      :textobj "j" #'evil-indent-plus-i-indent-up-down #'evil-indent-plus-a-indent-up-down

      ;; evil-snipe
      (:after evil-snipe
        :map evil-snipe-parent-transient-map
        "C-;" (λ! (require 'evil-easymotion)
                  (call-interactively
                   (evilem-create #'evil-snipe-repeat
                                  :bind ((evil-snipe-scope 'whole-buffer)
                                         (evil-snipe-enable-highlight)
                                         (evil-snipe-enable-incremental-highlight))))))

      ;; evil-surround
      :v "S" #'evil-surround-region
      :o "s" #'evil-surround-edit
      :o "S" #'evil-Surround-edit)


;;
;;; Module keybinds

;;; :completion
(map! (:when (featurep! :completion company)
        :i "C-@"      #'+company/complete
        :i "C-SPC"    #'+company/complete
        (:prefix "C-x"
          :i "C-l"    #'+company/whole-lines
          :i "C-k"    #'+company/dict-or-keywords
          :i "C-f"    #'company-files
          :i "C-]"    #'company-etags
          :i "s"      #'company-ispell
          :i "C-s"    #'company-yasnippet
          :i "C-o"    #'company-capf
          :i "C-n"    #'+company/dabbrev
          :i "C-p"    #'+company/dabbrev-code-previous)
        (:after company
          (:map company-active-map
            "C-w"     nil  ; don't interfere with `evil-delete-backward-word'
            "C-n"     #'company-select-next
            "C-p"     #'company-select-previous
            "C-j"     #'company-select-next
            "C-k"     #'company-select-previous
            "C-h"     #'company-show-doc-buffer
            "C-u"     #'company-previous-page
            "C-d"     #'company-next-page
            "C-s"     #'company-filter-candidates
            "C-S-s"   (cond ((featurep! :completion helm) #'helm-company)
                            ((featurep! :completion ivy)  #'counsel-company))
            "C-SPC"   #'company-complete-common
            "TAB"     #'company-complete-common-or-cycle
            [tab]     #'company-complete-common-or-cycle
            [backtab] #'company-select-previous)
          (:map company-search-map  ; applies to `company-filter-map' too
            "C-n"     #'company-select-next-or-abort
            "C-p"     #'company-select-previous-or-abort
            "C-j"     #'company-select-next-or-abort
            "C-k"     #'company-select-previous-or-abort
            "C-s"     (λ! (company-search-abort) (company-filter-candidates))
            "ESC"     #'company-search-abort)
          ;; TAB auto-completion in term buffers
          (:map comint-mode-map
            "TAB" #'company-complete
            [tab] #'company-complete)))

      (:when (featurep! :completion ivy)
        (:map (help-mode-map helpful-mode-map)
          :n "Q" #'ivy-resume)
        (:after ivy
          :map ivy-minibuffer-map
          "C-SPC" #'ivy-call-and-recenter  ; preview file
          "C-l"   #'ivy-alt-done
          "C-v"   #'yank)
        (:after counsel
          :map counsel-ag-map
          "C-SPC"    #'ivy-call-and-recenter ; preview
          "C-l"      #'ivy-done
          [C-return] (+ivy-do-action! #'+ivy-git-grep-other-window-action)))

      (:when (featurep! :completion helm)
        (:after helm
          (:map helm-map
            [left]     #'left-char
            [right]    #'right-char
            "C-S-n"    #'helm-next-source
            "C-S-p"    #'helm-previous-source
            "C-j"      #'helm-next-line
            "C-k"      #'helm-previous-line
            "C-S-j"    #'helm-next-source
            "C-S-k"    #'helm-previous-source
            "C-f"      #'helm-next-page
            "C-S-f"    #'helm-previous-page
            "C-u"      #'helm-delete-minibuffer-contents
            "C-w"      #'backward-kill-word
            "C-r"      #'evil-paste-from-register ; Evil registers in helm! Glorious!
            "C-s"      #'helm-minibuffer-history
            "C-b"      #'backward-word
            ;; Swap TAB and C-z
            "TAB"      #'helm-execute-persistent-action
            [tab]      #'helm-execute-persistent-action
            "C-z"      #'helm-select-action)
          (:after helm-ag
            :map helm-ag-map
            "C--"      #'+helm-do-ag-decrease-context
            "C-="      #'+helm-do-ag-increase-context
            [left]     nil
            [right]    nil)
          (:after helm-files
            :map (helm-find-files-map helm-read-file-map)
            [C-return] #'helm-ff-run-switch-other-window
            "C-w"      #'helm-find-files-up-one-level)
          (:after helm-locate
            :map helm-generic-files-map
            [C-return] #'helm-ff-run-switch-other-window)
          (:after helm-buffers
            :map helm-buffer-map
            [C-return] #'helm-buffer-switch-other-window)
          (:after helm-occur
            :map helm-occur-map
            [C-return] #'helm-occur-run-goto-line-ow)
          (:after helm-grep
            :map helm-grep-map
            [C-return] #'helm-grep-run-other-window-action))))

;;; :ui
(map! (:when (featurep! :ui hl-todo)
        :m "]t" #'hl-todo-next
        :m "[t" #'hl-todo-previous)

      (:when (featurep! :ui neotree)
        :after neotree
        :map neotree-mode-map
        :n "g"      nil
        :n "TAB"    #'neotree-quick-look
        :n "RET"    #'neotree-enter
        :n [tab]    #'neotree-quick-look
        :n [return] #'neotree-enter
        :n "DEL"    #'evil-window-prev
        :n "c"      #'neotree-create-node
        :n "r"      #'neotree-rename-node
        :n "d"      #'neotree-delete-node
        :n "j"      #'neotree-next-line
        :n "k"      #'neotree-previous-line
        :n "n"      #'neotree-next-line
        :n "p"      #'neotree-previous-line
        :n "h"      #'+neotree/collapse-or-up
        :n "l"      #'+neotree/expand-or-open
        :n "J"      #'neotree-select-next-sibling-node
        :n "K"      #'neotree-select-previous-sibling-node
        :n "H"      #'neotree-select-up-node
        :n "L"      #'neotree-select-down-node
        :n "G"      #'evil-goto-line
        :n "gg"     #'evil-goto-first-line
        :n "v"      #'neotree-enter-vertical-split
        :n "s"      #'neotree-enter-horizontal-split
        :n "q"      #'neotree-hide
        :n "R"      #'neotree-refresh)

      (:when (featurep! :ui popup)
        :n "C-`"   #'+popup/toggle
        :n "C-~"   #'+popup/raise
        :g "C-x p" #'+popup/other)

      (:when (featurep! :ui vc-gutter)
        :m "]d"    #'git-gutter:next-hunk
        :m "[d"    #'git-gutter:previous-hunk)

      (:when (featurep! :ui workspaces)
        :n "gt"    #'+workspace/switch-right
        :n "gT"    #'+workspace/switch-left
        :n "]w"    #'+workspace/switch-right
        :n "[w"    #'+workspace/switch-left
        :g "M-1"   (λ! (+workspace/switch-to 0))
        :g "M-2"   (λ! (+workspace/switch-to 1))
        :g "M-3"   (λ! (+workspace/switch-to 2))
        :g "M-4"   (λ! (+workspace/switch-to 3))
        :g "M-5"   (λ! (+workspace/switch-to 4))
        :g "M-6"   (λ! (+workspace/switch-to 5))
        :g "M-7"   (λ! (+workspace/switch-to 6))
        :g "M-8"   (λ! (+workspace/switch-to 7))
        :g "M-9"   (λ! (+workspace/switch-to 8))
        :g "M-0"   #'+workspace/switch-to-final
        :g "M-t"   #'+workspace/new
        :g "M-T"   #'+workspace/display))

;;; :editor
(map! (:when (featurep! :editor fold)
        :nv "C-SPC" #'+fold/toggle)<commit_msg>Replace closures with +workspace/switch-to-N<commit_after>;;; config/default/+bindings.el -*- lexical-binding: t; -*-

;; This file defines a Spacemacs-esque keybinding scheme

;; Don't let evil-collection interfere with certain keys
(setq evil-collection-key-blacklist
      (list "C-j" "C-k" "gd" "gf" "K" "[" "]" "gz"
            doom-leader-key doom-localleader-key
            doom-leader-alt-key doom-localleader-alt-key))


;;
;;; Global keybindings

(map! (:map override
        ;; A little sandbox to run code in
        "M-;" #'eval-expression
        "A-;" #'eval-expression)

      ;; Smart tab, these will only work in GUI Emacs
      :i [tab] (general-predicate-dispatch nil ; fall back to nearest keymap
                 (and (featurep! :editor snippets)
                      (bound-and-true-p yas-minor-mode)
                      (yas-maybe-expand-abbrev-key-filter 'yas-expand))
                 'yas-expand
                 (and (featurep! :completion company +tng)
                      (+company-has-completion-p))
                 '+company/complete)
      :n [tab] (general-predicate-dispatch nil
                 (and (featurep! :editor fold)
                      (save-excursion (end-of-line) (invisible-p (point))))
                 '+fold/toggle
                 (fboundp 'evil-jump-item)
                 'evil-jump-item)
      :v [tab] (general-predicate-dispatch nil
                 (and (bound-and-true-p yas-minor-mode)
                      (or (eq evil-visual-selection 'line)
                          (not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\))))))
                 'yas-insert-snippet
                 (fboundp 'evil-jump-item)
                 'evil-jump-item)

      ;; Smarter newlines
      :i [remap newline] #'newline-and-indent  ; auto-indent on newline
      :i "C-j"           #'+default/newline    ; default behavior

      (:after vc-annotate
        :map vc-annotate-mode-map
        [remap quit-window] #'kill-current-buffer)

      (:map (help-mode-map helpful-mode-map)
        :n "o" 'ace-link-help)

      ;; misc
      :n "C-S-f"  #'toggle-frame-fullscreen

      ;; Global evil keybinds
      :m  "]a"    #'evil-forward-arg
      :m  "[a"    #'evil-backward-arg
      :m  "]o"    #'outline-next-visible-heading
      :m  "[o"    #'outline-previous-visible-heading
      :n  "]b"    #'next-buffer
      :n  "[b"    #'previous-buffer
      :n  "zx"    #'kill-current-buffer
      :n  "ZX"    #'bury-buffer
      :n  "gp"    #'+evil/reselect-paste
      :n  "g="    #'evil-numbers/inc-at-pt
      :n  "g-"    #'evil-numbers/dec-at-pt
      :v  "g="    #'evil-numbers/inc-at-pt-incremental
      :v  "g-"    #'evil-numbers/dec-at-pt-incremental
      :v  "g+"    #'evil-numbers/inc-at-pt
      :nv "z="    #'flyspell-correct-word-generic
      :nv "g@"    #'+evil:apply-macro
      :nv "gc"    #'evil-commentary
      :nv "gx"    #'evil-exchange
      :v  "gp"    #'+evil/paste-preserve-register
      :v  "@"     #'+evil:apply-macro
      ;; repeat in visual mode (FIXME buggy)
      :v  "."     #'+evil:apply-macro
      ;; don't leave visual mode after shifting
      :v  "<"     #'+evil/visual-dedent  ; vnoremap < <gv
      :v  ">"     #'+evil/visual-indent  ; vnoremap > >gv

      ;; window management (prefix "C-w")
      (:map evil-window-map
        ;; Navigation
        "C-h"     #'evil-window-left
        "C-j"     #'evil-window-down
        "C-k"     #'evil-window-up
        "C-l"     #'evil-window-right
        "C-w"     #'other-window
        ;; Swapping windows
        "H"       #'+evil/window-move-left
        "J"       #'+evil/window-move-down
        "K"       #'+evil/window-move-up
        "L"       #'+evil/window-move-right
        "C-S-w"   #'ace-swap-window
        ;; Window undo/redo
        (:prefix "m"
          "m"       #'doom/window-maximize-buffer
          "v"       #'doom/window-maximize-vertically
          "s"       #'doom/window-maximize-horizontally)
        "u"       #'winner-undo
        "C-u"     #'winner-undo
        "C-r"     #'winner-redo
        "o"       #'doom/window-enlargen
        ;; Delete window
        "c"       #'+workspace/close-window-or-workspace
        "C-C"     #'ace-delete-window)

      ;; Plugins
      ;; evil-easymotion
      :m  "gs"    #'+evil/easymotion  ; lazy-load `evil-easymotion'
      (:after evil-easymotion
        :map evilem-map
        "a" (evilem-create #'evil-forward-arg)
        "A" (evilem-create #'evil-backward-arg)
        "s" (evilem-create #'evil-snipe-repeat
                           :name 'evil-easymotion-snipe-forward
                           :pre-hook (save-excursion (call-interactively #'evil-snipe-s))
                           :bind ((evil-snipe-scope 'buffer)
                                  (evil-snipe-enable-highlight)
                                  (evil-snipe-enable-incremental-highlight)))
        "S" (evilem-create #'evil-snipe-repeat
                           :name 'evil-easymotion-snipe-backward
                           :pre-hook (save-excursion (call-interactively #'evil-snipe-S))
                           :bind ((evil-snipe-scope 'buffer)
                                  (evil-snipe-enable-highlight)
                                  (evil-snipe-enable-incremental-highlight)))
        "SPC" #'avy-goto-char-timer
        "/" (evilem-create #'evil-ex-search-next
                           :pre-hook (save-excursion (call-interactively #'evil-ex-search-forward))
                           :bind ((evil-search-wrap)))
        "?" (evilem-create #'evil-ex-search-previous
                           :pre-hook (save-excursion (call-interactively #'evil-ex-search-backward))
                           :bind ((evil-search-wrap))))

      ;; text object plugins
      :textobj "x" #'evil-inner-xml-attr               #'evil-outer-xml-attr
      :textobj "a" #'evil-inner-arg                    #'evil-outer-arg
      :textobj "B" #'evil-textobj-anyblock-inner-block #'evil-textobj-anyblock-a-block
      :textobj "i" #'evil-indent-plus-i-indent         #'evil-indent-plus-a-indent
      :textobj "k" #'evil-indent-plus-i-indent-up      #'evil-indent-plus-a-indent-up
      :textobj "j" #'evil-indent-plus-i-indent-up-down #'evil-indent-plus-a-indent-up-down

      ;; evil-snipe
      (:after evil-snipe
        :map evil-snipe-parent-transient-map
        "C-;" (λ! (require 'evil-easymotion)
                  (call-interactively
                   (evilem-create #'evil-snipe-repeat
                                  :bind ((evil-snipe-scope 'whole-buffer)
                                         (evil-snipe-enable-highlight)
                                         (evil-snipe-enable-incremental-highlight))))))

      ;; evil-surround
      :v "S" #'evil-surround-region
      :o "s" #'evil-surround-edit
      :o "S" #'evil-Surround-edit)


;;
;;; Module keybinds

;;; :completion
(map! (:when (featurep! :completion company)
        :i "C-@"      #'+company/complete
        :i "C-SPC"    #'+company/complete
        (:prefix "C-x"
          :i "C-l"    #'+company/whole-lines
          :i "C-k"    #'+company/dict-or-keywords
          :i "C-f"    #'company-files
          :i "C-]"    #'company-etags
          :i "s"      #'company-ispell
          :i "C-s"    #'company-yasnippet
          :i "C-o"    #'company-capf
          :i "C-n"    #'+company/dabbrev
          :i "C-p"    #'+company/dabbrev-code-previous)
        (:after company
          (:map company-active-map
            "C-w"     nil  ; don't interfere with `evil-delete-backward-word'
            "C-n"     #'company-select-next
            "C-p"     #'company-select-previous
            "C-j"     #'company-select-next
            "C-k"     #'company-select-previous
            "C-h"     #'company-show-doc-buffer
            "C-u"     #'company-previous-page
            "C-d"     #'company-next-page
            "C-s"     #'company-filter-candidates
            "C-S-s"   (cond ((featurep! :completion helm) #'helm-company)
                            ((featurep! :completion ivy)  #'counsel-company))
            "C-SPC"   #'company-complete-common
            "TAB"     #'company-complete-common-or-cycle
            [tab]     #'company-complete-common-or-cycle
            [backtab] #'company-select-previous)
          (:map company-search-map  ; applies to `company-filter-map' too
            "C-n"     #'company-select-next-or-abort
            "C-p"     #'company-select-previous-or-abort
            "C-j"     #'company-select-next-or-abort
            "C-k"     #'company-select-previous-or-abort
            "C-s"     (λ! (company-search-abort) (company-filter-candidates))
            "ESC"     #'company-search-abort)
          ;; TAB auto-completion in term buffers
          (:map comint-mode-map
            "TAB" #'company-complete
            [tab] #'company-complete)))

      (:when (featurep! :completion ivy)
        (:map (help-mode-map helpful-mode-map)
          :n "Q" #'ivy-resume)
        (:after ivy
          :map ivy-minibuffer-map
          "C-SPC" #'ivy-call-and-recenter  ; preview file
          "C-l"   #'ivy-alt-done
          "C-v"   #'yank)
        (:after counsel
          :map counsel-ag-map
          "C-SPC"    #'ivy-call-and-recenter ; preview
          "C-l"      #'ivy-done
          [C-return] (+ivy-do-action! #'+ivy-git-grep-other-window-action)))

      (:when (featurep! :completion helm)
        (:after helm
          (:map helm-map
            [left]     #'left-char
            [right]    #'right-char
            "C-S-n"    #'helm-next-source
            "C-S-p"    #'helm-previous-source
            "C-j"      #'helm-next-line
            "C-k"      #'helm-previous-line
            "C-S-j"    #'helm-next-source
            "C-S-k"    #'helm-previous-source
            "C-f"      #'helm-next-page
            "C-S-f"    #'helm-previous-page
            "C-u"      #'helm-delete-minibuffer-contents
            "C-w"      #'backward-kill-word
            "C-r"      #'evil-paste-from-register ; Evil registers in helm! Glorious!
            "C-s"      #'helm-minibuffer-history
            "C-b"      #'backward-word
            ;; Swap TAB and C-z
            "TAB"      #'helm-execute-persistent-action
            [tab]      #'helm-execute-persistent-action
            "C-z"      #'helm-select-action)
          (:after helm-ag
            :map helm-ag-map
            "C--"      #'+helm-do-ag-decrease-context
            "C-="      #'+helm-do-ag-increase-context
            [left]     nil
            [right]    nil)
          (:after helm-files
            :map (helm-find-files-map helm-read-file-map)
            [C-return] #'helm-ff-run-switch-other-window
            "C-w"      #'helm-find-files-up-one-level)
          (:after helm-locate
            :map helm-generic-files-map
            [C-return] #'helm-ff-run-switch-other-window)
          (:after helm-buffers
            :map helm-buffer-map
            [C-return] #'helm-buffer-switch-other-window)
          (:after helm-occur
            :map helm-occur-map
            [C-return] #'helm-occur-run-goto-line-ow)
          (:after helm-grep
            :map helm-grep-map
            [C-return] #'helm-grep-run-other-window-action))))

;;; :ui
(map! (:when (featurep! :ui hl-todo)
        :m "]t" #'hl-todo-next
        :m "[t" #'hl-todo-previous)

      (:when (featurep! :ui neotree)
        :after neotree
        :map neotree-mode-map
        :n "g"      nil
        :n "TAB"    #'neotree-quick-look
        :n "RET"    #'neotree-enter
        :n [tab]    #'neotree-quick-look
        :n [return] #'neotree-enter
        :n "DEL"    #'evil-window-prev
        :n "c"      #'neotree-create-node
        :n "r"      #'neotree-rename-node
        :n "d"      #'neotree-delete-node
        :n "j"      #'neotree-next-line
        :n "k"      #'neotree-previous-line
        :n "n"      #'neotree-next-line
        :n "p"      #'neotree-previous-line
        :n "h"      #'+neotree/collapse-or-up
        :n "l"      #'+neotree/expand-or-open
        :n "J"      #'neotree-select-next-sibling-node
        :n "K"      #'neotree-select-previous-sibling-node
        :n "H"      #'neotree-select-up-node
        :n "L"      #'neotree-select-down-node
        :n "G"      #'evil-goto-line
        :n "gg"     #'evil-goto-first-line
        :n "v"      #'neotree-enter-vertical-split
        :n "s"      #'neotree-enter-horizontal-split
        :n "q"      #'neotree-hide
        :n "R"      #'neotree-refresh)

      (:when (featurep! :ui popup)
        :n "C-`"   #'+popup/toggle
        :n "C-~"   #'+popup/raise
        :g "C-x p" #'+popup/other)

      (:when (featurep! :ui vc-gutter)
        :m "]d"    #'git-gutter:next-hunk
        :m "[d"    #'git-gutter:previous-hunk)

      (:when (featurep! :ui workspaces)
        :n "gt"    #'+workspace/switch-right
        :n "gT"    #'+workspace/switch-left
        :n "]w"    #'+workspace/switch-right
        :n "[w"    #'+workspace/switch-left
        :g "M-1"   #'+workspace/switch-to-0
        :g "M-2"   #'+workspace/switch-to-1
        :g "M-3"   #'+workspace/switch-to-2
        :g "M-4"   #'+workspace/switch-to-3
        :g "M-5"   #'+workspace/switch-to-4
        :g "M-6"   #'+workspace/switch-to-5
        :g "M-7"   #'+workspace/switch-to-6
        :g "M-8"   #'+workspace/switch-to-7
        :g "M-9"   #'+workspace/switch-to-8
        :g "M-0"   #'+workspace/switch-to-final
        :g "M-t"   #'+workspace/new
        :g "M-T"   #'+workspace/display))

;;; :editor
(map! (:when (featurep! :editor fold)
        :nv "C-SPC" #'+fold/toggle)
{'fraction_non_alphanumeric': 0.16159542488452233, 'fraction_numerical': 0.0013930640076251924, 'mean_word_length': 1.5132669983416251, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4810601', 'n_tokens_mistral': 10068, 'n_tokens_neox': 9246, 'n_words': 1682}