/trim.nvim

This plugin trims trailing whitespace and lines.

Primary LanguageLuaApache License 2.0Apache-2.0

trim.nvim

GitHub release GitHub

This plugin trims trailing whitespace and lines.

Requirements

Neovim v0.5.0+

How to install

Plug 'cappyzawa/trim.nvim'

How to setup

-- default config
local config = {
  disable = {},
  patterns = {
    [[%s/\s\+$//e]],
    [[%s/\($\n\s*\)\+\%$//]],
    [[%s/\%^\n\+//]],
    [[%s/\(\n\n\)\n\+/\1/]],
  },
}
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