Skip to content

This plugin trims trailing whitespace and lines.

License

Notifications You must be signed in to change notification settings

jan-grimo/trim.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trim.nvim

GitHub release GitHub

This plugin trims trailing whitespace and lines.

Requirements

Neovim v0.7.0+

How to install

Lazy

require("lazy").setup({
  "cappyzawa/trim.nvim",
  opts = {}
}, opt)

Packer

use({
  "cappyzawa/trim.nvim",
  config = function()
    require("trim").setup({})
  end
})

How to setup

-- default config
local default_config = {
  ft_blocklist = {},
  patterns = {},
  trim_on_write = true,
  trim_trailing = true,
  trim_last_line = true,
  trim_first_line = true,
  trim_changed_only = false, -- Trim only lines changed from last save
  highlight = false,
  highlight_bg = '#ff0000', -- or 'red'
  highlight_ctermbg = 'red',
}
require('trim').setup({
  -- if you want to ignore markdown file.
  -- you can specify filetypes.
  ft_blocklist = {"markdown"},

  -- if you want to remove multiple blank lines
  patterns = {
    [[%s/\(\n\n\)\n\+/\1/]],   -- replace multiple blank lines with a single line
  },

  -- if you want to disable trim on write by default
  trim_on_write = false,

  -- highlight trailing spaces
  highlight = true
})

Commands

:TrimToggle

Toggle trim on save.

:Trim

Trim the buffer right away.

About

This plugin trims trailing whitespace and lines.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%