File: right-trim.lua

package info (click to toggle)
geany-plugins 1.37%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 21,548 kB
  • sloc: ansic: 112,728; sh: 4,283; makefile: 1,630; python: 947
file content (13 lines) | stat: -rw-r--r-- 254 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
--[[
  Trim all trailing whitespace from the current document
--]]


local s=geany.text()

if (s and string.match(s, "[ \t][\r\n]") )
then
  geany.text(string.gsub(s,"([ \t]+)([\r\n]+)", "%2"))
else
  geany.message("Right trim:", "Match not found.")
end