mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	 86c2adc074
			
		
	
	86c2adc074
	
	
	
		
			
			Default Vim behavior of i_CTRL-<Space> is to insert the last-inserted text and exit insert mode. :help i_CTRL-@ Before this commit that did not happen because insert_handle_key() checks for NUL instead of checking for ' ' with a CTRL `mod_mask`. I'm leaving the check for NUL despite the fact that at the moment that key is never seen when using the terminal UI (not for C-Space, nor C-@). This is because I assume it's still allowed for other front-ends to pass NUL, but at the moment the terminal UI isn't.
		
			
				
	
	
		
			23 lines
		
	
	
		
			639 B
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			639 B
		
	
	
	
		
			Lua
		
	
	
	
	
	
| local helpers = require('test.functional.helpers')(after_each)
 | |
| local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
 | |
| local expect = helpers.expect
 | |
| 
 | |
| clear()
 | |
| 
 | |
| describe('insert-mode', function()
 | |
|   it('CTRL-@ inserts last-inserted text, leaves insert-mode', function()
 | |
|     insert('hello')
 | |
|     feed('i<C-@>x')
 | |
|     expect('hellhello')
 | |
|   end)
 | |
|   -- C-Space is the same as C-@
 | |
|   it('CTRL-SPC inserts last-inserted text, leaves insert-mode', function()
 | |
|     feed('i<C-Space>x')
 | |
|     expect('hellhellhello')
 | |
|   end)
 | |
|   it('CTRL-A inserts last inserted text', function()
 | |
|     feed('i<C-A>x')
 | |
|     expect('hellhellhellhelloxo')
 | |
|   end)
 | |
| end)
 |