evil
evil copied to clipboard
Feature: set-ic and set-noic
Enhancement request
Environment
Emacs version: 28.1 Operating System: Fedora 36 Evil version: 1.15.0 Evil installation type: MELPA Graphical/Terminal: both
Reproduction steps
- Start Emacs
- Want to switch to case-insensitive search temporarily
- No easy equivalent to
:set icexists
Expected behavior
Be able to toggle search case sensitivity easily and in a manner very similar to vim.
Actual behavior
Function evil-ex-search-case exists to change case sensitivity, but it is not accessible in a vim-like manner
Further notes
I understand there is no set function in evil, and for good reason. However, in many cases (for very commonly toggled options), the behavior can be emulated using functions with the right names. For example
(defun set-noic() "set case sensitive search" (interactive) (setq evil-ex-search-case 'sensitive))
(defun set-ic() "set ignore case search" (interactive) (setq evil-ex-search-case 'insensitive))
Then the user can turn case sensitivity on and off as in vim by typing
:set-ic
or
M-x set-ic
In the latter case, they can even use a space between the two words. This is not technically a functionality issue, but could really enhance the user experience of people coming from vim and expecting to replicate vim functionality with minimal changes from existing habits.
There are a number of frequently used and missed yes/no options that can be rewritten as a single function in this manner. I'm not saying do it all now, but maybe the big low-hanging fruit that most people use.
It's an interesting idea, but I think it'd be best practice to prefix them all with evil- if we supply (and require) the functions as part of evil. I guess we could avoid the prefixes if we put them in a file we don't require by default (c.f. evil-want-integration and evil-want-keybinding in https://github.com/emacs-evil/evil/blob/master/evil.el).
It'd need adding to the docs too. PR welcome, even if just partial.
Actually what am I talking about. You could give the functions evil prefixes, but bind them to non-prefixed ex commands.
Check out FrostyX/evil-set-option.