TransWikia.com

Is it possible to use word completion (e.g. `Ctrl-N`) in Ex mode?

Vi and Vim Asked on December 16, 2021

I want to use word completion in Ex mode, similar to using Ctrl-N in Insert mode to complete the current word.

Suppose, I want to do a substitution: :%s/<pattern>/<replacement>/gc. If the cursor is on the word to substitute, I could use C-R C-W to paste it into Ex mode (command-line). However, sometimes the cursor is far away from the word to substitute, and here word completion would be beneficial.

One Answer

Not exactly what you want, but you can get insert-like completion in Command-line window, which is opened with q:. Just add b option to complete in your .vimrc, so vim will scan all opened buffers.

:set complete+=b

See:

:h cmdline-window
:h 'complete'

Answered by Dmitry on December 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP