diff options
author | Francesco Abbate <francesco.bbt@gmail.com> | 2021-04-10 11:41:27 +0200 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2021-04-10 11:41:27 +0200 |
commit | 34c911d9b254c1e9b3a68b050808584930e98797 (patch) | |
tree | ad69d82b65aa8188ec06325a8ef12479a60cf00b | |
parent | 5e753c5c4bf5b086f031fa0fbbe5a3b045298ab5 (diff) | |
download | lite-xl-plugins-34c911d9b254c1e9b3a68b050808584930e98797.tar.gz lite-xl-plugins-34c911d9b254c1e9b3a68b050808584930e98797.zip |
Add memory usage plugin
Original implementation from AqilCont:
https://github.com/franko/lite-xl/pull/108
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | plugins/memoryusage.lua | 18 |
2 files changed, 19 insertions, 0 deletions
@@ -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 + |