{"thread":{"id":"66096","subject":"Git trailing blank lines feature configuration","startedAt":"2026-07-31T10:24:30Z","lastAt":"2026-08-02T08:21:30Z","messageCount":10,"participants":["Thomas Nemeth","Johannes Sixt","Junio C Hamano","Ben Knoble"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"549342","messageId":"6022080.DvuYhMxLoT@cixi","threadId":"66096","inReplyTo":null,"subject":"Git trailing blank lines feature configuration","fromName":"Thomas Nemeth","fromEmail":"tnemeth@free.fr","sentAt":"2026-07-31T10:19:09Z","receivedAt":"2026-07-31T10:24:30Z","isPatch":false,"body":"    Hi !\n\n    I have the habit to keep 1 blank line at the end of my files. To me,\n    it eases the EOF modifications (selecting code blocks, pasting them)\n    in vim.\n\n    Note that I still want to remove blanks at EOL. But I'd like to keep\n    1 blank trailing line. I still can, of course, but the diff still\n    shows me a red \"+\"...\n\n    Would it be possible to have a configuration option to avoid warnings\n    (because I see that as a warning) about trailing blank lines ?\n\n    Thanks\n\nThomas.\n\n\n"},{"id":"549343","messageId":"d5ec69c8-e441-4134-a6bb-665fc06db187@kdbg.org","threadId":"66096","inReplyTo":"6022080.DvuYhMxLoT@cixi","subject":"Re: Git trailing blank lines feature configuration","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2026-07-31T11:08:49Z","receivedAt":"2026-07-31T11:09:02Z","isPatch":false,"body":"Am 31.07.26 um 12:19 schrieb Thomas Nemeth:\n>     I have the habit to keep 1 blank line at the end of my files. To me,\n>     it eases the EOF modifications (selecting code blocks, pasting them)\n>     in vim.\n\n(Call this is [x].)\n\n>     Would it be possible to have a configuration option to avoid warnings\n>     (because I see that as a warning) about trailing blank lines ?\nHearing the first time that an extra blank line at EOF is necessary or\nuseful. Would the correct question then perhaps be: how do you all\nhandle [x] without an extra blank line at EOF?\n\nThat said, are you looking to disable blank-at-eof from core.whitespace?\nCollect all \"enabled by default\" except this one from [*].\n\n[*]\nhttps://git-scm.com/docs/git-config#Documentation/git-config.txt-corewhitespace\n\n-- Hannes\n\n"},{"id":"549344","messageId":"5097209.GXAFRqVoOG@cixi","threadId":"66096","inReplyTo":"d5ec69c8-e441-4134-a6bb-665fc06db187@kdbg.org","subject":"Re: Git trailing blank lines feature configuration","fromName":"Thomas Nemeth","fromEmail":"tnemeth@free.fr","sentAt":"2026-07-31T11:50:17Z","receivedAt":"2026-07-31T11:50:20Z","isPatch":false,"body":"Le vendredi 31 juillet 2026, 13:08 Johannes Sixt a écrit :\n> Am 31.07.26 um 12:19 schrieb Thomas Nemeth:\n> >     I have the habit to keep 1 blank line at the end of my files. To\n> >     me,\n> >     it eases the EOF modifications (selecting code blocks, pasting\n> >     them)\n> >     in vim.\n> \n> (Call this is [x].)\n> \n> >     Would it be possible to have a configuration option to avoid\n> >     warnings\n> >     (because I see that as a warning) about trailing blank lines ?\n> \n> Hearing the first time that an extra blank line at EOF is necessary or\n> useful. Would the correct question then perhaps be: how do you all\n\n    I wouldn't say necessary, of course. It's -- at least -- my\n    preference. For _my_ use case, it's useful. When I move code\n    around, and that code is at the end of the file or to be put\n    at the end of the file, I find it easier to already have a\n    blank line there. That is... Because that's how I use vim to\n    code.\n\n\n> handle [x] without an extra blank line at EOF?\n> \n> That said, are you looking to disable blank-at-eof from core.whitespace?\n> Collect all \"enabled by default\" except this one from [*].\n> \n> [*]\n> https://git-scm.com/docs/git-config#Documentation/git-config.txt-corewhi\n> tespace\n\n    -_-;\n    indeed.\n\n    ```\n    git config --global core.whitespace \"-blank-at-eof\"\n    ```\n\n-- \nThomas.\n\n\n"},{"id":"549356","messageId":"xmqqy0ercg59.fsf@gitster.g","threadId":"66096","inReplyTo":"6022080.DvuYhMxLoT@cixi","subject":"Re: Git trailing blank lines feature configuration","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-31T15:50:26Z","receivedAt":"2026-07-31T15:50:29Z","isPatch":false,"body":"Thomas Nemeth <tnemeth@free.fr> writes:\n\n>     Hi !\n>\n>     I have the habit to keep 1 blank line at the end of my files. To me,\n>     it eases the EOF modifications (selecting code blocks, pasting them)\n>     in vim.\n>\n>     Note that I still want to remove blanks at EOL. But I'd like to keep\n>     1 blank trailing line. I still can, of course, but the diff still\n>     shows me a red \"+\"...\n>\n>     Would it be possible to have a configuration option to avoid warnings\n>     (because I see that as a warning) about trailing blank lines ?\n>\n>     Thanks\n>\n> Thomas.\n\nWould it be possible with the current system?  No.\n\nWould it be possible to add such a new feature?  If designed well,\nperhaps.\n\nThings to consider (though not exhaustive) include:\n\n - What mechanism should this modify?\n\n - What should the new option be called?\n\n - Do we only need to accommodate those who want one trailing blank\n   line?  What about those who want two?  Three?\n\nThanks.\n"},{"id":"549362","messageId":"xmqq33wzc7uy.fsf@gitster.g","threadId":"66096","inReplyTo":"d5ec69c8-e441-4134-a6bb-665fc06db187@kdbg.org","subject":"Re: Git trailing blank lines feature configuration","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-31T18:49:25Z","receivedAt":"2026-07-31T18:49:27Z","isPatch":false,"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Am 31.07.26 um 12:19 schrieb Thomas Nemeth:\n>>     I have the habit to keep 1 blank line at the end of my files. To me,\n>>     it eases the EOF modifications (selecting code blocks, pasting them)\n>>     in vim.\n>\n> (Call this is [x].)\n>\n>>     Would it be possible to have a configuration option to avoid warnings\n>>     (because I see that as a warning) about trailing blank lines ?\n> Hearing the first time that an extra blank line at EOF is necessary or\n> useful. Would the correct question then perhaps be: how do you all\n> handle [x] without an extra blank line at EOF?\n>\n> That said, are you looking to disable blank-at-eof from core.whitespace?\n> Collect all \"enabled by default\" except this one from [*].\n>\n> [*]\n> https://git-scm.com/docs/git-config#Documentation/git-config.txt-corewhitespace\n>\n> -- Hannes\n\nAh, if \"I want a configuration that does not complain when it sees\nany number (including zero) of blank lines\" is what is asked for,\nthen yes, 'blank-at-eof' would be sufficient.  \n\nI misread the request as \"I want it to complain if there is not\nexactly one blank line at the end\" (i.e., zero blank lines will be\nflagged as not vi-friendly and two or more blank lines will be\nflagged as excess blank lines at the end).  That is not something\n'blank-at-eof' would help you achieve.\n"},{"id":"549371","messageId":"06230920-FCA6-495C-BFE5-04DF1CC2A426@gmail.com","threadId":"66096","inReplyTo":"5097209.GXAFRqVoOG@cixi","subject":"Re: Git trailing blank lines feature configuration","fromName":"Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2026-08-01T00:05:45Z","receivedAt":"2026-08-01T00:05:57Z","isPatch":false,"body":"\n> Le 31 juil. 2026 à 20:55, Thomas Nemeth <tnemeth@free.fr> a écrit :\n> \n> ﻿Le vendredi 31 juillet 2026, 13:08 Johannes Sixt a écrit :\n>>> Am 31.07.26 um 12:19 schrieb Thomas Nemeth:\n>>>    I have the habit to keep 1 blank line at the end of my files. To\n>>>    me,\n>>>    it eases the EOF modifications (selecting code blocks, pasting\n>>>    them)\n>>>    in vim.\n>> \n>> (Call this is [x].)\n>> \n>>>    Would it be possible to have a configuration option to avoid\n>>>    warnings\n>>>    (because I see that as a warning) about trailing blank lines ?\n>> \n>> Hearing the first time that an extra blank line at EOF is necessary or\n>> useful. Would the correct question then perhaps be: how do you all\n> \n>    I wouldn't say necessary, of course. It's -- at least -- my\n>    preference. For _my_ use case, it's useful. When I move code\n>    around, and that code is at the end of the file or to be put\n>    at the end of the file, I find it easier to already have a\n>    blank line there. That is... Because that's how I use vim to\n>    code.\n\nI 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!).\n\nI 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 ;)\n\nCheers"},{"id":"549383","messageId":"2851117.mvXUDI8C0e@cixi","threadId":"66096","inReplyTo":"xmqq33wzc7uy.fsf@gitster.g","subject":"Re: Git trailing blank lines feature configuration","fromName":"Thomas Nemeth","fromEmail":"tnemeth@free.fr","sentAt":"2026-08-01T08:21:08Z","receivedAt":"2026-08-01T08:21:12Z","isPatch":false,"body":"Le vendredi 31 juillet 2026, 20:49 Junio C Hamano a écrit :\n> Johannes Sixt <j6t@kdbg.org> writes:\n[...]\n> >>     Would it be possible to have a configuration option to avoid\n> >>     warnings\n> >>     (because I see that as a warning) about trailing blank lines ?\n[...]\n> > That said, are you looking to disable blank-at-eof from\n> > core.whitespace? Collect all \"enabled by default\" except this one\n> > from [*].\n> \n> Ah, if \"I want a configuration that does not complain when it sees\n> any number (including zero) of blank lines\" is what is asked for,\n> then yes, 'blank-at-eof' would be sufficient.\n\n    \\o/\n\n    Thanks to you all :)\n\n-- \nThomas.\n\n\n"},{"id":"549384","messageId":"3433010.aeNJFYEL58@cixi","threadId":"66096","inReplyTo":"06230920-FCA6-495C-BFE5-04DF1CC2A426@gmail.com","subject":"Re: Git trailing blank lines feature configuration","fromName":"Thomas Nemeth","fromEmail":"tnemeth@free.fr","sentAt":"2026-08-01T08:48:11Z","receivedAt":"2026-08-01T08:48:14Z","isPatch":false,"body":"Le samedi 1 août 2026, 02:05 Ben Knoble a écrit :\n> > Le 31 juil. 2026 à 20:55, Thomas Nemeth <tnemeth@free.fr> a écrit :\n> > \n> >    I wouldn't say necessary, of course. It's -- at least -- my\n> >    preference. For _my_ use case, it's useful. When I move code\n> >    around, and that code is at the end of the file or to be put\n> >    at the end of the file, I find it easier to already have a\n> >    blank line there. That is... Because that's how I use vim to\n> >    code.\n> \n> I use Vim, too, and I’ve not personally encountered the desire for\n> keeping a blank line at EOF (though occasionally certain operations\n> benefit from placing one there first!).\n> \n> I wonder if you could describe example workflows that lead to this\n> desire? I might learn something, and in exchange, if I see a way to\n> accomplish the same thing with less hassle, I’ll suggest it ;)\n\n    It's hard to describe something like that :)\n\n    Imagine you are editing a C file. It contains functions, code blocks\n    an so on. I usually organize my code as such :\n\n#includes\n[...]\n#defines\n[...]\nstatic variables\n[...]\nstatic functions()\n[...]\npublic_functions()\n[...]\n\n\n    Code reorganization happens quite some times during the development\n    process.\n    If I need to move a previously static function at the end of the\n    public functions section, I switch to VISUAL, select the function\n    to be moved with the blank lines above (I like having neatly spaced\n    code) _and_ including the eol of the function last line.\n    Then I delete it (d), I move to EOF (:$). As the line is blank I\n    just have to paste (p) it back there. The function is moved. The last\n    blank line is kept for other code movements.\n\n    Conversely, I can select the last function to move it upper in the\n    file.\n\n    Adding new functions is also eased. It may be because I use only a\n    few vim commands (especially I rarely use the `o` command). But also\n    because I like spaced code :)\n\n\n-- \nThomas.\n\n\n"},{"id":"549416","messageId":"48771457-9f10-4176-897a-f8af2606bf2d@kdbg.org","threadId":"66096","inReplyTo":"3433010.aeNJFYEL58@cixi","subject":"Re: Git trailing blank lines feature configuration","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2026-08-01T21:05:33Z","receivedAt":"2026-08-01T21:40:28Z","isPatch":false,"body":"Am 01.08.26 um 10:48 schrieb Thomas Nemeth:\n>     If I need to move a previously static function at the end of the\n>     public functions section, I switch to VISUAL, select the function\n>     to be moved with the blank lines above (I like having neatly spaced\n>     code) _and_ including the eol of the function last line.\n>     Then I delete it (d), I move to EOF (:$). As the line is blank I\n>     just have to paste (p) it back there. The function is moved. The last\n>     blank line is kept for other code movements.\n\nSounds like you are using character-wise visual mode (v) instead of\nline-wise mode (V). Use line-wise operations, and these problems are gone.\n\nOh, and BTW, just use G instead of :$<Enter>\n\n-- Hannes\n\n"},{"id":"549430","messageId":"2845859.mvXUDI8C0e@cixi","threadId":"66096","inReplyTo":"48771457-9f10-4176-897a-f8af2606bf2d@kdbg.org","subject":"Re: Git trailing blank lines feature configuration","fromName":"Thomas Nemeth","fromEmail":"tnemeth@free.fr","sentAt":"2026-08-02T08:21:21Z","receivedAt":"2026-08-02T08:21:30Z","isPatch":false,"body":"Le samedi 1 août 2026, 23:05 Johannes Sixt a écrit :\n> Am 01.08.26 um 10:48 schrieb Thomas Nemeth:\n> >     If I need to move a previously static function at the end of the\n> >     public functions section, I switch to VISUAL, select the function\n> >     to be moved with the blank lines above (I like having neatly\n> >     spaced\n> >     code) _and_ including the eol of the function last line.\n> >     Then I delete it (d), I move to EOF (:$). As the line is blank I\n> >     just have to paste (p) it back there. The function is moved. The\n> >     last\n> >     blank line is kept for other code movements.\n> \n> Sounds like you are using character-wise visual mode (v) instead of\n> line-wise mode (V). Use line-wise operations, and these problems are\n> gone.\n> \n> Oh, and BTW, just use G instead of :$<Enter>\n\n    Old habits don't die easily ;)\n\n\n-- \nThomas. \n\n\n"}]}