cappyzawa/trim.nvim

[question] is there an option to keep just the empty lines at the end of file

Closed this issue · 3 comments

i have a file.
i want it to be trimmed.
but i want to keep the exceeding empty lines that are at the end of the file.
is there an option for that?

for example, keep all of these lines from 58 to 72, but trim everything else
image

Why don't you use :noa w ?

it doesnt trim the extra white space on the lines

i've come up with solution:

    patterns = {
        -- this just trims the whitespace on the lines
        -- its enough
        [[%s/\s\+$//e]],
        -- [[%s/\($\n\s*\)\+\%$//]],
        -- [[%s/\%^\n\+11//]],
        -- [[%s/\(\n\n\)\n\+/\0/]],
    },

and its working perfectly