Wednesday, January 9, 2013

Re: Please explain Regex

On 01/09/13 06:25, vicky b wrote:
> Recently i cam across this command :g /^/m0 which reverses
> order o line can any body explain how this works

The :g command takes a pattern (in this case "^", or the
start-of-line which matches on every line) and performs an Ex
command on it (in this case "m0" which means move the line to become
the first line in the file). So it matches the 1st line, moves it
to the top (a noop), matches the 2nd line, moves it to the top (now
above what was the 1st line), matches the 3rd line, moves it to the
top (now above line 2 which was above line 1), etc, for every line
in the file.

You can read more at

:help :g
:help :move

> Once more doubt i have is CTRL_0 i think this should copy object
> what is it really please explain

Do you mean control+{capital-oh} or control+zero? You typed
control+zero which I don't believe that Vim recognizes (let alone
copies a text object...I'm not sure why you think this should
happen). However, in Insert mode, you can use control+oh to issue
one Normal mode command and then return to insert mode. I often do
this to scroll up or down, using something like

{control+o}10{control+Y}


As an aside, I don't know if it's a bug, but i_CTRL-\_CTRL-o is
supposed to act like i_CTRL-o without moving the cursor, but in at
least my stock Debian 7.2.445, doing

{ctrl-\}{ctrl-o}yis

in the middle of a sentence moves the cursor to the beginning of the
sentence. Can somebody running a more recent version test this for me?

-tim




--
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

No comments: