[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vim macro|bind



On Fri, Feb 21, 2003 at 11:11:18AM +0000, Hugh Saunders wrote:
| On Thu, Feb 20, 2003 at 07:55:27PM -0500, Derrick 'dman' Hudson wrote:
| > The command
| >     dG
| > will do that.  "G" is a cursor movement command that moves the cursor
| > to the end of the buffer.
| ahh, i knew  you could use G to move, but not as a range for d,
| thanks.

Well, to be a bit more precise (or pedantic) it is a "motion", not a
"range".  Ranges precede the command, and are only used with ex
commands (beginning with ':').  Many command-mode commands can be
suffixed by a motion command which causes the command to operate on
the text traversed by <motion>.  In this example, the 'd' command
deletes text.  However after pressing 'd', vi(m) needs to know how
much text to delete.  'dd' deletes the current line; 'dj' deletes this
line and the line below it.  'dl' deletes the current chacter (same as
'x').  And thus 'dG' deletes from here to the end of the file.
command-mode commands can also be prepended by a 'count'.  For
example, '5dj' will execute 'dj' 5 times (IOW delete 5 lines).  Since
motions can be preceded by a count, 'd5j' would also do the same
thing.

| > Look at the "map" commands.  For example, on a laptop I often hit F1
| > when I mean to hit ESC.  I solved that with the following in my .vimrc :
| > 
| > " don't show help when F1 is pressed -- I press it too much by accident
| > map <F1> <ESC>
| > inoremap <F1> <ESC>
| 
| thanks, will play with that. I often hit f1 by mistake as well [is your
| laptop a thinkpad? mine is and has the esc where my fingers woulndt
| expect it]

I did that for the laptop I was using since the F1 is so close to the
ESC that I would often hit it instead or in addition to ESC.  Since I
didn't want the help popping up then (I use ":help" when I want it) I
remapped the key :-).

| but im so cluless with vim it quite good to see the help
| every now and then:-)

Some of it is a bit complicated, but it is organized and fairly
consistent.  Once you figure out the "big picture", reading the help
files for the details is easier.  For example, the above description
of how to combine counts, commands, and motions should help you put
other commands and motions together in the future.

HTH,
-D

-- 
Like a gold ring in a pig's snout
is a beautiful woman who shows no discretion.
        Proverbs 11:22
 
http://dman.ddts.net/~dman/

Attachment: pgp03nPg1nz1y.pgp
Description: PGP signature


Reply to: