fix: large file lag with filesize component (partially reverts #649) (#675)

This commit is contained in:
David van Munster 2022-05-07 05:53:33 +02:00 committed by GitHub
parent 45d07fc026
commit 619ededcff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -1,7 +1,14 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local function filesize()
local size = vim.fn.wordcount().bytes
local file = vim.fn.expand('%:p')
if file == nil or #file == 0 then
return ''
end
local size = vim.fn.getfsize(file)
if size <= 0 then
return ''
end
local suffixes = { 'b', 'k', 'm', 'g' }