-1

Is it possible to do something like this in vim:

function MyFunction
    echom "Part 1"
    raw_input('...') # python equivalent (or input(...) in python3)
    echom "Part "2"
endfunction

That is, a way to pause execution either for the user to enter input or to just pause the function until the user hits enter?

4
  • 1
    You could just do :h input<C-d> this will list all help topics containing the word input. This will lead you to :h input(). – Ralf Jun 14 '20 at 6:59
  • @Ralf thank you that was the help I needed to point me in the right direction and I was able to apply it. – David542 Jun 14 '20 at 7:38
  • @Ralf I never knew about <C-d> -- actually I mapped it on my keyboard so that it acts like a normal unix delete-forward-char -- but perhaps I should undo that mapping so I can use it for autocomplete on help. – David542 Jun 14 '20 at 7:39
  • David, you can write your own answer and accept it. – Ralf Jun 14 '20 at 7:41
4

Based on your other questions, it looks like you are familiar with Python. You can refer to the following gist which compares the various Python programming constructs with the corresponding VimScript constructs:

https://gist.github.com/yegappan/16d964a37ead0979b05e655aa036cad0

2
  • wow that's awesome. Did you write that? It's so thorough and super useful to me, thanks! – David542 Jun 14 '20 at 23:33
  • Welcome to Vi and Vim Yegappan, so great to have you here! – filbranden Jun 15 '20 at 2:26

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.