diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2015-05-02 09:44:54 +0900 |
---|---|---|
committer | Michael Reed <m.reed@mykolab.com> | 2015-06-04 21:20:09 -0400 |
commit | e6c62c80ef1138c6c6d177efbd765476c0283b71 (patch) | |
tree | 78afe36a6a4dc9f14602220193bea8b1e4b93ecf /test/functional/viml/completion_spec.lua | |
parent | 2271b746d7853d336f63480415c43d57fa39fb44 (diff) | |
download | rneovim-e6c62c80ef1138c6c6d177efbd765476c0283b71.tar.gz rneovim-e6c62c80ef1138c6c6d177efbd765476c0283b71.tar.bz2 rneovim-e6c62c80ef1138c6c6d177efbd765476c0283b71.zip |
Add noinsert and noselect features in completeopt #2564
Backported from vim_dev:
https://groups.google.com/forum/#!searchin/vim_dev/completeopt/vim_dev/tVsk0pdOGvs/fCzBbPkA4w0J
Use case:
https://github.com/Shougo/neocomplcache.vim/issues/426
Reviewed-by: Felipe Morales <hel.sheep@gmail.com>
Reviewed-by: Scott Prager <splinterofchaos@gmail.com>
Reviewed-by: Michael Reed <m.reed@mykolab.com>
Diffstat (limited to 'test/functional/viml/completion_spec.lua')
-rw-r--r-- | test/functional/viml/completion_spec.lua | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index df4018e707..2a02dd9cf0 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -3,12 +3,12 @@ local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq local execute, source = helpers.execute, helpers.source -describe("completion", function() +describe('completion', function() before_each(function() clear() end) - describe("v:completed_item", function() + describe('v:completed_item', function() it('returns expected dict in normal completion', function() feed('ifoo<ESC>o<C-x><C-n><ESC>') eq('foo', eval('getline(2)')) @@ -53,4 +53,26 @@ describe("completion", function() eval('v:completed_item')) end) end) + describe('completeopt', function() + it('inserts the first candidate if default', function() + execute('set completeopt+=menuone') + feed('ifoo<ESC>o<C-x><C-n>bar<ESC>') + eq('foobar', eval('getline(2)')) + end) + it('selects the first candidate if noinsert', function() + execute('set completeopt+=menuone,noinsert') + feed('ifoo<ESC>o<C-x><C-n><C-y><ESC>') + eq('foo', eval('getline(2)')) + end) + it('does not insert the first candidate if noselect', function() + execute('set completeopt+=menuone,noselect') + feed('ifoo<ESC>o<C-x><C-n>bar<ESC>') + eq('bar', eval('getline(2)')) + end) + it('does not select/insert the first candidate if noselect and noinsert', function() + execute('set completeopt+=menuone,noselect,noinsert') + feed('ifoo<ESC>o<C-x><C-n><ESC>') + eq('', eval('getline(2)')) + end) + end) end) |