[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vim
Subject:    Re: ctrl-x ctrl-l is not preserving the indent
From:       "Stahlman Family" <brettstahlman () comcast ! net>
Date:       2006-01-29 3:34:53
Message-ID: 003901c62484$f7ed87e0$20ea3e44 () computerroom
[Download RAW message or body]

> 
> 
> ----- Original Message ----- 
> From: "Kamaraju Kusumanchi" <kamaraju@gmail.com>
> To: "vim help" <vim@vim.org>
> Sent: Friday, January 27, 2006 10:46 PM
> Subject: ctrl-x ctrl-l is not preserving the indent
> 
> 
> When I use i_ctrl-x_ctrl-l for line completion, I would like to have
> the new line, the same indentation as the original match. But
> currently this indentation is ignored. How can I make ctrl-x ctrl-l
> indentation aware?
> 
> That is if I have
> 
> first line
>   second line
> 
> If I use ctrl-x ctrl-l for line completions, I would like to have
> 
> first line
>   second line
> 
> instead of
> 
> first line
> second line
> 
> I read the man page
> 
> *i_CTRL-X_CTRL-L*
> CTRL-X CTRL-L Search backwards for a line that starts with the
> same characters as in the current line before the
> cursor.  Indent is ignored.  The found line is
> inserted in front of the cursor.
> The 'complete' option is used to decide in which
> buffers a match is searched for.  But only loaded
> buffers are used.
> 
> 
> It says indent is ignored, but does not say anything about preserving
> the indent. Any ideas?

Raju,
 I think the reasoning goes like this: C-X C-L is line
'completion.' Note that Vim is completing something you've already
begun. It assumes you've begun the way you meant to (in the example
above, without an indent). This makes sense, I think. Consider the
following:

SomeFunc(arg1, arg2, arg3, arg4);
.
.

if(done)
    So<C-X><C-L>

Obviously, in this case, you would not wish Vim to remove the tab
inserted either by you or by Vim's C indenting mechanism. This is, I
think, a fairly common use of line completion. Of course, if you
realize after the completion that you want to add or remove indent,
just hit <C-D> or <C-T>...

Brett S.


> 
> thanks for your time
> raju


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic