On Oct 14, 3:54 am, Teemu Likonen <[EMAIL PROTECTED]> wrote:
> [2008-10-14 09:49 +0200] François Beaubert wrote:
>
> > Is it possible to extend/modify the proposed solutions to remove blank
> > lines around the cursor and keep just the line containing the cursor,
> > like:
>
> > Some text
> > blank line
> > blank line Some text
> > cursor line ----> cursor line
> > blank line Some text
> > Some text
>
> Ah, you want Emacs' "C-x C-o" (delete-blank-lines), right? In Vim it
> would be
>
> vipc
Or how about dip instead, saving 2 keystrokes (unless you _want_ to be
in insert mode after you delete the lines).
This uses the "inner paragraph" text object (:help text-objects) and
the deletion command (:help d).
>
> on an empty line or series of empty lines. This will delete the whole
> text paragraph too if you happen to be on one, so better emulation of
> Emacs' delete-blank-lines function it would be something like this:
>
> map <C-x><C-o> :if getline('.') =~ '^\s*$' <bar>
> \ execute 'normal! vipc' <bar> endif<CR>
Note the use of =~ to match a regular expression, and the use of '\s'
inside the regular expression to match _any_ whitespace, and not just
spaces and tabs like some previous patterns.
And of course, I'd again suggest "dip" instead of "vipc".
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---