(Move categories to tip template) |
(Change <tt> to <code>, perhaps also minor tweak.) |
||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
|previous=347 |
|previous=347 |
||
|next=349 |
|next=349 |
||
− | |created= |
+ | |created=2002 |
|complexity=basic |
|complexity=basic |
||
|author=spudnic |
|author=spudnic |
||
Line 15: | Line 15: | ||
<pre> |
<pre> |
||
− | nmap |
+ | nmap <buffer> <silent> ,w :exec ":imap \<space\> \<space\>\<esc\>,BB"<CR>i |
− | nmap |
+ | nmap <buffer> <silent> ,BB :exec ":iunmap \<space\>"<CR> |
</pre> |
</pre> |
||
Line 34: | Line 34: | ||
---- |
---- |
||
− | I get a lot of mileage out of < |
+ | I get a lot of mileage out of <code>cw</code> which is change word and <code>dw</code> which is delete word. |
Try them out! |
Try them out! |
Latest revision as of 05:25, 13 July 2012
created 2002 · complexity basic · author spudnic · version 5.7
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 cursor 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.
Comments[]
Unless I missed something, this doesn't save any keystrokes. Without this, I would use two keystrokes "i" to enter insert mode and ESC to exit. Here I still would still need two keystokes "," and "w".
Size isn't everything! This seems easier. Finding the ESC is harder than , . and with this you're entering ,w together rather than a key before your word and another key at the end. So you start this with 2 characters, but it ends itself automatically, which seems easier and more fluid to me.
I get a lot of mileage out of cw
which is change word and dw
which is delete word.
Try them out!