In Evil mode, in the Normal state, with the evil-search-module
variable set to Evil interactive search
, I would like to use some kind of auto-completion functionality like Ctrl+n
or Ctrl+p
so that I don't have to type the full string I am searching for. For example, if I wanted to turn the line
foo bar grue
into
foo bar zork
I would like to be able to do something like this:
- Type
:s/g
- Hit
Ctrl+n
(or some other concise key/combo). - See the command prompt change to
:s/grue
. - Type
/zork<RET>
.
The steps I've given above fail at step 2. At that point, instead of using the next match, Evil outputs the error message, "No later matching history item".
I have also tried using the suggestions given as answers here, but these do not work either:
Hitting
Ctrl+f
while in the middle of entering a substitution command simply causes Emacs to output the message "End of buffer".Using
q:is/g<Ctrl+n>
causes Emacs to output the error message "No dynamic expansion for `s/g' found".
What can I do to overcome or work around this?
Update: see Evil bug #166, which refers to this issue.
hippie-expand
. Many people bind it toM-/
.M-/
while in the middle of typing a substitution command causes Emacs to output "Scanning for dabbrevs...done", but doesn't complete the search string. If I instead attempt to typeM-x hippie-expand<RET>
in the middle of typing a substitution, Emacs instead outputs, "Command attempted to use minibuffer while in minibuffer".M-/
by default (it's not bound to anything). It was a suggestion. Additionally, as you've found, you cannot useM-x
while in the minibuffer, you must bind functions to keys if you want to use them.(global-set-key (kbd "M-/") 'hippie-expand)
to my.emacs
, and added thesetq
given here, and restarted Emacs. However, now when I hitM-/
while in the middle of typing a substitution command, Emacs outputs "No expansion found", even if the string I am typing is an initial substring of a string further on in the file. Perhaps I'm missing something...eval-expression
(M-:
)