Hi, I'm enjoying using ivy so far, but I've run into a problem I can't figure out. I want to use ivy-read to read a file from the minibuffer, and I want to start the input with an automatically generated file name without the extension, like "01234.". I thought :initial-input would do this but it's not working as I expected. Here's my code which I modified from counsel-find-file
(ivy-read "Junk file: "
'read-file-name-internal
:initial-input rel-fname
:action
(lambda (x)
(with-ivy-window
(make-directory (or ivy--directory default-directory) t)
(find-file (expand-file-name x ivy--directory))))
:matcher #'counsel--find-file-matcher
:keymap counsel-find-file-map)
rel-fname is the auto-generated name. I'm also let binding default-directory to start in a directory that may not exist, which is the reason for make-directory. What happens is I get a candidate that is preselected in the completions, but what I want is to be able to quickly type el RET and get the file name with an "el" extension. Does that make sense? Is there a variable I need to set? I can do M-i then el RET but I was hoping to eliminate that step. Thanks
Hi, I'm enjoying using ivy so far, but I've run into a problem I can't figure out. I want to use
ivy-readto read a file from the minibuffer, and I want to start the input with an automatically generated file name without the extension, like "01234.". I thought :initial-input would do this but it's not working as I expected. Here's my code which I modified fromcounsel-find-filerel-fnameis the auto-generated name. I'm also let bindingdefault-directoryto start in a directory that may not exist, which is the reason formake-directory. What happens is I get a candidate that is preselected in the completions, but what I want is to be able to quickly typeel RETand get the file name with an "el" extension. Does that make sense? Is there a variable I need to set? I can doM-ithenel RETbut I was hoping to eliminate that step. Thanks