I'm interested in setting up a TDD environment for developing Vim scripts and rc files. As a simple example, say I want to have vim insert 8 spaces when I press the tab key. I would set up a script that did the following:
- Launch vim using a sandboxed .vimrc file
- press i
- press tab
- press esc
- press :w test_out
- assert that test_out contains ' '
by the default config in vim, this would fail. However, once I add set expandtab
to my .vimrc file, the test will pass.
So the question is, how do I programmatically issue these commands? 'vim -c ' is close, but seems to only work for ex mode commands. Any suggestions? This question seem to be thoroughly google-proof.