Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to insert a space in normal mode?

Tags:

vim

I'm just starting to use vim.

I would like to know if there is a simple default key binding that will allow me to add a space in normal mode.

If not what is the next best alternative?

like image 459
ziiweb Avatar asked Apr 28 '12 14:04

ziiweb


People also ask

How do I add a space in vim normal mode?

Then, any time you type s p a c e in normal mode, it'll insert a space at the cursor. Or you could just hit i Space Esc . OK, OK. If you really want to use the space bar in normal, add <> to the above.

How do you add a space with multiple lines?

To insert individual spaces, click on the beginning of the line, then use cmd (for Mac) or ctrl (for Windows) and click on the beginning of other lines. It's the same way as how you select multiple files at once. Now when you add a space in front, it will add to all the lines that you selected.


1 Answers

:nnoremap space i<space><esc> 

Then, any time you type space in normal mode, it'll insert a space at the cursor.

Or you could just hit iSpaceEsc.

OK, OK. If you really want to use the space bar in normal, add <> to the above.

:nnoremap <space> i<space><esc> 
like image 100
Kevin Avatar answered Sep 29 '22 20:09

Kevin