aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--plugins/memoryusage.lua18
2 files changed, 19 insertions, 0 deletions
diff --git a/README.md b/README.md
index a973c9d..3ad8137 100644
--- a/README.md
+++ b/README.md
@@ -80,6 +80,7 @@ Plugin | Description
[`lint+`](https://github.com/liquid600pgm/lintplus)* | Advanced linter with ErrorLens-like error reporting. Compatible with linters made for `linter` *([screenshot](https://raw.githubusercontent.com/liquid600pgm/lintplus/master/screenshots/1.png))*
[`macmodkeys`](plugins/macmodkeys.lua?raw=1) | Remaps mac modkeys `command/option` to `ctrl/alt`
[`markers`](plugins/markers.lua?raw=1) | Add markers to docs and jump between them quickly *([screenshot](https://user-images.githubusercontent.com/3920290/82252149-5faaa200-9946-11ea-9199-bea2efb7ee23.png))*
+[`memoryusage`](plugins/memoryusage.lua?raw=1) | Show memory usage in the status view
[`motiontrail`](plugins/motiontrail.lua?raw=1) | Adds a motion-trail to the caret *([screenshot](https://user-images.githubusercontent.com/3920290/83256814-085ccb00-a1ab-11ea-9e35-e6633cbed1a9.gif))*
[`nagbar`](https://github.com/takase1121/lite-nagbar)* | consistent and _beautiful_ confirmation dialogs for lite and lite-xl *([gif](https://raw.githubusercontent.com/takase1121/lite-nagbar/master/assets/preview.gif))*
[`openfilelocation`](plugins/openfilelocation.lua?raw=1) | Opens the parent directory of the current file in the file manager
diff --git a/plugins/memoryusage.lua b/plugins/memoryusage.lua
new file mode 100644
index 0000000..38ca59d
--- /dev/null
+++ b/plugins/memoryusage.lua
@@ -0,0 +1,18 @@
+-- original implementation by AqilCont
+local style = require "core.style"
+local StatusView = require "core.statusview"
+
+local get_items = StatusView.get_items
+
+function StatusView:get_items()
+ local left, right = get_items(self)
+ local t = {
+ style.text, (math.floor(collectgarbage("count") / 10.24) / 100) .. " MB",
+ style.dim, self.separator2,
+ }
+ for i, item in ipairs(t) do
+ table.insert(right, i, item)
+ end
+ return left, right
+end
+