Monday, November 30, 2009

Re: ctrl+J without adding a space

On 2009-11-30, KKde wrote:
> >
> >    :help J
> >    :help gJ
> >
>
> gJ doesn't remove the indentation space whereas J removes the
> indentaion space and add's up to two spaces. Is there any command to
> join two lines without any white space added in between?or a function
> needs to be written to acheive this?

There's no built-in command to do that, but you could create a
mapping such as this one that redefines the behavior of gJ, taking
advantage of the observation that J moves the cursor to the
whitespace joining the two lines:

:nnoremap gJ Jdiw

HTH,
Gary


--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: