vile
[Top][All Lists]
Advanced

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

Re: [vile] turn off cindent?


From: Thomas Dickey
Subject: Re: [vile] turn off cindent?
Date: Wed, 22 Jun 2016 16:32:57 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Jun 22, 2016 at 03:48:58PM -0400, address@hidden wrote:
> I guess my first question is, what's the difference between cindent and
> autoindent?

It's vague in vile.hlp

   cindent (ci)
           C-style indentation. Helps maintain current indentation level
           automatically during insert, like autoindent, above. See
           cindent-chars for additional information. Note that when the
           majormode cmode is in effect, cindent assumes a local buffer mode
           value of true. (B)
 
but the source-code helps:

        /* do the appropriate insertion */
        if (allow_aindent && b_val(curbp, MDCINDENT)) {
            int dir;
            if (is_cindent_char(curbp, c)
                && is_user_fence(c, &dir)
                && dir == REVERSE) {
                rc = insbrace(1, c);
            } else if (c == '#' && is_cindent_char(curbp, '#')) {
                rc = inspound();
            } else {
                autoindented = -1;
                rc = lins_chars(1, c);
            }

That is, cindent makes a special case for '#' (or whatever cindent-chars
maps it to), putting it in the first column.  It also indents/dedents
a "fence" character (such as curly-brace or parenthesis).

This is simpler, without those special cases:

   autoindent (ai)
           During insert, newly created lines inherit their leading indent
           from the previous line in the buffer. (B)

> My .vilerc is very old and may have some deprecated/unwanted things in
> it.  Line 1 is
> 
> set cmode
> 
> I have a few other things like
> set c-tabstop=2
> set c-shiftwidth=2
> set notabinsert
> 
> My main question is this:
> 
> I don't always use vile's copy-n-paste to add lines of code to a file.
> Sometimes I use the mouse to copy from one window and paste into another.
> When I do this, cindent (and/or autoindent) comes into play and
> makes my code look like this:
> 
>     line_of_code;
>     line_of_code;
>     line_of_code;
>     line_of_code;
>         if (more)
>             {
>                     line_of_code;
>                           line_of_code;
>                                 line_of_code;
>                                       line_of_code;
>                                             line_of_code;
>                                                 }
> 
> I'm trying to turn off autoindent with these two commands
> :set noautoindent
> :set nocindent

cindent might be a buffer-mode (it is for cmode, and to see other cases,
use ":show-majormodes"), so you'd have to turn it off with ":setl"
 
> but neither of those prevents this from happening.  In fact, even after
> :set nocindent
> I still see this in the output of :set
> 
> --- "instruct.c" settings, if different than globals -------------------
> Buffer:
>    byteorder-mark=none       shiftwidth=2              tabstop=2
>    cindent
> 
> What can I do?
> 
> --hymie!
> 
> _______________________________________________
> vile mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/vile

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]