Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Mar 31 '13 at 6:52

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

up vote 3 down vote accepted

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()
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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