fix: rem abs as insert only abs tracking is useless
This commit is contained in:
@@ -10,12 +10,11 @@ It keeps global lifetime totals:
|
||||
- `added`: characters inserted
|
||||
- `deleted`: characters removed
|
||||
- `net`: `added - deleted`
|
||||
- `abs`: `added + deleted`
|
||||
|
||||
The statusline text shows `net/abs`, for example:
|
||||
The statusline text shows `net`, for example:
|
||||
|
||||
```text
|
||||
LOC +123/456
|
||||
LOC +123
|
||||
```
|
||||
|
||||
## Install
|
||||
@@ -121,7 +120,6 @@ require("loc").stats()
|
||||
added = 123,
|
||||
deleted = 45,
|
||||
net = 78,
|
||||
abs = 168,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
+1
-2
@@ -334,7 +334,6 @@ function M.stats()
|
||||
added = state.added,
|
||||
deleted = state.deleted,
|
||||
net = state.added - state.deleted,
|
||||
abs = state.added + state.deleted,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -342,7 +341,7 @@ function M.statusline()
|
||||
local stats = M.stats()
|
||||
local prefix = state.config.statusline_prefix
|
||||
|
||||
return string.format("%s %+d/%d", prefix, stats.net, stats.abs)
|
||||
return string.format("%s %+d", prefix, stats.net)
|
||||
end
|
||||
|
||||
function M.save()
|
||||
|
||||
+2
-3
@@ -19,11 +19,10 @@ end, { desc = "Reset loc.nvim character counters" })
|
||||
vim.api.nvim_create_user_command("LocStats", function()
|
||||
local stats = require("loc").stats()
|
||||
local message = string.format(
|
||||
"LOC added=%d deleted=%d net=%+d abs=%d",
|
||||
"LOC added=%d deleted=%d net=%+d",
|
||||
stats.added,
|
||||
stats.deleted,
|
||||
stats.net,
|
||||
stats.abs
|
||||
stats.net
|
||||
)
|
||||
|
||||
vim.notify(message, vim.log.levels.INFO)
|
||||
|
||||
+1
-1
@@ -29,6 +29,6 @@ loc.reset()
|
||||
local stats = loc.stats()
|
||||
assert_equal(stats.added, 0, "reset added")
|
||||
assert_equal(stats.deleted, 0, "reset deleted")
|
||||
assert_equal(loc.statusline(), "LOC +0/0", "statusline")
|
||||
assert_equal(loc.statusline(), "LOC +0", "statusline")
|
||||
|
||||
print("loc.nvim tests passed")
|
||||
|
||||
Reference in New Issue
Block a user