Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 Mar 31 '13 at 6:52

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .