(byte-compile-file (buffer-file-name) t)))
(error "Please install `hydra' and recompile/reinstall `ivy-hydra'")))))))
+(defun ivy--matcher-desc ()
+ (if (eq ivy--regex-function
+ 'ivy--regex-fuzzy)
+ "fuzzy"
+ "ivy"))
+
(defhydra hydra-ivy (:hint nil
:color pink)
"
-^^^^^^ ^Yes^ ^No^ ^Maybe^ ^Action^
-^^^^^^^^^^^^^^---------------------------------------------------------------
-^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %-3s(if ivy-calling \"on\" \"off\") _w_/_s_/_a_: %-14s(ivy-action-name)
-_h_ ^+^ _l_ _d_one _o_ops _m_: matcher %-27s(if (eq ivy--regex-function 'ivy--regex-fuzzy) \"fuzzy\" \"ivy\")
-^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow _t_runcate: %-11`truncate-lines
+^^^^^^ ^Yes^ ^No^ ^Maybe^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Action^ ^
+^^^^^^^^^^^^^^----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------
+^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %-5s(if ivy-calling \"on\" \"off\") _w_/_s_/_a_: %-14s(ivy-action-name)
+_h_ ^+^ _l_ _d_one _o_ops _m_: matcher %-5s(ivy--matcher-desc)^^^^^^^^^^^^ _C_ase-fold: %-10`ivy-case-fold-search
+^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _t_runcate: %-11`truncate-lines
"
;; arrows
("h" ivy-beginning-of-buffer)
("w" ivy-prev-action)
("s" ivy-next-action)
("a" ivy-read-action)
- ("t" (setq truncate-lines (not truncate-lines))))
+ ("t" (setq truncate-lines (not truncate-lines)))
+ ("C" ivy-toggle-case-fold))
(provide 'ivy-hydra)
(defvar ivy--old-text ""
"Store old `ivy-text' for dynamic completion.")
+(defvar ivy-case-fold-search 'auto
+ "Store the current overriding `case-fold-search'.")
+
(defvar Info-current-file)
(defmacro ivy-quit-and-run (&rest body)
(setq initial-input (cdr (assoc this-command
ivy-initial-inputs-alist))))
(setq ivy--directory nil)
+ (setq ivy-case-fold-search 'auto)
(setq ivy--regex-function
(or re-builder
(and (functionp collection)
(eval-after-load 'flx
'(setq ivy--flx-cache (flx-make-string-cache)))
+(defun ivy-toggle-case-fold ()
+ "Toggle the case folding between nil and auto.
+In any completion session, the case folding starts in auto:
+
+- when the input is all lower case, `case-fold-search' is t
+- otherwise it's nil.
+
+You can toggle this to make `case-fold-search' nil regardless of input."
+ (interactive)
+ (setq ivy-case-fold-search
+ (if ivy-case-fold-search
+ nil
+ 'auto))
+ ;; reset cache so that the candidate list updates
+ (setq ivy--old-re nil))
+
(defun ivy--filter (name candidates)
"Return all items that match NAME in CANDIDATES.
CANDIDATES are assumed to be static."
ivy--old-cands
(let* ((re-str (if (listp re) (caar re) re))
(matcher (ivy-state-matcher ivy-last))
- (case-fold-search (string= name (downcase name)))
+ (case-fold-search
+ (and ivy-case-fold-search
+ (string= name (downcase name))))
(cands (cond
(matcher
(funcall matcher re candidates))