As of 2022-02-19, the File Name Completion section of the Ivy manual, that @Basil mentioned earlier, now includes C-M-y bound by default to ivy-insert-current-full. That keybinding allows you to directly edit that path, without requiring further Ivy/Counsel customization.
Open up a directory, say
/tmp/dir1 and notice that the
/tmp/dir1 text is not truly editable (see Rafa de Castro's comment caution about DEL or BACKSPACE deleting parent directory text that is the very text that is desired to be edited):
Typing C-M-y pastes the
/tmp/dir1 path into the editable text area of the minibuffer:
Your arrow key bindings are now active as normal and you can edit it:
Update 2022-09-15 08:59:22 for clearing initial input before insertion in CTRL+SHIFT+y
An annoyance, slightly related to Mike Crowes comment on his question, is when you have typed in some input characters before typing CTRL+SHIFT+y, the directory path is appended to that path, instead of overwriting it with that new directory path. This is annoying in the majority of cases whereby the users intent is to edit that directory path somewhere in the middle of that long path, type RETURN, only to be baffled as to why Emacs shows some non-existent path with that initial input in front of the path.
Below is my workaround for that annoyance using
enter link description here
(defun bg-ivy-insert-current-full-clear-input-before-insert ()
"Clear the input before calling `ivy-insert-current-full'."
;; Use (line-beginning-position) instead of (point-min) because of text properties in use that inhibit motion:
(delete-region (line-beginning-position) (point-max)))
(advice-add 'ivy-insert-current-full :before #'bg-ivy-insert-current-full-clear-input-before-insert)