Having some command automatically populate the input string is a great thing (particularly, I refer to the feature that swiper-thing-at-point
provides).
However, I would like to enhance this functionality even more by being able to have the input string automatically marked after running this command. The rationale behind it is that I find myself using swiper mostly for two things:
- Find other occurrences of the thing that I currently have at point;
- Find an arbitrary text in the current buffer, regardless of thing at point.
For each of these cases, having the input string automatically marked is optimal because I can, respectively, with a single command,
- Start searching other occurrences of the thing at point right away;
- Start typing the string I have in mind right away, knowing that, whatever input string there is, it will be completely replaced (assuming
delete-selection-mode
is enabled), without having to check if an initial input was populated in the minibuffer and deleting it in case it was.
I have tried creating a function to do so, but the problem is that the part of the function that tries to mark the input string (which should be whole line inside the minibuffer) is only executed when I finish the swiper search, i.e., I end up selecting a region in the buffer where I executed the function (not in the minibuffer), and the swiper input string is never selected (and so I have to delete it manually). What would be the best way to solve this problem?