Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #466 - Insert one character only

Created: April 30, 2003 10:10 Complexity: basic Author: johnmaxa Version: 5.7 Karma: 105/49 Imported from: Tip#466

I have not yet seen this idea yet. But early in my use and love of Vim, I got frustrated in command mode when I wanted to insert just one character of text. So I put this in _vimrc:


"insert one character

noremap <somekey> i<Space><Esc>r


I think it has been one of the most time saving mappings -- and I have remapped most of my keyboard.

Comments

Huhn, I've wanted this feature for years -- and expected it would take source modifications to make it happen. Such a simple little script. Thanks!

Anonymous , May 23, 2004 23:34


This won't be repeated by the . command.

Therefore I define

nnoremap <somekey> :exec "normal i".nr2char(getchar())."\e"<cr> nnoremap <someother> :exec "normal a".nr2char(getchar())."\e"<cr>

Bertram

Bertram Scharpf , March 22, 2005 6:39


Advertisement