Tip #348: Quickly insert a single word
tip karma |
Rating 1/6, Viewed by 1135
|
created: |
|
October 19, 2002 15:43 |
|
complexity: |
|
basic |
author: |
|
spudnic |
|
as of Vim: |
|
5.7 |
I've had something like this for a single character for some time, and this may be something that everyone is already doing, but it's really convenient for me. These two mappings make it quick and easy to insert a word.
nmap <buffer> <silent> ,w :exec ":imap \<space\> \<space\>\<esc\>,BB"<cr>i
nmap <buffer> <silent> ,BB :exec ":iunmap \<space\>"<cr>
Given the sentence:
The quick fox.
To add the word "brown" you would put your curser on the f in fox and type ",w" (or whatever you decide is a good mapping). Type the word brown. As soon as you hit space you are out of insert mode.
If there's an easier way to do this, please feel free to comment.
Thanks.
<<Format paragraph without changing the cursor position |
Format your xml document using xmllint >>
Additional Notes
|