 
 
 ;;
-;;; Plugins
-
-(map! "C-="  #'er/expand-region
-      "C--"  #'er/contract-region
-      (:when (featurep! :ui neotree)
-        "<f9>"   #'+neotree/open
-        "<C-f9>" #'+neotree/find-this-file)
-      (:when (featurep! :ui treemacs)
-        "<f9>"   #'+treemacs/toggle
-        "<C-f9>" #'+treemacs/find-file)
-      ;; smartparens
-      (:after smartparens
-        :map smartparens-mode-map
-        "C-M-a"     #'sp-beginning-of-sexp
-        "C-M-e"     #'sp-end-of-sexp
-        "C-M-f"     #'sp-forward-sexp
-        "C-M-b"     #'sp-backward-sexp
-        "C-M-d"     #'sp-splice-sexp
-        "C-M-k"     #'sp-kill-sexp
-        "C-M-t"     #'sp-transpose-sexp
-        "C-<right>" #'sp-forward-slurp-sexp
-        "M-<right>" #'sp-forward-barf-sexp
-        "C-<left>"  #'sp-backward-slurp-sexp
-        "M-<left>"  #'sp-backward-barf-sexp)
-      ;; company mode
+;;; Global & plugin keybinds
+
+(map! "C-'" #'imenu
+
+      ;;; Text scaling
+      [C-mouse-4] #'text-scale-increase
+      [C-mouse-5] #'text-scale-decrease
+      [C-down-mouse-2] (λ! (text-scale-set 0))
+      "M-+" #'doom/reset-font-size
+      "M-=" #'doom/increase-font-size
+      "M--" #'doom/decrease-font-size
+
+      ;;; newlines
+      [remap newline]  #'newline-and-indent
+      "C-j"            #'+default/newline
+
+      ;;; search
+      (:when (featurep! :completion ivy)
+        "C-S-s"        #'swiper
+        "C-S-r"        #'ivy-resume)
+      (:when (featurep! :completion helm)
+        "C-S-s"        #'swiper-helm
+        "C-S-r"        #'helm-resume)
+
+      ;;; buffer management
+      "C-x b"       #'persp-switch-to-buffer
+      (:when (featurep! :completion ivy)
+        "C-x 4 b"   #'+ivy/switch-workspace-buffer-other-window)
+      "C-x C-b"     #'ibuffer-list-buffers
+      "C-x B"       #'switch-to-buffer
+      "C-x 4 B"     #'switch-to-buffer-other-window
+      "C-x K"       #'doom/kill-this-buffer-in-all-windows
+
+      ;;; company-mode
       "C-;" #'+company/complete
-      ;; Counsel
-      (:when (featurep! :completion ivy)
-        (:after counsel
-          :map counsel-ag-map
-          "C-c C-e"  #'+ivy/wgrep-occur      ; search/replace on results
-          [backtab]  #'+ivy/wgrep-occur      ; search/replace on results
-          "C-SPC"    #'ivy-call-and-recenter ; preview
-          "M-RET"    (+ivy-do-action! #'+ivy-git-grep-other-window-action))
-        "C-M-y" #'counsel-yank-pop)
-      ;; repl toggle
-      "C-c C-z" #'+eval/open-repl-other-window
-      ;; company mode
       (:after company
         :map company-active-map
         "C-o"        #'company-search-kill-others

        :desc "Recent project files"        "R"   #'projectile-recentf
        :desc "Sudo this file"              "s"   #'doom/sudo-this-file
        :desc "Sudo find file"              "S"   #'doom/sudo-find-file
        :desc "Delete this file"            "X"   #'doom/delete-this-file
        :desc "Yank filename"               "y"   #'+default/yank-buffer-filename)

      "o" nil ; we need to unbind it first as Org claims this
      (:prefix ("o". "org")
        (:prefix ("a" . "org agenda")
          :desc "Agenda"                  "a"   #'org-agenda
          :desc "Todo list"               "t"   #'org-todo-list
          :desc "Tags view"               "m"   #'org-tags-view
          :desc "View search"             "v"   #'org-search-view)
        :desc "Switch org buffers"      "b"     #'org-switchb
        :desc "Capture"                 "c"     #'org-capture
        :desc "Goto capture"            "C"     (λ! (require 'org-capture) (call-interactively #'org-capture-goto-target))
        :desc "Link store"              "l"     #'org-store-link
        :desc "Sync org caldav"         "s"     #'org-caldav-sync)

      (:prefix ("q" . "quit/restart")
        :desc "Quit Emacs"                   "q" #'kill-emacs
        :desc "Save and quit Emacs"          "Q" #'save-buffers-kill-terminal
        (:when (featurep! :ui workspaces)

        :desc "Create Temp Template"  "c" #'aya-create
        :desc "Use Temp Template"     "e" #'aya-expand)

      ;;; <leader> v --- versioning
      (:prefix-map ("v" . "versioning")
        :desc "Git revert file"             "R"   #'vc-revert
        (:when (featurep! :ui vc-gutter)
          :desc "Git revert hunk"           "r"   #'git-gutter:revert-hunk
