Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cappyzawa/trim.nvim
This plugin trims trailing whitespace and lines.
https://github.com/cappyzawa/trim.nvim
formatter lua neovim
Last synced: about 2 months ago
JSON representation
This plugin trims trailing whitespace and lines.
- Host: GitHub
- URL: https://github.com/cappyzawa/trim.nvim
- Owner: cappyzawa
- License: apache-2.0
- Created: 2020-09-16T06:02:39.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-03-15T04:26:54.000Z (3 months ago)
- Last Synced: 2024-03-15T05:29:14.305Z (3 months ago)
- Topics: formatter, lua, neovim
- Language: Lua
- Homepage:
- Size: 53.7 KB
- Stars: 94
- Watchers: 1
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Lists
- awesome-neovim - cappyzawa/trim.nvim - This plugin trims trailing whitespace and lines. (Formatting / Comment)
- awesome-stars - cappyzawa/trim.nvim - This plugin trims trailing whitespace and lines. (Lua)
- awesome-neovim - cappyzawa/trim.nvim - This plugin trims trailing whitespace and lines. (Formatting / Comment)
- awesome-neovim - cappyzawa/trim.nvim - This plugin trims trailing whitespace and lines. (Formatting / Comment)
README
# trim.nvim
[![GitHub release](https://img.shields.io/github/release/cappyzawa/trim.nvim.svg)](https://github.com/cappyzawa/trim.nvim/releases)
[![GitHub](https://img.shields.io/github/license/cappyzawa/trim.nvim.svg)](./LICENSE)This plugin trims trailing whitespace and lines.
## Requirements
**Neovim v0.7.0+**
## How to install
### Lazy
```lua
require("lazy").setup({
"cappyzawa/trim.nvim",
opts = {}
}, opt)
```### Packer
```lua
use({
"cappyzawa/trim.nvim",
config = function()
require("trim").setup({})
end
})
```## How to setup
```lua
-- default config
local default_config = {
ft_blocklist = {},
patterns = {},
trim_on_write = true,
trim_trailing = true,
trim_last_line = true,
trim_first_line = true,
highlight = false,
highlight_bg = '#ff0000', -- or 'red'
highlight_ctermbg = 'red',
}
``````lua
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.