Quellcode durchsuchen

Quick mode selector

Eiyeron Fulmincendii vor 4 Jahren
Ursprung
Commit
39218f34d3
1 geänderte Dateien mit 23 neuen und 0 gelöschten Zeilen
  1. 23 0
      config.org

+ 23 - 0
config.org

@@ -866,6 +866,29 @@ such feature.
     (add-to-list 'command-switch-alist '("ediff" . command-line-ediff))
     (add-to-list 'command-switch-alist '("ediff-merge" . command-line-ediff-merge))
 #+end_src
+* Quick mode selection
+As both an exercise and a way to quickly get the proper mode for newly created
+buffer, I created a small quick mode selector.
+#+begin_src emacs-lisp
+(setq chicken/quick-mode-modes '(("Org" . org-mode)
+                                 ("Emacs" . emacs-lisp-mode)
+                                 ("Lua" . lua-mode)))
+
+(defun chicken/quick-mode-set()
+  (interactive)
+  (ivy-read
+   "Select a mode"
+   chicken/quick-mode-modes
+   :require-match t
+   :action (lambda (selection)
+             (with-ivy-window
+               (when selection
+                 (funcall (cdr selection)))))))
+
+(map! :leader
+      :desc "Chicken" "M" nil
+      :desc "Quick mode select" "Mm" #'chicken/quick-mode-set)
+#+end_src
 
 * Unsorted Functions
 ** Search Everything with Everything