Rose Perrone
Rose Perrone

Reputation: 63546

How can I print from a .vim file?

I want to print internal variables, like s:myvar inside a .vim file. My first instinct was to use echo s:myvar and :source %, but I had no luck.

Upvotes: 0

Views: 1516

Answers (2)

Rose Perrone
Rose Perrone

Reputation: 63546

It turns out finish was getting called before my echo messages.

Upvotes: 0

Ingo Karkat
Ingo Karkat

Reputation: 172540

I can understand how :echo can cause errors (when given an invalid {expression}), but there's very little to make :print complain; it only allows 3 different [flags]. (And it does not output to a printer, that's :hardcopy!!!) Edit: this now looks out-of-place after the question has been totally rephrased

In any case:

  • you can "slow" the output by appending | sleep 10
  • use :echomsg to have the output recorded and then recall previous errors and output with :messages
  • increase the space for errors with :set cmdheight=5

For a more advanced debugging solution, there's the Decho plugin.

Upvotes: 1

Related Questions