How I can write something to vim command line and then read some input from it to plugin? For example, I want to write choose "Choose search patter (1, 2, ... 0):". Then user presses "2", the plugin read receive it and do something. How make such interaction in vim plugin?

1 Answer 1


in your function:

call inputsave()
let p = input('Choose search patter (1, 2, ... 0):')
call inputrestore()
echom p "here you got userinput

for detail:

:h input()
:h inputsave()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.