kana / vim-vspec

Vim plugin: Testing framework for Vim script
http://www.vim.org/scripts/script.php?script_id=3012
220 stars 13 forks source link

Respond to input("question") #31

Closed torgeir closed 10 years ago

torgeir commented 10 years ago

Is there a way to type text into a :call input("question") and hit <cr>?

torgeir commented 10 years ago

So, some more experimenting and I got this working.

In my code the CursorsPerformCommand plug calls a function that again runs input() and expects a normal mode command as input

The following works to have diw inserted and enter pressed, so the command gets passed back to input()

exe "normal \<plug>CursorsPerformCommand diw^M"

The ^M was inserted by doing <c-v><cr> in insert mode.

kana commented 10 years ago

You're right.

exe "normal \<plug>CursorsPerformCommand diw^M"

The ^M was inserted by doing <c-v><cr> in insert mode.

By the way, I prefer writing exe "...\<CR>". The ^M might cause problems. For example, GitHub doesn't render such text properly.

torgeir commented 10 years ago

Yes, I noticed. I'd swear I had a go with \<cr> but I'll try again, thanks!