Barry Gold wrote:
You wrote:
> I'm impressed that you can type your entire vimrc from memory. I'm
> tempted to use some of that. If only I _understood_ it.
Well the normal stuff that applies globablly. Stuff for specific classes
of files is a bit more difficult. :^) It's basically these three maps
and some :set options.
>> " Use * to "run" a line from the edit buffer
>> " Mnemonic: * is executible in "ls -F"
>> " Uses register y
>> :map * "yyy@y
:map begin a key remap
* remap key "*"
"y into register y
yy yank the current line
@y execute the commands in register y
The beauty of this one is the ability to compose complex commands
(typically ":g/select/ s/this/that/" type stuff for me) and then
being able to 'u'ndo and fix the command if I don't get it right
the first time. It also is useful to keep commands in comments of
code.
>> " Find previous space and split line on it
>> " Mnemonic: 'S'pace
>> :map S F r<CR>
:map begin a key remap
S remap key "S"
F ("F ") find previous " " on current line
r<CR> replace that space with carriage return
>> " Double the character under the cursor
>> " Mnemonic: fix C code like "if (0 = i) ..."
>> :map = y p
:map begin a key remap
= remap key "="
y ("y ") yank character under cursor
o put last yank
I remember learning a lot of vi tricks from comp.editors from people
doing things like the above breakdown. Approximately no one reads or
posts there any more.
Elijah
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment