ctrlf icon indicating copy to clipboard operation
ctrlf copied to clipboard

How do I customise `ctrlf-minibuffer-bindings` in my config?

Open Atemu opened this issue 3 years ago • 2 comments

Hi there, I'm trying to move away from swiper, came across your package and found that I don't actually need swiper, just a sane fuzzy isearch interface that auto-centers.

I installed your package using spacemacs' dotspacemacs-additional-packages and enabled it with (ctrlf-mode) later in the config.
Now I want to change some of the keybinds in the minibuffer. I.e. C-n to ctrlf-previous-match, similar to how I'd interact with swiper. However, when I try to

(define-key ctrlf-minibuffer-mode-map (kbd "C-n") 'ctrlf-next-match)
(define-key ctrlf-minibuffer-mode-map (kbd "C-p") 'ctrlf-previous-match)

I get

Symbol’s value as variable is void: ctrlf-minibuffer-mode-map

The variable is only available after the ctrlf minibuffer has been opened once. How do I customise it from within my config?

Atemu avatar Jul 13 '22 14:07 Atemu

Is it because those keys are in the default map and get overwritten when the minibuffer is first activated?

Atemu avatar Aug 09 '22 14:08 Atemu

You want to put your define-key declarations inside of a with-eval-after-load for ctrlf. There is a fancy thing that the package does, which actually defers the loading of ctrlf until it is invoked, even if you have run ctrlf-mode in your init-file.

raxod502 avatar Aug 15 '22 00:08 raxod502