Re: Git trailing blank lines feature configuration

Thomas Nemeth <[email protected]> Sat, 01 Aug 2026 10:48:11 +0200
Newsgroups org.kernel.vger.git
Organization désorganisée
Message-ID <3433010.aeNJFYEL58@cixi>
Le samedi 1 août 2026, 02:05 Ben Knoble a écrit :
> > Le 31 juil. 2026 à 20:55, Thomas Nemeth <[email protected]> a écrit :
> > 
> >    I wouldn't say necessary, of course. It's -- at least -- my
> >    preference. For _my_ use case, it's useful. When I move code
> >    around, and that code is at the end of the file or to be put
> >    at the end of the file, I find it easier to already have a
> >    blank line there. That is... Because that's how I use vim to
> >    code.
> 
> I use Vim, too, and I’ve not personally encountered the desire for
> keeping a blank line at EOF (though occasionally certain operations
> benefit from placing one there first!).
> 
> I wonder if you could describe example workflows that lead to this
> desire? I might learn something, and in exchange, if I see a way to
> accomplish the same thing with less hassle, I’ll suggest it ;)

    It's hard to describe something like that :)

    Imagine you are editing a C file. It contains functions, code blocks
    an so on. I usually organize my code as such :

#includes
[...]
#defines
[...]
static variables
[...]
static functions()
[...]
public_functions()
[...]


    Code reorganization happens quite some times during the development
    process.
    If I need to move a previously static function at the end of the
    public functions section, I switch to VISUAL, select the function
    to be moved with the blank lines above (I like having neatly spaced
    code) _and_ including the eol of the function last line.
    Then I delete it (d), I move to EOF (:$). As the line is blank I
    just have to paste (p) it back there. The function is moved. The last
    blank line is kept for other code movements.

    Conversely, I can select the last function to move it upper in the
    file.

    Adding new functions is also eased. It may be because I use only a
    few vim commands (especially I rarely use the `o` command). But also
    because I like spaced code :)


-- 
Thomas.