Function: viper-toggle-search-style
viper-toggle-search-style is an interactive and byte-compiled function
defined in viper-cmd.el.gz.
Signature
(viper-toggle-search-style ARG)
Documentation
Toggle the value of viper-case-fold-search/viper-re-search.
Without prefix argument, will ask which search style to toggle. With prefix arg 1, toggles viper-case-fold-search; with arg 2 toggles viper-re-search.
Although this function is bound to M-x viper-toggle-search-style (viper-toggle-search-style), the most
convenient way to use it is to bind // to the macro
1 M-x viper-toggle-search-style and /// to
2 M-x viper-toggle-search-style. In this way, hitting // quickly will
toggle case-fold-search and hitting / three times with toggle regexp
search. Macros are more convenient in this case because they don't affect
the Emacs binding of /.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emulation/viper-cmd.el.gz
(defun viper-toggle-search-style (arg)
"Toggle the value of viper-case-fold-search/viper-re-search.
Without prefix argument, will ask which search style to toggle. With prefix
arg 1, toggles viper-case-fold-search; with arg 2 toggles viper-re-search.
Although this function is bound to \\[viper-toggle-search-style], the most
convenient way to use it is to bind `//' to the macro
`1 M-x viper-toggle-search-style' and `///' to
`2 M-x viper-toggle-search-style'. In this way, hitting `//' quickly will
toggle case-fold-search and hitting `/' three times with toggle regexp
search. Macros are more convenient in this case because they don't affect
the Emacs binding of `/'."
(interactive "P")
(let (msg)
(cond ((or (eq arg 1)
(and (null arg)
(y-or-n-p (format-message
"Search style: `%s'. Want `%s'? "
(if viper-case-fold-search
"case-insensitive" "case-sensitive")
(if viper-case-fold-search
"case-sensitive"
"case-insensitive")))))
(setq viper-case-fold-search (null viper-case-fold-search))
(if viper-case-fold-search
(setq msg "Search becomes case-insensitive")
(setq msg "Search becomes case-sensitive")))
((or (eq arg 2)
(and (null arg)
(y-or-n-p (format-message
"Search style: `%s'. Want `%s'? "
(if viper-re-search
"regexp-search" "vanilla-search")
(if viper-re-search
"vanilla-search"
"regexp-search")))))
(setq viper-re-search (null viper-re-search))
(if viper-re-search
(setq msg "Search becomes regexp-style")
(setq msg "Search becomes vanilla-style")))
(t
(setq msg "Search style remains unchanged")))
(princ msg t)))