Comments (11)
You have to use :normal
instead of feedkeys()
.
feedkeys()
only pushes characters into the input queue. When Vim becomes idle and the input queue is not empty, Vim will take a character from the input queue and processes it as if user typed the character. And Vim will never be idle while running a test script, because Vim is always busy to execute each line in the test script.
While :normal {command}
directly executes Normal mode {command}
. This is the proper way to emulate Normal mode commands in a test script in most situations.
from vim-vspec.
Thanks for the reply! That makes sense, but what I'm actually trying to do though is simulate triggering omnicomplete with <c-x><c-o>
in insert mode. I don't think that's possible using :normal ?
from vim-vspec.
Try :execute 'normal!' "a\<C-x>\<C-o>"
.
from vim-vspec.
I can't get that to work. Even if I try just :normal "a\<C-x>\<C-o>"
manually (with quotes), it doesn't seem to do anything. I tried a bunch of different variations.
If I remove the quotes, then is inserted into the document. call feedkeys()
does what I want (if I invoke it manually), I understand your explanation for why it won't work in a script though.
Thanks for your help. Maybe it's not possible.
from vim-vspec.
Don't remove :execute
! Try :execute 'normal!' "a\<C-x>\<C-o>"
.
from vim-vspec.
I should have mentioned, I tried that first of all before I started trying to change the command. It has no effect.
from vim-vspec.
This doesn't seem to be a vspec issue. Feel free to close.
Thanks anyway!
from vim-vspec.
I confirmed :normal
can invoke omni completion with the following steps:
filetype plugin on
describe ':normal'
before
enew!
setfiletype html
end
it 'can invoke omni completion'
execute 'normal!' "a<div i\<C-x>\<C-o>"
Expect getline(1) ==# '<div id="'
end
end
from vim-vspec.
If you still have troubles, please paste the actual test script you wrote. I couldn't give a proper advice without it.
from vim-vspec.
Your script works for me too. Thank you so much for your time. I appreciate it!
I need to dig around a bit more to see what I'm doing wrong in my script.
from vim-vspec.
I added notes on how to emulate user input into the document.
Since vspec runs a test script with a plain Vim like vim -u NONE -i NONE -N
, plugins and filetype plugins are not loaded by default. So that I think the core problem you encountered that you didn't write :filetype plugin on
in test scripts. You succeeded to trigger omni completion, but the current buffer didn't have filetype, so nothing happened.
from vim-vspec.
Related Issues (20)
- Support before :all / after :all
- Fix failure messages to properly show multiline strings HOT 1
- Fix tests about vspec#pretty_string not to fail on Travis CI HOT 3
- Output friendly failure messages when unexpected errors occur while translating a test script HOT 3
- Allow using the same description for multiple :it blocks within a :describe block
- Support quickfix HOT 1
- does vspec support `Shared Example Groups'? HOT 2
- Revert changes on :SKIP/:TODO messages
- Allow to configure `vim` being used (in bin/vspec)
- Parse errors: No plan found in TAP output HOT 4
- Neovim support
- provide exception-related assertions HOT 2
- improve Ex-mode instead of Ex-mode? HOT 1
- Failure message of `Expected 0 to_be_true` is strange
- :redraw interferes Vim output and prove fails to parse the resulting output HOT 1
- Show also the line number whenever :Expect fails HOT 2
- Autocmds don't appear to work HOT 5
- *.t tests can't pass, please have a look HOT 7
- How to deal with function calling expand...
- No output when testing with VIM_VSPEC=nvim for certain tests on some environments HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-vspec.