Skip to content

Commit

Permalink
Update wc.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnpeace authored Oct 31, 2016
1 parent 71dc76a commit ef899a8
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions wc.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
VERSION = "1.0.0"

MakeCommand("wc", "wc.wordCount", 0)

function wordCount ()
buffer = CurView().Buf --Pulls working screen buffer from editor view
charCount = buffer:len() --Finds length of buffer
bufstr = tostring(buffer)
local _ , wordCount = bufstr:gsub("%S+","") --Lua patterns, see: lua.org/pil/20.2.html
messenger:Message("Words:"..wordCount.." Characters:"..charCount)
end

AddRuntimeFile("wc", "help", "help/wc.md")
BindKey("F5", "wc.wordCount")

VERSION = "1.0.1"

MakeCommand("wc", "wc.wordCount", 0)

function wordCount ()
buffer = CurView().Buf --Pulls working screen buffer from editor view
charCount = buffer:len() --Finds length of buffer
bufstr = tostring(buffer)
local _ , wordCount = bufstr:gsub("%S+","") --Lua patterns, see: lua.org/pil/20.2.html
messenger:Message("Words:"..wordCount.." Characters:"..charCount)
end

AddRuntimeFile("wc", "help", "help/wc.md")
BindKey("F5", "wc.wordCount")

0 comments on commit ef899a8

Please sign in to comment.