cappyzawa/trim.nvim

github github
formatting
star 33
stars
alert-circle 0
open issues
users 2
subscribers
git-branch 6
forks
CREATED

2020-09-16

UPDATED

18 days ago


trim.nvim

GitHub release GitHub

This plugin trims trailing whitespace and lines.

Requirements

Neovim v0.7.0+

How to install

Plug 'cappyzawa/trim.nvim'

How to setup

-- default config
local config = {
  disable = {},
  patterns = {
    [[%s/\s\+$//e]],           -- remove unwanted spaces
    [[%s/\($\n\s*\)\+\%$//]],  -- trim last line
    [[%s/\%^\n\+//]],          -- trim first line
    [[%s/\(\n\n\)\n\+/\1/]],   -- replace multiple blank lines with a single line
  },
}
lua <<EOF
  require('trim').setup({
    -- if you want to ignore markdown file.
    -- you can specify filetypes.
    disable = {"markdown"},

    -- if you want to ignore space of top
    patterns = {
      [[%s/\s\+$//e]],
      [[%s/\($\n\s*\)\+\%$//]],
      [[%s/\(\n\n\)\n\+/\1/]],
    },
  })
EOF

If you save without formatting, use :noa w