diff options
Diffstat (limited to '.config/micro/plug/wc')
| -rw-r--r-- | .config/micro/plug/wc/CHANGELOG.md | 6 | ||||
| -rw-r--r-- | .config/micro/plug/wc/LICENSE | 21 | ||||
| -rw-r--r-- | .config/micro/plug/wc/README.md | 4 | ||||
| -rw-r--r-- | .config/micro/plug/wc/help/wc.md | 25 | ||||
| -rw-r--r-- | .config/micro/plug/wc/info.json | 10 | ||||
| -rw-r--r-- | .config/micro/plug/wc/repo.json | 22 | ||||
| -rw-r--r-- | .config/micro/plug/wc/wc.lua | 37 |
7 files changed, 0 insertions, 125 deletions
diff --git a/.config/micro/plug/wc/CHANGELOG.md b/.config/micro/plug/wc/CHANGELOG.md deleted file mode 100644 index b36e4df..0000000 --- a/.config/micro/plug/wc/CHANGELOG.md +++ /dev/null @@ -1,6 +0,0 @@ -Version 1.2.1 -* Fixed utf8 character count - -Version 1.2.0 -+ Now counts lines -+ Added Support for counting lines, words and characters in selection diff --git a/.config/micro/plug/wc/LICENSE b/.config/micro/plug/wc/LICENSE deleted file mode 100644 index 8c58ad0..0000000 --- a/.config/micro/plug/wc/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 bananaapple - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/.config/micro/plug/wc/README.md b/.config/micro/plug/wc/README.md deleted file mode 100644 index 78ff3c6..0000000 --- a/.config/micro/plug/wc/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Micro Word Count Plugin - -Word, character and line counter for micro editor. -(forked from https://github.com/adamnpeace/micro-wc-plugin)
\ No newline at end of file diff --git a/.config/micro/plug/wc/help/wc.md b/.config/micro/plug/wc/help/wc.md deleted file mode 100644 index ad36643..0000000 --- a/.config/micro/plug/wc/help/wc.md +++ /dev/null @@ -1,25 +0,0 @@ -# WordCount (wc) Plugin # - -The wc plugin provides the user with the ability to count either -characters or strings in any text being edited with micro. - -A word is defined as a string of characters delimited by white -space characters. White space characters are the set of characters -for which the iswspace(3) function returns true. - -A line is defined as a string of characters delimited by \n -characters, or by the beginning or end of the file. \r\n line -endings will be counted correctly as well, since there is only -one \n per \r\n. - -Character count includes white space and newline characters. - -To initiate the function, you can either: - -Press "F5" - -Or run: - -``` -> wc -``` diff --git a/.config/micro/plug/wc/info.json b/.config/micro/plug/wc/info.json deleted file mode 100644 index b5b8886..0000000 --- a/.config/micro/plug/wc/info.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "wc", - "description": "Word count plugin", - "website": "", - "install": "", - "version": "1.2.1", - "require": [ - "micro >= 2.0.0" - ] -} diff --git a/.config/micro/plug/wc/repo.json b/.config/micro/plug/wc/repo.json deleted file mode 100644 index 3f6a05d..0000000 --- a/.config/micro/plug/wc/repo.json +++ /dev/null @@ -1,22 +0,0 @@ -[{ - "Name": "wc", - "Description": "Plugin to count words/characters in micro", - "Tags": ["wc", "word", "character", "count"], - "Website": "https://github.com/adamnpeace/micro-wc-plugin", - "Versions": [ - { - "Version": "1.1.0", - "Url": "https://github.com/adamnpeace/micro-wc-plugin/archive/v1.1.0.zip", - "Require": { - "micro": ">=2.0.0-1" - } - }, - { - "Version": "1.0.1", - "Url": "https://github.com/adamnpeace/micro-wc-plugin/archive/v1.0.1.zip", - "Require": { - "micro": ">=1.1.0" - } - } - ] -}] diff --git a/.config/micro/plug/wc/wc.lua b/.config/micro/plug/wc/wc.lua deleted file mode 100644 index 0e13677..0000000 --- a/.config/micro/plug/wc/wc.lua +++ /dev/null @@ -1,37 +0,0 @@ -VERSION = "1.2.1" - -local micro = import("micro") -local config = import("micro/config") -local util = import("micro/util") -local utf8 = import("unicode/utf8") - -function init() - config.MakeCommand("wc", wordCount, config.NoComplete) - config.AddRuntimeFile("wc", config.RTHelp, "help/wc.md") - config.TryBindKey("F5", "lua:wc.wordCount", false) -end - -function wordCount(bp) - -- Buffer of selection/whole document - local buffer - --Get active cursor (to get selection) - local cursor = bp.Buf:GetActiveCursor() - --If cursor exists and there is selection, convert selection byte[] to string - if cursor and cursor:HasSelection() then - buffer = util.String(cursor:GetSelection()) - else - --no selection, convert whole buffer byte[] to string - buffer = util.String(bp.Buf:Bytes()) - end - --length of the buffer/selection (string), utf8 friendly - charCount = utf8.RuneCountInString(buffer) - --Get word/line count using gsub's number of substitutions - -- number of substitutions, pattern: %S+ (more than one non-whitespace characters) - local _ , wordCount = buffer:gsub("%S+","") - -- number of substitutions, pattern: \n (number of newline characters) - local _, lineCount = buffer:gsub("\n", "") - --add one to line count (since we're counting separators not lines above) - lineCount = lineCount + 1 - --display the message - micro.InfoBar():Message("Lines:" .. lineCount .. " Words:"..wordCount.." Characters:"..charCount) -end |
