Re: Git trailing blank lines feature configuration
- From
- Thomas Nemeth <tnemeth@free.fr>
- Date
- Aug 1, 2026, 08:48 UTC
- Message-ID
- <3433010.aeNJFYEL58@cixi>
- In-Reply-To
- <06230920-FCA6-495C-BFE5-04DF1CC2A426@gmail.com>
Le samedi 1 août 2026, 02:05 Ben Knoble a écrit :
Show 16 quoted lines
> > Le 31 juil. 2026 à 20:55, Thomas Nemeth <tnemeth@free.fr> 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.